[rescue] $ for repair to 35 line X11 complete program

der Mouse mouse at Rodents-Montreal.ORG
Fri Jul 23 05:50:41 CDT 2010


> Thank you, der Mouse.

Glad I could help!

> I'll catch my breath with your revelation.  How about $100 Canadian?

Whatever you think is reasonable.  I don't feel you owe me anything; it
seems a bit excessive to me to get paid for just pointing out that
XStoreColor doesn't return anything meaningful.

> Willing to let me have a copy of your X API that tags which do and
> which don't?

Sure.

Actually, looking at my patch tree, I see that XStoreColor ended with a
"return 1;" (which my patch removes, because a void-returning function
shouldn't try to return any value).  And, looking at <X11/X.h>, I see
BadRequest is #defined as 1.  If your implementation's code for
XStoreColor is similar, it could be that you're not getting random
trash but rather a predictable value, a value which just happens to
match the value for BadRequest.  (BadRequest is a protocol value, one
which appears on the wire, so there is no real chance that your X's
value for it is different.)

I have a whole tree of patches which I apply whenever I build X.  While
one of the things they do is to make a bunch of functions return void,
there are some other things they do too, such as providing prototypes
for a bunch of function pointers, such as the second argument to, and
return value from, XSetAfterFunction().  I think I've got the patches
just to deal with returning void separated out.

ftp.rodents-montreal.org:/mouse/misc/Xlib-void.tar.bz2 holds the
result.  I think you said Solaris, which would imply you probably don't
have source to your X implementation.  In that case, strictly speaking,
patching your .h files is a bad idea, because it means there will be a
mismatch between the call signature seen by the caller and the call
signature seen by the called function.  However, I _think_ the Solaris
implementation is such that they are compatible in practice even though
the language doesn't promise it.  In any case, you could use a patched
Xlib.h to do a test build; if I'm wrong about compatability, it might
not run (or possibly not even link), but it should still allow a
compilation against the modified .h file to catch these cases.

The .tar.bz2 includes not only patches to the .h but patches to the
implementations as well.  If you don't have source to your
implementation, the .c file patches won't be of much use to you.

Oh, and, line numbers in the patches might well be wrong if you aren't
starting with the same version I based them on.

If you want the whole tree of patches, X-patches.tar.bz2 in the same
directory is the thing to get.  This may or may not be of any use to
you, of course, but there it is if you want it.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse at rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B



More information about the rescue mailing list