[trunk] Fix warnings about shadow variables

This commit is contained in:
Mathieu Malaterre 2014-03-10 08:25:08 +00:00
parent b478912910
commit e02ba05034
4 changed files with 22 additions and 21 deletions

View 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;

View 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;

View 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;
}

View 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);
}