changeset 14:b0b1d299aa5d

Don't use C99 style declarations here for no reason.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 13 Dec 2016 12:10:47 +0200
parents df9f2fee4285
children 29527d65b71a
files bpgenc.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/bpgenc.c	Tue Dec 13 10:50:18 2016 +0200
+++ b/bpgenc.c	Tue Dec 13 12:10:47 2016 +0200
@@ -953,10 +953,10 @@
     BPGImageFormatEnum img_format;
     uint8_t *buf = NULL, *tmp_buf = NULL;
     uint32_t img_width, img_height, tmp_len;
-    int img_alpha, err_spp = 0;
-    size_t img_linesize;
     uint16_t img_depth, img_spp, img_pconfig, img_pmetric,
         *buf2 = NULL, *img_colormap_r, *img_colormap_g, *img_colormap_b;
+    int img_alpha, err_spp, offs, x, y, idx;
+    size_t img_linesize;
     ColorConvertState cvt;
     RGBConvertFunc *convert_func;
 
@@ -980,6 +980,7 @@
     TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img_pmetric);
 
     // Check basics
+    err_spp = 0;
     switch (img_pmetric)
     {
         case PHOTOMETRIC_MINISBLACK:
@@ -1064,10 +1065,10 @@
 
     convert_init(&cvt, img_depth, out_bit_depth, color_space, limited_range);
 
-    int idx = img_depth == 16;
+    idx = img_depth == 16;
     convert_func = rgb_to_cs[idx][color_space];
 
-    for (int y = 0; y < img->h; y++)
+    for (y = 0; y < img->h; y++)
     {
         // Read TIFF image to raster
         if (!TIFFReadScanline(tif, buf, y, 0))
@@ -1077,7 +1078,7 @@
         switch (img_pmetric)
         {
             case PHOTOMETRIC_PALETTE:
-                for (int x = 0, offs = 0; x < img->w; x++)
+                for (x = 0, offs = 0; x < img->w; x++)
                 {
                     buf2[offs++] = img_colormap_r[buf[x]];
                     buf2[offs++] = img_colormap_g[buf[x]];