diff options
Diffstat (limited to 'src/3rdparty/libpng/pngrutil.c')
-rw-r--r-- | src/3rdparty/libpng/pngrutil.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/3rdparty/libpng/pngrutil.c b/src/3rdparty/libpng/pngrutil.c index 07e46e2..9b0ff3e 100644 --- a/src/3rdparty/libpng/pngrutil.c +++ b/src/3rdparty/libpng/pngrutil.c @@ -16,6 +16,7 @@ #include "pngpriv.h" +namespace PrivatePng { #ifdef PNG_READ_SUPPORTED #define png_strtod(p,a,b) strtod(a,b) @@ -458,7 +459,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, { /* Success (maybe) - really uncompress the chunk. */ png_size_t new_size = 0; - png_charp text = png_malloc_warn(png_ptr, + png_charp text = (png_charp) png_malloc_warn(png_ptr, prefix_size + expanded_size + 1); if (text != NULL) @@ -501,7 +502,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, * amount of compressed data. */ { - png_charp text = png_malloc_warn(png_ptr, prefix_size + 1); + png_charp text = (png_charp) png_malloc_warn(png_ptr, prefix_size + 1); if (text != NULL) { @@ -1037,12 +1038,14 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) */ png_uint_32 w = y_red + y_green + y_blue; - png_ptr->rgb_to_gray_red_coeff = (png_uint_16)(((png_uint_32)y_red * - 32768)/w); - png_ptr->rgb_to_gray_green_coeff = (png_uint_16)(((png_uint_32)y_green - * 32768)/w); - png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(((png_uint_32)y_blue * - 32768)/w); + if (w != 0) { + png_ptr->rgb_to_gray_red_coeff = (png_uint_16)(((png_uint_32)y_red * + 32768)/w); + png_ptr->rgb_to_gray_green_coeff = (png_uint_16)(((png_uint_32)y_green + * 32768)/w); + png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(((png_uint_32)y_blue * + 32768)/w); + } } } #endif @@ -3664,3 +3667,4 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) png_ptr->flags |= PNG_FLAG_ROW_INIT; } #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng |