summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2004-12-27 08:29:54 +0000
committerIan Romanick <[email protected]>2004-12-27 08:29:54 +0000
commit83fcf49647f423741a0a2143e03dbaa2d43d31a1 (patch)
treee28f9dd9c8ddad4ada76edea578f280672370ec9
parent3cbc2bd833b426057c4174ad44ae21ecb04f96e5 (diff)
Fixed two problems with the handling of GLX protocol replies. The logic
for determining when extra data needed to be read after a reply (to ensure 4-byte alignment) and the logic to determine whether or not to read reply data after the SingleReply packet were both slightly wrong.
-rw-r--r--src/glx/x11/indirect.c4
-rw-r--r--src/mesa/glapi/glX_proto_send.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index c476fbad3bf..965a4a2961a 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -64,13 +64,13 @@ read_reply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_ar
(void) _XReply(dpy, (xReply *) & reply, 0, False);
if (size != 0) {
- if ((reply.size >= 1) || reply_is_always_array) {
+ if ((reply.length > 0) || reply_is_always_array) {
const GLint bytes = (reply_is_always_array)
? (4 * reply.length) : (reply.size * size);
const GLint extra = 4 - (bytes & 3);
_XRead(dpy, dest, bytes);
- if ( extra != 0 ) {
+ if ( extra < 4 ) {
_XEatData(dpy, extra);
}
}
diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py
index 15be86bc9f2..023b07ee3bd 100644
--- a/src/mesa/glapi/glX_proto_send.py
+++ b/src/mesa/glapi/glX_proto_send.py
@@ -75,13 +75,13 @@ read_reply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_ar
(void) _XReply(dpy, (xReply *) & reply, 0, False);
if (size != 0) {
- if ((reply.size >= 1) || reply_is_always_array) {
+ if ((reply.length > 0) || reply_is_always_array) {
const GLint bytes = (reply_is_always_array)
? (4 * reply.length) : (reply.size * size);
const GLint extra = 4 - (bytes & 3);
_XRead(dpy, dest, bytes);
- if ( extra != 0 ) {
+ if ( extra < 4 ) {
_XEatData(dpy, extra);
}
}