[libpng16] Fixed array size calculations to avoid warnings. At various points

in the code the number of elements in an array is calculated using
sizeof.  This generates a compile time constant of type (size_t) which
is then typically assigned to an (unsigned int) or (int). Some versions
of GCC on 64-bit systems warn about the apparent narrowing, even though
the same compiler does apparently generate the correct, in-range,
numeric constant.  This adds appropriate, safe, casts to make the
warnings go away.
This commit is contained in:
John Bowler
2014-11-05 17:19:36 -06:00
committed by Glenn Randers-Pehrson
parent 6f2c50e7fc
commit 03df189954
5 changed files with 35 additions and 5 deletions

View File

@@ -1329,7 +1329,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
};
chunk_list = chunks_to_ignore;
num_chunks = (sizeof chunks_to_ignore)/5;
num_chunks = (unsigned int)/*SAFE*/(sizeof chunks_to_ignore)/5U;
}
else /* num_chunks_in > 0 */