From be5641a45118fcbc77119917dccbd3f79d0c6f4e Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 8 Apr 2025 17:40:10 +0300
Subject: [PATCH] rename local vars 'pixel' to 'pixelvalue' or 'pixels'
Reference issue: https://github.com/libsdl-org/SDL/issues/12749.
---
src/IMG_avif.c | 18 +++++++++---------
src/IMG_bmp.c | 24 ++++++++++++------------
src/IMG_tga.c | 6 +++---
src/IMG_xpm.c | 10 +++++-----
src/stb_image.h | 24 ++++++++++++------------
5 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/src/IMG_avif.c b/src/IMG_avif.c
index b5685a505..27e506d05 100644
--- a/src/IMG_avif.c
+++ b/src/IMG_avif.c
@@ -154,7 +154,7 @@ static bool ReadAVIFHeader(SDL_IOStream *src, Uint8 **header_data, size_t *heade
size = (((Uint64)magic[0] << 24) |
((Uint64)magic[1] << 16) |
- ((Uint64)magic[2] << 8) |
+ ((Uint64)magic[2] << 8) |
((Uint64)magic[3] << 0));
if (size == 1) {
/* 64-bit header size */
@@ -163,13 +163,13 @@ static bool ReadAVIFHeader(SDL_IOStream *src, Uint8 **header_data, size_t *heade
}
read += 8;
- size = (((Uint64)magic[8] << 56) |
- ((Uint64)magic[9] << 48) |
+ size = (((Uint64)magic[8] << 56) |
+ ((Uint64)magic[9] << 48) |
((Uint64)magic[10] << 40) |
((Uint64)magic[11] << 32) |
((Uint64)magic[12] << 24) |
((Uint64)magic[13] << 16) |
- ((Uint64)magic[14] << 8) |
+ ((Uint64)magic[14] << 8) |
((Uint64)magic[15] << 0));
}
@@ -592,12 +592,12 @@ static bool IMG_SaveAVIF_IO_libavif(SDL_Surface *surface, SDL_IOStream *dst, int
while (height--) {
width = image->width;
while (width--) {
- Uint32 pixel = *src++;
+ Uint32 pixelvalue = *src++;
- *dst16++ = (pixel >> 20) & 0x3FF;
- *dst16++ = (pixel >> 10) & 0x3FF;
- *dst16++ = (pixel >> 0) & 0x3FF;
- *dst16++ = expand_alpha[(pixel >> 30) & 0x3];
+ *dst16++ = (pixelvalue >> 20) & 0x3FF;
+ *dst16++ = (pixelvalue >> 10) & 0x3FF;
+ *dst16++ = (pixelvalue >> 0) & 0x3FF;
+ *dst16++ = expand_alpha[(pixelvalue >> 30) & 0x3];
}
src = (Uint32 *)(((Uint8 *)src) + srcskip);
}
diff --git a/src/IMG_bmp.c b/src/IMG_bmp.c
index 49ef7657a..499463961 100644
--- a/src/IMG_bmp.c
+++ b/src/IMG_bmp.c
@@ -352,33 +352,33 @@ static SDL_Surface *LoadICOCUR_IO(SDL_IOStream * src, int type, bool closeio)
case 4:
case 8:
{
- Uint8 pixel = 0;
+ Uint8 pixelvalue = 0;
int shift = (8 - ExpandBMP);
for (i = 0; i < surface->w; ++i) {
if (i % (8 / ExpandBMP) == 0) {
- if (SDL_ReadIO(src, &pixel, 1) != 1) {
+ if (SDL_ReadIO(src, &pixelvalue, 1) != 1) {
goto done;
}
}
- *((Uint32 *) bits + i) = (palette[pixel >> shift]);
- pixel <<= ExpandBMP;
+ *((Uint32 *) bits + i) = (palette[pixelvalue >> shift]);
+ pixelvalue <<= ExpandBMP;
}
}
break;
case 24:
{
- Uint32 pixel;
+ Uint32 pixelvalue;
Uint8 channel;
for (i = 0; i < surface->w; ++i) {
- pixel = 0xFF000000;
+ pixelvalue = 0xFF000000;
for (j = 0; j < 3; ++j) {
/* Load each color channel into pixel */
if (SDL_ReadIO(src, &channel, 1) != 1) {
goto done;
}
- pixel |= (channel << (j * 8));
+ pixelvalue |= (channel << (j * 8));
}
- *((Uint32 *) bits + i) = pixel;
+ *((Uint32 *) bits + i) = pixelvalue;
}
}
break;
@@ -405,18 +405,18 @@ static SDL_Surface *LoadICOCUR_IO(SDL_IOStream * src, int type, bool closeio)
bmpPitch = (biWidth + 7) >> 3;
pad = (((bmpPitch) % 4) ? (4 - ((bmpPitch) % 4)) : 0);
while (bits > (Uint8 *) surface->pixels) {
- Uint8 pixel = 0;
+ Uint8 pixelvalue = 0;
int shift = (8 - ExpandBMP);
bits -= surface->pitch;
for (i = 0; i < surface->w; ++i) {
if (i % (8 / ExpandBMP) == 0) {
- if (SDL_ReadIO(src, &pixel, 1) != 1) {
+ if (SDL_ReadIO(src, &pixelvalue, 1) != 1) {
goto done;
}
}
- *((Uint32 *) bits + i) &= ((pixel >> shift) ? 0 : 0xFFFFFFFF);
- pixel <<= ExpandBMP;
+ *((Uint32 *) bits + i) &= ((pixelvalue >> shift) ? 0 : 0xFFFFFFFF);
+ pixelvalue <<= ExpandBMP;
}
/* Skip padding bytes, ugh */
if (pad) {
diff --git a/src/IMG_tga.c b/src/IMG_tga.c
index 92ace3df6..42c7dcfd0 100644
--- a/src/IMG_tga.c
+++ b/src/IMG_tga.c
@@ -97,7 +97,7 @@ SDL_Surface *IMG_LoadTGA_IO(SDL_IOStream *src)
int i;
int bpp;
int lstep;
- Uint32 pixel;
+ Uint32 pixelvalue;
int count, rep;
if ( !src ) {
@@ -283,7 +283,7 @@ SDL_Surface *IMG_LoadTGA_IO(SDL_IOStream *src)
n = w - x;
rep -= n;
while (n--) {
- SDL_memcpy(dst + x * bpp, &pixel, bpp);
+ SDL_memcpy(dst + x * bpp, &pixelvalue, bpp);
x++;
}
if (x == w)
@@ -295,7 +295,7 @@ SDL_Surface *IMG_LoadTGA_IO(SDL_IOStream *src)
goto error;
}
if (c & 0x80) {
- if (SDL_ReadIO(src, &pixel, bpp) != (size_t)bpp) {
+ if (SDL_ReadIO(src, &pixelvalue, bpp) != (size_t)bpp) {
error = "Error reading TGA data";
goto error;
}
diff --git a/src/IMG_xpm.c b/src/IMG_xpm.c
index 8b67f593d..fe98ce0f3 100644
--- a/src/IMG_xpm.c
+++ b/src/IMG_xpm.c
@@ -1095,7 +1095,7 @@ static SDL_Surface *load_xpm(char **xpm, SDL_IOStream *src, bool force_32bit)
for (;;) {
char nametype;
char *colname;
- Uint32 argb, pixel;
+ Uint32 argb, pixelvalue;
SKIPSPACE(p);
if (!*p) {
@@ -1120,14 +1120,14 @@ static SDL_Surface *load_xpm(char **xpm, SDL_IOStream *src, bool force_32bit)
c->r = (Uint8)(argb >> 16);
c->g = (Uint8)(argb >> 8);
c->b = (Uint8)(argb);
- pixel = index;
+ pixelvalue = index;
if (argb == 0x00000000) {
- SDL_SetSurfaceColorKey(image, true, pixel);
+ SDL_SetSurfaceColorKey(image, true, pixelvalue);
}
} else {
- pixel = argb;
+ pixelvalue = argb;
}
- add_colorhash(colors, nextkey, cpp, pixel);
+ add_colorhash(colors, nextkey, cpp, pixelvalue);
nextkey += cpp;
break;
}
diff --git a/src/stb_image.h b/src/stb_image.h
index 7147a7a1c..cda1aec6c 100644
--- a/src/stb_image.h
+++ b/src/stb_image.h
@@ -6473,26 +6473,26 @@ static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req
if (channelCount >= 4) {
if (ri->bits_per_channel == 16) {
for (i=0; i < w*h; ++i) {
- stbi__uint16 *pixel = (stbi__uint16 *) out + 4*i;
- if (pixel[3] != 0 && pixel[3] != 65535) {
- float a = pixel[3] / 65535.0f;
+ stbi__uint16 *pixels = (stbi__uint16 *) out + 4*i;
+ if (pixels[3] != 0 && pixels[3] != 65535) {
+ float a = pixels[3] / 65535.0f;
float ra = 1.0f / a;
float inv_a = 65535.0f * (1 - ra);
- pixel[0] = (stbi__uint16) (pixel[0]*ra + inv_a);
- pixel[1] = (stbi__uint16) (pixel[1]*ra + inv_a);
- pixel[2] = (stbi__uint16) (pixel[2]*ra + inv_a);
+ pixels[0] = (stbi__uint16) (pixels[0]*ra + inv_a);
+ pixels[1] = (stbi__uint16) (pixels[1]*ra + inv_a);
+ pixels[2] = (stbi__uint16) (pixels[2]*ra + inv_a);
}
}
} else {
for (i=0; i < w*h; ++i) {
- unsigned char *pixel = out + 4*i;
- if (pixel[3] != 0 && pixel[3] != 255) {
- float a = pixel[3] / 255.0f;
+ unsigned char *pixels = out + 4*i;
+ if (pixels[3] != 0 && pixels[3] != 255) {
+ float a = pixels[3] / 255.0f;
float ra = 1.0f / a;
float inv_a = 255.0f * (1 - ra);
- pixel[0] = (unsigned char) (pixel[0]*ra + inv_a);
- pixel[1] = (unsigned char) (pixel[1]*ra + inv_a);
- pixel[2] = (unsigned char) (pixel[2]*ra + inv_a);
+ pixels[0] = (unsigned char) (pixels[0]*ra + inv_a);
+ pixels[1] = (unsigned char) (pixels[1]*ra + inv_a);
+ pixels[2] = (unsigned char) (pixels[2]*ra + inv_a);
}
}
}