FLIF-hub / FLIF

Free Lossless Image Format
Other
3.72k stars 229 forks source link

-Wsign-compare in image-pam.cpp #564

Open ziemek99 opened 2 years ago

ziemek99 commented 2 years ago
image/image-pam.cpp:90:27: warning: comparison of integer expressions of different signedness: ‘ColorVal’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]
   90 |                 if (pixel > maxval)
      |                     ~~~~~~^~~~~~~~
image/image-pam.cpp:106:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
  106 |                 if (pixel > maxval)
      |                     ~~~~~~^~~~~~~~

Introduced in #532. The first warning is especially problematic because the definition of ColorVal can change depending on build options: https://github.com/FLIF-hub/FLIF/blob/0074d6fd095d27ce81346aa3fbe9bab59105053e/src/image/image.hpp#L36-L40