gtk+ warning-reducing patch



Here's a gtk+ patch that reduces warnings. Let me know if it's OK to commit.

Index: .cvsignore
===================================================================
RCS file: /cvs/gnome/gtk+/.cvsignore,v
retrieving revision 1.12
diff -p -u -r1.12 .cvsignore
--- .cvsignore	2001/06/13 14:04:15	1.12
+++ .cvsignore	2001/07/13 00:32:30
@@ -31,3 +31,4 @@ gdk-pixbuf-2.0-uninstalled.pc
 missing
 install-sh
 mkinstalldirs
+sgml
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gtk+/configure.in,v
retrieving revision 1.220
diff -p -u -r1.220 configure.in
--- configure.in	2001/06/28 17:12:31	1.220
+++ configure.in	2001/07/13 00:32:31
@@ -94,8 +94,6 @@ AM_PROG_LIBTOOL
 dnl Initialize maintainer mode
 AM_MAINTAINER_MODE

-AC_CANONICAL_HOST
-
 dnl figure debugging default, prior to $ac_help setup
 dnl
 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
Index: demos/pixbuf-demo.c
===================================================================
RCS file: /cvs/gnome/gtk+/demos/pixbuf-demo.c,v
retrieving revision 1.7
diff -p -u -r1.7 pixbuf-demo.c
--- demos/pixbuf-demo.c	2001/04/18 18:09:15	1.7
+++ demos/pixbuf-demo.c	2001/07/13 00:32:32
@@ -213,7 +213,7 @@ main (int argc, char **argv)

 	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 	gtk_widget_set_usize (window, back_width, back_height);
-	gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
+	gtk_window_set_resizable (GTK_WINDOW (window), FALSE);

 	gtk_signal_connect (GTK_OBJECT (window), "destroy",
 			    GTK_SIGNAL_FUNC (destroy_cb), NULL);
Index: demos/testpixbuf-scale.c
===================================================================
RCS file: /cvs/gnome/gtk+/demos/testpixbuf-scale.c,v
retrieving revision 1.9
diff -p -u -r1.9 testpixbuf-scale.c
--- demos/testpixbuf-scale.c	2000/10/18 18:42:46	1.9
+++ demos/testpixbuf-scale.c	2001/07/13 00:32:32
@@ -1,6 +1,7 @@
 #include <gtk/gtk.h>

 #include <stdio.h>
+#include <stdlib.h>

 GdkInterpType interp_type = GDK_INTERP_BILINEAR;
 int overall_alpha = 255;
Index: gdk/gdkkeys.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkkeys.c,v
retrieving revision 1.3
diff -p -u -r1.3 gdkkeys.c
--- gdk/gdkkeys.c	2001/07/02 05:03:19	1.3
+++ gdk/gdkkeys.c	2001/07/13 00:32:38
@@ -34,7 +34,6 @@ enum {

 static void gdk_keymap_init       (GdkKeymap      *keymap);
 static void gdk_keymap_class_init (GdkKeymapClass *klass);
-static void gdk_keymap_finalize   (GObject              *object);

 static gpointer parent_class = NULL;

@@ -81,8 +80,6 @@ gdk_keymap_class_init (GdkKeymapClass *k

   parent_class = g_type_class_peek_parent (klass);

-  object_class->finalize = gdk_keymap_finalize;
-
   signals[DIRECTION_CHANGED] =
     g_signal_new ("direction_changed",
 		  G_OBJECT_CLASS_TYPE (object_class),
@@ -93,16 +90,6 @@ gdk_keymap_class_init (GdkKeymapClass *k
 		  G_TYPE_NONE,
 		  0);
 }
-
-static void
-gdk_keymap_finalize (GObject *object)
-{
-  GdkKeymap *keymap = GDK_KEYMAP (object);
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-

 /* Other key-handling stuff
  */
Index: gdk/gdkrgb.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkrgb.c,v
retrieving revision 1.38
diff -p -u -r1.38 gdkrgb.c
--- gdk/gdkrgb.c	2001/03/02 17:06:06	1.38
+++ gdk/gdkrgb.c	2001/07/13 00:32:44
@@ -63,6 +63,7 @@

 #include "gdk.h"		/* For gdk_flush() */
 #include "gdkrgb.h"
+#include "gdkimage.h"

 typedef struct _GdkRgbInfo     GdkRgbInfo;
 typedef struct _GdkRgbCmapInfo GdkRgbCmapInfo;
Index: gdk/x11/gdkcolor-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkcolor-x11.c,v
retrieving revision 1.30
diff -p -u -r1.30 gdkcolor-x11.c
--- gdk/x11/gdkcolor-x11.c	2001/02/13 05:44:46	1.30
+++ gdk/x11/gdkcolor-x11.c	2001/07/13 00:32:45
@@ -522,7 +522,7 @@ gdk_colors_free (GdkColormap *colormap,

   if (npixels)
     XFreeColors (private->xdisplay, private->xcolormap,
-		 pixels, npixels, planes);
+		 (long *) pixels, npixels, planes);
   g_free (pixels);
 }

@@ -610,7 +610,7 @@ gdk_colormap_alloc1 (GdkColormap *colorm
 	  if (private->info[ret->pixel].ref_count) /* got a duplicate */
 	    {
 	      XFreeColors (private->xdisplay, private->xcolormap,
-			   &ret->pixel, 1, 0);
+			   (long *) &ret->pixel, 1, 0);
 	    }
 	  else
 	    {
Index: gdk/x11/gdkfont-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkfont-x11.c,v
retrieving revision 1.25
diff -p -u -r1.25 gdkfont-x11.c
--- gdk/x11/gdkfont-x11.c	2000/07/26 11:32:30	1.25
+++ gdk/x11/gdkfont-x11.c	2001/07/13 00:32:45
@@ -137,7 +137,7 @@ gdk_font_load (const gchar *font_name)
 }

 static char *
-gdk_font_charset_for_locale ()
+gdk_font_charset_for_locale (void)
 {
   static char *charset_map[][2] = {
     { "ANSI_X3.4-1968", "iso8859-1" },
@@ -154,7 +154,7 @@ gdk_font_charset_for_locale ()
     { "UTF-8",      "iso8859-1" }
   };

-  char *codeset;
+  const char *codeset;
   char *result = NULL;
   int i;

Index: gdk/x11/gdkmain-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkmain-x11.c,v
retrieving revision 1.132
diff -p -u -r1.132 gdkmain-x11.c
--- gdk/x11/gdkmain-x11.c	2001/06/28 05:24:00	1.132
+++ gdk/x11/gdkmain-x11.c	2001/07/13 00:32:45
@@ -170,7 +170,6 @@ _gdk_windowing_init_check (int argc, cha
   {
     gint xkb_major = XkbMajorVersion;
     gint xkb_minor = XkbMinorVersion;
-    gint xkb_event_type;
     if (XkbLibraryVersion (&xkb_major, &xkb_minor))
       {
         xkb_major = XkbMajorVersion;
Index: gdk/x11/gdkpango-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkpango-x11.c,v
retrieving revision 1.4
diff -p -u -r1.4 gdkpango-x11.c
--- gdk/x11/gdkpango-x11.c	2000/12/15 01:46:40	1.4
+++ gdk/x11/gdkpango-x11.c	2001/07/13 00:32:45
@@ -34,7 +34,7 @@ gdk_pango_context_get (void)
   static gint use_xft = -1;
   if (use_xft == -1)
     {
-      char *val = g_getenv ("GDK_USE_XFT");
+      const char *val = g_getenv ("GDK_USE_XFT");

       use_xft = val && (atoi (val) != 0);
     }
Index: gdk/x11/gdkselection-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkselection-x11.c,v
retrieving revision 1.16
diff -p -u -r1.16 gdkselection-x11.c
--- gdk/x11/gdkselection-x11.c	2000/11/12 19:16:09	1.16
+++ gdk/x11/gdkselection-x11.c	2001/07/13 00:32:46
@@ -414,7 +414,7 @@ gdk_text_property_to_utf8_list (GdkAtom
       gchar **local_list;
       gint local_count;
       gint i;
-      gchar *charset = NULL;
+      const gchar *charset = NULL;
       gboolean need_conversion = !g_get_charset (&charset);
       gint count = 0;
       GError *error = NULL;
@@ -598,7 +598,7 @@ gdk_utf8_to_compound_text (const gchar *
 			   gint        *length)
 {
   gboolean need_conversion;
-  gchar *charset;
+  const gchar *charset;
   gchar *locale_str, *tmp_str;
   GError *error = NULL;
   gboolean result;
Index: gdk/x11/gdkwindow-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkwindow-x11.c,v
retrieving revision 1.122
diff -p -u -r1.122 gdkwindow-x11.c
--- gdk/x11/gdkwindow-x11.c	2001/07/06 19:40:59	1.122
+++ gdk/x11/gdkwindow-x11.c	2001/07/13 00:32:50
@@ -3601,6 +3601,8 @@ update_pos (gint new_root_x,
           w += dx;
           h += dy;
           break;
+        default:
+          break;
         }

       w = MAX (w, 1);
Index: gdk-pixbuf/gdk-pixbuf-csource.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/gdk-pixbuf-csource.c,v
retrieving revision 1.3
diff -p -u -r1.3 gdk-pixbuf-csource.c
--- gdk-pixbuf/gdk-pixbuf-csource.c	2001/06/29 02:53:01	1.3
+++ gdk-pixbuf/gdk-pixbuf-csource.c	2001/07/13 00:32:50
@@ -22,7 +22,9 @@
 #include "gdk-pixbuf.h"
 #include "gdk-pixdata.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>


 /* --- defines --- */
Index: gdk-pixbuf/io-png.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-png.c,v
retrieving revision 1.39
diff -p -u -r1.39 io-png.c
--- gdk-pixbuf/io-png.c	2001/06/01 23:05:46	1.39
+++ gdk-pixbuf/io-png.c	2001/07/13 00:32:50
@@ -40,7 +40,9 @@ setup_png_transformations(png_structp pn
 {
         png_uint_32 width, height;
int bit_depth, color_type, interlace_type, compression_type, filter_type;
+#ifndef G_DISABLE_CHECKS
         int channels;
+#endif

         /* Get the image info */

Index: gdk-pixbuf/io-pnm.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-pnm.c,v
retrieving revision 1.22
diff -p -u -r1.22 io-pnm.c
--- gdk-pixbuf/io-pnm.c	2001/06/04 20:31:51	1.22
+++ gdk-pixbuf/io-pnm.c	2001/07/13 00:32:51
@@ -840,7 +840,7 @@ gdk_pixbuf__pnm_image_load_increment (gp
 	PnmIOBuffer *inbuf;
 	guchar *old_byte;
 	guint old_nbytes;
-	guchar *bufhd;
+	const guchar *bufhd;
 	guint num_left, spinguard;
 	gint retval;
 	
Index: gdk-pixbuf/io-wbmp.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-wbmp.c,v
retrieving revision 1.9
diff -p -u -r1.9 io-wbmp.c
--- gdk-pixbuf/io-wbmp.c	2001/05/07 15:58:41	1.9
+++ gdk-pixbuf/io-wbmp.c	2001/07/13 00:32:51
@@ -160,7 +160,7 @@ static gboolean gdk_pixbuf__wbmp_image_s
 }

 static gboolean
-getin(struct wbmp_progressive_state *context, guchar **buf, guint *buf_size, guchar *ptr, int datum_size) +getin(struct wbmp_progressive_state *context, const guchar **buf, guint *buf_size, guchar *ptr, int datum_size)
 {
   int last_num, buf_num;

@@ -195,7 +195,7 @@ save_rest(struct wbmp_progressive_state
 }

 static gboolean
-get_mbi(struct wbmp_progressive_state *context, guchar **buf, guint *buf_size, int *val) +get_mbi(struct wbmp_progressive_state *context, const guchar **buf, guint *buf_size, int *val)
 {
   guchar intbuf[16];
   int i, n;
Index: gdk-pixbuf/io-xbm.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-xbm.c,v
retrieving revision 1.3
diff -p -u -r1.3 io-xbm.c
--- gdk-pixbuf/io-xbm.c	2001/05/07 15:58:41	1.3
+++ gdk-pixbuf/io-xbm.c	2001/07/13 00:32:52
@@ -272,9 +272,9 @@ gdk_pixbuf__xbm_image_load_real (FILE *f
 	guchar *pixels;
 	guint row_stride;
 	int x, y;
-	int reg, bits;
+	int reg = 0; /* Quiet compiler */
+	int bits;

-	int num_pixs;
 	GdkPixbuf *pixbuf;

 	if (!read_bitmap_file_data (f, &w, &h, &data, &x_hot, &y_hot)) {
Index: gdk-pixbuf/pixops/pixops.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk-pixbuf/pixops/pixops.c,v
retrieving revision 1.16
diff -p -u -r1.16 pixops.c
--- gdk-pixbuf/pixops/pixops.c	2001/05/07 15:58:42	1.16
+++ gdk-pixbuf/pixops/pixops.c	2001/07/13 00:32:53
@@ -818,6 +818,7 @@ scale_line_22_33_mmx_stub (int *weights,
 }
 #endif /* USE_MMX */

+#ifdef SCALE_LINE_22_33_USED /* This dead code would need changes if we wanted to use it */
 static guchar *
 scale_line_22_33 (int *weights, int n_x, int n_y,
guchar *dest, guchar *dest_end, int dest_channels, int dest_has_alpha,
@@ -874,6 +875,7 @@ scale_line_22_33 (int *weights, int n_x,

   return dest;
 }
+#endif /* SCALE_LINE_22_33_USED */

 static void
 process_pixel (int *weights, int n_x, int n_y,
Index: gtk/gtkimage.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkimage.c,v
retrieving revision 1.24
diff -p -u -r1.24 gtkimage.c
--- gtk/gtkimage.c	2001/05/11 17:13:41	1.24
+++ gtk/gtkimage.c	2001/07/13 00:32:57
@@ -874,7 +874,7 @@ gtk_image_expose (GtkWidget      *widget
     {
       GtkImage *image;
       GtkMisc *misc;
-      GdkRectangle area, image_bound, intersection;
+      GdkRectangle area, image_bound;
       gint x, y;
       GdkBitmap *mask = NULL;
       GdkPixbuf *stock_pixbuf = NULL;
Index: gtk/gtkmenubar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenubar.c,v
retrieving revision 1.33
diff -p -u -r1.33 gtkmenubar.c
--- gtk/gtkmenubar.c	2001/07/12 21:46:32	1.33
+++ gtk/gtkmenubar.c	2001/07/13 00:32:57
@@ -484,7 +484,7 @@ gtk_menu_bar_hierarchy_changed (GtkWidge
   toplevel = gtk_widget_get_toplevel (widget);

   if (old_toplevel)
-    remove_from_window (old_toplevel, GTK_MENU_BAR (menubar));
+    remove_from_window (GTK_WINDOW (old_toplevel), menubar);

   if (GTK_WIDGET_TOPLEVEL (toplevel))
     add_to_window (GTK_WINDOW (toplevel), menubar);
Index: gtk/gtksettings.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtksettings.c,v
retrieving revision 1.14
diff -p -u -r1.14 gtksettings.c
--- gtk/gtksettings.c	2001/06/30 16:08:24	1.14
+++ gtk/gtksettings.c	2001/07/13 00:32:59
@@ -314,7 +314,6 @@ gtk_settings_notify (GObject    *object,
 {
   guint property_id = pspec->param_id;
   gint double_click_time;
-  gchar *str_value;

 #if 1
   GValue tmp_value = { 0, };
Index: gtk/gtkstatusbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstatusbar.c,v
retrieving revision 1.28
diff -p -u -r1.28 gtkstatusbar.c
--- gtk/gtkstatusbar.c	2001/06/04 23:15:50	1.28
+++ gtk/gtkstatusbar.c	2001/07/13 00:32:59
@@ -643,7 +643,6 @@ gtk_statusbar_size_allocate  (GtkWidget
   if (statusbar->has_resize_grip)
     {
       GdkRectangle rect;
-      GtkAllocation hbox_allocation;
       GtkRequisition saved_req;

widget->allocation = *allocation; /* get_grip_rect needs this info */
Index: gtk/gtktreemodelsort.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreemodelsort.c,v
retrieving revision 1.25
diff -p -u -r1.25 gtktreemodelsort.c
--- gtk/gtktreemodelsort.c	2001/06/29 16:30:22	1.25
+++ gtk/gtktreemodelsort.c	2001/07/13 00:33:00
@@ -1129,7 +1129,6 @@ gtk_tree_model_sort_build_level (GtkTree
   GtkTreeIter *parent_iter = NULL;
   GtkTreeIter iter;
   SortElt elt;
-  SortData sort_data;

   if (place)
     parent_iter = & (place->iter);
Index: modules/input/gtkimcontextxim.c
===================================================================
RCS file: /cvs/gnome/gtk+/modules/input/gtkimcontextxim.c,v
retrieving revision 1.8
diff -p -u -r1.8 gtkimcontextxim.c
--- modules/input/gtkimcontextxim.c	2001/06/23 14:32:44	1.8
+++ modules/input/gtkimcontextxim.c	2001/07/13 00:33:01
@@ -258,7 +258,7 @@ gtk_im_context_xim_new (void)
 {
   GtkXIMInfo *info;
   GtkIMContextXIM *result;
-  gchar *charset;
+  const gchar *charset;

   info = get_im (setlocale (LC_CTYPE, NULL));
   if (!info)
Index: tests/testsocket.c
===================================================================
RCS file: /cvs/gnome/gtk+/tests/testsocket.c,v
retrieving revision 1.6
diff -p -u -r1.6 testsocket.c
--- tests/testsocket.c	2001/07/05 02:58:34	1.6
+++ tests/testsocket.c	2001/07/13 00:33:02
@@ -206,7 +206,7 @@ add_child (GtkWidget *window,
       socket = create_socket ();
       gtk_box_pack_start (GTK_BOX (vbox), socket->box, TRUE, TRUE, 0);
       gtk_widget_show (socket->box);
- sprintf(buffer, "%#lx", gtk_socket_get_id (GTK_SOCKET (socket->socket))); + sprintf(buffer, "%#lx", (gulong) gtk_socket_get_id (GTK_SOCKET (socket->socket)));
       argv[1] = buffer;
     }

Index: tests/testtextbuffer.c
===================================================================
RCS file: /cvs/gnome/gtk+/tests/testtextbuffer.c,v
retrieving revision 1.14
diff -p -u -r1.14 testtextbuffer.c
--- tests/testtextbuffer.c	2001/04/03 18:48:46	1.14
+++ tests/testtextbuffer.c	2001/07/13 00:33:02
@@ -551,7 +551,7 @@ run_tests (GtkTextBuffer *buffer)
 }


-static char  *book_closed_xpm[] = {
+static const char  *book_closed_xpm[] = {
 "16 16 6 1",
 "       c None s None",
 ".      c black",
Index: tests/testtreefocus.c
===================================================================
RCS file: /cvs/gnome/gtk+/tests/testtreefocus.c,v
retrieving revision 1.9
diff -p -u -r1.9 testtreefocus.c
--- tests/testtreefocus.c	2001/06/30 02:38:17	1.9
+++ tests/testtreefocus.c	2001/07/13 00:33:02
@@ -309,7 +309,6 @@ main (int argc, char *argv[])
   GtkCellRenderer *renderer;
   gint col_offset;
   GtkTreeViewColumn *column;
-  GtkTreeSelection *selection;

   gtk_init (&argc, &argv);

Index: tests/treestoretest.c
===================================================================
RCS file: /cvs/gnome/gtk+/tests/treestoretest.c,v
retrieving revision 1.23
diff -p -u -r1.23 treestoretest.c
--- tests/treestoretest.c	2001/06/30 02:38:17	1.23
+++ tests/treestoretest.c	2001/07/13 00:33:03
@@ -38,7 +38,6 @@ static void
 iter_remove (GtkWidget *button, GtkTreeView *tree_view)
 {
   GtkTreeIter selected;
-  GtkTreeIter s_selected;
   GtkTreeModel *model;

   model = gtk_tree_view_get_model (tree_view);
@@ -201,19 +200,6 @@ iter_append (GtkWidget *button, GtkTreeV
 }

 static void
-uppercase_value (const GValue *src, GValue *dest, gpointer data)
-{
-  gchar *str;
-
-  g_value_init (dest, G_TYPE_STRING);
-  str = g_strdup (g_value_get_string (src));
-  if (str)
-    g_strup (str);
-  g_value_set_string (dest, str);
-  g_free (str);
-}
-
-static void
 make_window (gint view_type)
 {
   GtkWidget *window;
@@ -257,6 +243,7 @@ make_window (gint view_type)
       break;
     default:
       g_assert_not_reached ();
+      tree_view = NULL; /* Quiet compiler */
       break;
     }

===================================================================

    -- Darin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]