From kaz@hypercore.co.jp Wed Apr 30 08:46:26 1997 Date: 30 Apr 1997 09:59:43 +0900 From: Kazuhiro Sasayama To: gimp-developer@XCF.Berkeley.EDU Subject: [gimp-devel][patch] 0.99.9 format string type mismatch I tried to fix some format string type mismatches as follows. This patch also includes addition of function attributes for GNU C, which makes finding such mismatches easy. Please try compiling with `-Wformat' or just `-Wall', which will produce many warning messages:-). There are still other unfixed format strings, but I do not have enough time now to fix them. I would try later if time permits. --- gimp-0.99.9/gtk+/gdk/gdk.c 1997-04-29 19:00:37+09 1.1 +++ gimp-0.99.9/gtk+/gdk/gdk.c 1997-04-29 19:09:49+09 @@ -288,7 +288,7 @@ /* base_id = RESOURCE_BASE; */ base_id = 0; if (gdk_show_events) - g_print ("base id: %ul\n", base_id); + g_print ("base id: %lu\n", base_id); connection_number = ConnectionNumber (gdk_display); if (gdk_debug_level >= 1) @@ -431,7 +431,7 @@ if (received_destroy_notify) { if (gdk_show_events) - g_print ("destroying window:\twindow: %d\n", + g_print ("destroying window:\twindow: %ld\n", ((GdkWindowPrivate*) window_to_destroy)->xwindow - base_id); gdk_window_real_destroy (window_to_destroy); @@ -1201,7 +1201,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("key press:\t\twindow: %d key: %12s %d\n", + g_print ("key press:\t\twindow: %ld key: %12s %d\n", xevent->xkey.window - base_id, XKeysymToString (event->key.keyval), event->key.keyval); @@ -1224,7 +1224,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("key release:\t\twindow: %d key: %12s %d\n", + g_print ("key release:\t\twindow: %ld key: %12s %d\n", xevent->xkey.window - base_id, XKeysymToString (event->key.keyval), event->key.keyval); @@ -1241,7 +1241,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("button press:\t\twindow: %d x,y: %d %d button: %d\n", + g_print ("button press:\t\twindow: %ld x,y: %d %d button: %d\n", xevent->xbutton.window - base_id, xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.button); @@ -1297,7 +1297,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("button release:\twindow: %d x,y: %d %d button: %d\n", + g_print ("button release:\twindow: %ld x,y: %d %d button: %d\n", xevent->xbutton.window - base_id, xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.button); @@ -1317,7 +1317,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("motion notify:\t\twindow: %d x,y: %d %d hint: %s\n", + g_print ("motion notify:\t\twindow: %ld x,y: %d %d hint: %s\n", xevent->xmotion.window - base_id, xevent->xmotion.x, xevent->xmotion.y, (xevent->xmotion.is_hint) ? "true" : "false"); @@ -1337,7 +1337,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("enter notify:\t\twindow: %d detail: %d\n", + g_print ("enter notify:\t\twindow: %ld detail: %d\n", xevent->xcrossing.window - base_id, xevent->xcrossing.detail); @@ -1383,7 +1383,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("leave notify:\t\twindow: %d detail: %d\n", + g_print ("leave notify:\t\twindow: %ld detail: %d\n", xevent->xcrossing.window - base_id, xevent->xcrossing.detail); @@ -1421,7 +1421,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("focus in:\t\twindow: %d\n", + g_print ("focus in:\t\twindow: %ld\n", xevent->xfocus.window - base_id); event->focus_change.type = GDK_FOCUS_CHANGE; @@ -1435,7 +1435,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("focus out:\t\twindow: %d\n", + g_print ("focus out:\t\twindow: %ld\n", xevent->xfocus.window - base_id); event->focus_change.type = GDK_FOCUS_CHANGE; @@ -1458,7 +1458,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("expose:\t\twindow: %d %d x,y: %d %d w,h: %d %d\n", + g_print ("expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d\n", xevent->xexpose.window - base_id, xevent->xexpose.count, xevent->xexpose.x, xevent->xexpose.y, xevent->xexpose.width, xevent->xexpose.height); @@ -1478,7 +1478,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("graphics expose:\tdrawable: %d\n", + g_print ("graphics expose:\tdrawable: %ld\n", xevent->xgraphicsexpose.drawable - base_id); event->expose.type = GDK_EXPOSE; @@ -1496,7 +1496,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("no expose:\t\tdrawable: %d\n", + g_print ("no expose:\t\tdrawable: %ld\n", xevent->xnoexpose.drawable - base_id); /* Not currently handled */ @@ -1509,15 +1509,15 @@ switch (xevent->xvisibility.state) { case VisibilityFullyObscured: - g_print ("visibility notify:\twindow: %d none\n", + g_print ("visibility notify:\twindow: %ld none\n", xevent->xvisibility.window - base_id); break; case VisibilityPartiallyObscured: - g_print ("visibility notify:\twindow: %d partial\n", + g_print ("visibility notify:\twindow: %ld partial\n", xevent->xvisibility.window - base_id); break; case VisibilityUnobscured: - g_print ("visibility notify:\twindow: %d full\n", + g_print ("visibility notify:\twindow: %ld full\n", xevent->xvisibility.window - base_id); break; } @@ -1533,7 +1533,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("destroy notify:\twindow: %d\n", + g_print ("destroy notify:\twindow: %ld\n", xevent->xdestroywindow.window - base_id); event->any.type = GDK_DESTROY; @@ -1554,7 +1554,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("unmap notify:\t\twindow: %d\n", + g_print ("unmap notify:\t\twindow: %ld\n", xevent->xmap.window - base_id); event->any.type = GDK_UNMAP; @@ -1567,7 +1567,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("map notify:\t\twindow: %d\n", + g_print ("map notify:\t\twindow: %ld\n", xevent->xmap.window - base_id); event->any.type = GDK_MAP; @@ -1580,7 +1580,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("reparent notify:\twindow: %d\n", + g_print ("reparent notify:\twindow: %ld\n", xevent->xreparent.window - base_id); /* Not currently handled */ @@ -1590,7 +1590,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("configure notify:\twindow: %d x,y: %d %d w,h: %d %d\n", + g_print ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d\n", xevent->xconfigure.window - base_id, xevent->xconfigure.x, xevent->xconfigure.height, xevent->xconfigure.width, xevent->xconfigure.height); @@ -1622,7 +1622,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("property notify:\twindow: %d\n", + g_print ("property notify:\twindow: %ld\n", xevent->xproperty.window - base_id); event->property.type = GDK_PROPERTY_NOTIFY; @@ -1636,7 +1636,7 @@ case SelectionClear: if (gdk_show_events) - g_print ("selection clear:\twindow: %d\n", + g_print ("selection clear:\twindow: %ld\n", xevent->xproperty.window - base_id); event->selection.type = GDK_SELECTION_CLEAR; @@ -1665,7 +1665,7 @@ case SelectionRequest: if (gdk_show_events) - g_print ("selection request:\twindow: %d\n", + g_print ("selection request:\twindow: %ld\n", xevent->xproperty.window - base_id); if (xevent->xselectionrequest.target == XA_STRING) @@ -1683,7 +1683,7 @@ case SelectionNotify: if (gdk_show_events) - g_print ("selection notify:\twindow: %d\n", + g_print ("selection notify:\twindow: %ld\n", xevent->xproperty.window - base_id); if ((xevent->xselection.target == XA_STRING) && @@ -1703,7 +1703,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("colormap notify:\twindow: %d\n", + g_print ("colormap notify:\twindow: %ld\n", xevent->xcolormap.window - base_id); /* Not currently handled */ @@ -1713,7 +1713,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("client message:\twindow: %d\n", + g_print ("client message:\twindow: %ld\n", xevent->xclient.window - base_id); /* Client messages are the means of the window manager @@ -1737,7 +1737,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("delete window:\t\twindow: %d\n", + g_print ("delete window:\t\twindow: %ld\n", xevent->xclient.window - base_id); event->any.type = GDK_DELETE; @@ -1750,7 +1750,7 @@ /* Print debugging info. */ if (gdk_show_events) - g_print ("take focus:\t\twindow: %d\n", + g_print ("take focus:\t\twindow: %ld\n", xevent->xclient.window - base_id); /* Not currently handled */ --- gimp-0.99.9/gtk+/glib/glib.h 1997-04-29 15:55:36+09 1.1 +++ gimp-0.99.9/gtk+/glib/glib.h 1997-04-29 16:03:53+09 @@ -566,11 +566,17 @@ /* Output */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +void g_error (gchar *format, ...) __attribute__ ((format (printf, 1, 2))); +void g_warning (gchar *format, ...) __attribute__ ((format (printf, 1, 2))); +void g_message (gchar *format, ...) __attribute__ ((format (printf, 1, 2))); +void g_print (gchar *format, ...) __attribute__ ((format (printf, 1, 2))); +#else void g_error (gchar *format, ...); void g_warning (gchar *format, ...); void g_message (gchar *format, ...); void g_print (gchar *format, ...); - +#endif /* Utility functions */ --- gimp-0.99.9/gtk+/glib/gmem.c 1997-04-29 18:58:17+09 1.1 +++ gimp-0.99.9/gtk+/glib/gmem.c 1997-04-29 19:00:13+09 @@ -122,7 +122,7 @@ p = (gpointer) malloc (size); if (!p) - g_error ("could not allocate %d bytes", size); + g_error ("could not allocate %ld bytes", size); #ifdef MEM_CHECK @@ -179,7 +179,7 @@ p = (gpointer) calloc (size, 1); if (!p) - g_error ("could not allocate %d bytes", size); + g_error ("could not allocate %ld bytes", size); #ifdef MEM_CHECK @@ -257,7 +257,7 @@ } if (!p) - g_error ("could not reallocate %d bytes", size); + g_error ("could not reallocate %ld bytes", size); #ifdef MEM_CHECK -- Kaz Sasayama, the designer of Hyperplay. PGP key fingerprint = 53 71 54 56 FB 3D 76 0B 92 5D 32 40 C5 34 38 00