From c71236d5ae587f6a673a8bf1b6fd5de64a3ba78c Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 20 Nov 2022 11:03:55 -0800 Subject: Handle implicit conversion warnings from clang Clears 6 -Wimplicit-int-conversion, 6 -Wshorten-64-to-32, and 7 -Wsign-conversion warnings. Signed-off-by: Alan Coopersmith --- src/XRes.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/XRes.c') diff --git a/src/XRes.c b/src/XRes.c index fd130a8..d061dd7 100644 --- a/src/XRes.c +++ b/src/XRes.c @@ -70,7 +70,7 @@ XResQueryVersion(Display *dpy, LockDisplay(dpy); GetReq(XResQueryVersion, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->XResReqType = X_XResQueryVersion; req->client_major = XRES_MAJOR_VERSION; req->client_minor = XRES_MINOR_VERSION; @@ -101,7 +101,7 @@ XResQueryClients(Display *dpy, int *num_clients, XResClient **clients) LockDisplay(dpy); GetReq(XResQueryClients, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->XResReqType = X_XResQueryClients; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); @@ -126,7 +126,7 @@ XResQueryClients(Display *dpy, int *num_clients, XResClient **clients) clnts[i].resource_mask = scratch.resource_mask; } *clients = clnts; - *num_clients = rep.num_clients; + *num_clients = (int) rep.num_clients; result = 1; } else { @@ -155,9 +155,9 @@ XResQueryClientResources(Display *dpy, XID xid, LockDisplay(dpy); GetReq(XResQueryClientResources, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->XResReqType = X_XResQueryClientResources; - req->xid = xid; + req->xid = (CARD32) xid; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); @@ -181,7 +181,7 @@ XResQueryClientResources(Display *dpy, XID xid, typs[i].count = scratch.count; } *types = typs; - *num_types = rep.num_types; + *num_types = (int) rep.num_types; result = 1; } else { @@ -207,9 +207,9 @@ XResQueryClientPixmapBytes(Display *dpy, XID xid, unsigned long *bytes) LockDisplay(dpy); GetReq(XResQueryClientPixmapBytes, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->XResReqType = X_XResQueryClientPixmapBytes; - req->xid = xid; + req->xid = (CARD32) xid; if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); @@ -236,12 +236,12 @@ ReadClientValues(Display *dpy, long num_ids, long int value; _XRead32(dpy, &value, 4); - client->spec.client = value; + client->spec.client = (XID) value; _XRead32(dpy, &value, 4); - client->spec.mask = value; + client->spec.mask = (unsigned int) value; _XRead32(dpy, &value, 4); client->length = value; - client->value = malloc(client->length); + client->value = malloc((unsigned long) client->length); _XRead(dpy, client->value, client->length); } return True; @@ -266,10 +266,10 @@ XResQueryClientIds( XResCheckExtension(dpy, info, 0); LockDisplay(dpy); GetReq(XResQueryClientIds, req); - req->reqType = info->codes->major_opcode; + 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->numSpecs = (CARD32) num_specs; for (int c = 0; c < num_specs; ++c) { Data32(dpy, &client_specs[c].client, 4); @@ -315,7 +315,7 @@ XResGetClientIdType(XResClientIdValue *value) XResClientIdType idType = 0; Bool found = False; - for (int 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; @@ -345,9 +345,9 @@ 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); @@ -396,11 +396,11 @@ XResQueryResourceBytes( LockDisplay(dpy); GetReq(XResQueryResourceBytes, req); - req->reqType = info->codes->major_opcode; + 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->client = (CARD32) client; + req->numSpecs = (CARD32) num_specs; for (int c = 0; c < num_specs; ++c) { Data32(dpy, &resource_specs[c].resource, 4); -- cgit v1.2.1