summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-11-20 12:17:00 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-11-20 12:17:00 -0800
commit9dc9fb1bb8ca8e304a191430278703b7bc092eb2 (patch)
tree2821a6208c21eb64237dbfa5d73def79b13ca302
parentd32243b670b472fc08f577957d1a3fd9bab6430d (diff)
Handle implicit conversion warnings from clang
Clears 16 -Wimplicit-int-conversion, 11 -Wshorten-64-to-32, and 8 -Wsign-conversion warnings. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/XScrnSaver.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/src/XScrnSaver.c b/src/XScrnSaver.c
index 5428a89..2fe296b 100644
--- a/src/XScrnSaver.c
+++ b/src/XScrnSaver.c
@@ -129,16 +129,16 @@ static Status event_to_wire (
case ScreenSaverNotify:
se = (XScreenSaverNotifyEvent *) re;
sevent = (xScreenSaverNotifyEvent *) event;
- sevent->type = se->type | (se->send_event ? 0x80 : 0);
+ sevent->type = (CARD8) (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->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;
+ sevent->timestamp = (CARD32) se->time;
return 1;
}
return 0;
@@ -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 ();
@@ -245,10 +245,10 @@ void XScreenSaverSelectInput (
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 ();
}
@@ -260,9 +260,9 @@ XScreenSaverProcessWindowAttributes (
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;
@@ -277,13 +277,13 @@ XScreenSaverProcessWindowAttributes (
*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;
@@ -292,16 +292,16 @@ XScreenSaverProcessWindowAttributes (
*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,7 +309,8 @@ 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);
@@ -337,22 +338,22 @@ 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))
+ if ((req->mask = (CARD32) valuemask) != 0)
XScreenSaverProcessWindowAttributes (dpy,
(xChangeWindowAttributesReq *)req,
valuemask, attributes);
@@ -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,9 +462,9 @@ XScreenSaverSuspend (Display *dpy, Bool suspend)
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 ();
}