gtk-jbuhler-980516-0 This patch applies to GTK+ 1.0.2. While compiling the new GTK, I chased down a compiler warning that opened up a whole can of worms. It seems that in several places, the GTK code uses 'const gpointer' declarations which are presumably intended to expand into 'const void *'. Unfortunately, consts and pointer typedefs don't mix well, so 'const gpointer' is actually the same as 'void const *'. In other words, the pointer, but NOT the pointed-to data, is declared to be constant! To implement what I think the authors' intention was, I declared a new type 'gconstpointer' in glib.h which is really 'const void *'. Lo and behold, when I changed all the 'const gpointer's in the code to 'gconstpointer's, I discovered that const correctness was being widely violated because the expected compiler checks weren't happening. I have tried to make a minimal set of changes in this patch to get rid of all the const-related warnings. The affected files are: glib/glib.h glib/ghash.c glib/gstring.c glib/testglib.c gdk/gdk.h gdk/gdkcc.c gdk/gdkfont.c gtk/gtkmain.c gtk/gtkobject.c gtk/gtksignal.c gtk/gtktext.c The exported GTK interfaces that now properly declare const-ness are: glib: types gconstpointer, and GHashFunc, GCompareFunc functions g_hash_table_lookup(), g_hash_table_remove(), g_str_equal(), g_str_hash() gdk: functions gdk_font_id(), gdk_font_equal() [gdk_font_id()'s declaration had to be changed so that font_hash() in gtktext.c could use it on its argument. font_hash(), in turn, had to have its argument declared const because it is used as a GHashFunc. To paraphrase Larry Niven, "Changing one const declaration is like trying to eat one peanut."] For the future, the exported interfaces in glib.h, and possibly in gdk.h and gtk.h, could have their arguments much more aggressively const-qualified. For example, the keys passed to hash tables, caches, etc could certainly be made const everywhere in those interfaces. Not only would this be good programming practice, it would probably make GTK smaller and faster by allowing a smart compiler to avoid reloading some values from memory after calling GTK functions. Jeremy Buhler jbuhler@cs.washington.edu