Commit 05b72b8d authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

Convert more _XEatData callers to _XEatDataWords

parent 306ca006
...@@ -78,7 +78,7 @@ char *XGetAtomName( ...@@ -78,7 +78,7 @@ char *XGetAtomName(
name[rep.nameLength] = '\0'; name[rep.nameLength] = '\0';
_XUpdateAtomCache(dpy, name, atom, 0, -1, 0); _XUpdateAtomCache(dpy, name, atom, 0, -1, 0);
} else { } else {
_XEatData(dpy, (unsigned long) (rep.nameLength + 3) & ~3); _XEatDataWords(dpy, rep.length);
name = (char *) NULL; name = (char *) NULL;
} }
UnlockDisplay(dpy); UnlockDisplay(dpy);
...@@ -176,7 +176,7 @@ XGetAtomNames ( ...@@ -176,7 +176,7 @@ XGetAtomNames (
_XUpdateAtomCache(dpy, names_return[missed], atoms[missed], _XUpdateAtomCache(dpy, names_return[missed], atoms[missed],
0, -1, 0); 0, -1, 0);
} else { } else {
_XEatData(dpy, (unsigned long) (rep.nameLength + 3) & ~3); _XEatDataWords(dpy, rep.length);
async_state.status = 0; async_state.status = 0;
} }
} }
......
...@@ -34,7 +34,7 @@ Colormap *XListInstalledColormaps( ...@@ -34,7 +34,7 @@ Colormap *XListInstalledColormaps(
Window win, Window win,
int *n) /* RETURN */ int *n) /* RETURN */
{ {
long nbytes; unsigned long nbytes;
Colormap *cmaps; Colormap *cmaps;
xListInstalledColormapsReply rep; xListInstalledColormapsReply rep;
register xResourceReq *req; register xResourceReq *req;
...@@ -51,14 +51,14 @@ Colormap *XListInstalledColormaps( ...@@ -51,14 +51,14 @@ Colormap *XListInstalledColormaps(
if (rep.nColormaps) { if (rep.nColormaps) {
nbytes = rep.nColormaps * sizeof(Colormap); nbytes = rep.nColormaps * sizeof(Colormap);
cmaps = (Colormap *) Xmalloc((unsigned) nbytes); cmaps = Xmalloc(nbytes);
nbytes = rep.nColormaps << 2;
if (! cmaps) { if (! cmaps) {
_XEatData(dpy, (unsigned long) nbytes); _XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return((Colormap *) NULL); return((Colormap *) NULL);
} }
nbytes = rep.nColormaps << 2;
_XRead32 (dpy, (long *) cmaps, nbytes); _XRead32 (dpy, (long *) cmaps, nbytes);
} }
else cmaps = (Colormap *) NULL; else cmaps = (Colormap *) NULL;
......
...@@ -34,7 +34,7 @@ Atom *XListProperties( ...@@ -34,7 +34,7 @@ Atom *XListProperties(
Window window, Window window,
int *n_props) /* RETURN */ int *n_props) /* RETURN */
{ {
long nbytes; unsigned long nbytes;
xListPropertiesReply rep; xListPropertiesReply rep;
Atom *properties; Atom *properties;
register xResourceReq *req; register xResourceReq *req;
...@@ -50,14 +50,14 @@ Atom *XListProperties( ...@@ -50,14 +50,14 @@ Atom *XListProperties(
if (rep.nProperties) { if (rep.nProperties) {
nbytes = rep.nProperties * sizeof(Atom); nbytes = rep.nProperties * sizeof(Atom);
properties = (Atom *) Xmalloc ((unsigned) nbytes); properties = Xmalloc (nbytes);
nbytes = rep.nProperties << 2;
if (! properties) { if (! properties) {
_XEatData(dpy, (unsigned long) nbytes); _XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return (Atom *) NULL; return (Atom *) NULL;
} }
nbytes = rep.nProperties << 2;
_XRead32 (dpy, (long *) properties, nbytes); _XRead32 (dpy, (long *) properties, nbytes);
} }
else properties = (Atom *) NULL; else properties = (Atom *) NULL;
......
...@@ -788,7 +788,7 @@ fallback_success: ...@@ -788,7 +788,7 @@ fallback_success:
dpy->xdefaults[reply.nItems] = '\0'; dpy->xdefaults[reply.nItems] = '\0';
} }
else if (reply.propertyType != None) else if (reply.propertyType != None)
_XEatData(dpy, reply.nItems * (reply.format >> 3)); _XEatDataWords(dpy, reply.length);
} }
#if !USE_XCB #if !USE_XCB
DeqAsyncHandler(dpy, &async); DeqAsyncHandler(dpy, &async);
......
...@@ -37,9 +37,7 @@ XQueryColors( ...@@ -37,9 +37,7 @@ XQueryColors(
int ncolors) int ncolors)
{ {
register int i; register int i;
xrgb *color;
xQueryColorsReply rep; xQueryColorsReply rep;
long nbytes;
register xQueryColorsReq *req; register xQueryColorsReq *req;
LockDisplay(dpy); LockDisplay(dpy);
...@@ -53,8 +51,9 @@ XQueryColors( ...@@ -53,8 +51,9 @@ XQueryColors(
/* XXX this isn't very efficient */ /* XXX this isn't very efficient */
if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) {
if ((color = (xrgb *) unsigned long nbytes = (long) ncolors * SIZEOF(xrgb);
Xmalloc((unsigned) (nbytes = (long) ncolors * SIZEOF(xrgb))))) { xrgb *color = Xmalloc(nbytes);
if (color != NULL) {
_XRead(dpy, (char *) color, nbytes); _XRead(dpy, (char *) color, nbytes);
...@@ -68,7 +67,8 @@ XQueryColors( ...@@ -68,7 +67,8 @@ XQueryColors(
} }
Xfree((char *)color); Xfree((char *)color);
} }
else _XEatData(dpy, (unsigned long) nbytes); else
_XEatDataWords(dpy, rep.length);
} }
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
......
...@@ -37,7 +37,7 @@ Status XQueryTree ( ...@@ -37,7 +37,7 @@ Status XQueryTree (
Window **children, /* RETURN */ Window **children, /* RETURN */
unsigned int *nchildren) /* RETURN */ unsigned int *nchildren) /* RETURN */
{ {
long nbytes; unsigned long nbytes;
xQueryTreeReply rep; xQueryTreeReply rep;
register xResourceReq *req; register xResourceReq *req;
...@@ -52,14 +52,14 @@ Status XQueryTree ( ...@@ -52,14 +52,14 @@ Status XQueryTree (
*children = (Window *) NULL; *children = (Window *) NULL;
if (rep.nChildren != 0) { if (rep.nChildren != 0) {
nbytes = rep.nChildren * sizeof(Window); nbytes = rep.nChildren * sizeof(Window);
*children = (Window *) Xmalloc((unsigned) nbytes); *children = Xmalloc(nbytes);
nbytes = rep.nChildren << 2;
if (! *children) { if (! *children) {
_XEatData(dpy, (unsigned long) nbytes); _XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return (0); return (0);
} }
nbytes = rep.nChildren << 2;
_XRead32 (dpy, (long *) *children, nbytes); _XRead32 (dpy, (long *) *children, nbytes);
} }
*parent = rep.parent; *parent = rep.parent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment