[Xlibs] Fixing xlib fixes
Fri, 17 Oct 2003 21:13:58 -0700
The snapshot of XFree86 CVS which formed the basis for Xlib CVS at
freedesktop.org contained a couple of very poorly written patches, one in
XlibInt.c (!) and another dealing with color management.
The XlibInt changes miscompute network buffer pointers in one case; the
gnome bugzilla has a bug which may be related:
I backed out the non-prototype changes and repaired the trivial warnings
that were in the original code.
The CMS change was an attempt to fix the broken types in the public
interface to cms color conversion functions.
There are two kinds of color conversion functions; device-independent
conversion which often needs a white point but which never need do gamut
compression and device-dependent conversion which doesn't need a white
point but often does gamut compression.
The functions for these two modes return the same value, but take slightly
different parameters. The X lib header, however, doesn't distinguish
between them. As the code all pre-dates ANSI-C, there was not a problem
until an attempt was made to add prototypes to the public interfaces in
The attempted fix conditionally compiled two different typedef
declarations for the relevant function pointer datatype; but didn't manage
to conditionally compile the code which invoked the functions. The caller
and callee no longer agreed on the function parameters, so any invocation
of any CMS conversion would result in a segfault.
I backed out the conditional compilation and added appropriate casts to
the original code to silence the compiler.
This fix is very easy to test as it affects all X CMS conversion
$ xlogo -bg 'cms red'
should cause a segfault with the previous version of the library, and
should work correctly with the current CVS version.