[comp.windows.x] PolyText8 request.

peterson@SW.MCC.COM (James Peterson) (09/03/88)

The PolyText8 command is defined in the  X Protocol document  (page 126) 
as follows

	Byte 0:		  74		   opcode
	Byte 1:				   unused
 	Byte 2-3	  4+(n+p)/4	   request length
	Byte 4-7	  DRAWABLE	   drawable
	Byte 8-11	  GCONTEXT	   gc
	Byte 12-13	  INT16		   x
	Byte 14-15	  INT16		   y
	Byte 16-16+n-1    LISTofTEXTITEM8  items
	Byte 16+n-16+n+p                   padding

A comment indicates that the number of bytes (p) of padding is always
0 or 1.  How can this be?  A TEXTITEM8 is a 1-byte length (m), followed by
a 1-byte delta and m bytes of data.  Assume that m is 3.  Then the TEXTITEM8
is:
	Byte 16:  3   length
	Byte 17:  0   delta
	Byte 18:  "a"
	Byte 19:  "b"
	Byte 20:  "c"

Now we need 3 bytes of padding (bytes 21, 22, 23) to get up to a multiple of 4
bytes in the request.  How do we know the number of items in the list?

jim

RWS@zermatt.lcs.mit.EDU (Robert Scheifler) (09/03/88)

    Date: Fri, 2 Sep 88 17:39:08 CDT
    From: James Peterson <peterson%sw.MCC.COM@mcc.com>

    A comment indicates that the number of bytes (p) of padding is always
    0 or 1.  How can this be?

As far as the server is concerned, the client is responsible for adding
an "extraneous" TEXTITEM8 with a length of zero.  Xlib takes care of
this little annoyance for you.