summaryrefslogtreecommitdiff
path: root/bitmap.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-16 14:34:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-16 15:14:22 -0700
commit6d526c90729d1b66da6c2546ad3ae794ff0f7751 (patch)
treed8e839a7aa03dad62a845fbf936e0d9d1491d09f /bitmap.c
parent548998994665241967a43e583f5d0f00ee089289 (diff)
Variable scope reductions as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/bitmap.c b/bitmap.c
index 4b2bf3c..5073782 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -49,7 +49,6 @@ bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
CharInfoPtr *glyphsBase;
register unsigned int c;
register CharInfoPtr pci;
- unsigned int r;
CharInfoPtr **encoding;
CharInfoPtr pDefault;
@@ -115,6 +114,8 @@ bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
firstRow = pFont->info.firstRow;
numRows = pFont->info.lastRow - firstRow + 1;
while (count--) {
+ unsigned int r;
+
r = (*chars++) - firstRow;
c = (*chars++) - firstCol;
if (r < numRows && c < numCols &&
@@ -138,23 +139,19 @@ bitmapGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars,
xCharInfo ** glyphs) /* RETURN */
{
int ret;
- xCharInfo *ink_metrics;
- CharInfoPtr metrics;
- BitmapFontPtr bitmapFont;
- CharInfoPtr oldDefault;
- int i;
+ BitmapFontPtr bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
+ CharInfoPtr oldDefault = bitmapFont->pDefault;
- bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- oldDefault = bitmapFont->pDefault;
bitmapFont->pDefault = &nonExistantChar;
ret =
bitmapGetGlyphs(pFont, count, chars, charEncoding, glyphCount,
(CharInfoPtr *) glyphs);
if (ret == Successful) {
if (bitmapFont->ink_metrics) {
- metrics = bitmapFont->metrics;
- ink_metrics = bitmapFont->ink_metrics;
- for (i = 0; i < *glyphCount; i++) {
+ CharInfoPtr metrics = bitmapFont->metrics;
+ xCharInfo *ink_metrics = bitmapFont->ink_metrics;
+
+ for (int i = 0; i < *glyphCount; i++) {
if (glyphs[i] != (xCharInfo *) & nonExistantChar)
glyphs[i] =
ink_metrics + (((CharInfoPtr) glyphs[i]) - metrics);