pidgin: 59e2b989: Clean up the GtkSmileyTrees on active Gt...
elb at pidgin.im
Thu Oct 30 11:11:48 EDT 2008
John Bailey spake unto us the following wisdom:
> > @@ -1974,7 +1976,7 @@ static void gtk_smiley_tree_remove (GtkS
> > pos = strchr (t->values->str, *x);
> > if (pos)
> > - t = t->children [(int) pos - (int) t->values->str];
> > + t = t->children [(unsigned int) pos - (unsigned int) t->values->str];
> While the original state of this line was also wrong, this change is incorrect
> as it assumes sizeof(void *) == sizeof (unsigned int) which is not true
> everywhere. For example, on x86_64, void * is 8 bytes and unsigned int is 4
> bytes. Perhaps a more appropriate cast here would be gsize or size_t?
There is no reason to believe that gsize or size_t are appropriate,
either. In this case, however, we can be confident that the
*difference* between these two values is small; the appropriate cast
would be something like (int)(pos - t->values->str). However, the
difference between pointers yields an integer value in any case, so
the cast should be unnecessary.
It looks like this has been resolved in the source already, but just
for the sake of clarification...
The laws that forbid the carrying of arms are laws [that have no remedy
for evils]. They disarm only those who are neither inclined nor
determined to commit crimes.
-- Cesare Beccaria, "On Crimes and Punishments", 1764
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: Digital signature
More information about the Devel