Remove some warnings when building
authormayeut <mayeut@users.noreply.github.com>
Sun, 26 Jul 2015 11:41:59 +0000 (13:41 +0200)
committermayeut <mayeut@users.noreply.github.com>
Sun, 26 Jul 2015 11:41:59 +0000 (13:41 +0200)
Update #442

src/bin/jp2/convertpng.c
src/bin/jp2/opj_compress.c

index f962f69627f10bcdd5d218ce65d56f4d2ee9b55b..22d3b67ec6717b539e2c499d689b4b6f3ac8ebc9 100644 (file)
@@ -194,12 +194,12 @@ static void convert_16u32s_C1R(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T
 
 opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
 {
-       png_structp  png;
-       png_infop    info;
+       png_structp  png = NULL;
+       png_infop    info = NULL;
        double gamma;
        int bit_depth, interlace_type,compression_type, filter_type;
        OPJ_UINT32 i;
-       png_uint_32  width, height;
+       png_uint_32  width, height = 0U;
        int color_type;
        FILE *reader = NULL;
        OPJ_BYTE** rows = NULL;
@@ -395,12 +395,14 @@ int imagetopng(opj_image_t * image, const char *write_idf)
        int *red, *green, *blue, *alpha;
        unsigned char *row_buf, *d;
        int has_alpha, width, height, nr_comp, color_type;
-       int adjustR, adjustG, adjustB, adjustA, x, y, fails;
+       int adjustR, adjustG, adjustB, adjustA, x, y;
        int prec, ushift, dshift, is16, force16, force8;
-       unsigned short mask = 0xffff;
+       unsigned short mask;
        png_color_8 sig_bit;
        
-       is16 = force16 = force8 = ushift = dshift = 0; fails = 1;
+       volatile int fails = 1;
+       
+       is16 = force16 = force8 = ushift = dshift = 0;
        prec = (int)image->comps[0].prec;
        nr_comp = (int)image->numcomps;
        
@@ -474,6 +476,7 @@ int imagetopng(opj_image_t * image, const char *write_idf)
         */
        png_set_compression_level(png, Z_BEST_COMPRESSION);
        
+       mask = 0xffff;
        if(prec == 16) mask = 0xffff;
        else
                if(prec == 8) mask = 0x00ff;
index 92e2a1e81343be6b83d87d5faa0d1d70d12f2417..ee473ce3cfd73d0597f14fba9c668fce11d6ecf3 100644 (file)
@@ -601,7 +601,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
             char signo;
             int width,height,bitdepth,ncomp;
             OPJ_UINT32 len;
-            OPJ_BOOL raw_signed;
+            OPJ_BOOL raw_signed = OPJ_FALSE;
             substr2 = strchr(opj_optarg,'@');
             if (substr2 == NULL) {
                 len = (OPJ_UINT32) strlen(opj_optarg);