From ded8aa8c97fc90f0c02f26084d118e683163e4ca Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Thu, 8 Sep 2022 19:05:07 -0400 Subject: amend cppcheck-scope change, fixing c89 build Signed-off-by: Thomas E. Dickey --- src/Color.c | 3 ++- src/Glyph.c | 17 ++++++++++------- src/Poly.c | 4 ++-- src/Xrender.c | 42 +++++++++++++++++++++++++++--------------- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/src/Color.c b/src/Color.c index 9139068..671d60b 100644 --- a/src/Color.c +++ b/src/Color.c @@ -34,13 +34,14 @@ XRenderParseColor(Display *dpy, char *spec, XRenderColor *def) { unsigned short elements[4]; unsigned short *pShort; + int i; spec += 5; /* * Attempt to parse the value portion. */ pShort = elements; - for (int i = 0; i < 4; i++, pShort++, spec++) { + for (i = 0; i < 4; i++, pShort++, spec++) { int n = 0; *pShort = 0; diff --git a/src/Glyph.c b/src/Glyph.c index 8c2a9ea..9e1c2b3 100644 --- a/src/Glyph.c +++ b/src/Glyph.c @@ -30,7 +30,7 @@ GlyphSet XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format) { - XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy); + XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy); GlyphSet gsid; xRenderCreateGlyphSetReq *req; @@ -398,6 +398,7 @@ XRenderCompositeText8 (Display *dpy, xRenderCompositeGlyphs8Req *req; GlyphSet glyphset; long len; + int i; if (!nelt) return; @@ -424,7 +425,7 @@ XRenderCompositeText8 (Display *dpy, #define MAX_8 252 glyphset = elts[0].glyphset; - for (int i = 0; i < nelt; i++) + for (i = 0; i < nelt; i++) { long elen; int nchars; @@ -453,7 +454,7 @@ XRenderCompositeText8 (Display *dpy, * Send the glyphs */ glyphset = elts[0].glyphset; - for (int i = 0; i < nelt; i++) + for (i = 0; i < nelt; i++) { xGlyphElt *elt; _Xconst char *chars; @@ -513,6 +514,7 @@ XRenderCompositeText16 (Display *dpy, xRenderCompositeGlyphs16Req *req; GlyphSet glyphset; long len; + int i; if (!nelt) return; @@ -539,7 +541,7 @@ XRenderCompositeText16 (Display *dpy, #define MAX_16 254 glyphset = elts[0].glyphset; - for (int i = 0; i < nelt; i++) + for (i = 0; i < nelt; i++) { int nchars; long elen; @@ -565,7 +567,7 @@ XRenderCompositeText16 (Display *dpy, req->length += len; glyphset = elts[0].glyphset; - for (int i = 0; i < nelt; i++) + for (i = 0; i < nelt; i++) { xGlyphElt *elt; _Xconst unsigned short *chars; @@ -626,6 +628,7 @@ XRenderCompositeText32 (Display *dpy, xRenderCompositeGlyphs32Req *req; GlyphSet glyphset; long len; + int i; if (!nelt) return; @@ -653,7 +656,7 @@ XRenderCompositeText32 (Display *dpy, #define MAX_32 254 glyphset = elts[0].glyphset; - for (int i = 0; i < nelt; i++) + for (i = 0; i < nelt; i++) { int nchars; long elen; @@ -674,7 +677,7 @@ XRenderCompositeText32 (Display *dpy, req->length += len; glyphset = elts[0].glyphset; - for (int i = 0; i < nelt; i++) + for (i = 0; i < nelt; i++) { xGlyphElt *elt; _Xconst unsigned int *chars; diff --git a/src/Poly.c b/src/Poly.c index b6ae990..1e90973 100644 --- a/src/Poly.c +++ b/src/Poly.c @@ -245,7 +245,7 @@ XRenderCompositeDoublePoly (Display *dpy, { Edge *edges; XTrapezoid *traps; - int nedges, ntraps; + int i, nedges, ntraps; XFixed prevx = 0, prevy = 0, firstx = 0, firsty = 0; XFixed top = 0, bottom = 0; /* GCCism */ @@ -255,7 +255,7 @@ XRenderCompositeDoublePoly (Display *dpy, return; traps = (XTrapezoid *) (edges + npoints); nedges = 0; - for (int i = 0; i <= npoints; i++) + for (i = 0; i <= npoints; i++) { XFixed x, y; diff --git a/src/Xrender.c b/src/Xrender.c index efa29b6..7f302f1 100644 --- a/src/Xrender.c +++ b/src/Xrender.c @@ -97,8 +97,10 @@ XRenderDepthCheckErrorHandler (Display *dpy, XErrorEvent *evt) { if (evt->request_code == X_CreatePixmap && evt->error_code == BadValue) { + DepthCheckPtr d; + _XLockMutex(_Xglobal_lock); - for (DepthCheckPtr d = depthChecks; d; d = d->next) + for (d = depthChecks; d; d = d->next) { if (d->dpy == dpy) { @@ -115,18 +117,21 @@ XRenderDepthCheckErrorHandler (Display *dpy, XErrorEvent *evt) static Bool XRenderHasDepths (Display *dpy) { - for (int s = 0; s < ScreenCount (dpy); s++) + int s; + + for (s = 0; s < ScreenCount (dpy); s++) { CARD32 depths = 0; CARD32 missing; Screen *scr = ScreenOfDisplay (dpy, s); + int d; - for (int d = 0; d < scr->ndepths; d++) + for (d = 0; d < scr->ndepths; d++) depths |= DEPTH_MASK(scr->depths[d].depth); missing = ~depths & REQUIRED_DEPTHS; if (missing) { - DepthCheckRec dc; + DepthCheckRec dc, **dp; XErrorHandler previousHandler; /* @@ -151,7 +156,7 @@ XRenderHasDepths (Display *dpy) /* * Try each missing depth and see if pixmap creation succeeds */ - for (int d = 1; d <= 32; d++) + for (d = 1; d <= 32; d++) /* don't check depth 1 == Xcursor recurses... */ if ((missing & DEPTH_MASK(d)) && d != 1) { @@ -165,7 +170,7 @@ XRenderHasDepths (Display *dpy) * Unhook from the list of depth check records */ _XLockMutex(_Xglobal_lock); - for (DepthCheckRec **dp = &depthChecks; *dp; dp = &(*dp)->next) + for (dp = &depthChecks; *dp; dp = &(*dp)->next) { if (*dp == &dc) { @@ -340,7 +345,9 @@ Status XRenderQueryVersion (Display *dpy, static XRenderPictFormat * _XRenderFindFormat (XRenderInfo *xri, PictFormat format) { - for (int nf = 0; nf < xri->nformat; nf++) + int nf; + + for (nf = 0; nf < xri->nformat; nf++) if (xri->format[nf].id == format) return &xri->format[nf]; return NULL; @@ -407,6 +414,8 @@ XRenderQueryFormats (Display *dpy) xPictVisual *xVisual; CARD32 *xSubpixel; void *xData; + int ns, nd; + unsigned nf; unsigned long rlength; unsigned long nbytes; @@ -500,7 +509,7 @@ XRenderQueryFormats (Display *dpy) _XRead (dpy, (char *) xData, rlength); format = xri->format; xFormat = (xPictFormInfo *) xData; - for (unsigned int nf = 0; nf < rep.numFormats; nf++) + for (nf = 0; nf < rep.numFormats; nf++) { format->id = xFormat->id; format->type = xFormat->type; @@ -521,7 +530,7 @@ XRenderQueryFormats (Display *dpy) screen = xri->screen; depth = xri->depth; visual = xri->visual; - for (int ns = 0; ns < xri->nscreen; ns++) + for (ns = 0; ns < xri->nscreen; ns++) { screen->depths = depth; screen->ndepths = xScreen->nDepth; @@ -537,8 +546,10 @@ XRenderQueryFormats (Display *dpy) return 0; } rep.numDepths -= screen->ndepths; - for (int nd = 0; nd < screen->ndepths; nd++) + for (nd = 0; nd < screen->ndepths; nd++) { + int nv; + depth->depth = xPDepth->depth; depth->nvisuals = xPDepth->nPictVisuals; depth->visuals = visual; @@ -552,7 +563,7 @@ XRenderQueryFormats (Display *dpy) return 0; } rep.numVisuals -= depth->nvisuals; - for (int nv = 0; nv < depth->nvisuals; nv++) + for (nv = 0; nv < depth->nvisuals; nv++) { visual->visual = _XRenderFindVisual (dpy, xVisual->visual); visual->format = _XRenderFindFormat (xri, xVisual->format); @@ -567,7 +578,7 @@ XRenderQueryFormats (Display *dpy) } xSubpixel = (CARD32 *) xScreen; screen = xri->screen; - for (unsigned int ns = 0; ns < rep.numSubpixel; ns++) + for (ns = 0; ns < rep.numSubpixel; ns++) { screen->subpixel = *xSubpixel; xSubpixel++; @@ -644,13 +655,14 @@ XRenderFindFormat (Display *dpy, int count) { XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy); + int nf; XRenderInfo *xri; RenderCheckExtension (dpy, info, NULL); if (!XRenderQueryFormats (dpy)) return NULL; xri = info->info; - for (int nf = 0; nf < xri->nformat; nf++) + for (nf = 0; nf < xri->nformat; nf++) { if (mask & PictFormatID) if (template->id != xri->format[nf].id) @@ -856,7 +868,7 @@ XRenderQueryPictIndexValues(Display *dpy, xRenderQueryPictIndexValuesReq *req; xRenderQueryPictIndexValuesReply rep; XIndexValue *values; - unsigned int nbytes, nread, rlength; + unsigned int nbytes, nread, rlength, i; RenderCheckExtension (dpy, info, NULL); @@ -898,7 +910,7 @@ XRenderQueryPictIndexValues(Display *dpy, /* read the values one at a time and convert */ *num = rep.numIndexValues; - for (unsigned int i = 0; i < rep.numIndexValues; i++) + for (i = 0; i < rep.numIndexValues; i++) { xIndexValue value; -- cgit v1.2.1