summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/AddTrap.c7
-rw-r--r--src/Color.c9
-rw-r--r--src/FillRects.c7
-rw-r--r--src/Glyph.c50
-rw-r--r--src/Picture.c8
-rw-r--r--src/Poly.c8
-rw-r--r--src/Trap.c9
-rw-r--r--src/Tri.c29
-rw-r--r--src/Xrender.c40
9 files changed, 89 insertions, 78 deletions
diff --git a/src/AddTrap.c b/src/AddTrap.c
index 421463d..7e2021e 100644
--- a/src/AddTrap.c
+++ b/src/AddTrap.c
@@ -36,15 +36,16 @@ XRenderAddTraps (Display *dpy,
int ntrap)
{
XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderAddTrapsReq *req;
- int n;
- long len;
unsigned long max_req = dpy->bigreq_size ? dpy->bigreq_size : dpy->max_request_size;
RenderSimpleCheckExtension (dpy, info);
LockDisplay(dpy);
while (ntrap)
{
+ xRenderAddTrapsReq *req;
+ int n;
+ long len;
+
GetReq(RenderAddTraps, req);
req->reqType = info->codes->major_opcode;
req->renderReqType = X_RenderAddTraps;
diff --git a/src/Color.c b/src/Color.c
index 23ef800..9139068 100644
--- a/src/Color.c
+++ b/src/Color.c
@@ -34,18 +34,19 @@ XRenderParseColor(Display *dpy, char *spec, XRenderColor *def)
{
unsigned short elements[4];
unsigned short *pShort;
- int i, n;
- char c;
spec += 5;
/*
* Attempt to parse the value portion.
*/
pShort = elements;
- for (i = 0; i < 4; i++, pShort++, spec++) {
- n = 0;
+ for (int i = 0; i < 4; i++, pShort++, spec++) {
+ int n = 0;
+
*pShort = 0;
while (*spec != '/' && *spec != '\0') {
+ char c;
+
if (++n > 4) {
return 0;
}
diff --git a/src/FillRects.c b/src/FillRects.c
index ec88f4b..6e026a7 100644
--- a/src/FillRects.c
+++ b/src/FillRects.c
@@ -39,16 +39,17 @@ XRenderFillRectangles (Display *dpy,
_Xconst XRectangle *rectangles,
int n_rects)
{
- XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
+ XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
xRenderFillRectanglesReq *req;
- long len;
- int n;
RenderSimpleCheckExtension (dpy, info);
LockDisplay(dpy);
while (n_rects)
{
+ long len;
+ int n;
+
GetReq(RenderFillRectangles, req);
req->reqType = info->codes->major_opcode;
diff --git a/src/Glyph.c b/src/Glyph.c
index 48e40c3..8c2a9ea 100644
--- a/src/Glyph.c
+++ b/src/Glyph.c
@@ -394,15 +394,10 @@ XRenderCompositeText8 (Display *dpy,
_Xconst XGlyphElt8 *elts,
int nelt)
{
- XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
+ XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
xRenderCompositeGlyphs8Req *req;
GlyphSet glyphset;
long len;
- long elen;
- xGlyphElt *elt;
- int i;
- _Xconst char *chars;
- int nchars;
if (!nelt)
return;
@@ -429,8 +424,11 @@ XRenderCompositeText8 (Display *dpy,
#define MAX_8 252
glyphset = elts[0].glyphset;
- for (i = 0; i < nelt; i++)
+ for (int i = 0; i < nelt; i++)
{
+ long elen;
+ int nchars;
+
/*
* Check for glyphset change
*/
@@ -455,8 +453,12 @@ XRenderCompositeText8 (Display *dpy,
* Send the glyphs
*/
glyphset = elts[0].glyphset;
- for (i = 0; i < nelt; i++)
+ for (int i = 0; i < nelt; i++)
{
+ xGlyphElt *elt;
+ _Xconst char *chars;
+ int nchars;
+
/*
* Switch glyphsets
*/
@@ -511,11 +513,6 @@ XRenderCompositeText16 (Display *dpy,
xRenderCompositeGlyphs16Req *req;
GlyphSet glyphset;
long len;
- long elen;
- xGlyphElt *elt;
- int i;
- _Xconst unsigned short *chars;
- int nchars;
if (!nelt)
return;
@@ -542,8 +539,11 @@ XRenderCompositeText16 (Display *dpy,
#define MAX_16 254
glyphset = elts[0].glyphset;
- for (i = 0; i < nelt; i++)
+ for (int i = 0; i < nelt; i++)
{
+ int nchars;
+ long elen;
+
/*
* Check for glyphset change
*/
@@ -565,8 +565,12 @@ XRenderCompositeText16 (Display *dpy,
req->length += len;
glyphset = elts[0].glyphset;
- for (i = 0; i < nelt; i++)
+ for (int i = 0; i < nelt; i++)
{
+ xGlyphElt *elt;
+ _Xconst unsigned short *chars;
+ int nchars;
+
/*
* Switch glyphsets
*/
@@ -622,11 +626,6 @@ XRenderCompositeText32 (Display *dpy,
xRenderCompositeGlyphs32Req *req;
GlyphSet glyphset;
long len;
- long elen;
- xGlyphElt *elt;
- int i;
- _Xconst unsigned int *chars;
- int nchars;
if (!nelt)
return;
@@ -654,8 +653,11 @@ XRenderCompositeText32 (Display *dpy,
#define MAX_32 254
glyphset = elts[0].glyphset;
- for (i = 0; i < nelt; i++)
+ for (int i = 0; i < nelt; i++)
{
+ int nchars;
+ long elen;
+
/*
* Check for glyphset change
*/
@@ -672,8 +674,12 @@ XRenderCompositeText32 (Display *dpy,
req->length += len;
glyphset = elts[0].glyphset;
- for (i = 0; i < nelt; i++)
+ for (int i = 0; i < nelt; i++)
{
+ xGlyphElt *elt;
+ _Xconst unsigned int *chars;
+ int nchars;
+
/*
* Switch glyphsets
*/
diff --git a/src/Picture.c b/src/Picture.c
index d9d6913..500eef1 100644
--- a/src/Picture.c
+++ b/src/Picture.c
@@ -172,15 +172,17 @@ XRenderSetPictureClipRegion (Display *dpy,
Region r)
{
XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
- int i;
- XRectangle *xr, *pr;
- BOX *pb;
+ XRectangle *xr;
unsigned long total;
RenderSimpleCheckExtension (dpy, info);
LockDisplay(dpy);
total = 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++) {
pr->x = pb->x1;
pr->y = pb->y1;
diff --git a/src/Poly.c b/src/Poly.c
index c6be3b0..b6ae990 100644
--- a/src/Poly.c
+++ b/src/Poly.c
@@ -245,8 +245,8 @@ XRenderCompositeDoublePoly (Display *dpy,
{
Edge *edges;
XTrapezoid *traps;
- int i, nedges, ntraps;
- XFixed x, y, prevx = 0, prevy = 0, firstx = 0, firsty = 0;
+ int nedges, ntraps;
+ XFixed prevx = 0, prevy = 0, firstx = 0, firsty = 0;
XFixed top = 0, bottom = 0; /* GCCism */
edges = Xmalloc ((npoints * sizeof (Edge)) +
@@ -255,8 +255,10 @@ XRenderCompositeDoublePoly (Display *dpy,
return;
traps = (XTrapezoid *) (edges + npoints);
nedges = 0;
- for (i = 0; i <= npoints; i++)
+ for (int i = 0; i <= npoints; i++)
{
+ XFixed x, y;
+
if (i == npoints)
{
x = firstx;
diff --git a/src/Trap.c b/src/Trap.c
index 919aaef..636b439 100644
--- a/src/Trap.c
+++ b/src/Trap.c
@@ -37,16 +37,17 @@ XRenderCompositeTrapezoids (Display *dpy,
_Xconst XTrapezoid *traps,
int ntrap)
{
- XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderTrapezoidsReq *req;
- int n;
- long len;
+ XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
unsigned long max_req = dpy->bigreq_size ? dpy->bigreq_size : dpy->max_request_size;
RenderSimpleCheckExtension (dpy, info);
LockDisplay(dpy);
while (ntrap)
{
+ xRenderTrapezoidsReq *req;
+ int n;
+ long len;
+
GetReq(RenderTrapezoids, req);
req->reqType = info->codes->major_opcode;
req->renderReqType = X_RenderTrapezoids;
diff --git a/src/Tri.c b/src/Tri.c
index 155f2ce..6aa8f0c 100644
--- a/src/Tri.c
+++ b/src/Tri.c
@@ -37,15 +37,16 @@ XRenderCompositeTriangles (Display *dpy,
_Xconst XTriangle *triangles,
int ntriangle)
{
- XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderTrianglesReq *req;
- int n;
- long len;
+ XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
RenderSimpleCheckExtension (dpy, info);
LockDisplay(dpy);
while (ntriangle)
{
+ xRenderTrianglesReq *req;
+ int n;
+ long len;
+
GetReq(RenderTriangles, req);
req->reqType = info->codes->major_opcode;
req->renderReqType = X_RenderTriangles;
@@ -82,15 +83,16 @@ XRenderCompositeTriStrip (Display *dpy,
_Xconst XPointFixed *points,
int npoint)
{
- XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderTriStripReq *req;
- int n;
- long len;
+ XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
RenderSimpleCheckExtension (dpy, info);
LockDisplay(dpy);
while (npoint > 2)
{
+ xRenderTriStripReq *req;
+ int n;
+ long len;
+
GetReq(RenderTriStrip, req);
req->reqType = info->codes->major_opcode;
req->renderReqType = X_RenderTriStrip;
@@ -127,12 +129,8 @@ XRenderCompositeTriFan (Display *dpy,
_Xconst XPointFixed *points,
int npoint)
{
- XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
+ XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
_Xconst XPointFixed *first = points;
- xPointFixed *p;
- xRenderTriFanReq *req;
- int n;
- long len;
RenderSimpleCheckExtension (dpy, info);
LockDisplay(dpy);
@@ -140,6 +138,11 @@ XRenderCompositeTriFan (Display *dpy,
npoint--;
while (npoint > 1)
{
+ xRenderTriFanReq *req;
+ xPointFixed *p;
+ int n;
+ long len;
+
GetReqExtra(RenderTriFan, SIZEOF (xPointFixed), req);
req->reqType = info->codes->major_opcode;
req->renderReqType = X_RenderTriFan;
diff --git a/src/Xrender.c b/src/Xrender.c
index 20134a6..a72df5e 100644
--- a/src/Xrender.c
+++ b/src/Xrender.c
@@ -97,15 +97,16 @@ XRenderDepthCheckErrorHandler (Display *dpy, XErrorEvent *evt)
{
if (evt->request_code == X_CreatePixmap && evt->error_code == BadValue)
{
- DepthCheckPtr d;
_XLockMutex(_Xglobal_lock);
- for (d = depthChecks; d; d = d->next)
+ for (DepthCheckPtr d = depthChecks; d; d = d->next)
+ {
if (d->dpy == dpy)
{
if ((long) (evt->serial - d->serial) >= 0)
d->missing |= DEPTH_MASK(evt->resourceid);
break;
}
+ }
_XUnlockMutex (_Xglobal_lock);
}
return 0;
@@ -114,21 +115,18 @@ XRenderDepthCheckErrorHandler (Display *dpy, XErrorEvent *evt)
static Bool
XRenderHasDepths (Display *dpy)
{
- int s;
-
- for (s = 0; s < ScreenCount (dpy); s++)
+ for (int s = 0; s < ScreenCount (dpy); s++)
{
CARD32 depths = 0;
CARD32 missing;
Screen *scr = ScreenOfDisplay (dpy, s);
- int d;
- for (d = 0; d < scr->ndepths; d++)
+ for (int d = 0; d < scr->ndepths; d++)
depths |= DEPTH_MASK(scr->depths[d].depth);
missing = ~depths & REQUIRED_DEPTHS;
if (missing)
{
- DepthCheckRec dc, **dp;
+ DepthCheckRec dc;
XErrorHandler previousHandler;
/*
@@ -153,7 +151,7 @@ XRenderHasDepths (Display *dpy)
/*
* Try each missing depth and see if pixmap creation succeeds
*/
- for (d = 1; d <= 32; d++)
+ for (int d = 1; d <= 32; d++)
/* don't check depth 1 == Xcursor recurses... */
if ((missing & DEPTH_MASK(d)) && d != 1)
{
@@ -167,7 +165,7 @@ XRenderHasDepths (Display *dpy)
* Unhook from the list of depth check records
*/
_XLockMutex(_Xglobal_lock);
- for (dp = &depthChecks; *dp; dp = &(*dp)->next)
+ for (DepthCheckRec **dp = &depthChecks; *dp; dp = &(*dp)->next)
{
if (*dp == &dc)
{
@@ -342,9 +340,7 @@ Status XRenderQueryVersion (Display *dpy,
static XRenderPictFormat *
_XRenderFindFormat (XRenderInfo *xri, PictFormat format)
{
- int nf;
-
- for (nf = 0; nf < xri->nformat; nf++)
+ for (int nf = 0; nf < xri->nformat; nf++)
if (xri->format[nf].id == format)
return &xri->format[nf];
return NULL;
@@ -411,7 +407,6 @@ XRenderQueryFormats (Display *dpy)
xPictVisual *xVisual;
CARD32 *xSubpixel;
void *xData;
- int nf, ns, nd, nv;
unsigned long rlength;
unsigned long nbytes;
@@ -505,7 +500,7 @@ XRenderQueryFormats (Display *dpy)
_XRead (dpy, (char *) xData, rlength);
format = xri->format;
xFormat = (xPictFormInfo *) xData;
- for (nf = 0; nf < rep.numFormats; nf++)
+ for (int nf = 0; nf < rep.numFormats; nf++)
{
format->id = xFormat->id;
format->type = xFormat->type;
@@ -526,7 +521,7 @@ XRenderQueryFormats (Display *dpy)
screen = xri->screen;
depth = xri->depth;
visual = xri->visual;
- for (ns = 0; ns < xri->nscreen; ns++)
+ for (int ns = 0; ns < xri->nscreen; ns++)
{
screen->depths = depth;
screen->ndepths = xScreen->nDepth;
@@ -542,7 +537,7 @@ XRenderQueryFormats (Display *dpy)
return 0;
}
rep.numDepths -= screen->ndepths;
- for (nd = 0; nd < screen->ndepths; nd++)
+ for (int nd = 0; nd < screen->ndepths; nd++)
{
depth->depth = xDepth->depth;
depth->nvisuals = xDepth->nPictVisuals;
@@ -557,7 +552,7 @@ XRenderQueryFormats (Display *dpy)
return 0;
}
rep.numVisuals -= depth->nvisuals;
- for (nv = 0; nv < depth->nvisuals; nv++)
+ for (int nv = 0; nv < depth->nvisuals; nv++)
{
visual->visual = _XRenderFindVisual (dpy, xVisual->visual);
visual->format = _XRenderFindFormat (xri, xVisual->format);
@@ -572,7 +567,7 @@ XRenderQueryFormats (Display *dpy)
}
xSubpixel = (CARD32 *) xScreen;
screen = xri->screen;
- for (ns = 0; ns < rep.numSubpixel; ns++)
+ for (int ns = 0; ns < rep.numSubpixel; ns++)
{
screen->subpixel = *xSubpixel;
xSubpixel++;
@@ -649,14 +644,13 @@ 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 (nf = 0; nf < xri->nformat; nf++)
+ for (int nf = 0; nf < xri->nformat; nf++)
{
if (mask & PictFormatID)
if (template->id != xri->format[nf].id)
@@ -862,7 +856,7 @@ XRenderQueryPictIndexValues(Display *dpy,
xRenderQueryPictIndexValuesReq *req;
xRenderQueryPictIndexValuesReply rep;
XIndexValue *values;
- unsigned int nbytes, nread, rlength, i;
+ unsigned int nbytes, nread, rlength;
RenderCheckExtension (dpy, info, NULL);
@@ -904,7 +898,7 @@ XRenderQueryPictIndexValues(Display *dpy,
/* read the values one at a time and convert */
*num = rep.numIndexValues;
- for(i = 0; i < rep.numIndexValues; i++)
+ for (unsigned int i = 0; i < rep.numIndexValues; i++)
{
xIndexValue value;