Commit 87074622 authored by Ulrich Sibiller's avatar Ulrich Sibiller

compext/Clean.c: fix shadow warnings / scope

Clean.c: In function ‘CleanZImage’: Clean.c:141:23: warning: declaration of ‘j’ shadows a previous local [-Wshadow=local] register int i, j; ^ Clean.c:88:16: note: shadowed declaration is here unsigned int j; ^ Clean.c: In function ‘CopyAndCleanImage’: Clean.c:239:22: warning: declaration of ‘i’ shadows a previous local [-Wshadow=compatible-local] register int i; ^ Clean.c:192:16: note: shadowed declaration is here register int i; ^ Clean.c:324:13: warning: declaration of ‘i’ shadows a previous local [-Wshadow=compatible-local] int i; ^ Clean.c:192:16: note: shadowed declaration is here register int i; ^
parent a94e8258
...@@ -85,7 +85,6 @@ int CleanXYImage(XImage *image) ...@@ -85,7 +85,6 @@ int CleanXYImage(XImage *image)
int CleanZImage(XImage *image) int CleanZImage(XImage *image)
{ {
unsigned int bytesToClean; unsigned int bytesToClean;
unsigned int j;
unsigned int imageLength; unsigned int imageLength;
#ifdef TEST #ifdef TEST
...@@ -105,8 +104,6 @@ int CleanZImage(XImage *image) ...@@ -105,8 +104,6 @@ int CleanZImage(XImage *image)
* as fully transparent. * as fully transparent.
*/ */
register int i;
bytesToClean = image -> bytes_per_line * image -> height; bytesToClean = image -> bytes_per_line * image -> height;
#ifdef DEBUG #ifdef DEBUG
...@@ -118,14 +115,14 @@ int CleanZImage(XImage *image) ...@@ -118,14 +115,14 @@ int CleanZImage(XImage *image)
if (image -> byte_order == LSBFirst) if (image -> byte_order == LSBFirst)
{ {
for (i = 3; i < bytesToClean; i += 4) for (int i = 3; i < bytesToClean; i += 4)
{ {
((unsigned char *) image -> data)[i] = 0x00; ((unsigned char *) image -> data)[i] = 0x00;
} }
} }
else else
{ {
for (i = 0; i < bytesToClean; i += 4) for (int i = 0; i < bytesToClean; i += 4)
{ {
((unsigned char *) image -> data)[i] = 0x00; ((unsigned char *) image -> data)[i] = 0x00;
} }
...@@ -138,14 +135,12 @@ int CleanZImage(XImage *image) ...@@ -138,14 +135,12 @@ int CleanZImage(XImage *image)
case 16: case 16:
case 8: case 8:
{ {
register int i, j;
bytesToClean = image -> bytes_per_line - bytesToClean = image -> bytes_per_line -
((image -> width * image -> bits_per_pixel) >> 3); ((image -> width * image -> bits_per_pixel) >> 3);
for (i = 1; i <= image -> height; i++) for (int i = 1; i <= image -> height; i++)
{ {
for (j = bytesToClean; j > 0; j--) for (int j = bytesToClean; j > 0; j--)
{ {
((unsigned char *) image -> data)[(i * image -> bytes_per_line) - j] = 0x00; ((unsigned char *) image -> data)[(i * image -> bytes_per_line) - j] = 0x00;
} }
...@@ -171,7 +166,7 @@ int CleanZImage(XImage *image) ...@@ -171,7 +166,7 @@ int CleanZImage(XImage *image)
bytesToClean = imageLength % 4; bytesToClean = imageLength % 4;
for (j = 0; j < bytesToClean; j++) for (int j = 0; j < bytesToClean; j++)
{ {
((unsigned char *)image -> data)[(imageLength + j)] = 0x00; ((unsigned char *)image -> data)[(imageLength + j)] = 0x00;
} }
...@@ -189,7 +184,6 @@ int CleanZImage(XImage *image) ...@@ -189,7 +184,6 @@ int CleanZImage(XImage *image)
int CopyAndCleanImage(XImage *src_image, XImage *dst_image) int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
register long data_size; register long data_size;
register int i;
data_size = (src_image -> bytes_per_line * src_image -> height) >> 2; data_size = (src_image -> bytes_per_line * src_image -> height) >> 2;
...@@ -212,7 +206,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -212,7 +206,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
mask = 0x00ffffff; mask = 0x00ffffff;
} }
for (i = 0; i < data_size; i++) for (int i = 0; i < data_size; i++)
{ {
((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i] & mask; ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i] & mask;
} }
...@@ -224,7 +218,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -224,7 +218,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
unsigned int bytes_to_clean; unsigned int bytes_to_clean;
for (i = 0; i < data_size; i++) for (int i = 0; i < data_size; i++)
{ {
((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i]; ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i];
} }
...@@ -236,7 +230,6 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -236,7 +230,6 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
register unsigned int mask = 0xffffffff; register unsigned int mask = 0xffffffff;
register int line_size; register int line_size;
register int i;
line_size = dst_image -> bytes_per_line >> 2; line_size = dst_image -> bytes_per_line >> 2;
...@@ -249,7 +242,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -249,7 +242,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
mask = mask >> (bytes_to_clean << 3); mask = mask >> (bytes_to_clean << 3);
} }
for (i = 0; i < dst_image -> height;) for (int i = 0; i < dst_image -> height;)
{ {
((unsigned char *)dst_image -> data)[(++i * line_size) -1] &= mask; ((unsigned char *)dst_image -> data)[(++i * line_size) -1] &= mask;
} }
...@@ -261,7 +254,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -261,7 +254,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
case 15: case 15:
case 16: case 16:
{ {
for (i = 0; i < data_size; i++) for (int i = 0; i < data_size; i++)
{ {
((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i];
} }
...@@ -270,7 +263,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -270,7 +263,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
int card32_per_line = dst_image -> bytes_per_line >> 2; int card32_per_line = dst_image -> bytes_per_line >> 2;
for (i = 0; i < dst_image -> height;) for (int i = 0; i < dst_image -> height;)
{ {
((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= 0x0000ffff; ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= 0x0000ffff;
} }
...@@ -313,7 +306,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -313,7 +306,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
} }
} }
for (i = 0; i < data_size; i++) for (int i = 0; i < data_size; i++)
{ {
((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i];
} }
...@@ -321,11 +314,10 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -321,11 +314,10 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
if (mask) if (mask)
{ {
int card32_per_line; int card32_per_line;
int i;
card32_per_line = dst_image -> bytes_per_line >> 2; card32_per_line = dst_image -> bytes_per_line >> 2;
for (i = 0; i < dst_image -> height; i++) for (int i = 0; i < dst_image -> height; i++)
{ {
((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= mask; ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= mask;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment