diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2022-09-09 16:51:01 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2022-09-09 20:34:19 -0400 |
commit | ea28ca1a2cce8e0d8e5a1f620a809384ed276c37 (patch) | |
tree | 9b0743cd1727eb5e6dbfc84f33dd08db49c5f9a9 /src | |
parent | afc7f259668bbb25d5b06929d529add93fb39ebf (diff) |
use casts to reduce compiler warnings (no object change)
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/AddTrap.c | 12 | ||||
-rw-r--r-- | src/Color.c | 14 | ||||
-rw-r--r-- | src/Composite.c | 26 | ||||
-rw-r--r-- | src/Cursor.c | 14 | ||||
-rw-r--r-- | src/FillRect.c | 16 | ||||
-rw-r--r-- | src/FillRects.c | 8 | ||||
-rw-r--r-- | src/Filter.c | 26 | ||||
-rw-r--r-- | src/Glyph.c | 188 | ||||
-rw-r--r-- | src/Picture.c | 86 | ||||
-rw-r--r-- | src/Poly.c | 6 | ||||
-rw-r--r-- | src/Trap.c | 14 | ||||
-rw-r--r-- | src/Tri.c | 42 | ||||
-rw-r--r-- | src/Xrender.c | 52 |
13 files changed, 252 insertions, 252 deletions
diff --git a/src/AddTrap.c b/src/AddTrap.c index ccbada0..5d01114 100644 --- a/src/AddTrap.c +++ b/src/AddTrap.c @@ -47,20 +47,20 @@ XRenderAddTraps (Display *dpy, unsigned long len; GetReq(RenderAddTraps, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderAddTraps; - req->picture = picture; - req->xOff = xOff; - req->yOff = yOff; + req->picture = (CARD32) picture; + req->xOff = (INT16) xOff; + req->yOff = (INT16) yOff; n = ntrap; len = ((unsigned long) n) * (SIZEOF (xTrap) >> 2); if (len > (max_req - req->length)) { - n = (max_req - req->length) / (SIZEOF (xTrap) >> 2); + n = (int) ((max_req - req->length) / (SIZEOF (xTrap) >> 2)); len = ((unsigned long) n) * (SIZEOF (xTrap) >> 2); } SetReqLen (req, len, len); len <<= 2; - DataInt32 (dpy, (int *) traps, len); + DataInt32 (dpy, (int *) traps, (long) len); ntrap -= n; traps += n; } diff --git a/src/Color.c b/src/Color.c index 671d60b..1c48136 100644 --- a/src/Color.c +++ b/src/Color.c @@ -52,21 +52,21 @@ XRenderParseColor(Display *dpy, char *spec, XRenderColor *def) return 0; } c = *spec++; - *pShort <<= 4; + *pShort = (unsigned short) (*pShort << 4); if (c >= '0' && c <= '9') - *pShort |= c - '0'; + *pShort = (unsigned short) (*pShort | (c - '0')); /* assume string in lowercase else if (c >= 'A' && c <= 'F') *pShort |= c - ('A' - 10); */ else if (c >= 'a' && c <= 'f') - *pShort |= c - ('a' - 10); + *pShort = (unsigned short) (*pShort | (c - ('a' - 10))); else return 0; } if (n == 0) return 0; if (n < 4) { - *pShort = ((unsigned long)*pShort * 0xFFFF) / ((1 << n*4) - 1); + *pShort = (unsigned short) (((unsigned long)*pShort * 0xFFFF) / (unsigned long) ((1 << n*4) - 1)); } } def->red = elements[0]; @@ -87,8 +87,8 @@ XRenderParseColor(Display *dpy, char *spec, XRenderColor *def) def->blue = coreColor.blue; def->alpha = 0xffff; } - def->red = (def->red * def->alpha) / 0xffffU; - def->green = (def->green * def->alpha) / 0xffffU; - def->blue = (def->blue * def->alpha) / 0xffffU; + def->red = (unsigned short) ((unsigned) (def->red * def->alpha) / 0xffffU); + def->green = (unsigned short) ((unsigned) (def->green * def->alpha) / 0xffffU); + def->blue = (unsigned short) ((unsigned) (def->blue * def->alpha) / 0xffffU); return 1; } diff --git a/src/Composite.c b/src/Composite.c index b529088..c635453 100644 --- a/src/Composite.c +++ b/src/Composite.c @@ -48,20 +48,20 @@ XRenderComposite (Display *dpy, RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); GetReq(RenderComposite, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderComposite; - req->op = (CARD8) op; - req->src = src; - req->mask = mask; - req->dst = dst; - req->xSrc = src_x; - req->ySrc = src_y; - req->xMask = mask_x; - req->yMask = mask_y; - req->xDst = dst_x; - req->yDst = dst_y; - req->width = width; - req->height = height; + req->op = (CARD8) op; + req->src = (CARD32) src; + req->mask = (CARD32) mask; + req->dst = (CARD32) dst; + req->xSrc = (INT16) src_x; + req->ySrc = (INT16) src_y; + req->xMask = (INT16) mask_x; + req->yMask = (INT16) mask_y; + req->xDst = (INT16) dst_x; + req->yDst = (INT16) dst_y; + req->width = (CARD16) width; + req->height = (CARD16) height; UnlockDisplay(dpy); SyncHandle(); } diff --git a/src/Cursor.c b/src/Cursor.c index 1d44c80..2efa8ca 100644 --- a/src/Cursor.c +++ b/src/Cursor.c @@ -39,12 +39,12 @@ XRenderCreateCursor (Display *dpy, RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreateCursor, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCreateCursor; - req->cid = cid = XAllocID (dpy); - req->src = source; - req->x = x; - req->y = y; + req->cid = (CARD32) (cid = XAllocID (dpy)); + req->src = (CARD32) source; + req->x = (CARD16) x; + req->y = (CARD16) y; UnlockDisplay(dpy); SyncHandle(); @@ -64,9 +64,9 @@ XRenderCreateAnimCursor (Display *dpy, RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreateAnimCursor, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCreateAnimCursor; - req->cid = cid = XAllocID (dpy); + req->cid = (CARD32) (cid = XAllocID (dpy)); len = (long) ncursor * SIZEOF (xAnimCursorElt) >> 2; SetReqLen (req, len, len); diff --git a/src/FillRect.c b/src/FillRect.c index 04757fe..49a5648 100644 --- a/src/FillRect.c +++ b/src/FillRect.c @@ -67,7 +67,7 @@ XRenderFillRectangle (Display *dpy, dpy->bufptr + SIZEOF(xRectangle) <= dpy->bufmax && (char *)dpy->bufptr - (char *)req < size) { - req->length += SIZEOF(xRectangle) >> 2; + req->length = (CARD16) (req->length + (SIZEOF(xRectangle) >> 2)); #ifndef MUSTCOPY rect = (xRectangle *) dpy->bufptr; dpy->bufptr += SIZEOF(xRectangle); @@ -77,10 +77,10 @@ XRenderFillRectangle (Display *dpy, { GetReqExtra(RenderFillRectangles, SIZEOF(xRectangle), req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderFillRectangles; - req->op = op; - req->dst = dst; + req->op = (CARD8) op; + req->dst = (CARD32) dst; req->color.red = color->red; req->color.green = color->green; req->color.blue = color->blue; @@ -92,10 +92,10 @@ XRenderFillRectangle (Display *dpy, rect = (xRectangle *) NEXTPTR(req,xRenderFillRectanglesReq); #endif /* MUSTCOPY */ } - rect->x = x; - rect->y = y; - rect->width = width; - rect->height = height; + rect->x = (INT16) x; + rect->y = (INT16) y; + rect->width = (CARD16) width; + rect->height = (CARD16) height; #ifdef MUSTCOPY Data (dpy, (char *) rect, len); diff --git a/src/FillRects.c b/src/FillRects.c index 6e026a7..0076f24 100644 --- a/src/FillRects.c +++ b/src/FillRects.c @@ -52,10 +52,10 @@ XRenderFillRectangles (Display *dpy, GetReq(RenderFillRectangles, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderFillRectangles; - req->op = op; - req->dst = dst; + req->op = (CARD8) op; + req->dst = (CARD32) dst; req->color.red = color->red; req->color.green = color->green; req->color.blue = color->blue; @@ -65,7 +65,7 @@ XRenderFillRectangles (Display *dpy, len = ((long)n) << 1; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) >> 1; + n = (int) ((dpy->max_request_size - req->length) >> 1); len = ((long)n) << 1; } SetReqLen(req, len, len); diff --git a/src/Filter.c b/src/Filter.c index 55e7418..7d71b96 100644 --- a/src/Filter.c +++ b/src/Filter.c @@ -52,9 +52,9 @@ XRenderQueryFilters (Display *dpy, Drawable drawable) LockDisplay (dpy); GetReq (RenderQueryFilters, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderQueryFilters; - req->drawable = drawable; + req->drawable = (CARD32) drawable; if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay (dpy); @@ -106,8 +106,8 @@ XRenderQueryFilters (Display *dpy, Drawable drawable) * nbytesName char strings */ - filters->nfilter = rep.numFilters; - filters->nalias = rep.numAliases; + filters->nfilter = (int) rep.numFilters; + filters->nalias = (int) rep.numAliases; filters->filter = (char **) (filters + 1); filters->alias = (short *) (filters->filter + rep.numFilters); name = (char *) (filters->alias + rep.numAliases); @@ -134,14 +134,14 @@ XRenderQueryFilters (Display *dpy, Drawable drawable) SyncHandle (); return NULL; } - nbytesName -= l + 1; + nbytesName -= (unsigned long) (l + 1); filters->filter[i] = name; _XRead (dpy, name, l); - reply_left -= l; + reply_left -= (unsigned long) l; name[l] = '\0'; name += l + 1; } - i = name - (char *) (filters->alias + rep.numAliases); + i = (unsigned) (name - (char *) (filters->alias + rep.numAliases)); if (i & 3) _XEatData (dpy, 4 - (i & 3)); @@ -160,18 +160,18 @@ XRenderSetPictureFilter (Display *dpy, { XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy); xRenderSetPictureFilterReq *req; - int nbytes = strlen (filter); + int nbytes = (int) strlen (filter); RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); GetReq(RenderSetPictureFilter, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderSetPictureFilter; - req->picture = picture; - req->nbytes = nbytes; - req->length += ((nbytes + 3) >> 2) + nparams; + req->picture = (CARD32) picture; + req->nbytes = (CARD16) nbytes; + req->length = (CARD16) (req->length + (((nbytes + 3) >> 2) + nparams)); Data (dpy, filter, nbytes); - Data (dpy, (_Xconst char *)params, nparams << 2); + Data (dpy, (_Xconst char *)params, (nparams << 2)); UnlockDisplay(dpy); SyncHandle(); } diff --git a/src/Glyph.c b/src/Glyph.c index 9e1c2b3..77041a7 100644 --- a/src/Glyph.c +++ b/src/Glyph.c @@ -37,10 +37,10 @@ XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format) RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreateGlyphSet, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCreateGlyphSet; - req->gsid = gsid = XAllocID(dpy); - req->format = format->id; + req->gsid = (CARD32) (gsid = XAllocID(dpy)); + req->format = (CARD32) format->id; UnlockDisplay(dpy); SyncHandle(); return gsid; @@ -56,10 +56,10 @@ XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing) RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderReferenceGlyphSet, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderReferenceGlyphSet; - req->gsid = gsid = XAllocID(dpy); - req->existing = existing; + req->gsid = (CARD32) (gsid = XAllocID(dpy)); + req->existing = (CARD32) existing; UnlockDisplay(dpy); SyncHandle(); return gsid; @@ -74,9 +74,9 @@ XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset) RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); GetReq(RenderFreeGlyphSet, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderFreeGlyphSet; - req->glyphset = glyphset; + req->glyphset = (CARD32) glyphset; UnlockDisplay(dpy); SyncHandle(); } @@ -99,10 +99,10 @@ XRenderAddGlyphs (Display *dpy, RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); GetReq(RenderAddGlyphs, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderAddGlyphs; - req->glyphset = glyphset; - req->nglyphs = nglyphs; + req->glyphset = (CARD32) glyphset; + req->nglyphs = (CARD32) nglyphs; len = (nglyphs * (SIZEOF (xGlyphInfo) + 4) + nbyte_images) >> 2; SetReqLen(req, len, len); Data32 (dpy, (long *) gids, nglyphs * 4); @@ -125,9 +125,9 @@ XRenderFreeGlyphs (Display *dpy, RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); GetReq(RenderFreeGlyphs, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderFreeGlyphs; - req->glyphset = glyphset; + req->glyphset = (CARD32) glyphset; len = nglyphs; SetReqLen(req, len, len); len <<= 2; @@ -163,15 +163,15 @@ XRenderCompositeString8 (Display *dpy, LockDisplay(dpy); GetReq(RenderCompositeGlyphs8, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCompositeGlyphs8; - req->op = op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : None; - req->glyphset = glyphset; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->op = (CARD8) op; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : None); + req->glyphset = (CARD32) glyphset; + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; /* * xGlyphElt must be aligned on a 32-bit boundary; this is @@ -183,7 +183,7 @@ XRenderCompositeString8 (Display *dpy, len = SIZEOF(xGlyphElt) * ((nchar + MAX_8-1) / MAX_8) + nchar; - req->length += (len + 3)>>2; /* convert to number of 32-bit words */ + req->length = (CARD16) (req->length + ((len + 3)>>2)); /* convert to number of 32-bit words */ /* * If the entire request does not fit into the remaining space in the @@ -198,8 +198,8 @@ XRenderCompositeString8 (Display *dpy, nbytes = MAX_8 + SIZEOF(xGlyphElt); BufAlloc (xGlyphElt *, elt, nbytes); elt->len = MAX_8; - elt->deltax = xDst; - elt->deltay = yDst; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; xDst = 0; yDst = 0; memcpy ((char *) (elt + 1), string, MAX_8); @@ -211,10 +211,10 @@ XRenderCompositeString8 (Display *dpy, { nbytes = (nchar + SIZEOF(xGlyphElt) + 3) & ~3; BufAlloc (xGlyphElt *, elt, nbytes); - elt->len = nchar; - elt->deltax = xDst; - elt->deltay = yDst; - memcpy ((char *) (elt + 1), string, nchar); + elt->len = (CARD8) nchar; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; + memcpy ((char *) (elt + 1), string, (size_t) nchar); } #undef MAX_8 @@ -248,21 +248,21 @@ XRenderCompositeString16 (Display *dpy, LockDisplay(dpy); GetReq(RenderCompositeGlyphs16, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCompositeGlyphs16; - req->op = op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : None; - req->glyphset = glyphset; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->op = (CARD8) op; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : None); + req->glyphset = (CARD32) glyphset; + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; #define MAX_16 254 len = SIZEOF(xGlyphElt) * ((nchar + MAX_16-1) / MAX_16) + nchar * 2; - req->length += (len + 3)>>2; /* convert to number of 32-bit words */ + req->length = (CARD16) (req->length + ((len + 3)>>2)); /* convert to number of 32-bit words */ /* * If the entire request does not fit into the remaining space in the @@ -277,8 +277,8 @@ XRenderCompositeString16 (Display *dpy, nbytes = MAX_16 * 2 + SIZEOF(xGlyphElt); BufAlloc (xGlyphElt *, elt, nbytes); elt->len = MAX_16; - elt->deltax = xDst; - elt->deltay = yDst; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; xDst = 0; yDst = 0; memcpy ((char *) (elt + 1), (char *) string, MAX_16 * 2); @@ -290,10 +290,10 @@ XRenderCompositeString16 (Display *dpy, { nbytes = (nchar * 2 + SIZEOF(xGlyphElt) + 3) & ~3; BufAlloc (xGlyphElt *, elt, nbytes); - elt->len = nchar; - elt->deltax = xDst; - elt->deltay = yDst; - memcpy ((char *) (elt + 1), (char *) string, nchar * 2); + elt->len = (CARD8) nchar; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; + memcpy ((char *) (elt + 1), (char *) string, (size_t) (nchar * 2)); } #undef MAX_16 @@ -328,21 +328,21 @@ XRenderCompositeString32 (Display *dpy, LockDisplay(dpy); GetReq(RenderCompositeGlyphs32, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCompositeGlyphs32; - req->op = op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : None; - req->glyphset = glyphset; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->op = (CARD8) op; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : None); + req->glyphset = (CARD32) glyphset; + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; #define MAX_32 254 len = SIZEOF(xGlyphElt) * ((nchar + MAX_32-1) / MAX_32) + nchar * 4; - req->length += (len + 3)>>2; /* convert to number of 32-bit words */ + req->length = (CARD16) (req->length + ((len + 3)>>2)); /* convert to number of 32-bit words */ /* * If the entire request does not fit into the remaining space in the @@ -357,8 +357,8 @@ XRenderCompositeString32 (Display *dpy, nbytes = MAX_32 * 4 + SIZEOF(xGlyphElt); BufAlloc (xGlyphElt *, elt, nbytes); elt->len = MAX_32; - elt->deltax = xDst; - elt->deltay = yDst; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; xDst = 0; yDst = 0; memcpy ((char *) (elt + 1), (char *) string, MAX_32 * 4); @@ -370,10 +370,10 @@ XRenderCompositeString32 (Display *dpy, { nbytes = nchar * 4 + SIZEOF(xGlyphElt); BufAlloc (xGlyphElt *, elt, nbytes); - elt->len = nchar; - elt->deltax = xDst; - elt->deltay = yDst; - memcpy ((char *) (elt + 1), (char *) string, nchar * 4); + elt->len = (CARD8) nchar; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; + memcpy ((char *) (elt + 1), (char *) string, (size_t) (nchar * 4)); } #undef MAX_32 @@ -407,15 +407,15 @@ XRenderCompositeText8 (Display *dpy, LockDisplay(dpy); GetReq(RenderCompositeGlyphs8, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCompositeGlyphs8; - req->op = op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : None; - req->glyphset = elts[0].glyphset; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->op = (CARD8) op; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : None); + req->glyphset = (CARD32) elts[0].glyphset; + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; /* * Compute the space necessary @@ -448,7 +448,7 @@ XRenderCompositeText8 (Display *dpy, len += (elen + 3) >> 2; } - req->length += len; + req->length = (CARD16) (req->length + len); /* * Send the glyphs @@ -481,9 +481,9 @@ XRenderCompositeText8 (Display *dpy, int this_chars = nchars > MAX_8 ? MAX_8 : nchars; BufAlloc (xGlyphElt *, elt, SIZEOF(xGlyphElt)) - elt->len = this_chars; - elt->deltax = xDst; - elt->deltay = yDst; + elt->len = (CARD8) this_chars; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; xDst = 0; yDst = 0; Data (dpy, chars, this_chars); @@ -523,15 +523,15 @@ XRenderCompositeText16 (Display *dpy, LockDisplay(dpy); GetReq(RenderCompositeGlyphs16, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCompositeGlyphs16; - req->op = op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : None; - req->glyphset = elts[0].glyphset; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->op = (CARD8) op; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : None); + req->glyphset = (CARD32) elts[0].glyphset; + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; /* * Compute the space necessary @@ -564,7 +564,7 @@ XRenderCompositeText16 (Display *dpy, len += (elen + 3) >> 2; } - req->length += len; + req->length = (CARD16) (req->length + len); glyphset = elts[0].glyphset; for (i = 0; i < nelt; i++) @@ -595,9 +595,9 @@ XRenderCompositeText16 (Display *dpy, int this_bytes = this_chars * 2; BufAlloc (xGlyphElt *, elt, SIZEOF(xGlyphElt)) - elt->len = this_chars; - elt->deltax = xDst; - elt->deltay = yDst; + elt->len = (CARD8) this_chars; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; xDst = 0; yDst = 0; Data16 (dpy, chars, this_bytes); @@ -638,15 +638,15 @@ XRenderCompositeText32 (Display *dpy, GetReq(RenderCompositeGlyphs32, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCompositeGlyphs32; - req->op = op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : None; - req->glyphset = elts[0].glyphset; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->op = (CARD8) op; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : None); + req->glyphset = (CARD32) elts[0].glyphset; + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; /* * Compute the space necessary @@ -674,7 +674,7 @@ XRenderCompositeText32 (Display *dpy, len += (elen + 3) >> 2; } - req->length += len; + req->length = (CARD16) (req->length + len); glyphset = elts[0].glyphset; for (i = 0; i < nelt; i++) @@ -704,9 +704,9 @@ XRenderCompositeText32 (Display *dpy, int this_chars = nchars > MAX_32 ? MAX_32 : nchars; int this_bytes = this_chars * 4; BufAlloc (xGlyphElt *, elt, SIZEOF(xGlyphElt)) - elt->len = this_chars; - elt->deltax = xDst; - elt->deltay = yDst; + elt->len = (CARD8) this_chars; + elt->deltax = (INT16) xDst; + elt->deltay = (INT16) yDst; xDst = 0; yDst = 0; DataInt32 (dpy, chars, this_bytes); diff --git a/src/Picture.c b/src/Picture.c index 500eef1..a7fff5a 100644 --- a/src/Picture.c +++ b/src/Picture.c @@ -39,33 +39,33 @@ _XRenderProcessPictureAttributes (Display *dpy, unsigned int nvalues; if (valuemask & CPRepeat) - *value++ = attributes->repeat; + *value++ = (unsigned long) attributes->repeat; if (valuemask & CPAlphaMap) *value++ = attributes->alpha_map; if (valuemask & CPAlphaXOrigin) - *value++ = attributes->alpha_x_origin; + *value++ = (unsigned long) attributes->alpha_x_origin; if (valuemask & CPAlphaYOrigin) - *value++ = attributes->alpha_y_origin; + *value++ = (unsigned long) attributes->alpha_y_origin; if (valuemask & CPClipXOrigin) - *value++ = attributes->clip_x_origin; + *value++ = (unsigned long) attributes->clip_x_origin; if (valuemask & CPClipYOrigin) - *value++ = attributes->clip_y_origin; + *value++ = (unsigned long) attributes->clip_y_origin; if (valuemask & CPClipMask) *value++ = attributes->clip_mask; if (valuemask & CPGraphicsExposure) - *value++ = attributes->graphics_exposures; + *value++ = (unsigned long) attributes->graphics_exposures; if (valuemask & CPSubwindowMode) - *value++ = attributes->subwindow_mode; + *value++ = (unsigned long) attributes->subwindow_mode; if (valuemask & CPPolyEdge) - *value++ = attributes->poly_edge; + *value++ = (unsigned long) attributes->poly_edge; if (valuemask & CPPolyMode) - *value++ = attributes->poly_mode; + *value++ = (unsigned long) attributes->poly_mode; if (valuemask & CPDither) *value++ = attributes->dither; if (valuemask & CPComponentAlpha) - *value++ = attributes->component_alpha; + *value++ = (unsigned long) attributes->component_alpha; - req->length += (nvalues = value - values); + req->length += (nvalues = (unsigned) (value - values)); nvalues <<= 2; /* watch out for macros... */ Data32 (dpy, (long *) values, (long)nvalues); @@ -85,12 +85,12 @@ XRenderCreatePicture (Display *dpy, RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreatePicture, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCreatePicture; - req->pid = pid = XAllocID(dpy); - req->drawable = drawable; - req->format = format->id; - if ((req->mask = valuemask)) + req->pid = (CARD32) (pid = XAllocID(dpy)); + req->drawable = (CARD32) drawable; + req->format = (CARD32) format->id; + if ((req->mask = (CARD32) valuemask)) _XRenderProcessPictureAttributes (dpy, (xRenderChangePictureReq *) req, valuemask, @@ -112,10 +112,10 @@ XRenderChangePicture (Display *dpy, RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); GetReq(RenderChangePicture, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderChangePicture; - req->picture = picture; - req->mask = valuemask; + req->picture = (CARD32) picture; + req->mask = (CARD32) valuemask; _XRenderProcessPictureAttributes (dpy, req, valuemask, @@ -137,11 +137,11 @@ _XRenderSetPictureClipRectangles (Display *dpy, long len; GetReq (RenderSetPictureClipRectangles, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderSetPictureClipRectangles; - req->picture = picture; - req->xOrigin = xOrigin; - req->yOrigin = yOrigin; + req->picture = (CARD32) picture; + req->xOrigin = (INT16) xOrigin; + req->yOrigin = (INT16) yOrigin; len = ((long) n) << 1; SetReqLen (req, len, 1); len <<= 2; @@ -177,22 +177,22 @@ XRenderSetPictureClipRegion (Display *dpy, RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); - total = r->numRects * sizeof (XRectangle); + total = (unsigned long) ((size_t) r->numRects * sizeof (XRectangle)); if ((xr = (XRectangle *) _XAllocTemp(dpy, total))) { int i; XRectangle *pr; BOX *pb; - for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) { + for (pr = xr, pb = r->rects, i = (int) r->numRects; --i >= 0; pr++, pb++) { pr->x = pb->x1; pr->y = pb->y1; - pr->width = pb->x2 - pb->x1; - pr->height = pb->y2 - pb->y1; + pr->width = (unsigned short) (pb->x2 - pb->x1); + pr->height = (unsigned short) (pb->y2 - pb->y1); } } if (xr || !r->numRects) _XRenderSetPictureClipRectangles (dpy, info, picture, 0, 0, - xr, r->numRects); + xr, (int) r->numRects); if (xr) _XFreeTemp(dpy, (char *)xr, total); UnlockDisplay(dpy); @@ -210,9 +210,9 @@ XRenderSetPictureTransform (Display *dpy, RenderSimpleCheckExtension (dpy, info); LockDisplay (dpy); GetReq(RenderSetPictureTransform, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderSetPictureTransform; - req->picture = picture; + req->picture = (CARD32) picture; req->transform.matrix11 = transform->matrix[0][0]; req->transform.matrix12 = transform->matrix[0][1]; req->transform.matrix13 = transform->matrix[0][2]; @@ -237,9 +237,9 @@ XRenderFreePicture (Display *dpy, RenderSimpleCheckExtension (dpy, info); LockDisplay(dpy); GetReq(RenderFreePicture, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderFreePicture; - req->picture = picture; + req->picture = (CARD32) picture; UnlockDisplay(dpy); SyncHandle(); } @@ -255,10 +255,10 @@ Picture XRenderCreateSolidFill(Display *dpy, RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreateSolidFill, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCreateSolidFill; - req->pid = pid = XAllocID(dpy); + req->pid = (CARD32) (pid = XAllocID(dpy)); req->color.red = color->red; req->color.green = color->green; req->color.blue = color->blue; @@ -284,16 +284,16 @@ Picture XRenderCreateLinearGradient(Display *dpy, RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreateLinearGradient, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCreateLinearGradient; - req->pid = pid = XAllocID(dpy); + req->pid = (CARD32) (pid = XAllocID(dpy)); req->p1.x = gradient->p1.x; req->p1.y = gradient->p1.y; req->p2.x = gradient->p2.x; req->p2.y = gradient->p2.y; - req->nStops = nStops; + req->nStops = (CARD32) nStops; len = (long) nStops * 3; SetReqLen (req, len, 6); DataInt32(dpy, stops, nStops * 4); @@ -318,10 +318,10 @@ Picture XRenderCreateRadialGradient(Display *dpy, RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreateRadialGradient, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCreateRadialGradient; - req->pid = pid = XAllocID(dpy); + req->pid = (CARD32) (pid = XAllocID(dpy)); req->inner.x = gradient->inner.x; req->inner.y = gradient->inner.y; req->outer.x = gradient->outer.x; @@ -329,7 +329,7 @@ Picture XRenderCreateRadialGradient(Display *dpy, req->inner_radius = gradient->inner.radius; req->outer_radius = gradient->outer.radius; - req->nStops = nStops; + req->nStops = (CARD32) nStops; len = (long) nStops * 3; SetReqLen (req, len, 6); DataInt32(dpy, stops, nStops * 4); @@ -354,15 +354,15 @@ Picture XRenderCreateConicalGradient(Display *dpy, RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreateConicalGradient, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderCreateConicalGradient; - req->pid = pid = XAllocID(dpy); + req->pid = (CARD32) (pid = XAllocID(dpy)); req->center.x = gradient->center.x; req->center.y = gradient->center.y; req->angle = gradient->angle; - req->nStops = nStops; + req->nStops = (CARD32) nStops; len = (long) nStops * 3; SetReqLen (req, len, 6); DataInt32(dpy, stops, nStops * 4); @@ -99,7 +99,7 @@ XRenderComputeTrapezoids (Edge *edges, Edge *e, *en, *next; XFixed y, next_y, intersect; - qsort (edges, nedges, sizeof (Edge), CompareEdge); + qsort (edges, (size_t) nedges, sizeof (Edge), CompareEdge); *ntraps = 0; y = edges[0].edge.p1.y; @@ -249,8 +249,8 @@ XRenderCompositeDoublePoly (Display *dpy, XFixed prevx = 0, prevy = 0, firstx = 0, firsty = 0; XFixed top = 0, bottom = 0; /* GCCism */ - edges = Xmalloc ((npoints * sizeof (Edge)) + - (npoints * npoints * sizeof (XTrapezoid))); + edges = Xmalloc (((size_t) npoints * sizeof (Edge)) + + ((size_t) (npoints * npoints) * sizeof (XTrapezoid))); if (!edges) return; traps = (XTrapezoid *) (edges + npoints); @@ -49,18 +49,18 @@ XRenderCompositeTrapezoids (Display *dpy, unsigned long len; GetReq(RenderTrapezoids, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderTrapezoids; req->op = (CARD8) op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : 0; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : 0); + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; n = ntrap; len = ((unsigned long) n) * (SIZEOF (xTrapezoid) >> 2); if (len > (max_req - req->length)) { - n = (max_req - req->length) / (SIZEOF (xTrapezoid) >> 2); + n = (int) ((max_req - req->length) / (SIZEOF (xTrapezoid) >> 2)); len = ((unsigned long) n) * (SIZEOF (xTrapezoid) >> 2); } SetReqLen (req, len, len); @@ -48,18 +48,18 @@ XRenderCompositeTriangles (Display *dpy, long len; GetReq(RenderTriangles, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderTriangles; req->op = (CARD8) op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : 0; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : 0); + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; n = ntriangle; len = ((long) n) * (SIZEOF (xTriangle) >> 2); if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) / (SIZEOF (xTriangle) >> 2); + n = (int) ((dpy->max_request_size - req->length) / (SIZEOF (xTriangle) >> 2)); len = ((long)n) * (SIZEOF (xTriangle) >> 2); } SetReqLen (req, len, len); @@ -94,18 +94,18 @@ XRenderCompositeTriStrip (Display *dpy, long len; GetReq(RenderTriStrip, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderTriStrip; req->op = (CARD8) op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : 0; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : 0); + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; n = npoint; len = ((long) n) * (SIZEOF (xPointFixed) >> 2); if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) / (SIZEOF (xPointFixed) >> 2); + n = (int) ((dpy->max_request_size - req->length) / (SIZEOF (xPointFixed) >> 2)); len = ((long)n) * (SIZEOF (xPointFixed) >> 2); } SetReqLen (req, len, len); @@ -144,21 +144,21 @@ XRenderCompositeTriFan (Display *dpy, long len; GetReqExtra(RenderTriFan, SIZEOF (xPointFixed), req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderTriFan; req->op = (CARD8) op; - req->src = src; - req->dst = dst; - req->maskFormat = maskFormat ? maskFormat->id : 0; - req->xSrc = xSrc; - req->ySrc = ySrc; + req->src = (CARD32) src; + req->dst = (CARD32) dst; + req->maskFormat = (CARD32) (maskFormat ? maskFormat->id : 0); + req->xSrc = (INT16) xSrc; + req->ySrc = (INT16) ySrc; p = (xPointFixed *) (req + 1); p->x = first->x; p->y = first->y; n = npoint; len = ((long) n) * (SIZEOF (xPointFixed) >> 2); if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) / (SIZEOF (xPointFixed) >> 2); + n = (int) ((dpy->max_request_size - req->length) / (SIZEOF (xPointFixed) >> 2)); len = ((long)n) * (SIZEOF (xPointFixed) >> 2); } SetReqLen (req, len, len); diff --git a/src/Xrender.c b/src/Xrender.c index 5924a5f..11affad 100644 --- a/src/Xrender.c +++ b/src/Xrender.c @@ -161,7 +161,7 @@ XRenderHasDepths (Display *dpy) if ((missing & DEPTH_MASK(d)) && d != 1) { Pixmap p; - p = XCreatePixmap (dpy, RootWindow (dpy, s), 1, 1, d); + p = XCreatePixmap (dpy, RootWindow (dpy, s), 1, 1, (unsigned) d); XFreePixmap (dpy, p); } XSync (dpy, False); @@ -389,8 +389,8 @@ _XRenderVersionHandler (Display *dpy, _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, (SIZEOF(xRenderQueryVersionReply) - SIZEOF(xReply)) >> 2, True); - state->major_version = repl->majorVersion; - state->minor_version = repl->minorVersion; + state->major_version = (int) repl->majorVersion; + state->minor_version = (int) repl->minorVersion; return True; } @@ -427,7 +427,7 @@ XRenderQueryFormats (Display *dpy) return 1; } GetReq (RenderQueryVersion, vreq); - vreq->reqType = info->codes->major_opcode; + vreq->reqType = (CARD8) info->codes->major_opcode; vreq->renderReqType = X_RenderQueryVersion; vreq->majorVersion = RENDER_MAJOR; vreq->minorVersion = RENDER_MINOR; @@ -440,7 +440,7 @@ XRenderQueryFormats (Display *dpy) dpy->async_handlers = &async; GetReq (RenderQueryPictFormats, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderQueryPictFormats; if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) @@ -499,14 +499,14 @@ XRenderQueryFormats (Display *dpy) xri->major_version = async_state.major_version; xri->minor_version = async_state.minor_version; xri->format = (XRenderPictFormat *) (xri + 1); - xri->nformat = rep.numFormats; + xri->nformat = (int) rep.numFormats; xri->screen = (XRenderScreen *) (xri->format + rep.numFormats); - xri->nscreen = rep.numScreens; + xri->nscreen = (int) rep.numScreens; xri->depth = (XRenderDepth *) (xri->screen + rep.numScreens); - xri->ndepth = rep.numDepths; + xri->ndepth = (int) rep.numDepths; xri->visual = (XRenderVisual *) (xri->depth + rep.numDepths); - xri->nvisual = rep.numVisuals; - _XRead (dpy, (char *) xData, rlength); + xri->nvisual = (int) rep.numVisuals; + _XRead (dpy, (char *) xData, (long) rlength); format = xri->format; xFormat = (xPictFormInfo *) xData; for (nf = 0; nf < rep.numFormats; nf++) @@ -514,14 +514,14 @@ XRenderQueryFormats (Display *dpy) format->id = xFormat->id; format->type = xFormat->type; format->depth = xFormat->depth; - format->direct.red = xFormat->direct.red; - format->direct.redMask = xFormat->direct.redMask; - format->direct.green = xFormat->direct.green; - format->direct.greenMask = xFormat->direct.greenMask; - format->direct.blue = xFormat->direct.blue; - format->direct.blueMask = xFormat->direct.blueMask; - format->direct.alpha = xFormat->direct.alpha; - format->direct.alphaMask = xFormat->direct.alphaMask; + format->direct.red = (short) xFormat->direct.red; + format->direct.redMask = (short) xFormat->direct.redMask; + format->direct.green = (short) xFormat->direct.green; + format->direct.greenMask = (short) xFormat->direct.greenMask; + format->direct.blue = (short) xFormat->direct.blue; + format->direct.blueMask = (short) xFormat->direct.blueMask; + format->direct.alpha = (short) xFormat->direct.alpha; + format->direct.alphaMask = (short) xFormat->direct.alphaMask; format->colormap = xFormat->colormap; format++; xFormat++; @@ -533,7 +533,7 @@ XRenderQueryFormats (Display *dpy) for (ns = 0; ns < xri->nscreen; ns++) { screen->depths = depth; - screen->ndepths = xScreen->nDepth; + screen->ndepths = (int) xScreen->nDepth; screen->fallback = _XRenderFindFormat (xri, xScreen->fallback); screen->subpixel = SubPixelUnknown; xPDepth = (xPictDepth *) (xScreen + 1); @@ -545,7 +545,7 @@ XRenderQueryFormats (Display *dpy) SyncHandle (); return 0; } - rep.numDepths -= screen->ndepths; + rep.numDepths -= (CARD32) screen->ndepths; for (nd = 0; nd < screen->ndepths; nd++) { int nv; @@ -562,7 +562,7 @@ XRenderQueryFormats (Display *dpy) SyncHandle (); return 0; } - rep.numVisuals -= depth->nvisuals; + rep.numVisuals -= (CARD32) depth->nvisuals; for (nv = 0; nv < depth->nvisuals; nv++) { visual->visual = _XRenderFindVisual (dpy, xVisual->visual); @@ -580,7 +580,7 @@ XRenderQueryFormats (Display *dpy) screen = xri->screen; for (ns = 0; ns < rep.numSubpixel; ns++) { - screen->subpixel = *xSubpixel; + screen->subpixel = (int) *xSubpixel; xSubpixel++; screen++; } @@ -874,9 +874,9 @@ XRenderQueryPictIndexValues(Display *dpy, LockDisplay (dpy); GetReq (RenderQueryPictIndexValues, req); - req->reqType = info->codes->major_opcode; + req->reqType = (CARD8) info->codes->major_opcode; req->renderReqType = X_RenderQueryPictIndexValues; - req->format = format->id; + req->format = (CARD32) format->id; if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay (dpy); @@ -892,7 +892,7 @@ XRenderQueryPictIndexValues(Display *dpy, /* bytes of actual data in the request */ nread = rep.numIndexValues * SIZEOF (xIndexValue); /* size of array returned to application */ - rlength = rep.numIndexValues * sizeof (XIndexValue); + rlength = (unsigned) ((unsigned long) rep.numIndexValues * sizeof (XIndexValue)); /* allocate returned data */ values = Xmalloc (rlength); @@ -910,7 +910,7 @@ XRenderQueryPictIndexValues(Display *dpy, } /* read the values one at a time and convert */ - *num = rep.numIndexValues; + *num = (int) rep.numIndexValues; for (i = 0; i < rep.numIndexValues; i++) { xIndexValue value; |