Skip to content

Commit 3b88a3a

Browse files
committed
tr_image: make some iterators more local
1 parent 7b745f6 commit 3b88a3a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/engine/renderer/tr_image.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,6 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
850850
const byte *data;
851851
byte *scaledBuffer = nullptr;
852852
int mipWidth, mipHeight, mipLayers, mipSize, blockSize = 0;
853-
int i, c;
854853
const byte *scan;
855854

856855
bool isSRGB = image->bits & IF_SRGB;
@@ -1066,7 +1065,7 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
10661065

10671066
internalFormat = GL_RGB8;
10681067

1069-
c = image->width * image->height;
1068+
int c = image->width * image->height;
10701069

10711070
/* A normalmap may have the heightmap in the alpha channel,
10721071
an opaque alpha channel means no displacement, so we can enable
@@ -1076,7 +1075,7 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
10761075
{
10771076
scan = dataArray[ l ];
10781077

1079-
for ( i = 0; i < c * 4; i += 4 )
1078+
for ( int i = 0; i < c * 4; i += 4 )
10801079
{
10811080
if ( scan[ i + 3 ] != 255 )
10821081
{
@@ -1100,13 +1099,13 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
11001099
bool hasGreen = false;
11011100
bool hasBlue = false;
11021101

1103-
c = image->width * image->height;
1102+
int c = image->width * image->height;
11041103

11051104
for ( int l = 0; l < numLayers; l++ )
11061105
{
11071106
scan = dataArray[ l ];
11081107

1109-
for ( i = 0; i < c * 4; i += 4 )
1108+
for ( int i = 0; i < c * 4; i += 4 )
11101109
{
11111110
if ( scan[ i + 2 ] != 0 )
11121111
{
@@ -1204,7 +1203,7 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
12041203
mipHeight = scaledHeight;
12051204
mipLayers = numLayers;
12061205

1207-
for( i = 0; i < numMips; i++ ) {
1206+
for( int i = 0; i < numMips; i++ ) {
12081207
GL_TexImage3D( GL_TEXTURE_3D, i, internalFormat, scaledWidth, scaledHeight, mipLayers, 0, format, GL_UNSIGNED_BYTE, nullptr, isSRGB );
12091208

12101209
if( mipWidth > 1 ) mipWidth >>= 1;
@@ -1217,7 +1216,7 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
12171216
if( dataArray )
12181217
scaledBuffer = (byte*) ri.Hunk_AllocateTempMemory( sizeof( byte ) * scaledWidth * scaledHeight * 4 );
12191218

1220-
for ( i = 0; i < numLayers; i++ )
1219+
for ( int i = 0; i < numLayers; i++ )
12211220
{
12221221
if( dataArray )
12231222
data = dataArray[ i ];
@@ -1238,7 +1237,7 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
12381237
}
12391238

12401239
if( image->bits & IF_NORMALMAP ) {
1241-
c = scaledWidth * scaledHeight;
1240+
int c = scaledWidth * scaledHeight;
12421241
for ( int j = 0; j < c; j++ )
12431242
{
12441243
vec3_t n;
@@ -1306,7 +1305,7 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
13061305
mipHeight = scaledHeight;
13071306
mipLayers = numLayers;
13081307

1309-
for ( i = 0; i < numMips; i++ )
1308+
for ( int i = 0; i < numMips; i++ )
13101309
{
13111310
mipSize = ((mipWidth + 3) >> 2)
13121311
* ((mipHeight + 3) >> 2) * blockSize;

0 commit comments

Comments
 (0)