ProcRenderAddGlyphs: Convert while loops to for loops where more natural
This commit is contained in:
parent
f3955c0a02
commit
dc8a528cd6
|
@ -1098,6 +1098,7 @@ ProcRenderAddGlyphs (ClientPtr client)
|
||||||
CARD8 *bits;
|
CARD8 *bits;
|
||||||
int size;
|
int size;
|
||||||
int err = BadAlloc;
|
int err = BadAlloc;
|
||||||
|
int i;
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
|
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
|
||||||
glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client,
|
glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client,
|
||||||
|
@ -1131,7 +1132,7 @@ ProcRenderAddGlyphs (ClientPtr client)
|
||||||
gi = (xGlyphInfo *) (gids + nglyphs);
|
gi = (xGlyphInfo *) (gids + nglyphs);
|
||||||
bits = (CARD8 *) (gi + nglyphs);
|
bits = (CARD8 *) (gi + nglyphs);
|
||||||
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
|
remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
|
||||||
while (remain >= 0 && nglyphs)
|
for (i = 0; i < nglyphs; i++)
|
||||||
{
|
{
|
||||||
glyph = AllocateGlyph (gi, glyphSet->fdepth);
|
glyph = AllocateGlyph (gi, glyphSet->fdepth);
|
||||||
if (!glyph)
|
if (!glyph)
|
||||||
|
@ -1155,21 +1156,19 @@ ProcRenderAddGlyphs (ClientPtr client)
|
||||||
gi++;
|
gi++;
|
||||||
gids++;
|
gids++;
|
||||||
glyphs++;
|
glyphs++;
|
||||||
nglyphs--;
|
|
||||||
}
|
}
|
||||||
if (nglyphs || remain)
|
if (remain || i < nglyphs)
|
||||||
{
|
{
|
||||||
err = BadLength;
|
err = BadLength;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
nglyphs = stuff->nglyphs;
|
|
||||||
if (!ResizeGlyphSet (glyphSet, nglyphs))
|
if (!ResizeGlyphSet (glyphSet, nglyphs))
|
||||||
{
|
{
|
||||||
err = BadAlloc;
|
err = BadAlloc;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
glyphs = glyphsBase;
|
glyphs = glyphsBase;
|
||||||
while (nglyphs--) {
|
for (i = 0; i < nglyphs; i++) {
|
||||||
AddGlyph (glyphSet, glyphs->glyph, glyphs->id);
|
AddGlyph (glyphSet, glyphs->glyph, glyphs->id);
|
||||||
glyphs++;
|
glyphs++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue