[fdo] Can anyone help me understand xGetImageReply in libx11?

Alan Coopersmith alan.coopersmith at oracle.com
Fri Jul 30 17:31:14 UTC 2021


Questions about X11 are better handled on the X.Org mailing lists at
https://www.x.org/wiki/XorgMailingLists/ than the generic freedesktop
list.

On 7/29/21 3:08 PM, Chuanlong Du wrote:
> I read the source code of the file GetImage.c in libX11 
> <https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/src/GetImage.c> but got 
> confused by line 66 
> <https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/src/GetImage.c#L66> (see 
> screenshot below for convenience). I couldn't find the definition of 
> xGetImageReply anywhere in the code. 

Since the xGetImageReply structure is part of the protocol between
the client and server, it's defined in the separate xorgproto package
so both libX11 and the Xserver can share the definition and ensure
it's always in sync between both sides.  You can see its definition at:

https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/master/include/X11/Xproto.h#L713-724

> What is the value of rep.length after execution of line 66?

Undefined, as that just declares the variable without initializing it.
It won't be set until the XReply call at line 85 writes the reply
received from the X server into that structure.

-- 
	-Alan Coopersmith-               alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - https://blogs.oracle.com/alanc


More information about the freedesktop mailing list