Skip to content

Commit 470d9f3

Browse files
codeql/cpp-comparison-with-wider-type (#172)
- fixes codeql cpp/comparison-with-wider-type, types now match in loop condition
1 parent 24607fe commit 470d9f3

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

ctlrender/tiff_file.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ void tiff_read_multiplane(TIFF *t, float scale, ctl::dpx::fb<float> * pixels) {
278278
uint32_t row;
279279
uint32_t orientation_offset;
280280
uint16_t d;
281+
uint32_t e;
281282

282283
TIFFGetFieldDefaulted(t, TIFFTAG_IMAGEWIDTH, &w);
283284
TIFFGetFieldDefaulted(t, TIFFTAG_IMAGELENGTH, &h);
@@ -300,8 +301,8 @@ void tiff_read_multiplane(TIFF *t, float scale, ctl::dpx::fb<float> * pixels) {
300301
for(row=0; row<4; row++) {
301302
if(row<samples_per_pixel) {
302303
scanline_buffer_uint8[row]=(uint8_t *)alloca(scanline_size);
303-
for(d=0; d<w; d++) {
304-
scanline_buffer_uint8[row][d]= row==3 ? 255 : 0;
304+
for(e=0; e<w; e++) {
305+
scanline_buffer_uint8[row][e]= row==3 ? 255 : 0;
305306
}
306307
} else {
307308
scanline_buffer_uint8[row]=NULL;
@@ -330,8 +331,8 @@ void tiff_read_multiplane(TIFF *t, float scale, ctl::dpx::fb<float> * pixels) {
330331
for(row=0; row<4; row++) {
331332
if(row<samples_per_pixel) {
332333
scanline_buffer_uint16[row]=(uint16_t *)alloca(scanline_size);
333-
for(d=0; d<w; d++) {
334-
scanline_buffer_uint16[row][d]= row==3 ? 65535 : 0;
334+
for(e=0; e<w; e++) {
335+
scanline_buffer_uint16[row][e]= row==3 ? 65535 : 0;
335336
}
336337
} else {
337338
scanline_buffer_uint16[row]=NULL;
@@ -358,8 +359,8 @@ void tiff_read_multiplane(TIFF *t, float scale, ctl::dpx::fb<float> * pixels) {
358359
for(row=0; row<4; row++) {
359360
if(row<samples_per_pixel) {
360361
scanline_buffer_float[row]=(float *)alloca(scanline_size);
361-
for(d=0; d<w; d++) {
362-
scanline_buffer_float[row][d]= row==3 ? 1.0 : 0.0;
362+
for(e=0; e<w; e++) {
363+
scanline_buffer_float[row][e]= row==3 ? 1.0 : 0.0;
363364
}
364365
} else {
365366
scanline_buffer_float[row]=NULL;

ctlrender/transform.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ void transform(const char *inputFile, const char *outputFile,
699699
ctl_operation_t ctl_operation;
700700
CTLParameters::const_iterator parameters_iter;
701701
uint8_t i;
702+
uint32_t j;
702703
std::string error;
703704
ctl::dpx::fb<float> image_buffer;
704705

@@ -807,11 +808,11 @@ void transform(const char *inputFile, const char *outputFile,
807808

808809
char name[16];
809810

810-
for (i = 4; i < image_buffer.depth(); i++)
811+
for (j = 4; j < image_buffer.depth(); j++)
811812
{
812813
memset(name, 0, sizeof(name));
813-
snprintf(name, sizeof(name) - 1, "c%02dIn", i);
814-
ctl_results.push_back(mkresult(name, NULL, image_buffer, i));
814+
snprintf(name, sizeof(name) - 1, "c%02dIn", j);
815+
ctl_results.push_back(mkresult(name, NULL, image_buffer, j));
815816
}
816817

817818
for (operations_iter = ctl_operations.begin(); operations_iter != ctl_operations.end(); operations_iter++)

lib/dpx/dpx_rw.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ void rwinfo::write_init(std::ostream *o, dpx *h) {
268268
}
269269

270270
void rwinfo::find_home(dpx *h, uint8_t element, uint64_t size) {
271-
uint8_t i;
271+
uint16_t i;
272272
rwinfo info;
273273
uint64_t eof;
274274
uint64_t actual_eof;

0 commit comments

Comments
 (0)