[comp.windows.x] XDrawText in Xlib

mlp@ardent.UUCP (Mark Patrick) (07/10/88)

Today we had a problem with XDrawText. The same program which had worked
in a previous version of our system suddenly got XIO Errors following a
call to XDrawText.  After several fruitless experiments it turned out that
the server was getting a huge request from the client which was too big
for its buffers and the server then killed the client.  This huge request
was, it turns out, generated by an uninitialized `delta' field in the 
XTextItem structure.  This field allows for horizontal spacing between items.
It appears that XDrawText generates different sized requests based on this
value!!  Although the problem was in the client program and not in Xlib
or the X server I have a hard time in understanding why the delta value
is not simply passed on to the server but rather affects the size of
the request.  Does anyone have any ideas?

Mark Patrick
Ardent Computer 
uunet!ardent!mlp

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (07/11/88)

    Date: Sat, 9 Jul 88 17:49:03 PDT
    From: ardent!mlp@uunet.uu.net (Mark Patrick)

    It appears that XDrawText generates different sized requests based on this
    value!!  Although the problem was in the client program and not in Xlib
    or the X server I have a hard time in understanding why the delta value
    is not simply passed on to the server but rather affects the size of
    the request.

Go look at the protocol encoding.  In the encoding, the delta value is
only 8 bits (signed).  The small range keeps the encoding compact, and
covers all normal cases, while still allowing for chained elements to
represent larger values.  The Xlib interface has a favor built in; it
allows you to specify large deltas, and automatically converts them into
chains as necessary.