summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-10 10:37:23 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-10 10:37:23 -0700
commitf82c0ee2d491b700bb8ae38dea3cf711e6bfb176 (patch)
treed73bc90af04d54257e6445c0a53edfad6db61d67
parent2325f84273ac846fdfc89f4655c21fd3b89da2bc (diff)
Reduce scope of some variables
No difference seen in elf binary Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--chars.c11
-rw-r--r--header.c9
2 files changed, 7 insertions, 13 deletions
diff --git a/chars.c b/chars.c
index f624f88..d139f80 100644
--- a/chars.c
+++ b/chars.c
@@ -76,7 +76,6 @@ EmitBitmap(FILE *outFile,
unsigned char *data)
{
char *glyphName;
- unsigned int row;
/*-
* format:
@@ -118,7 +117,7 @@ EmitBitmap(FILE *outFile,
* emit the bitmap
*/
fprintf(outFile, "BITMAP\n");
- for (row = 0; row < (charInfo->ascent + charInfo->descent); row++) {
+ for (unsigned row = 0; row < (charInfo->ascent + charInfo->descent); row++) {
unsigned byte;
unsigned bit;
@@ -151,7 +150,6 @@ EmitCharacters(FILE *outFile,
{
FSXCharInfo *extents;
FSXCharInfo *charInfo;
- unsigned int encoding;
FSOffset *offsets;
unsigned char *glyph;
unsigned char *glyphs;
@@ -196,11 +194,10 @@ EmitCharacters(FILE *outFile,
glyph = glyphs;
for (chHigh = firstCharHigh; chHigh <= lastCharHigh; chHigh++) {
for (chLow = firstCharLow; chLow <= lastCharLow; chLow++) {
- int bpr;
+ int bpr = GLWIDTHBYTESPADDED((charInfo->right - charInfo->left),
+ SCANLINE_PAD_BYTES);
+ unsigned int encoding = (chHigh << 8) + chLow;
- bpr = GLWIDTHBYTESPADDED((charInfo->right - charInfo->left),
- SCANLINE_PAD_BYTES);
- encoding = (chHigh << 8) + chLow;
if ((charInfo->width != 0) || (charInfo->right != charInfo->left))
EmitBitmap(outFile, fontHeader, charInfo, encoding, bpr, glyph);
glyph = glyphs +
diff --git a/header.c b/header.c
index 32262f3..45a92a1 100644
--- a/header.c
+++ b/header.c
@@ -72,11 +72,10 @@ FindStringProperty(const char *propName,
{
FSPropOffset *propOffset;
unsigned int length;
- unsigned int i;
propOffset = &propOffsets[0];
length = (unsigned int) strlen(propName);
- for (i = propInfo->num_offsets; i--; propOffset++) {
+ for (unsigned int i = propInfo->num_offsets; i--; propOffset++) {
if (propOffset->type == PropTypeString) {
#ifdef DEBUG
@@ -109,12 +108,11 @@ FindNumberProperty(const char *propName,
unsigned char *propData)
{
FSPropOffset *propOffset;
- unsigned int i;
unsigned int length;
propOffset = &propOffsets[0];
length = (unsigned int) strlen(propName);
- for (i = propInfo->num_offsets; i--; propOffset++) {
+ for (unsigned int i = propInfo->num_offsets; i--; propOffset++) {
if ((propOffset->type == PropTypeSigned) ||
(propOffset->type == PropTypeUnsigned)) {
if ((propOffset->name.length == length) &&
@@ -142,7 +140,6 @@ EmitHeader(FILE *outFile,
unsigned int len;
int type;
char *cp;
- const char **cpp;
unsigned long xResolution;
fprintf(outFile, "STARTFONT 2.1\n");
@@ -156,7 +153,7 @@ EmitHeader(FILE *outFile,
fwrite(cp, 1, len, outFile);
fputc('\n', outFile);
}
- for (cpp = warning; *cpp; cpp++)
+ for (const char **cpp = warning; *cpp; cpp++)
fprintf(outFile, "%s\n", *cpp);
/*