diff options
author | Carl Worth <cworth@cworth.org> | 2007-07-25 14:57:13 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2007-08-02 22:49:56 -0700 |
commit | dc8a528cd6b9a4da3e60fa31428c37f5b34a897f (patch) | |
tree | 042d0f806aa5c0f1ca3569012ad05c9210e78871 /render | |
parent | f3955c0a020b39021050cd33c20a17f14fc4b579 (diff) |
ProcRenderAddGlyphs: Convert while loops to for loops where more natural
Diffstat (limited to 'render')
-rw-r--r-- | render/render.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/render/render.c b/render/render.c index caaa2781c..d311fb383 100644 --- a/render/render.c +++ b/render/render.c @@ -1098,6 +1098,7 @@ ProcRenderAddGlyphs (ClientPtr client) CARD8 *bits; int size; int err = BadAlloc; + int i; REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, @@ -1131,7 +1132,7 @@ ProcRenderAddGlyphs (ClientPtr client) gi = (xGlyphInfo *) (gids + nglyphs); bits = (CARD8 *) (gi + nglyphs); remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs; - while (remain >= 0 && nglyphs) + for (i = 0; i < nglyphs; i++) { glyph = AllocateGlyph (gi, glyphSet->fdepth); if (!glyph) @@ -1155,21 +1156,19 @@ ProcRenderAddGlyphs (ClientPtr client) gi++; gids++; glyphs++; - nglyphs--; } - if (nglyphs || remain) + if (remain || i < nglyphs) { err = BadLength; goto bail; } - nglyphs = stuff->nglyphs; if (!ResizeGlyphSet (glyphSet, nglyphs)) { err = BadAlloc; goto bail; } glyphs = glyphsBase; - while (nglyphs--) { + for (i = 0; i < nglyphs; i++) { AddGlyph (glyphSet, glyphs->glyph, glyphs->id); glyphs++; } |