On Mon, August 24, 2009, Carlos R. Mafra wrote:
> > I tried this patch but no success. Actually this is what I
> > expected since the arguments to XGetWindowProperty() are no
> > pointers, i.e. they are simply passed by value. In our case
> > we've got int variables which are assigned to long variables
> > when the function is called, there's no harm in this at all.
>
> I don't understand this well. I was reading more stuff and
> it seems that this whole XGetWindowProperty() is a mess with
> types of the arguments and return values. I think I will
> take much more time to learn all this.
The way XGetWindowProperty() is called according to your patch
the code *looks* better, in particular since when looking at it
you see that the arguments in question are supposed to be longs.
However if you write code like this:
| void myFunc(long long foo) {
| /* ... */
| }
and then call it like this:
| myFunc('\0');
... you'll get exactly the same result as if you had called it
like this:
| myFunc(0L);
Since you assign a smaller type to a larger one you'll just have
the usual conversions with no data loss at all. The argument
foo' to myFunc() is nothing but a local variable of type `long
long'. I can't see how passing 0L instead of 0 should make any
difference.
> /*
> * TODO
> * ----
> *
> * This file needs to be checked for all calls to XGetWindowProperty() and
> * proper checks need to be made on the returned values. Only checking for
> * return to be Success is not enough. -Dan
> */
>
> So they knew about the fishiness at that time.
I saw this comment, too. Not quite sure what he meant, I had the
impression that he was concerned about checking the results. Or
maybe there's something we haven't seen yet?
> Checking for NULL seems the obvious safe thing to do anyway,
> I will push your patch to the repo.
Yes, that would be good. I could finally run safari again :)
Cheers,
M'bert
--
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+=
HAS ANYBODY SEEN MY CAPS_LOCK KEY? __ shi...@aol:COM
--
To unsubscribe, send mail to [email protected].