[trunk] Fix warnings about shadow variables
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 10 Mar 2014 08:25:08 +0000 (08:25 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 10 Mar 2014 08:25:08 +0000 (08:25 +0000)
src/bin/jp2/convert.c
src/bin/jp2/opj_compress.c
src/lib/openjpip/jp2k_encoder.c
tests/compare_images.c

index 1e578c077c34990ffad3c016216d7b3381aff14c..72babbaad903db8f619df89edc52cfda0e31161b 100644 (file)
@@ -573,7 +573,8 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
     unsigned char *table_R, *table_G, *table_B;
     unsigned int j, PAD = 0;
 
-    int x, y, index;
+    unsigned int x, y;
+    int index;
     int gray_scale = 1;
     int has_color;
     DWORD W, H;
@@ -732,10 +733,10 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
 
         index = 0;
 
-        for(y = 0; y < (int)H; y++)
+        for(y = 0; y < H; y++)
         {
             unsigned char *scanline = RGB + (3 * (unsigned int)W + PAD) * ((unsigned int)H - 1 - (unsigned int)y);
-            for(x = 0; x < (int)W; x++)
+            for(x = 0; x < W; x++)
             {
                 unsigned char *pixel = &scanline[3 * x];
                 image->comps[0].data[index] = pixel[2];        /* R */
@@ -862,8 +863,8 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
             {
                 unsigned char *pix, *beyond;
                 int *gray, *red, *green, *blue;
-                unsigned int x, y, max;
-                int i, c, c1;
+                unsigned int max;
+                int c, c1;
                 unsigned char uc;
 
                 if (Info_h.biClrUsed == 0)
@@ -3126,15 +3127,15 @@ static int imagetoraw_common(opj_image_t * image, const char *outfile, OPJ_BOOL
         {
             if(image->comps[compno].sgnd == 1)
             {
-                union { signed short val; signed char vals[2]; } uc;
+                union { signed short val; signed char vals[2]; } uc16;
                 mask = (1 << image->comps[compno].prec) - 1;
                 ptr = image->comps[compno].data;
                 for (line = 0; line < h; line++) {
                     for(row = 0; row < w; row++)       {
                         curr = *ptr;
                         if(curr > 32767 ) curr = 32767; else if( curr < -32768) curr = -32768;
-                        uc.val = (signed short)(curr & mask);
-                        res = fwrite(uc.vals, 1, 2, rawFile);
+                        uc16.val = (signed short)(curr & mask);
+                        res = fwrite(uc16.vals, 1, 2, rawFile);
                         if( res < 2 ) {
                             fprintf(stderr, "failed to write 2 byte for %s\n", outfile);
                             goto fin;
@@ -3145,15 +3146,15 @@ static int imagetoraw_common(opj_image_t * image, const char *outfile, OPJ_BOOL
             }
             else if(image->comps[compno].sgnd == 0)
             {
-                union { unsigned short val; unsigned char vals[2]; } uc;
+                union { unsigned short val; unsigned char vals[2]; } uc16;
                 mask = (1 << image->comps[compno].prec) - 1;
                 ptr = image->comps[compno].data;
                 for (line = 0; line < h; line++) {
                     for(row = 0; row < w; row++)       {
                         curr = *ptr;
                         if(curr > 65536 ) curr = 65536; else if( curr < 0) curr = 0;
-                        uc.val = (unsigned short)(curr & mask);
-                        res = fwrite(uc.vals, 1, 2, rawFile);
+                        uc16.val = (unsigned short)(curr & mask);
+                        res = fwrite(uc16.vals, 1, 2, rawFile);
                         if( res < 2 ) {
                             fprintf(stderr, "failed to write 2 byte for %s\n", outfile);
                             goto fin;
index e42e88df0b9ac4696588248dffb34fb51ae7d4e5..ffb76349782207a2a2b2d64870b21d26a3d86e1c 100644 (file)
@@ -935,7 +935,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
             float *lCurrentDoublePtr;
             float *lSpace;
             int *l_int_ptr;
-            int lNbComp = 0, lTotalComp, lMctComp, i;
+            int lNbComp = 0, lTotalComp, lMctComp, i2;
             size_t lStrLen, lStrFread;
 
             /* Open file */
@@ -972,14 +972,14 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
             lTotalComp = lMctComp + lNbComp;
             lSpace = (float *) malloc((size_t)lTotalComp * sizeof(float));
             lCurrentDoublePtr = lSpace;
-            for (i=0;i<lMctComp;++i) {
+            for (i2=0;i2<lMctComp;++i2) {
                 lStrLen = strlen(lCurrentPtr) + 1;
                 *lCurrentDoublePtr++ = (float) atof(lCurrentPtr);
                 lCurrentPtr += lStrLen;
             }
 
             l_int_ptr = (int*) lCurrentDoublePtr;
-            for (i=0;i<lNbComp;++i) {
+            for (i2=0;i2<lNbComp;++i2) {
                 lStrLen = strlen(lCurrentPtr) + 1;
                 *l_int_ptr++ = atoi(lCurrentPtr);
                 lCurrentPtr += lStrLen;
index a80b037f63e2895bece02222e30ab78e944ffed7..f73a1f5a2475f7bdfb7f175e4f9bbb9d00f52066 100644 (file)
@@ -608,14 +608,14 @@ Byte8_t comp_seqID( Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD
   return seqID;
 }
 
-Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, OPJ_BOOL isJPPstream)
+Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, OPJ_BOOL isjppstream)
 {
   Byte8_t last_tileID = 0;
   message_param_t *msg;
   
   msg = msgqueue->first;
   while( msg){
-    if( isJPPstream){
+    if( isjppstream){
       if((msg->class_id == TILE_HEADER_MSG) && msg->csn == csn && last_tileID < msg->in_class_id)
        last_tileID = msg->in_class_id;
     }
index fba897107615639054223db04fa1ae28d0305f35..5dfd69d16debcb084948863165fcfd091da94309 100644 (file)
@@ -729,14 +729,14 @@ int main(int argc, char **argv)
 
   if ( (inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL))
     {
-    int it_comp;
+    int it_comp2;
     printf(" MSE values = [");
-    for (it_comp = 0; it_comp < inParam.nbcomp; it_comp++)
-      printf(" %f ", inParam.tabMSEvalues[it_comp]);
+    for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++)
+      printf(" %f ", inParam.tabMSEvalues[it_comp2]);
     printf("]\n");
     printf(" PEAK values = [");
-    for (it_comp = 0; it_comp < inParam.nbcomp; it_comp++)
-      printf(" %f ", inParam.tabPEAKvalues[it_comp]);
+    for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++)
+      printf(" %f ", inParam.tabPEAKvalues[it_comp2]);
     printf("]\n");
     printf(" Non-regression test = %d\n", inParam.nr_flag);
     }