glxproxy: Use _XReadPad instead of _XEatData to clean up the slop
Xlib already provides a function to eat padding bytes after the data read, so use it instead of calculating it ourselves. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
1cb182cbdc
commit
87b0cabc14
|
@ -2582,7 +2582,6 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
|
||||||
xGLXQueryExtensionsStringReply be_reply;
|
xGLXQueryExtensionsStringReply be_reply;
|
||||||
DMXScreenInfo *dmxScreen;
|
DMXScreenInfo *dmxScreen;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
int slop;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen = req->screen;
|
screen = req->screen;
|
||||||
|
@ -2608,16 +2607,13 @@ __glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
|
||||||
_XReply(dpy, (xReply *) &be_reply, 0, False);
|
_XReply(dpy, (xReply *) &be_reply, 0, False);
|
||||||
len = (int) be_reply.length;
|
len = (int) be_reply.length;
|
||||||
numbytes = (int) be_reply.n;
|
numbytes = (int) be_reply.n;
|
||||||
slop = numbytes * __GLX_SIZE_INT8 & 3;
|
|
||||||
be_buf = (char *) malloc(numbytes);
|
be_buf = (char *) malloc(numbytes);
|
||||||
if (!be_buf) {
|
if (!be_buf) {
|
||||||
/* Throw data on the floor */
|
/* Throw data on the floor */
|
||||||
_XEatData(dpy, len);
|
_XEatData(dpy, len);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_XRead(dpy, (char *) be_buf, numbytes);
|
_XReadPad(dpy, (char *) be_buf, numbytes);
|
||||||
if (slop)
|
|
||||||
_XEatData(dpy, 4 - slop);
|
|
||||||
}
|
}
|
||||||
UnlockDisplay(dpy);
|
UnlockDisplay(dpy);
|
||||||
SyncHandle();
|
SyncHandle();
|
||||||
|
@ -2666,7 +2662,6 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
|
||||||
xGLXQueryServerStringReply be_reply;
|
xGLXQueryServerStringReply be_reply;
|
||||||
DMXScreenInfo *dmxScreen;
|
DMXScreenInfo *dmxScreen;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
int slop;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
name = req->name;
|
name = req->name;
|
||||||
|
@ -2693,16 +2688,13 @@ __glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
|
||||||
_XReply(dpy, (xReply *) &be_reply, 0, False);
|
_XReply(dpy, (xReply *) &be_reply, 0, False);
|
||||||
len = (int) be_reply.length;
|
len = (int) be_reply.length;
|
||||||
numbytes = (int) be_reply.n;
|
numbytes = (int) be_reply.n;
|
||||||
slop = numbytes * __GLX_SIZE_INT8 & 3;
|
|
||||||
be_buf = (char *) malloc(numbytes);
|
be_buf = (char *) malloc(numbytes);
|
||||||
if (!be_buf) {
|
if (!be_buf) {
|
||||||
/* Throw data on the floor */
|
/* Throw data on the floor */
|
||||||
_XEatData(dpy, len);
|
_XEatData(dpy, len);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_XRead(dpy, (char *) be_buf, numbytes);
|
_XReadPad(dpy, (char *) be_buf, numbytes);
|
||||||
if (slop)
|
|
||||||
_XEatData(dpy, 4 - slop);
|
|
||||||
}
|
}
|
||||||
UnlockDisplay(dpy);
|
UnlockDisplay(dpy);
|
||||||
SyncHandle();
|
SyncHandle();
|
||||||
|
|
|
@ -138,7 +138,7 @@ CalcServerVersionAndExtensions(void)
|
||||||
Display *dpy = dmxScreen->beDisplay;
|
Display *dpy = dmxScreen->beDisplay;
|
||||||
xGLXQueryServerStringReq *req;
|
xGLXQueryServerStringReq *req;
|
||||||
xGLXQueryServerStringReply reply;
|
xGLXQueryServerStringReply reply;
|
||||||
int length, numbytes, slop;
|
int length, numbytes;
|
||||||
|
|
||||||
/* Send the glXQueryServerString request */
|
/* Send the glXQueryServerString request */
|
||||||
LockDisplay(dpy);
|
LockDisplay(dpy);
|
||||||
|
@ -151,16 +151,13 @@ CalcServerVersionAndExtensions(void)
|
||||||
|
|
||||||
length = (int) reply.length;
|
length = (int) reply.length;
|
||||||
numbytes = (int) reply.n;
|
numbytes = (int) reply.n;
|
||||||
slop = numbytes * __GLX_SIZE_INT8 & 3;
|
|
||||||
be_extensions[s] = (char *) malloc(numbytes);
|
be_extensions[s] = (char *) malloc(numbytes);
|
||||||
if (!be_extensions[s]) {
|
if (!be_extensions[s]) {
|
||||||
/* Throw data on the floor */
|
/* Throw data on the floor */
|
||||||
_XEatData(dpy, length);
|
_XEatData(dpy, length);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_XRead(dpy, (char *) be_extensions[s], numbytes);
|
_XReadPad(dpy, (char *) be_extensions[s], numbytes);
|
||||||
if (slop)
|
|
||||||
_XEatData(dpy, 4 - slop);
|
|
||||||
}
|
}
|
||||||
UnlockDisplay(dpy);
|
UnlockDisplay(dpy);
|
||||||
SyncHandle();
|
SyncHandle();
|
||||||
|
|
Loading…
Reference in New Issue