gdk/gdk.c gdk/gdkinputnone.h casts to get rid of const warnings

* gdk/gdk.c
* gdk/gdkinputnone.h
* gtk/gtkruler.c: casts to get rid of const warnings

* gtk/Makefile.am: fix gtktypebuiltins.h dependencies, and do a
cmp so people don't whine about rebuilds

* gtk/gtknotebook.c: use g_snprintf on translated strings, so we
don't get buffer overflows

* gtk/gtkrc.c: use g_strdup_printf instead of g_malloc/sprintf
Plug some memleaks.

-Yosh
This commit is contained in:
Manish Singh 1999-01-02 03:16:07 +00:00
parent 7433badf8e
commit a6da2cf948
16 changed files with 170 additions and 84 deletions

View File

@ -1,3 +1,18 @@
Fri Jan 1 18:41:09 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c
* gdk/gdkinputnone.h
* gtk/gtkruler.c: casts to get rid of const warnings
* gtk/Makefile.am: fix gtktypebuiltins.h dependencies, and do a
cmp so people don't whine about rebuilds
* gtk/gtknotebook.c: use g_snprintf on translated strings, so we
don't get buffer overflows
* gtk/gtkrc.c: use g_strdup_printf instead of g_malloc/sprintf
Plug some memleaks.
1999-01-01 Jeff Garzik <jgarzik@pobox.com>
* configure.in, config.h.in:

View File

@ -1,3 +1,18 @@
Fri Jan 1 18:41:09 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c
* gdk/gdkinputnone.h
* gtk/gtkruler.c: casts to get rid of const warnings
* gtk/Makefile.am: fix gtktypebuiltins.h dependencies, and do a
cmp so people don't whine about rebuilds
* gtk/gtknotebook.c: use g_snprintf on translated strings, so we
don't get buffer overflows
* gtk/gtkrc.c: use g_strdup_printf instead of g_malloc/sprintf
Plug some memleaks.
1999-01-01 Jeff Garzik <jgarzik@pobox.com>
* configure.in, config.h.in:

View File

@ -1,3 +1,18 @@
Fri Jan 1 18:41:09 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c
* gdk/gdkinputnone.h
* gtk/gtkruler.c: casts to get rid of const warnings
* gtk/Makefile.am: fix gtktypebuiltins.h dependencies, and do a
cmp so people don't whine about rebuilds
* gtk/gtknotebook.c: use g_snprintf on translated strings, so we
don't get buffer overflows
* gtk/gtkrc.c: use g_strdup_printf instead of g_malloc/sprintf
Plug some memleaks.
1999-01-01 Jeff Garzik <jgarzik@pobox.com>
* configure.in, config.h.in:

View File

@ -1,3 +1,18 @@
Fri Jan 1 18:41:09 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c
* gdk/gdkinputnone.h
* gtk/gtkruler.c: casts to get rid of const warnings
* gtk/Makefile.am: fix gtktypebuiltins.h dependencies, and do a
cmp so people don't whine about rebuilds
* gtk/gtknotebook.c: use g_snprintf on translated strings, so we
don't get buffer overflows
* gtk/gtkrc.c: use g_strdup_printf instead of g_malloc/sprintf
Plug some memleaks.
1999-01-01 Jeff Garzik <jgarzik@pobox.com>
* configure.in, config.h.in:

View File

@ -1,3 +1,18 @@
Fri Jan 1 18:41:09 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c
* gdk/gdkinputnone.h
* gtk/gtkruler.c: casts to get rid of const warnings
* gtk/Makefile.am: fix gtktypebuiltins.h dependencies, and do a
cmp so people don't whine about rebuilds
* gtk/gtknotebook.c: use g_snprintf on translated strings, so we
don't get buffer overflows
* gtk/gtkrc.c: use g_strdup_printf instead of g_malloc/sprintf
Plug some memleaks.
1999-01-01 Jeff Garzik <jgarzik@pobox.com>
* configure.in, config.h.in:

View File

@ -1,3 +1,18 @@
Fri Jan 1 18:41:09 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c
* gdk/gdkinputnone.h
* gtk/gtkruler.c: casts to get rid of const warnings
* gtk/Makefile.am: fix gtktypebuiltins.h dependencies, and do a
cmp so people don't whine about rebuilds
* gtk/gtknotebook.c: use g_snprintf on translated strings, so we
don't get buffer overflows
* gtk/gtkrc.c: use g_strdup_printf instead of g_malloc/sprintf
Plug some memleaks.
1999-01-01 Jeff Garzik <jgarzik@pobox.com>
* configure.in, config.h.in:

View File

@ -1,3 +1,18 @@
Fri Jan 1 18:41:09 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c
* gdk/gdkinputnone.h
* gtk/gtkruler.c: casts to get rid of const warnings
* gtk/Makefile.am: fix gtktypebuiltins.h dependencies, and do a
cmp so people don't whine about rebuilds
* gtk/gtknotebook.c: use g_snprintf on translated strings, so we
don't get buffer overflows
* gtk/gtkrc.c: use g_strdup_printf instead of g_malloc/sprintf
Plug some memleaks.
1999-01-01 Jeff Garzik <jgarzik@pobox.com>
* configure.in, config.h.in:

View File

@ -175,7 +175,7 @@ gdk_init (int *argc,
gchar *debug_string = getenv("GDK_DEBUG");
if (debug_string != NULL)
gdk_debug_flags = g_parse_debug_string (debug_string,
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
}
#endif /* G_ENABLE_DEBUG */
@ -204,13 +204,13 @@ gdk_init (int *argc,
if (equal_pos != NULL)
{
gdk_debug_flags |= g_parse_debug_string (equal_pos+1,
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
}
else if ((i + 1) < *argc && (*argv)[i + 1])
{
gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
(*argv)[i] = NULL;
i += 1;
@ -225,13 +225,13 @@ gdk_init (int *argc,
if (equal_pos != NULL)
{
gdk_debug_flags &= ~g_parse_debug_string (equal_pos+1,
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
}
else if ((i + 1) < *argc && (*argv)[i + 1])
{
gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
(*argv)[i] = NULL;
i += 1;

View File

@ -45,7 +45,7 @@ gdk_input_init (void)
gdk_input_vtable.enable_window = NULL;
gdk_input_vtable.disable_window = NULL;
gdk_input_devices = g_list_append (NULL, &gdk_input_core_info);
gdk_input_devices = g_list_append (NULL, (GdkDeviceInfo *) &gdk_input_core_info);
gdk_input_ignore_core = FALSE;
}

View File

@ -45,7 +45,7 @@ gdk_input_init (void)
gdk_input_vtable.enable_window = NULL;
gdk_input_vtable.disable_window = NULL;
gdk_input_devices = g_list_append (NULL, &gdk_input_core_info);
gdk_input_devices = g_list_append (NULL, (GdkDeviceInfo *) &gdk_input_core_info);
gdk_input_ignore_core = FALSE;
}

View File

@ -175,7 +175,7 @@ gdk_init (int *argc,
gchar *debug_string = getenv("GDK_DEBUG");
if (debug_string != NULL)
gdk_debug_flags = g_parse_debug_string (debug_string,
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
}
#endif /* G_ENABLE_DEBUG */
@ -204,13 +204,13 @@ gdk_init (int *argc,
if (equal_pos != NULL)
{
gdk_debug_flags |= g_parse_debug_string (equal_pos+1,
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
}
else if ((i + 1) < *argc && (*argv)[i + 1])
{
gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
(*argv)[i] = NULL;
i += 1;
@ -225,13 +225,13 @@ gdk_init (int *argc,
if (equal_pos != NULL)
{
gdk_debug_flags &= ~g_parse_debug_string (equal_pos+1,
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
}
else if ((i + 1) < *argc && (*argv)[i + 1])
{
gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
gdk_debug_keys,
(GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys);
(*argv)[i] = NULL;
i += 1;

View File

@ -23,4 +23,5 @@ gtktypebuiltins_evals.c
gtk.defs
testdnd
stamp-d
stamp-t
stamp-m

View File

@ -235,11 +235,12 @@ gtkinclude_HEADERS = \
gtkmarshal.h \
gtktypebuiltins.h
# note gtk.defs and gtkmarshal.[ch] aren't here, but their stamps are
# note gtk.defs, gtktypebuiltins.h, and gtkmarshal.[ch] aren't here, but their
# stamps are
BUILT_SOURCES = \
stamp-d \
stamp-t \
stamp-m \
gtktypebuiltins.h \
gtktypebuiltins_evals.c \
gtktypebuiltins_ids.c \
gtktypebuiltins_vars.c
@ -253,7 +254,7 @@ gdk_headers = \
../gdk/gdkrgb.h
# generate gtk.defs file from gtk-boxed.defs and *.h
gtk.defs: @REBUILD@ stamp-d
$(srcdir)/gtk.defs: @REBUILD@ stamp-d
@:
stamp-d: @REBUILD@ makeenums.pl gtk-boxed.defs $(source_headers) $(gdk_headers)
cd $(srcdir) \
@ -263,10 +264,14 @@ stamp-d: @REBUILD@ makeenums.pl gtk-boxed.defs $(source_headers) $(gdk_headers)
&& echo timestamp > stamp-d
# generate type identifier header (GTK_TYPE_WIDGET_FLAGS)
gtktypebuiltins.h: #@REBUILD@ gtk.defs maketypes.awk
$(srcdir)/gtktypebuiltins.h: @REBUILD@ stamp-t
@:
stamp-t: $(srcdir)/gtk.defs $(srcdir)/maketypes.awk
cd $(srcdir) \
&& $(AWK) -f maketypes.awk gtk.defs macros > s-gtb \
&& mv s-gtb gtktypebuiltins.h
&& (cmp -s s-gtb gtktypebuiltins.h || mv s-gtb gtktypebuiltins.h) \
&& rm -f s-gtb \
&& echo timestamp > stamp-t
# generate type identifier variables (GTK_TYPE_WIDGET_FLAGS)
$(srcdir)/gtktypebuiltins_vars.c: @REBUILD@ $(srcdir)/gtk.defs $(srcdir)/maketypes.awk
@ -289,18 +294,20 @@ $(srcdir)/gtktypebuiltins_evals.c: @REBUILD@ $(srcdir)/makeenums.pl $(srcdir)/gt
$(srcdir)/gtkmarshal.c $(srcdir)/gtkmarshal.h: @REBUILD@ stamp-m
@:
stamp-m: @REBUILD@ $(srcdir)/gtkmarshal.list $(srcdir)/genmarshal.pl
(srcdir=$(srcdir) INDENT=$(INDENT) $(PERL) $(srcdir)/genmarshal.pl \
&& (cmp -s s-gmc gtkmarshal.c || mv s-gmc gtkmarshal.c) && rm -f s-gmc \
&& (cmp -s s-gmh gtkmarshal.h || mv s-gmh gtkmarshal.h) && rm -f s-gmh) \
&& (cmp -s s-gmc gtkmarshal.c || mv s-gmc gtkmarshal.c) \
&& rm -f s-gmc \
&& (cmp -s s-gmh gtkmarshal.h || mv s-gmh gtkmarshal.h) \
&& rm -f s-gmh) \
&& echo timestamp > stamp-m
libgtk_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) \
@GLIB_LIBS@ \
@x_ldflags@ \
@x_libs@ \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE) \
@GLIB_LIBS@ \
@x_ldflags@ \
@x_libs@ \
-lm
# $(top_builddir)/gdk/libgdk.la
@ -346,16 +353,16 @@ EXTRA_DIST = \
circles.xbm
INCLUDES = \
-DG_LOG_DOMAIN=\"Gtk\" \
-DGTK_EXE_PREFIX=\"$(exec_prefix)\" \
-DGTK_DATA_PREFIX=\"$(prefix)\" \
-DGTK_SYSCONFDIR=\"$(sysconfdir)\" \
-DGTK_LOCALEDIR=\"$(datadir)/locale\" \
-I$(top_srcdir) \
@GTK_DEBUG_FLAGS@ \
@GTK_XIM_FLAGS@ \
@GTK_LOCALE_FLAGS@ \
@GLIB_CFLAGS@ \
-DG_LOG_DOMAIN=\"Gtk\" \
-DGTK_EXE_PREFIX=\"$(exec_prefix)\" \
-DGTK_DATA_PREFIX=\"$(prefix)\" \
-DGTK_SYSCONFDIR=\"$(sysconfdir)\" \
-DGTK_LOCALEDIR=\"$(datadir)/locale\" \
-I$(top_srcdir) \
@GTK_DEBUG_FLAGS@ \
@GTK_XIM_FLAGS@ \
@GTK_LOCALE_FLAGS@ \
@GLIB_CFLAGS@ \
@x_cflags@
noinst_PROGRAMS = testgtk testinput testselection testrgb testdnd simple

View File

@ -1943,7 +1943,7 @@ gtk_notebook_update_labels (GtkNotebook *notebook)
list = gtk_notebook_search_page (notebook, list, STEP_NEXT, FALSE))
{
page = list->data;
sprintf (string, _("Page %u"), page_num++);
g_snprintf (string, sizeof(string), _("Page %u"), page_num++);
if (notebook->show_tabs)
{
if (page->default_tab)
@ -3963,8 +3963,8 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
{
gchar string[32];
sprintf (string, _("Page %u"),
gtk_notebook_real_page_position (notebook, list));
g_snprintf (string, sizeof(string), _("Page %u"),
gtk_notebook_real_page_position (notebook, list));
page->tab_label = gtk_label_new (string);
gtk_widget_set_parent (page->tab_label, GTK_WIDGET (notebook));
}

View File

@ -209,15 +209,10 @@ gtk_rc_get_theme_dir(void)
var = getenv("GTK_DATA_PREFIX");
if (var)
{
path = g_malloc(strlen(var) + strlen("/share/themes") +1);
sprintf(path, "%s%s", var, "/share/themes");
}
path = g_strdup_printf("%s%s", var, "/share/themes");
else
{
path = g_malloc(strlen(GTK_DATA_PREFIX) + strlen("/share/themes") +1);
sprintf(path, "%s%s", GTK_DATA_PREFIX, "/share/themes");
}
path = g_strdup_printf("%s%s", GTK_DATA_PREFIX, "/share/themes");
return path;
}
@ -228,15 +223,10 @@ gtk_rc_get_module_dir(void)
var = getenv("GTK_EXE_PREFIX");
if (var)
{
path = g_malloc(strlen(var) + strlen("/lib/gtk/themes/engines") +1);
sprintf(path, "%s%s", var, "/lib/gtk/themes/engines");
}
path = g_strdup_printf("%s%s", var, "/lib/gtk/themes/engines");
else
{
path = g_malloc(strlen(GTK_EXE_PREFIX) + strlen("/lib/gtk/themes/engines") +1);
sprintf(path, "%s%s", GTK_EXE_PREFIX, "/lib/gtk/themes/engines");
}
path = g_strdup_printf("%s%s", GTK_EXE_PREFIX, "/lib/gtk/themes/engines");
return path;
}
@ -248,15 +238,9 @@ gtk_rc_append_default_pixmap_path(void)
var = getenv("GTK_DATA_PREFIX");
if (var)
{
path = g_malloc(strlen(var) + strlen("/share/gtk/themes") +1);
sprintf(path, "%s%s", var, "/share/gtk/themes");
}
path = g_strdup_printf("%s%s", var, "/share/gtk/themes");
else
{
path = g_malloc(strlen(GTK_DATA_PREFIX) + strlen("/share/gtk/themes") +1);
sprintf(path, "%s%s", GTK_DATA_PREFIX, "/share/gtk/themes");
}
path = g_strdup_printf("%s%s", GTK_DATA_PREFIX, "/share/gtk/themes");
for (n = 0; pixmap_path[n]; n++) ;
if (n >= GTK_RC_MAX_PIXMAP_PATHS - 1)
@ -290,23 +274,15 @@ gtk_rc_append_default_module_path(void)
var = getenv("GTK_EXE_PREFIX");
if (var)
{
path = g_malloc(strlen(var) + strlen("/lib/gtk/themes/engines") +1);
sprintf(path, "%s%s", var, "/lib/gtk/themes/engines");
}
path = g_strdup_printf("%s%s", var, "/lib/gtk/themes/engines");
else
{
path = g_malloc(strlen(GTK_EXE_PREFIX) + strlen("/lib/gtk/themes/engines") +1);
sprintf(path, "%s%s", GTK_EXE_PREFIX, "/lib/gtk/themes/engines");
}
path = g_strdup_printf("%s%s", GTK_EXE_PREFIX, "/lib/gtk/themes/engines");
module_path[n++] = g_strdup(path);
g_free(path);
var = getenv("HOME");
if (var)
{
path = g_malloc(strlen(var) + strlen(".gtk/lib/themes/engines") +1);
sprintf(path, "%s%s", var, ".gtk/lib/themes/engines");
}
path = g_strdup_printf("%s%s", var, ".gtk/lib/themes/engines");
module_path[n++] = g_strdup(path);
module_path[n] = NULL;
g_free(path);
@ -340,14 +316,13 @@ gtk_rc_add_initial_default_files (void)
}
else
{
str = g_malloc (strlen(GTK_SYSCONFDIR) + strlen("/gtk/gtkrc") + 1);
sprintf (str, "%s%s", GTK_SYSCONFDIR, "/gtk/gtkrc");
str = g_strdup_printf ("%s%s", GTK_SYSCONFDIR, "/gtk/gtkrc");
gtk_rc_add_default_file (str);
g_free (str);
var = g_get_home_dir ();
str = g_malloc (strlen(var) + strlen("/.gtkrc") + 1);
sprintf (str, "%s%s", var, "/.gtkrc");
str = g_strdup_printf ("%s%s", g_get_home_dir (), "/.gtkrc");
gtk_rc_add_default_file (str);
g_free (str);
}
}
@ -878,7 +853,7 @@ gtk_rc_parse_any (const gchar *input_name,
guint i;
gboolean done;
scanner = g_scanner_new (&gtk_rc_scanner_config);
scanner = g_scanner_new ((GScannerConfig *) &gtk_rc_scanner_config);
if (input_fd >= 0)
{
@ -1516,8 +1491,7 @@ gtk_rc_find_pixmap_in_path (GScanner *scanner,
for (i = 0; (i < GTK_RC_MAX_PIXMAP_PATHS) && (pixmap_path[i] != NULL); i++)
{
buf = g_malloc (strlen (pixmap_path[i]) + strlen (pixmap_file) + 2);
sprintf (buf, "%s%c%s", pixmap_path[i], '/', pixmap_file);
buf = g_strdup_printf ("%s%c%s", pixmap_path[i], '/', pixmap_file);
fd = open (buf, O_RDONLY);
if (fd >= 0)
@ -1548,8 +1522,7 @@ gtk_rc_find_module_in_path (const gchar *module_file)
for (i = 0; (i < GTK_RC_MAX_MODULE_PATHS) && (module_path[i] != NULL); i++)
{
buf = g_malloc (strlen (module_path[i]) + strlen (module_file) + 2);
sprintf (buf, "%s%c%s", module_path[i], '/', module_file);
buf = g_strdup_printf ("%s%c%s", module_path[i], '/', module_file);
fd = open (buf, O_RDONLY);
if (fd >= 0)

View File

@ -108,7 +108,7 @@ gtk_ruler_set_metric (GtkRuler *ruler,
g_return_if_fail (ruler != NULL);
g_return_if_fail (GTK_IS_RULER (ruler));
ruler->metric = &ruler_metrics[metric];
ruler->metric = (GtkRulerMetric *) &ruler_metrics[metric];
if (GTK_WIDGET_DRAWABLE (ruler))
gtk_widget_queue_draw (GTK_WIDGET (ruler));