From 26cd44cc3d2b5db5caa42d9203a866f12c039980 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 19 Nov 2022 11:18:11 -0800 Subject: Handle 63 of 63 -Wshorten-64-to-32 warnings from clang Signed-off-by: Alan Coopersmith --- src/Cursor.c | 29 +++++++++++----------- src/Region.c | 77 ++++++++++++++++++++++++++++++--------------------------- src/SaveSet.c | 2 +- src/Selection.c | 6 ++--- src/Xfixes.c | 18 +++++++------- 5 files changed, 69 insertions(+), 63 deletions(-) diff --git a/src/Cursor.c b/src/Cursor.c index 2b177b8..34f534d 100644 --- a/src/Cursor.c +++ b/src/Cursor.c @@ -63,8 +63,8 @@ XFixesSelectCursorInput (Display *dpy, GetReq (XFixesSelectCursorInput, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSelectCursorInput; - req->window = win; - req->eventMask = eventMask; + req->window = (CARD32) win; + req->eventMask = (CARD32) eventMask; UnlockDisplay (dpy); SyncHandle (); } @@ -155,7 +155,7 @@ XFixesSetCursorName (Display *dpy, Cursor cursor, const char *name) { XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy); xXFixesSetCursorNameReq *req; - int nbytes = strlen (name); + CARD16 nbytes = (CARD16) strlen (name); XFixesSimpleCheckExtension (dpy, info); if (info->major_version < 2) @@ -164,7 +164,7 @@ XFixesSetCursorName (Display *dpy, Cursor cursor, const char *name) GetReq (XFixesSetCursorName, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSetCursorName; - req->cursor = cursor; + req->cursor = (CARD32) cursor; req->nbytes = nbytes; req->length += (nbytes + 3) >> 2; Data (dpy, name, nbytes); @@ -187,7 +187,7 @@ XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom) GetReq (XFixesGetCursorName, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesGetCursorName; - req->cursor = cursor; + req->cursor = (CARD32) cursor; if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay (dpy); @@ -220,8 +220,8 @@ XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination) GetReq (XFixesChangeCursor, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesChangeCursor; - req->source = source; - req->destination = destination; + req->source = (CARD32) source; + req->destination = (CARD32) destination; UnlockDisplay(dpy); SyncHandle(); } @@ -231,7 +231,7 @@ XFixesChangeCursorByName (Display *dpy, Cursor source, const char *name) { XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy); xXFixesChangeCursorByNameReq *req; - int nbytes = strlen (name); + CARD16 nbytes = (CARD16) strlen (name); XFixesSimpleCheckExtension (dpy, info); if (info->major_version < 2) @@ -240,7 +240,7 @@ XFixesChangeCursorByName (Display *dpy, Cursor source, const char *name) GetReq (XFixesChangeCursorByName, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesChangeCursorByName; - req->source = source; + req->source = (CARD32) source; req->nbytes = nbytes; req->length += (nbytes + 3) >> 2; Data (dpy, name, nbytes); @@ -261,7 +261,7 @@ XFixesHideCursor (Display *dpy, Window win) GetReq (XFixesHideCursor, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesHideCursor; - req->window = win; + req->window = (CARD32) win; UnlockDisplay (dpy); SyncHandle (); } @@ -279,7 +279,7 @@ XFixesShowCursor (Display *dpy, Window win) GetReq (XFixesShowCursor, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesShowCursor; - req->window = win; + req->window = (CARD32) win; UnlockDisplay (dpy); SyncHandle (); } @@ -305,8 +305,9 @@ XFixesCreatePointerBarrier(Display *dpy, Window w, int x1, int y1, GetReqExtra (XFixesCreatePointerBarrier, extra, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesCreatePointerBarrier; - barrier = req->barrier = XAllocID (dpy); - req->window = w; + barrier = XAllocID (dpy); + req->barrier = (CARD32) barrier; + req->window = (CARD32) w; req->x1 = x1; req->y1 = y1; req->x2 = x2; @@ -338,7 +339,7 @@ XFixesDestroyPointerBarrier(Display *dpy, PointerBarrier b) GetReq (XFixesDestroyPointerBarrier, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesDestroyPointerBarrier; - req->barrier = b; + req->barrier = (CARD32) b; UnlockDisplay (dpy); SyncHandle(); } diff --git a/src/Region.c b/src/Region.c index 59bcc1a..d29297f 100644 --- a/src/Region.c +++ b/src/Region.c @@ -39,7 +39,8 @@ XFixesCreateRegion (Display *dpy, XRectangle *rectangles, int nrectangles) GetReq (XFixesCreateRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesCreateRegion; - region = req->region = XAllocID (dpy); + region = XAllocID (dpy); + req->region = (CARD32) region; len = ((long) nrectangles) << 1; SetReqLen (req, len, len); len <<= 2; @@ -61,8 +62,9 @@ XFixesCreateRegionFromBitmap (Display *dpy, Pixmap bitmap) GetReq (XFixesCreateRegionFromBitmap, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesCreateRegionFromBitmap; - region = req->region = XAllocID (dpy); - req->bitmap = bitmap; + region = XAllocID (dpy); + req->region = (CARD32) region; + req->bitmap = (CARD32) bitmap; UnlockDisplay (dpy); SyncHandle(); return region; @@ -80,8 +82,9 @@ XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind) GetReq (XFixesCreateRegionFromWindow, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesCreateRegionFromWindow; - region = req->region = XAllocID (dpy); - req->window = window; + region = XAllocID (dpy); + req->region = (CARD32) region; + req->window = (CARD32) window; req->kind = kind; UnlockDisplay (dpy); SyncHandle(); @@ -100,8 +103,9 @@ XFixesCreateRegionFromGC (Display *dpy, GC gc) GetReq (XFixesCreateRegionFromGC, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesCreateRegionFromGC; - region = req->region = XAllocID (dpy); - req->gc = gc->gid; + region = XAllocID (dpy); + req->region = (CARD32) region; + req->gc = (CARD32) gc->gid; UnlockDisplay (dpy); SyncHandle(); return region; @@ -119,8 +123,9 @@ XFixesCreateRegionFromPicture (Display *dpy, XID picture) GetReq (XFixesCreateRegionFromPicture, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesCreateRegionFromPicture; - region = req->region = XAllocID (dpy); - req->picture = picture; + region = XAllocID (dpy); + req->region = (CARD32) region; + req->picture = (CARD32) picture; UnlockDisplay (dpy); SyncHandle(); return region; @@ -137,7 +142,7 @@ XFixesDestroyRegion (Display *dpy, XserverRegion region) GetReq (XFixesDestroyRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesDestroyRegion; - req->region = region; + req->region = (CARD32) region; UnlockDisplay (dpy); SyncHandle(); } @@ -155,7 +160,7 @@ XFixesSetRegion (Display *dpy, XserverRegion region, GetReq (XFixesSetRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSetRegion; - req->region = region; + req->region = (CARD32) region; len = ((long) nrectangles) << 1; SetReqLen (req, len, len); len <<= 2; @@ -175,8 +180,8 @@ XFixesCopyRegion (Display *dpy, XserverRegion dst, XserverRegion src) GetReq (XFixesCopyRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesCopyRegion; - req->source = src; - req->destination = dst; + req->source = (CARD32) src; + req->destination = (CARD32) dst; UnlockDisplay (dpy); SyncHandle(); } @@ -193,9 +198,9 @@ XFixesUnionRegion (Display *dpy, XserverRegion dst, GetReq (XFixesUnionRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesUnionRegion; - req->source1 = src1; - req->source2 = src2; - req->destination = dst; + req->source1 = (CARD32) src1; + req->source2 = (CARD32) src2; + req->destination = (CARD32) dst; UnlockDisplay (dpy); SyncHandle(); } @@ -212,9 +217,9 @@ XFixesIntersectRegion (Display *dpy, XserverRegion dst, GetReq (XFixesIntersectRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesIntersectRegion; - req->source1 = src1; - req->source2 = src2; - req->destination = dst; + req->source1 = (CARD32) src1; + req->source2 = (CARD32) src2; + req->destination = (CARD32) dst; UnlockDisplay (dpy); SyncHandle(); } @@ -231,9 +236,9 @@ XFixesSubtractRegion (Display *dpy, XserverRegion dst, GetReq (XFixesSubtractRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSubtractRegion; - req->source1 = src1; - req->source2 = src2; - req->destination = dst; + req->source1 = (CARD32) src1; + req->source2 = (CARD32) src2; + req->destination = (CARD32) dst; UnlockDisplay (dpy); SyncHandle(); } @@ -254,8 +259,8 @@ XFixesInvertRegion (Display *dpy, XserverRegion dst, req->y = rect->y; req->width = rect->width; req->height = rect->height; - req->source = src; - req->destination = dst; + req->source = (CARD32) src; + req->destination = (CARD32) dst; UnlockDisplay (dpy); SyncHandle(); } @@ -271,7 +276,7 @@ XFixesTranslateRegion (Display *dpy, XserverRegion region, int dx, int dy) GetReq (XFixesTranslateRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesTranslateRegion; - req->region = region; + req->region = (CARD32) region; req->dx = dx; req->dy = dy; UnlockDisplay (dpy); @@ -289,8 +294,8 @@ XFixesRegionExtents (Display *dpy, XserverRegion dst, XserverRegion src) GetReq (XFixesRegionExtents, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesRegionExtents; - req->source = src; - req->destination = dst; + req->source = (CARD32) src; + req->destination = (CARD32) dst; UnlockDisplay (dpy); SyncHandle(); } @@ -322,7 +327,7 @@ XFixesFetchRegionAndBounds (Display *dpy, GetReq (XFixesFetchRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesFetchRegion; - req->region = region; + req->region = (CARD32) region; *nrectanglesRet = 0; if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { @@ -378,8 +383,8 @@ XFixesSetGCClipRegion (Display *dpy, GC gc, GetReq (XFixesSetGCClipRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSetGCClipRegion; - req->gc = gc->gid; - req->region = region; + req->gc = (CARD32) gc->gid; + req->region = (CARD32) region; req->xOrigin = clip_x_origin; req->yOrigin = clip_y_origin; UnlockDisplay (dpy); @@ -398,11 +403,11 @@ XFixesSetWindowShapeRegion (Display *dpy, Window win, int shape_kind, GetReq (XFixesSetWindowShapeRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSetWindowShapeRegion; - req->dest = win; + req->dest = (CARD32) win; req->destKind = shape_kind; req->xOff = x_off; req->yOff = y_off; - req->region = region; + req->region = (CARD32) region; UnlockDisplay (dpy); SyncHandle(); } @@ -420,8 +425,8 @@ XFixesSetPictureClipRegion (Display *dpy, XID picture, GetReq (XFixesSetPictureClipRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSetPictureClipRegion; - req->picture = picture; - req->region = region; + req->picture = (CARD32) picture; + req->region = (CARD32) region; req->xOrigin = clip_x_origin; req->yOrigin = clip_y_origin; UnlockDisplay (dpy); @@ -441,8 +446,8 @@ XFixesExpandRegion (Display *dpy, XserverRegion dst, XserverRegion src, GetReq (XFixesExpandRegion, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesExpandRegion; - req->source = src; - req->destination = dst; + req->source = (CARD32) src; + req->destination = (CARD32) dst; req->left = left; req->right = right; req->top = top; diff --git a/src/SaveSet.c b/src/SaveSet.c index cf050a0..74e4924 100644 --- a/src/SaveSet.c +++ b/src/SaveSet.c @@ -41,7 +41,7 @@ XFixesChangeSaveSet (Display *dpy, Window win, int mode, int target, int map) req->mode = mode; req->target = target; req->map = map; - req->window = win; + req->window = (CARD32) win; UnlockDisplay (dpy); SyncHandle (); } diff --git a/src/Selection.c b/src/Selection.c index 7f4769c..357870b 100644 --- a/src/Selection.c +++ b/src/Selection.c @@ -41,9 +41,9 @@ XFixesSelectSelectionInput (Display *dpy, GetReq (XFixesSelectSelectionInput, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSelectSelectionInput; - req->window = win; - req->selection = selection; - req->eventMask = eventMask; + req->window = (CARD32) win; + req->selection = (CARD32) selection; + req->eventMask = (CARD32) eventMask; UnlockDisplay (dpy); SyncHandle (); } diff --git a/src/Xfixes.c b/src/Xfixes.c index 2ce8106..4e5c247 100644 --- a/src/Xfixes.c +++ b/src/Xfixes.c @@ -272,11 +272,11 @@ XFixesEventToWire(Display *dpy, XEvent *event, xEvent *wire) aevent = (XFixesSelectionNotifyEvent *) event; awire->type = aevent->type | (aevent->send_event ? 0x80 : 0); awire->subtype = aevent->subtype; - awire->window = aevent->window; - awire->owner = aevent->owner; - awire->selection = aevent->selection; - awire->timestamp = aevent->timestamp; - awire->selectionTimestamp = aevent->selection_timestamp; + awire->window = (CARD32) aevent->window; + awire->owner = (CARD32) aevent->owner; + awire->selection = (CARD32) aevent->selection; + awire->timestamp = (CARD32) aevent->timestamp; + awire->selectionTimestamp = (CARD32) aevent->selection_timestamp; return True; } case XFixesCursorNotify: { @@ -286,10 +286,10 @@ XFixesEventToWire(Display *dpy, XEvent *event, xEvent *wire) aevent = (XFixesCursorNotifyEvent *) event; awire->type = aevent->type | (aevent->send_event ? 0x80 : 0); awire->subtype = aevent->subtype; - awire->window = aevent->window; - awire->timestamp = aevent->timestamp; - awire->cursorSerial = aevent->cursor_serial; - awire->name = aevent->cursor_name; + awire->window = (CARD32) aevent->window; + awire->timestamp = (CARD32) aevent->timestamp; + awire->cursorSerial = (CARD32) aevent->cursor_serial; + awire->name = (CARD32) aevent->cursor_name; } } return False; -- cgit v1.2.1