mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-04 16:28:03 +02:00
Convert more _XEatData callers to _XEatDataWords
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
This commit is contained in:
parent
192bbb9e2f
commit
b2c86b582c
6 changed files with 20 additions and 20 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ XOpenDisplay (
|
|||
dpy->xdefaults[reply.nItems] = '\0';
|
||||
}
|
||||
else if (reply.propertyType != None)
|
||||
_XEatData(dpy, reply.nItems * (reply.format >> 3));
|
||||
_XEatDataWords(dpy, reply.length);
|
||||
}
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
|
|
|
|||
|
|
@ -37,9 +37,7 @@ _XQueryColors(
|
|||
int ncolors)
|
||||
{
|
||||
register int i;
|
||||
xrgb *color;
|
||||
xQueryColorsReply rep;
|
||||
long nbytes;
|
||||
register xQueryColorsReq *req;
|
||||
|
||||
GetReq(QueryColors, req);
|
||||
|
|
@ -52,8 +50,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);
|
||||
|
||||
|
|
@ -67,7 +66,8 @@ _XQueryColors(
|
|||
}
|
||||
Xfree((char *)color);
|
||||
}
|
||||
else _XEatData(dpy, (unsigned long) nbytes);
|
||||
else
|
||||
_XEatDataWords(dpy, rep.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue