Fix 'declaration hides parameter'

This commit is contained in:
twinaphex 2019-07-14 13:15:55 +02:00
parent 31f142ef9c
commit 2e3162cdca

View File

@ -222,7 +222,7 @@ static uint8_t *rtga__tga_load(rtga__context *s,
(void)tga_y_origin;
/* do a tiny bit of precessing */
if ( tga_image_type >= 8 )
if (tga_image_type >= 8)
{
tga_image_type -= 8;
tga_is_RLE = 1;
@ -243,28 +243,29 @@ static uint8_t *rtga__tga_load(rtga__context *s,
return NULL; /* we don't report this as a bad TGA because we don't even know if it's TGA */
/* If paletted, then we will use the number of bits from the palette */
if ( tga_indexed )
if (tga_indexed)
tga_comp = tga_palette_bits / 8;
/* TGA info */
*x = tga_width;
*y = tga_height;
if (comp) *comp = tga_comp;
if (comp)
*comp = tga_comp;
tga_data = (unsigned char*)malloc( (size_t)tga_width * tga_height * tga_comp );
tga_data = (unsigned char*)malloc((size_t)tga_width * tga_height * tga_comp);
if (!tga_data)
return NULL;
/* skip to the data's starting position (offset usually = 0) */
rtga__skip(s, tga_offset );
if ( !tga_indexed && !tga_is_RLE)
if (!tga_indexed && !tga_is_RLE)
{
int i;
for (i=0; i < tga_height; ++i)
{
int y = tga_inverted ? tga_height -i - 1 : i;
uint8_t *tga_row = tga_data + y*tga_width*tga_comp;
int _y = tga_inverted ? (tga_height -i - 1) : i;
uint8_t *tga_row = tga_data + _y * tga_width * tga_comp;
rtga__getn(s, tga_row, tga_width * tga_comp);
}
}
@ -278,12 +279,12 @@ static uint8_t *rtga__tga_load(rtga__context *s,
unsigned char *tga_palette = NULL;
/* Do I need to load a palette? */
if ( tga_indexed)
if (tga_indexed)
{
/* any data to skip? (offset usually = 0) */
rtga__skip(s, tga_palette_start );
/* load the palette */
tga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 );
tga_palette = (unsigned char*)malloc(tga_palette_len * tga_palette_bits / 8);
if (!tga_palette)
{
@ -303,9 +304,9 @@ static uint8_t *rtga__tga_load(rtga__context *s,
for (i=0; i < tga_width * tga_height; ++i)
{
/* if I'm in RLE mode, do I need to get a RLE rtga__pngchunk? */
if ( tga_is_RLE )
if (tga_is_RLE)
{
if ( RLE_count == 0 )
if (RLE_count == 0)
{
/* yep, get the next byte as a RLE command */
int RLE_cmd = rtga__get8(s);
@ -313,21 +314,21 @@ static uint8_t *rtga__tga_load(rtga__context *s,
RLE_repeating = RLE_cmd >> 7;
read_next_pixel = 1;
}
else if ( !RLE_repeating )
else if (!RLE_repeating)
read_next_pixel = 1;
}
else
read_next_pixel = 1;
/* OK, if I need to read a pixel, do it now */
if ( read_next_pixel )
if (read_next_pixel)
{
/* load however much data we did have */
if ( tga_indexed )
if (tga_indexed)
{
/* read in 1 byte, then perform the lookup */
int pal_idx = rtga__get8(s);
if ( pal_idx >= tga_palette_len ) /* invalid index */
if (pal_idx >= tga_palette_len) /* invalid index */
pal_idx = 0;
pal_idx *= tga_bits_per_pixel / 8;
for (j = 0; j*8 < tga_bits_per_pixel; ++j)
@ -353,7 +354,7 @@ static uint8_t *rtga__tga_load(rtga__context *s,
}
/* do I need to invert the image? */
if ( tga_inverted )
if (tga_inverted)
{
for (j = 0; j*2 < tga_height; ++j)
{
@ -372,8 +373,8 @@ static uint8_t *rtga__tga_load(rtga__context *s,
}
/* Clear my palette, if I had one */
if ( tga_palette != NULL )
free( tga_palette );
if (tga_palette)
free(tga_palette);
}
/* swap RGB */