diff --git a/src/bin/jp2/convertpng.c b/src/bin/jp2/convertpng.c index f962f696..22d3b67e 100644 --- a/src/bin/jp2/convertpng.c +++ b/src/bin/jp2/convertpng.c @@ -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; diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index 92e2a1e8..ee473ce3 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -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);