]> git.draconx.ca Git - liblbx.git/commitdiff
lbximg: Avoid %zu printf format.
authorNick Bowler <nbowler@draconx.ca>
Wed, 22 Sep 2021 01:32:17 +0000 (21:32 -0400)
committerNick Bowler <nbowler@draconx.ca>
Wed, 22 Sep 2021 01:32:17 +0000 (21:32 -0400)
Some older library implementations don't support %zu conversions.
Since the use in lbximg is entirely pointless, this is just
gratuitious incompatibility.

src/pnm.c

index 5359ac23518e6be165ea12e47d609eaca76bf69f..d70d8b5ceadf63107d5d4e3fb718e854db17b1f1 100644 (file)
--- a/src/pnm.c
+++ b/src/pnm.c
@@ -322,8 +322,7 @@ int img_output_pam(FILE *f, const char *filename,
                    struct lbx_colour *palette)
 {
        bool masked = img_is_masked(mask, width, height);
-       unsigned x, y;
-       size_t depth;
+       unsigned x, y, depth;
 
        if (fprintf_ascii(f, "P7\nWIDTH %u\nHEIGHT %u\n", width, height) < 0)
                goto err;
@@ -331,7 +330,7 @@ int img_output_pam(FILE *f, const char *filename,
        if (palette) {
                depth = masked ? 4 : 3;
 
-               if (fprintf_ascii(f, "DEPTH %zu\nMAXVAL 63\n"
+               if (fprintf_ascii(f, "DEPTH %u\nMAXVAL 63\n"
                                     "TUPLTYPE RGB%s\nENDHDR\n",
                                     depth, masked ? "_ALPHA" : "") < 0)
                        goto err;
@@ -354,7 +353,7 @@ int img_output_pam(FILE *f, const char *filename,
        } else {
                depth = masked ? 2 : 1;
 
-               if (fprintf_ascii(f, "DEPTH %zu\nMAXVAL 255\n"
+               if (fprintf_ascii(f, "DEPTH %u\nMAXVAL 255\n"
                                     "TUPLTYPE GRAYSCALE%s\nENDHDR\n",
                                     depth, masked ? "_ALPHA" : "") < 0)
                        goto err;