summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2014-03-10 08:25:08 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2014-03-10 08:25:08 +0000
commite02ba05034de2d4bfb68419b0e4819441f9166e7 (patch)
treee3b5dba6617d256c6461cd7a27546913169fed0c /src
parentb4789129102adc8f0fbfe9c22230c196ecd39c03 (diff)
[trunk] Fix warnings about shadow variables
Diffstat (limited to 'src')
-rw-r--r--src/bin/jp2/convert.c23
-rw-r--r--src/bin/jp2/opj_compress.c6
-rw-r--r--src/lib/openjpip/jp2k_encoder.c4
3 files changed, 17 insertions, 16 deletions
diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c
index 1e578c07..72babbaa 100644
--- a/src/bin/jp2/convert.c
+++ b/src/bin/jp2/convert.c
@@ -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;
diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c
index e42e88df..ffb76349 100644
--- a/src/bin/jp2/opj_compress.c
+++ b/src/bin/jp2/opj_compress.c
@@ -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;
diff --git a/src/lib/openjpip/jp2k_encoder.c b/src/lib/openjpip/jp2k_encoder.c
index a80b037f..f73a1f5a 100644
--- a/src/lib/openjpip/jp2k_encoder.c
+++ b/src/lib/openjpip/jp2k_encoder.c
@@ -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;
}