Skip to content

Resolve compiler warnings to comply with -Werror; tabs to spaces#8

Open
zyphlar wants to merge 1 commit intopixelmatix:masterfrom
zyphlar:master
Open

Resolve compiler warnings to comply with -Werror; tabs to spaces#8
zyphlar wants to merge 1 commit intopixelmatix:masterfrom
zyphlar:master

Conversation

@zyphlar
Copy link

@zyphlar zyphlar commented Oct 3, 2023

When compiling under Ubuntu it fails because warnings about an unused int and unguarded (oddly-indented) else are treated as errors. This fixes that with a few curly braces and commented-out lines, and reduces future indent chaos by moving to spaces for indentation plus a bit of cleanup. (I don't care about spaces or tabs, but the source file was inconsistent/mixed)

Here's the git diff -w:

diff --git a/bdf2c.c b/bdf2c.c
index 2543638..3a7111b 100644
--- a/bdf2c.c
+++ b/bdf2c.c
@@ -232,9 +232,9 @@ void DumpCharacter(FILE * out, unsigned char *bitmap, int fontwidth, int fonthei
         fputc('\t', out);
         for (x = 0; x < fontwidth; x += 8) {
           // if current row is above or below the bitmap, output a blank row
-        if(y < yoffset || y > yoffset + charheight)
+          if(y < yoffset || y > yoffset + charheight) {
             c = 0;
-        else
+          } else {
             c = bitmap[(y - yoffset) * ((fontwidth + 7) / 8) + x / 8];

             //printf("%d = %d\n", y * ((width+7)/8) + x/8, c);
@@ -280,6 +280,7 @@ void DumpCharacter(FILE * out, unsigned char *bitmap, int fontwidth, int fonthei
             }
             fputc(',', out);
           }
+        }
         fputc('\n', out);
     }
 }
@@ -394,7 +395,7 @@ void ReadBdf(FILE * bdf, FILE * out, const char *name)
     char *p;
     int fontboundingbox_width;
     int fontboundingbox_height;
-    int fontboundingbox_xoff;
+    // int fontboundingbox_xoff;
     int fontboundingbox_yoff;
     int chars;
     int i;
@@ -414,7 +415,7 @@ void ReadBdf(FILE * bdf, FILE * out, const char *name)

     fontboundingbox_width = 0;
     fontboundingbox_height = 0;
-    fontboundingbox_xoff = 0;
+    // fontboundingbox_xoff = 0;
     fontboundingbox_yoff = 0;
     chars = 0;
     for (;;) {
@@ -431,7 +432,7 @@ void ReadBdf(FILE * bdf, FILE * out, const char *name)
             p = strtok(NULL, " \t\n\r");
             fontboundingbox_height = atoi(p);
             p = strtok(NULL, " \t\n\r");
-        fontboundingbox_xoff = atoi(p);
+            // fontboundingbox_xoff = atoi(p);
             p = strtok(NULL, " \t\n\r");
             fontboundingbox_yoff = atoi(p);
         } else if (!strcasecmp(s, "CHARS")) {

Copy link

@RobLoach RobLoach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yuppers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants