diff options
author | Christian Linhart <chris@demorecorder.com> | 2015-09-13 15:45:12 +0200 |
---|---|---|
committer | Christian Linhart <chris@demorecorder.com> | 2015-10-26 17:34:14 +0100 |
commit | 8a7096ce7375b1840aa350a27a092dd4a22f4c6e (patch) | |
tree | 7aa966f226dc16aab46330ebe4dc13290972202c /src | |
parent | 9add1748e9e87d74a7e5f1cf6a4aad914a9cfb0d (diff) | |
download | xcb-proto-8a7096ce7375b1840aa350a27a092dd4a22f4c6e.tar.gz |
xprint: make padding explicit
Add explicit padding for:
* the struct "PRINTER":
- between list "name" and field "descLen"
I cannot read any of the formats that the xproto-spec is provided in.
(the postscript file is broken)
Therefore I provide the Xlib implementation as a reference:
The list "name" is read with _XReadPad or _XEatData:
http://cgit.freedesktop.org/xorg/lib/libXp/tree/src/XpPrinter.c?id=libXp-1.0.3#n158
_XReadPad does 4-byte padding:
http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xcb_io.c?id=libX11-1.6.3#n743
_XEatData does not do 4-byte padding:
http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xcb_io.c?id=libX11-1.6.3#n755
Since _XEatData is only a fallback when malloc fails, this is usually not
used. Therefore, using _XEatData as an alternative to _XReadPad in libXp
is a bug there.
- at the end of the struct "PRINTER"
this is OK because of the same reasons as above:
http://cgit.freedesktop.org/xorg/lib/libXp/tree/src/XpPrinter.c?id=libXp-1.0.3#n181
* the reply of request "PrintInputSelected"
- add a 1-byte pad at the start.
This is needed because all replies start with a 1-byte field that occupies
a place in the reply-header.
Signed-off-by: Christian Linhart <chris@demorecorder.com>
Reviewed-by: Peter Harris <pharris@opentext.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/xprint.xml | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/xprint.xml b/src/xprint.xml index 4da49b0..f9af65f 100644 --- a/src/xprint.xml +++ b/src/xprint.xml @@ -41,12 +41,12 @@ authorization from the authors. <list type="STRING8" name="name"> <fieldref>nameLen</fieldref> </list> - <!-- Padding --> + <pad align="4" /> <field type="CARD32" name="descLen" /> <list type="STRING8" name="description"> <fieldref>descLen</fieldref> </list> - <!-- More padding --> + <pad align="4" /> </struct> <!--<typedef oldname="CARD32" newname="PCONTEXT" />--> @@ -219,6 +219,7 @@ authorization from the authors. <request name="PrintInputSelected" opcode="16"> <field type="PCONTEXT" name="context" /> <reply> + <pad bytes="1" /> <field type="CARD32" name="event_mask" /> <field type="CARD32" name="all_events_mask" /> </reply> |