Module Name: xsrc
Committed By: mrg
Date: Sun Jan 8 08:52:49 UTC 2023
Modified Files:
xsrc/external/mit/libXScrnSaver/dist/src: XScrnSaver.c
xsrc/external/mit/libXcomposite/dist/man: Xcomposite.man
xsrc/external/mit/libXres/dist/src: XRes.c
Removed Files:
xsrc/external/mit/libXScrnSaver/dist: README
xsrc/external/mit/libXdamage/dist: README
xsrc/external/mit/libXv/dist: README
Log Message:
merge libXScrnSaver 1.2.4, libXcomposite 0.4.6, libXdamage 1.1.6,
libXres 1.2.2, and libXv 1.0.12.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r0 xsrc/external/mit/libXScrnSaver/dist/README
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/libXScrnSaver/dist/src/XScrnSaver.c
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/libXcomposite/dist/man/Xcomposite.man
cvs rdiff -u -r1.1.1.2 -r0 xsrc/external/mit/libXdamage/dist/README
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/libXres/dist/src/XRes.c
cvs rdiff -u -r1.1.1.2 -r0 xsrc/external/mit/libXv/dist/README
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/libXScrnSaver/dist/src/XScrnSaver.c
diff -u xsrc/external/mit/libXScrnSaver/dist/src/XScrnSaver.c:1.4 xsrc/external/mit/libXScrnSaver/dist/src/XScrnSaver.c:1.5
--- xsrc/external/mit/libXScrnSaver/dist/src/XScrnSaver.c:1.4 Fri Dec 28 22:16:48 2018
+++ xsrc/external/mit/libXScrnSaver/dist/src/XScrnSaver.c Sun Jan 8 08:52:48 2023
@@ -95,21 +95,21 @@ static Bool wire_to_event (
switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
case ScreenSaverNotify:
- se = (XScreenSaverNotifyEvent *) re;
+ se = (XScreenSaverNotifyEvent *) re;
sevent = (xScreenSaverNotifyEvent *) event;
- se->type = sevent->type & 0x7f;
- se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
- se->send_event = (sevent->type & 0x80) != 0;
- se->display = dpy;
- se->window = sevent->window;
+ se->type = sevent->type & 0x7f;
+ se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
+ se->send_event = (sevent->type & 0x80) != 0;
+ se->display = dpy;
+ se->window = sevent->window;
se->root = sevent->root;
- se->state = sevent->state;
+ se->state = sevent->state;
se->kind = sevent->kind;
se->forced = True;
if (sevent->forced == xFalse)
se->forced = False;
se->time = sevent->timestamp;
- return True;
+ return True;
}
return False;
}
@@ -127,27 +127,27 @@ static Status event_to_wire (
switch ((re->type & 0x7f) - info->codes->first_event) {
case ScreenSaverNotify:
- se = (XScreenSaverNotifyEvent *) re;
+ se = (XScreenSaverNotifyEvent *) re;
sevent = (xScreenSaverNotifyEvent *) event;
- sevent->type = se->type | (se->send_event ? 0x80 : 0);
- sevent->sequenceNumber = se->serial & 0xffff;
- sevent->root = se->root;
- sevent->window = se->window;
- sevent->state = se->state;
- sevent->kind = se->kind;
+ sevent->type = (CARD8) (se->type | (se->send_event ? 0x80 : 0));
+ sevent->sequenceNumber = se->serial & 0xffff;
+ sevent->root = (CARD32) se->root;
+ sevent->window = (CARD32) se->window;
+ sevent->state = (BYTE) se->state;
+ sevent->kind = (BYTE) se->kind;
sevent->forced = xFalse;
if (se->forced == True)
sevent->forced = xTrue;
- sevent->timestamp = se->time;
- return 1;
+ sevent->timestamp = (CARD32) se->time;
+ return 1;
}
return 0;
}
/****************************************************************************
- * *
- * ScreenSaver public interfaces *
- * *
+ * *
+ * ScreenSaver public interfaces *
+ * *
****************************************************************************/
Bool XScreenSaverQueryExtension (
@@ -180,7 +180,7 @@ Status XScreenSaverQueryVersion(
LockDisplay (dpy);
GetReq (ScreenSaverQueryVersion, req);
- req->reqType = info->codes->major_opcode;
+ req->reqType = (CARD8) info->codes->major_opcode;
req->saverReqType = X_ScreenSaverQueryVersion;
req->clientMajor = ScreenSaverMajorVersion;
req->clientMinor = ScreenSaverMinorVersion;
@@ -214,9 +214,9 @@ Status XScreenSaverQueryInfo (
LockDisplay (dpy);
GetReq (ScreenSaverQueryInfo, req);
- req->reqType = info->codes->major_opcode;
+ req->reqType = (CARD8) info->codes->major_opcode;
req->saverReqType = X_ScreenSaverQueryInfo;
- req->drawable = drawable;
+ req->drawable = (CARD32) drawable;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
@@ -239,16 +239,16 @@ void XScreenSaverSelectInput (
unsigned long mask)
{
XExtDisplayInfo *info = find_display (dpy);
- register xScreenSaverSelectInputReq *req;
+ register xScreenSaverSelectInputReq *req;
ScreenSaverSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (ScreenSaverSelectInput, req);
- req->reqType = info->codes->major_opcode;
+ req->reqType = (CARD8) info->codes->major_opcode;
req->saverReqType = X_ScreenSaverSelectInput;
- req->drawable = drawable;
- req->eventMask = mask;
+ req->drawable = (CARD32) drawable;
+ req->eventMask = (CARD32) mask;
UnlockDisplay (dpy);
SyncHandle ();
}
@@ -259,49 +259,49 @@ XScreenSaverProcessWindowAttributes (
xChangeWindowAttributesReq *req,
register unsigned long valuemask,
register XSetWindowAttributes *attributes)
- {
- unsigned long values[32];
+{
+ unsigned long values[32] = { 0 };
register unsigned long *value = values;
- unsigned int nvalues;
+ unsigned long nvalues;
if (valuemask & CWBackPixmap)
*value++ = attributes->background_pixmap;
if (valuemask & CWBackPixel)
- *value++ = attributes->background_pixel;
+ *value++ = attributes->background_pixel;
if (valuemask & CWBorderPixmap)
- *value++ = attributes->border_pixmap;
+ *value++ = attributes->border_pixmap;
if (valuemask & CWBorderPixel)
- *value++ = attributes->border_pixel;
+ *value++ = attributes->border_pixel;
if (valuemask & CWBitGravity)
- *value++ = attributes->bit_gravity;
+ *value++ = (unsigned long) attributes->bit_gravity;
if (valuemask & CWWinGravity)
- *value++ = attributes->win_gravity;
+ *value++ = (unsigned long) attributes->win_gravity;
if (valuemask & CWBackingStore)
- *value++ = attributes->backing_store;
+ *value++ = (unsigned long) attributes->backing_store;
if (valuemask & CWBackingPlanes)
*value++ = attributes->backing_planes;
if (valuemask & CWBackingPixel)
- *value++ = attributes->backing_pixel;
+ *value++ = attributes->backing_pixel;
if (valuemask & CWOverrideRedirect)
- *value++ = attributes->override_redirect;
+ *value++ = (unsigned long) attributes->override_redirect;
if (valuemask & CWSaveUnder)
- *value++ = attributes->save_under;
+ *value++ = (unsigned long) attributes->save_under;
if (valuemask & CWEventMask)
- *value++ = attributes->event_mask;
+ *value++ = (unsigned long) attributes->event_mask;
if (valuemask & CWDontPropagate)
- *value++ = attributes->do_not_propagate_mask;
+ *value++ = (unsigned long) attributes->do_not_propagate_mask;
if (valuemask & CWColormap)
*value++ = attributes->colormap;
@@ -309,12 +309,13 @@ XScreenSaverProcessWindowAttributes (
if (valuemask & CWCursor)
*value++ = attributes->cursor;
- req->length += (nvalues = value - values);
+ nvalues = (unsigned long) (value - values);
+ req->length += nvalues;
nvalues <<= 2; /* watch out for macros... */
Data32 (dpy, (long *) values, (long)nvalues);
- }
+}
void XScreenSaverSetAttributes (
Display *dpy,
@@ -337,23 +338,23 @@ void XScreenSaverSetAttributes (
LockDisplay (dpy);
GetReq (ScreenSaverSetAttributes, req);
- req->reqType = info->codes->major_opcode;
+ req->reqType = (CARD8) info->codes->major_opcode;
req->saverReqType = X_ScreenSaverSetAttributes;
- req->drawable = drawable;
- req->x = x;
- req->y = y;
- req->width = width;
- req->height = height;
- req->borderWidth = border_width;
- req->c_class = class;
- req->depth = depth;
+ req->drawable = (CARD32) drawable;
+ req->x = (INT16) x;
+ req->y = (INT16) y;
+ req->width = (CARD16) width;
+ req->height = (CARD16) height;
+ req->borderWidth = (CARD16) border_width;
+ req->c_class = (BYTE) class;
+ req->depth = (CARD8) depth;
if (visual == (Visual *)CopyFromParent)
req->visualID = CopyFromParent;
else
- req->visualID = visual->visualid;
+ req->visualID = (CARD32) visual->visualid;
/* abuse an Xlib internal interface - is this legal for us? */
- if ((req->mask = valuemask))
- XScreenSaverProcessWindowAttributes (dpy,
+ if ((req->mask = (CARD32) valuemask) != 0)
+ XScreenSaverProcessWindowAttributes (dpy,
(xChangeWindowAttributesReq *)req,
valuemask, attributes);
UnlockDisplay (dpy);
@@ -372,9 +373,9 @@ void XScreenSaverUnsetAttributes (
LockDisplay (dpy);
GetReq (ScreenSaverUnsetAttributes, req);
- req->reqType = info->codes->major_opcode;
+ req->reqType = (CARD8) info->codes->major_opcode;
req->saverReqType = X_ScreenSaverUnsetAttributes;
- req->drawable = drawable;
+ req->drawable = (CARD32) drawable;
UnlockDisplay (dpy);
SyncHandle ();
}
@@ -461,10 +462,9 @@ XScreenSaverSuspend (Display *dpy, Bool
LockDisplay (dpy);
GetReq (ScreenSaverSuspend, req);
- req->reqType = info->codes->major_opcode;
+ req->reqType = (CARD8) info->codes->major_opcode;
req->saverReqType = X_ScreenSaverSuspend;
- req->suspend = suspend;
+ req->suspend = (CARD32) suspend;
UnlockDisplay (dpy);
SyncHandle ();
}
-
Index: xsrc/external/mit/libXcomposite/dist/man/Xcomposite.man
diff -u xsrc/external/mit/libXcomposite/dist/man/Xcomposite.man:1.4 xsrc/external/mit/libXcomposite/dist/man/Xcomposite.man:1.5
--- xsrc/external/mit/libXcomposite/dist/man/Xcomposite.man:1.4 Mon Mar 11 06:37:19 2019
+++ xsrc/external/mit/libXcomposite/dist/man/Xcomposite.man Sun Jan 8 08:52:48 2023
@@ -1,7 +1,7 @@
'\" t
.\" Title: Xcomposite
.\" Author: Keith Packard <[email protected]>
-.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\" Generator: DocBook XSL Stylesheets vsnapshot_9276 <http://docbook.sf.net/>
.\" Date: <pubdate>23 April 2007</pubdate>
.\" Manual: X Composite Extension Library
.\" Source: __vendorversion__
@@ -9,6 +9,15 @@
.\"
.TH "XCOMPOSITE" "__libmansuffix__" "<pubdate>23 April 2007</pubdate>" "__vendorversion__" "X Composite Extension Library"
.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
@@ -243,7 +252,7 @@ The X server must support at least versi
\fBXCompositeReleaseOverlayWindow\fR
.RS 4
This request specifies that the client is no longer using the Composite Overlay Window on the screen specified by the argument
-\fIwindow\fR\&. A screen\'s Composite Overlay Window is unmapped when there are no longer any clients using it\&.
+\fIwindow\fR\&. A screen\*(Aqs Composite Overlay Window is unmapped when there are no longer any clients using it\&.
.sp
The X server must support at least version 0\&.3 of the Composite Extension for
\fBXCompositeReleaseOverlayWindow\fR\&.
Index: xsrc/external/mit/libXres/dist/src/XRes.c
diff -u xsrc/external/mit/libXres/dist/src/XRes.c:1.5 xsrc/external/mit/libXres/dist/src/XRes.c:1.6
--- xsrc/external/mit/libXres/dist/src/XRes.c:1.5 Mon Apr 26 21:25:12 2021
+++ xsrc/external/mit/libXres/dist/src/XRes.c Sun Jan 8 08:52:49 2023
@@ -22,209 +22,197 @@ static const char *xres_extension_name =
#define XResCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, xres_extension_name, val)
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xres_ext_info)
+static XEXT_GENERATE_CLOSE_DISPLAY(close_display, xres_ext_info)
static XExtensionHooks xres_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
};
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xres_ext_info,
- xres_extension_name,
- &xres_extension_hooks,
- 0, NULL)
-
-Bool XResQueryExtension (
- Display *dpy,
- int *event_base_return,
- int *error_base_return
-)
+static
+XEXT_GENERATE_FIND_DISPLAY(find_display, xres_ext_info, xres_extension_name,
+ &xres_extension_hooks, 0, NULL)
+
+Bool
+XResQueryExtension(Display *dpy,
+ int *event_base_return, int *error_base_return)
{
- XExtDisplayInfo *info = find_display (dpy);
+ XExtDisplayInfo *info = find_display(dpy);
if (XextHasExtension(info)) {
*event_base_return = info->codes->first_event;
*error_base_return = info->codes->first_error;
return True;
- } else {
+ }
+ else {
return False;
}
}
-Status XResQueryVersion(
- Display *dpy,
- int *major_version_return,
- int *minor_version_return
-)
+Status
+XResQueryVersion(Display *dpy,
+ int *major_version_return, int *minor_version_return)
{
- XExtDisplayInfo *info = find_display (dpy);
+ XExtDisplayInfo *info = find_display(dpy);
xXResQueryVersionReply rep;
xXResQueryVersionReq *req;
- XResCheckExtension (dpy, info, 0);
+ XResCheckExtension(dpy, info, 0);
- LockDisplay (dpy);
- GetReq (XResQueryVersion, req);
- req->reqType = info->codes->major_opcode;
+ LockDisplay(dpy);
+ GetReq(XResQueryVersion, req);
+ req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryVersion;
req->client_major = XRES_MAJOR_VERSION;
req->client_minor = XRES_MINOR_VERSION;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
+ if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
return 0;
}
*major_version_return = rep.server_major;
*minor_version_return = rep.server_minor;
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
return 1;
}
-
-Status XResQueryClients (
- Display *dpy,
- int *num_clients,
- XResClient **clients
-)
+Status
+XResQueryClients(Display *dpy, int *num_clients, XResClient **clients)
{
- XExtDisplayInfo *info = find_display (dpy);
+ XExtDisplayInfo *info = find_display(dpy);
xXResQueryClientsReq *req;
xXResQueryClientsReply rep;
- XResClient *clnts;
int result = 0;
*num_clients = 0;
*clients = NULL;
- XResCheckExtension (dpy, info, 0);
+ XResCheckExtension(dpy, info, 0);
- LockDisplay (dpy);
- GetReq (XResQueryClients, req);
- req->reqType = info->codes->major_opcode;
+ LockDisplay(dpy);
+ GetReq(XResQueryClients, req);
+ req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryClients;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
return 0;
}
- if(rep.num_clients) {
+ if (rep.num_clients) {
+ XResClient *clnts;
+
if (rep.num_clients < (INT_MAX / sizeof(XResClient)))
- clnts = Xmalloc(sizeof(XResClient) * rep.num_clients);
+ clnts = Xcalloc(rep.num_clients, sizeof(XResClient));
else
clnts = NULL;
if (clnts != NULL) {
- xXResClient scratch;
- int i;
+ for (CARD32 i = 0; i < rep.num_clients; i++) {
+ xXResClient scratch;
- for(i = 0; i < rep.num_clients; i++) {
- _XRead(dpy, (char*)&scratch, sz_xXResClient);
+ _XRead(dpy, (char *) &scratch, sz_xXResClient);
clnts[i].resource_base = scratch.resource_base;
clnts[i].resource_mask = scratch.resource_mask;
}
*clients = clnts;
- *num_clients = rep.num_clients;
+ *num_clients = (int) rep.num_clients;
result = 1;
- } else {
+ }
+ else {
_XEatDataWords(dpy, rep.length);
}
}
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
return result;
}
-Status XResQueryClientResources (
- Display *dpy,
- XID xid,
- int *num_types,
- XResType **types
-)
+Status
+XResQueryClientResources(Display *dpy, XID xid,
+ int *num_types, XResType **types)
{
- XExtDisplayInfo *info = find_display (dpy);
+ XExtDisplayInfo *info = find_display(dpy);
xXResQueryClientResourcesReq *req;
xXResQueryClientResourcesReply rep;
- XResType *typs;
int result = 0;
*num_types = 0;
*types = NULL;
- XResCheckExtension (dpy, info, 0);
+ XResCheckExtension(dpy, info, 0);
- LockDisplay (dpy);
- GetReq (XResQueryClientResources, req);
- req->reqType = info->codes->major_opcode;
+ LockDisplay(dpy);
+ GetReq(XResQueryClientResources, req);
+ req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryClientResources;
- req->xid = xid;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
+ req->xid = (CARD32) xid;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
return 0;
}
- if(rep.num_types) {
+ if (rep.num_types) {
+ XResType *typs;
+
if (rep.num_types < (INT_MAX / sizeof(XResType)))
- typs = Xmalloc(sizeof(XResType) * rep.num_types);
+ typs = Xcalloc(rep.num_types, sizeof(XResType));
else
typs = NULL;
if (typs != NULL) {
- xXResType scratch;
- int i;
+ for (CARD32 i = 0; i < rep.num_types; i++) {
+ xXResType scratch;
- for(i = 0; i < rep.num_types; i++) {
- _XRead(dpy, (char*)&scratch, sz_xXResType);
+ _XRead(dpy, (char *) &scratch, sz_xXResType);
typs[i].resource_type = scratch.resource_type;
typs[i].count = scratch.count;
}
*types = typs;
- *num_types = rep.num_types;
+ *num_types = (int) rep.num_types;
result = 1;
- } else {
+ }
+ else {
_XEatDataWords(dpy, rep.length);
}
}
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
return result;
}
-Status XResQueryClientPixmapBytes (
- Display *dpy,
- XID xid,
- unsigned long *bytes
-)
+Status
+XResQueryClientPixmapBytes(Display *dpy, XID xid, unsigned long *bytes)
{
- XExtDisplayInfo *info = find_display (dpy);
+ XExtDisplayInfo *info = find_display(dpy);
xXResQueryClientPixmapBytesReq *req;
xXResQueryClientPixmapBytesReply rep;
*bytes = 0;
- XResCheckExtension (dpy, info, 0);
+ XResCheckExtension(dpy, info, 0);
- LockDisplay (dpy);
- GetReq (XResQueryClientPixmapBytes, req);
- req->reqType = info->codes->major_opcode;
+ LockDisplay(dpy);
+ GetReq(XResQueryClientPixmapBytes, req);
+ req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryClientPixmapBytes;
- req->xid = xid;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
+ req->xid = (CARD32) xid;
+ if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
return 0;
}
@@ -234,63 +222,61 @@ Status XResQueryClientPixmapBytes (
*bytes = rep.bytes_overflow ? 0xffffffff : rep.bytes;
#endif
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
return 1;
}
-static Bool ReadClientValues(
- Display *dpy,
- long num_ids,
- XResClientIdValue *client_ids /* out */
-)
+static Bool
+ReadClientValues(Display *dpy, long num_ids,
+ XResClientIdValue *client_ids /* out */)
{
- int c;
- for (c = 0; c < num_ids; ++c) {
- XResClientIdValue* client = client_ids + c;
+ for (int c = 0; c < num_ids; ++c) {
+ XResClientIdValue *client = client_ids + c;
long int value;
- _XRead32 (dpy, &value, 4);
- client->spec.client = value;
- _XRead32 (dpy, &value, 4);
- client->spec.mask = value;
- _XRead32 (dpy, &value, 4);
+
+ _XRead32(dpy, &value, 4);
+ client->spec.client = (XID) value;
+ _XRead32(dpy, &value, 4);
+ client->spec.mask = (unsigned int) value;
+ _XRead32(dpy, &value, 4);
client->length = value;
- client->value = malloc(client->length);
- _XRead (dpy, client->value, client->length);
+ client->value = malloc((unsigned long) client->length);
+ _XRead(dpy, client->value, client->length);
}
return True;
}
/* Returns an array of uint32_t values, not an array of long */
-Status XResQueryClientIds (
- Display *dpy,
- long num_specs,
- XResClientIdSpec *client_specs, /* in */
- long *num_ids, /* out */
- XResClientIdValue **client_ids /* out */
+Status
+XResQueryClientIds(
+ Display *dpy,
+ long num_specs,
+ XResClientIdSpec *client_specs, /* in */
+ long *num_ids, /* out */
+ XResClientIdValue **client_ids /* out */
)
{
- XExtDisplayInfo *info = find_display (dpy);
+ XExtDisplayInfo *info = find_display(dpy);
xXResQueryClientIdsReq *req;
xXResQueryClientIdsReply rep;
- int c;
*num_ids = 0;
- XResCheckExtension (dpy, info, 0);
- LockDisplay (dpy);
- GetReq (XResQueryClientIds, req);
- req->reqType = info->codes->major_opcode;
+ XResCheckExtension(dpy, info, 0);
+ LockDisplay(dpy);
+ GetReq(XResQueryClientIds, req);
+ req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryClientIds;
- req->length += num_specs * 2; /* 2 longs per client id spec */
- req->numSpecs = num_specs;
+ req->length += num_specs * 2; /* 2 longs per client id spec */
+ req->numSpecs = (CARD32) num_specs;
- for (c = 0; c < num_specs; ++c) {
+ for (int c = 0; c < num_specs; ++c) {
Data32(dpy, &client_specs[c].client, 4);
Data32(dpy, &client_specs[c].mask, 4);
}
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
goto error;
}
@@ -301,39 +287,35 @@ Status XResQueryClientIds (
goto error;
}
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
return Success;
error:
- XResClientIdsDestroy (*num_ids, *client_ids);
+ XResClientIdsDestroy(*num_ids, *client_ids);
*client_ids = NULL;
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
return !Success;
}
-void XResClientIdsDestroy (
- long num_ids,
- XResClientIdValue *client_ids
-)
+void
+XResClientIdsDestroy(long num_ids, XResClientIdValue *client_ids)
{
- int c;
- for (c = 0; c < num_ids; ++c) {
+ for (int c = 0; c < num_ids; ++c) {
free(client_ids[c].value);
}
free(client_ids);
}
-XResClientIdType XResGetClientIdType(
- XResClientIdValue* value
-)
+XResClientIdType
+XResGetClientIdType(XResClientIdValue *value)
{
- int bit;
XResClientIdType idType = 0;
Bool found = False;
- for (bit = 0; bit < XRES_CLIENT_ID_NR; ++bit) {
+
+ for (unsigned int bit = 0; bit < XRES_CLIENT_ID_NR; ++bit) {
if (value->spec.mask & (1 << bit)) {
assert(!found);
found = True;
@@ -346,27 +328,26 @@ XResClientIdType XResGetClientIdType(
return idType;
}
-pid_t XResGetClientPid(
- XResClientIdValue* value
-)
+pid_t
+XResGetClientPid(XResClientIdValue *value)
{
if (value->spec.mask & XRES_CLIENT_ID_PID_MASK && value->length >= 4) {
- return (pid_t) * (CARD32*) value->value;
- } else {
- return (pid_t) -1;
+ return (pid_t) * (CARD32 *) value->value;
+ }
+ else {
+ return (pid_t) - 1;
}
}
-static Status ReadResourceSizeSpec(
- Display *dpy,
- XResResourceSizeSpec *size
-)
+static Status
+ReadResourceSizeSpec(Display *dpy, XResResourceSizeSpec *size)
{
long int value;
+
_XRead32(dpy, &value, 4);
- size->spec.resource = value;
+ size->spec.resource = (XID) value;
_XRead32(dpy, &value, 4);
- size->spec.type = value;
+ size->spec.type = (Atom) value;
_XRead32(dpy, &value, 4);
size->bytes = value;
_XRead32(dpy, &value, 4);
@@ -376,53 +357,52 @@ static Status ReadResourceSizeSpec(
return 0;
}
-static Status ReadResourceSizeValues(
- Display *dpy,
- long num_sizes,
- XResResourceSizeValue *sizes)
-{
- int c;
- int d;
- for (c = 0; c < num_sizes; ++c) {
+static Status
+ReadResourceSizeValues(Display *dpy,
+ long num_sizes, XResResourceSizeValue *sizes)
+{
+ for (int c = 0; c < num_sizes; ++c) {
long int num;
+
ReadResourceSizeSpec(dpy, &sizes[c].size);
_XRead32(dpy, &num, 4);
sizes[c].num_cross_references = num;
- sizes[c].cross_references = num ? calloc(num, sizeof(*sizes[c].cross_references)) : NULL;
- for (d = 0; d < num; ++d) {
+ sizes[c].cross_references =
+ num ? calloc(num, sizeof(*sizes[c].cross_references)) : NULL;
+ for (int d = 0; d < num; ++d) {
ReadResourceSizeSpec(dpy, &sizes[c].cross_references[d]);
}
}
return Success;
}
-Status XResQueryResourceBytes (
- Display *dpy,
- XID client,
- long num_specs,
- XResResourceIdSpec *resource_specs, /* in */
- long *num_sizes, /* out */
- XResResourceSizeValue **sizes /* out */
+Status
+XResQueryResourceBytes(
+ Display *dpy,
+ XID client,
+ long num_specs,
+ XResResourceIdSpec *resource_specs, /* in */
+ long *num_sizes, /* out */
+ XResResourceSizeValue **sizes /* out */
)
{
- XExtDisplayInfo *info = find_display (dpy);
+ XExtDisplayInfo *info = find_display(dpy);
xXResQueryResourceBytesReq *req;
xXResQueryResourceBytesReply rep;
- int c;
*num_sizes = 0;
- XResCheckExtension (dpy, info, 0);
+ XResCheckExtension(dpy, info, 0);
- LockDisplay (dpy);
- GetReq (XResQueryResourceBytes, req);
- req->reqType = info->codes->major_opcode;
+ LockDisplay(dpy);
+ GetReq(XResQueryResourceBytes, req);
+ req->reqType = (CARD8) info->codes->major_opcode;
req->XResReqType = X_XResQueryResourceBytes;
- req->length += num_specs * 2; /* 2 longs per client id spec */
- req->client = client;
- req->numSpecs = num_specs;
+ req->length += num_specs * 2; /* 2 longs per client id spec */
+ req->client = (CARD32) client;
+ req->numSpecs = (CARD32) num_specs;
- for (c = 0; c < num_specs; ++c) {
+ for (int c = 0; c < num_specs; ++c) {
Data32(dpy, &resource_specs[c].resource, 4);
Data32(dpy, &resource_specs[c].type, 4);
}
@@ -430,7 +410,7 @@ Status XResQueryResourceBytes (
*num_sizes = 0;
*sizes = NULL;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
goto error;
}
@@ -441,25 +421,22 @@ Status XResQueryResourceBytes (
goto error;
}
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
return Success;
error:
XResResourceSizeValuesDestroy(*num_sizes, *sizes);
- UnlockDisplay (dpy);
- SyncHandle ();
+ UnlockDisplay(dpy);
+ SyncHandle();
return !Success;
}
-void XResResourceSizeValuesDestroy (
- long num_sizes,
- XResResourceSizeValue *sizes
-)
+void
+XResResourceSizeValuesDestroy(long num_sizes, XResResourceSizeValue *sizes)
{
- int c;
- for (c = 0; c < num_sizes; ++c) {
+ for (int c = 0; c < num_sizes; ++c) {
free(sizes[c].cross_references);
}
free(sizes);