Const correctness fixes for gtk+/glib [PATCH]



Hi,

I've uploaded `gtk-rrh-980412-0.patch.gz' to ftp://ftp.gtk.org/incoming.
Here's the README:

  A few functions in `gtk+' use something like

	  const gpointer mem

  in their prototypes.  Presumably it is supposed to mean that that the 
  pointed-to memory will _not_ be modified through that pointer.  
  Unfortunately, the above declaration doesn't do that.  It just means
  that the variable `mem' will not be assigned to in the function body.
  In fact, `const' is ignored in the prototype of the function.

  This patch fixes that by

       1. Introducing a new `const pointer' type

	    typedef const void *g_const_pointer;

       2. Replacing occurances of `const gpointer' with `g_const_pointer'.
	  I just used a simple grep for `const gpointer', and may have
	  missed usage with more whitespace &c.

       3. Fixed a few unsafe conversions, using a couple of compile
	  passes. Note that this analysis is _very_ incomplete,
	  but should satisfy `gcc' for now.  

  Other compilers could identify more of these, which can be handled on
  demand.  In the meantime, someone should do a `const-correctness' audit
  (I'll do it once I have more time, and if nobody else does it before).

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash



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