Skip to content

Commit

Permalink
Fix msvc compiler warnings
Browse files Browse the repository at this point in the history
With all warnings enabled, cl emits a 'C4127: conditional expression is constant'.
Just remove the offending line since uit's dead code and the comment for
it is clear emough.
Also fix a 'C4334' warning implicit 64bit conversion of 32bit shift result.
  • Loading branch information
stinos committed Feb 21, 2018
1 parent 116f5b2 commit 83b5cb1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lodepng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2624,12 +2624,10 @@ static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColo
/*if one of the palette sizes is 0, then we consider it to be the same as the
other: it means that e.g. the palette was not given by the user and should be
considered the same as the palette inside the PNG.*/
if(1/*a->palettesize != 0 && b->palettesize != 0*/) {
if(a->palettesize != b->palettesize) return 0;
for(i = 0; i != a->palettesize * 4; ++i)
{
if(a->palette[i] != b->palette[i]) return 0;
}
if(a->palettesize != b->palettesize) return 0;
for(i = 0; i != a->palettesize * 4; ++i)
{
if(a->palette[i] != b->palette[i]) return 0;
}
return 1;
}
Expand Down Expand Up @@ -3476,7 +3474,7 @@ unsigned lodepng_convert(unsigned char* out, const unsigned char* in,
{
size_t palettesize = mode_out->palettesize;
const unsigned char* palette = mode_out->palette;
size_t palsize = 1u << mode_out->bitdepth;
size_t palsize = size_t( 1u ) << mode_out->bitdepth;
/*if the user specified output palette but did not give the values, assume
they want the values of the input color type (assuming that one is palette).
Note that we never create a new palette ourselves.*/
Expand Down

0 comments on commit 83b5cb1

Please sign in to comment.