[Xcb] [icccm] function GetTextProperty
Jamey Sharp
jamey at minilop.net
Sun Sep 10 14:06:44 PDT 2006
On Sun, Sep 10, 2006 at 11:15:15AM +0200, Vincent Torri wrote:
> in the function GetTextProperty, we ask for a GetProperty, we check if
> bytes_after is non 0, and if so, we ask for another GetProperty. I've not
> found such test in the Xlib version of XGetTextProperty.
>
> Can someone explain me why we are doing that check ?
Um... I think the correct thing to do would have been to ask for as many
words as possible the first time around, instead of using the first
query to find out how long the property is and asking for the whole
thing the second time. (Especially since the property may have changed
in the meantime.)
I guess the way to do that is to pass -1 for long_len instead of 128,
although I'm never entirely confident about what C does with negative
literals assigned to unsigned variables.
I see that in Xlib, they passed 1000000L for that field instead, which
is essentially equivalent to what I've described: 4MB is about the same
as 16GB in properties. :-) However, if somebody does have more than 4MB
of data in the property, Xlib will silently truncate it, which could be
surprising...
--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20060910/e84db389/attachment.pgp
More information about the Xcb
mailing list