@@ -174,7 +174,7 @@ ht_undo_impl (
174174 size_t header_sz;
175175 header_sz = read_header (
176176 (uint8_t *) compressed_data, comp_buf_size, cs_to_file_ch);
177- if (decode->channel_count != cs_to_file_ch.size ())
177+ if (static_cast <std:: size_t >( decode->channel_count ) != cs_to_file_ch.size ())
178178 throw std::runtime_error (" Unexpected number of channels" );
179179
180180 for (int cs_i = 0 ; cs_i < decode->channel_count ; cs_i++)
@@ -199,16 +199,13 @@ ht_undo_impl (
199199 cs.read_headers (&infile);
200200
201201 ojph::param_siz siz = cs.access_siz ();
202- ojph::param_nlt nlt = cs.access_nlt ();
203202
204- ojph::ui32 image_width =
205- siz.get_image_extent ().x - siz.get_image_offset ().x ;
206203 ojph::ui32 image_height =
207204 siz.get_image_extent ().y - siz.get_image_offset ().y ;
208205
209206 int bpl = 0 ;
210207 bool is_planar = false ;
211- for (ojph::ui32 c = 0 ; c < decode->channel_count ; c++)
208+ for (ojph::ui32 c = 0 ; c < static_cast <ojph::ui32>( decode->channel_count ) ; c++)
212209 {
213210 bpl +=
214211 decode->channels [c].bytes_per_element * decode->channels [c].width ;
@@ -218,7 +215,7 @@ ht_undo_impl (
218215 }
219216 cs.set_planar (is_planar);
220217
221- assert (decode->chunk .width == image_width );
218+ assert (decode->chunk .width == siz. get_image_extent (). x - siz. get_image_offset (). x );
222219 assert (decode->chunk .height == image_height);
223220 assert (decode->channel_count == siz.get_num_components ());
224221
@@ -230,7 +227,7 @@ ht_undo_impl (
230227 ojph::line_buf* cur_line;
231228 if (cs.is_planar ())
232229 {
233- for (uint32_t c = 0 ; c < decode->channel_count ; c++)
230+ for (uint32_t c = 0 ; c < static_cast < uint32_t >( decode->channel_count ) ; c++)
234231 {
235232 int file_c = cs_to_file_ch[c].file_index ;
236233 assert (
@@ -245,12 +242,12 @@ ht_undo_impl (
245242 y < image_height + decode->chunk .start_y ;
246243 y++)
247244 {
248- for (ojph::ui32 line_c = 0 ; line_c < decode->channel_count ;
245+ for (ojph::ui32 line_c = 0 ; line_c < static_cast <ojph::ui32>( decode->channel_count ) ;
249246 line_c++)
250247 {
251248 if (y % decode->channels [line_c].y_samples != 0 ) continue ;
252249
253- if (line_c == file_c)
250+ if (line_c == static_cast <ojph::ui32>( file_c) )
254251 {
255252 cur_line = cs.pull (next_comp);
256253 assert (next_comp == c);
@@ -260,7 +257,7 @@ ht_undo_impl (
260257 {
261258 int16_t * channel_pixels = (int16_t *) line_pixels;
262259 for (uint32_t p = 0 ;
263- p < decode->channels [file_c].width ;
260+ p < static_cast < uint32_t >( decode->channels [file_c].width ) ;
264261 p++)
265262 {
266263 *channel_pixels++ = cur_line->i32 [p];
@@ -270,7 +267,7 @@ ht_undo_impl (
270267 {
271268 int32_t * channel_pixels = (int32_t *) line_pixels;
272269 for (uint32_t p = 0 ;
273- p < decode->channels [file_c].width ;
270+ p < static_cast < uint32_t >( decode->channels [file_c].width ) ;
274271 p++)
275272 {
276273 *channel_pixels++ = cur_line->i32 [p];
@@ -292,7 +289,7 @@ ht_undo_impl (
292289
293290 for (uint32_t y = 0 ; y < image_height; ++y)
294291 {
295- for (uint32_t c = 0 ; c < decode->channel_count ; c++)
292+ for (uint32_t c = 0 ; c < static_cast < uint32_t >( decode->channel_count ) ; c++)
296293 {
297294 int file_c = cs_to_file_ch[c].file_index ;
298295 cur_line = cs.pull (next_comp);
@@ -301,7 +298,7 @@ ht_undo_impl (
301298 {
302299 int16_t * channel_pixels =
303300 (int16_t *) (line_pixels + cs_to_file_ch[c].raster_line_offset );
304- for (uint32_t p = 0 ; p < decode->channels [file_c].width ;
301+ for (uint32_t p = 0 ; p < static_cast < uint32_t >( decode->channels [file_c].width ) ;
305302 p++)
306303 {
307304 *channel_pixels++ = cur_line->i32 [p];
@@ -311,7 +308,7 @@ ht_undo_impl (
311308 {
312309 int32_t * channel_pixels =
313310 (int32_t *) (line_pixels + cs_to_file_ch[c].raster_line_offset );
314- for (uint32_t p = 0 ; p < decode->channels [file_c].width ;
311+ for (uint32_t p = 0 ; p < static_cast < uint32_t >( decode->channels [file_c].width ) ;
315312 p++)
316313 {
317314 *channel_pixels++ = cur_line->i32 [p];
@@ -371,7 +368,7 @@ ht_apply_impl (exr_encode_pipeline_t* encode)
371368 bool isPlanar = false ;
372369 siz.set_num_components (encode->channel_count );
373370 int bpl = 0 ;
374- for (ojph::ui32 c = 0 ; c < encode->channel_count ; c++)
371+ for (ojph::ui32 c = 0 ; c < static_cast <ojph::ui32>( encode->channel_count ) ; c++)
375372 {
376373 int file_c = cs_to_file_ch[c].file_index ;
377374 if (encode->channels [file_c].data_type != EXR_PIXEL_UINT)
@@ -425,7 +422,7 @@ ht_apply_impl (exr_encode_pipeline_t* encode)
425422
426423 if (cs.is_planar ())
427424 {
428- for (ojph::ui32 c = 0 ; c < encode->channel_count ; c++)
425+ for (ojph::ui32 c = 0 ; c < static_cast <ojph::ui32>( encode->channel_count ) ; c++)
429426 {
430427 if (encode->channels [c].height == 0 ) continue ;
431428
@@ -437,20 +434,20 @@ ht_apply_impl (exr_encode_pipeline_t* encode)
437434 y < image_height + encode->chunk .start_y ;
438435 y++)
439436 {
440- for (ojph::ui32 line_c = 0 ; line_c < encode->channel_count ;
437+ for (ojph::ui32 line_c = 0 ; line_c < static_cast <ojph::ui32>( encode->channel_count ) ;
441438 line_c++)
442439 {
443440
444441 if (y % encode->channels [line_c].y_samples != 0 ) continue ;
445442
446- if (line_c == file_c)
443+ if (line_c == static_cast <ojph::ui32>( file_c) )
447444 {
448445 if (encode->channels [file_c].data_type ==
449446 EXR_PIXEL_HALF)
450447 {
451448 int16_t * channel_pixels = (int16_t *) (line_pixels);
452449 for (uint32_t p = 0 ;
453- p < encode->channels [file_c].width ;
450+ p < static_cast <ojph::ui32>( encode->channels [file_c].width ) ;
454451 p++)
455452 {
456453 cur_line->i32 [p] = *channel_pixels++;
@@ -460,7 +457,7 @@ ht_apply_impl (exr_encode_pipeline_t* encode)
460457 {
461458 int32_t * channel_pixels = (int32_t *) (line_pixels);
462459 for (uint32_t p = 0 ;
463- p < encode->channels [file_c].width ;
460+ p < static_cast <ojph::ui32>( encode->channels [file_c].width ) ;
464461 p++)
465462 {
466463 cur_line->i32 [p] = *channel_pixels++;
@@ -486,15 +483,15 @@ ht_apply_impl (exr_encode_pipeline_t* encode)
486483
487484 for (int y = 0 ; y < image_height; y++)
488485 {
489- for (ojph::ui32 c = 0 ; c < encode->channel_count ; c++)
486+ for (ojph::ui32 c = 0 ; c < static_cast <ojph::ui32>( encode->channel_count ) ; c++)
490487 {
491488 int file_c = cs_to_file_ch[c].file_index ;
492489
493490 if (encode->channels [file_c].data_type == EXR_PIXEL_HALF)
494491 {
495492 int16_t * channel_pixels =
496493 (int16_t *) (line_pixels + cs_to_file_ch[c].raster_line_offset );
497- for (uint32_t p = 0 ; p < encode->channels [file_c].width ;
494+ for (uint32_t p = 0 ; p < static_cast < uint32_t >( encode->channels [file_c].width ) ;
498495 p++)
499496 {
500497 cur_line->i32 [p] = *channel_pixels++;
@@ -504,7 +501,7 @@ ht_apply_impl (exr_encode_pipeline_t* encode)
504501 {
505502 int32_t * channel_pixels =
506503 (int32_t *) (line_pixels + cs_to_file_ch[c].raster_line_offset );
507- for (uint32_t p = 0 ; p < encode->channels [file_c].width ;
504+ for (uint32_t p = 0 ; p < static_cast < uint32_t >( encode->channels [file_c].width ) ;
508505 p++)
509506 {
510507 cur_line->i32 [p] = *channel_pixels++;
0 commit comments