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