Imported from libpng-1.4.0beta40.tar
diff --git a/png.c b/png.c index 83bff04..3cadc7f 100644 --- a/png.c +++ b/png.c
@@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.4.0 [November 23, 2008] + * Last changed in libpng 1.4.0 [November 25, 2008] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -13,7 +13,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_4_0beta39 Your_png_h_is_not_version_1_4_0beta39; +typedef version_1_4_0beta40 Your_png_h_is_not_version_1_4_0beta40; /* Version information for C files. This had better match the version * string defined in png.h. */ @@ -641,13 +641,13 @@ #else #ifdef __STDC__ return ((png_charp) PNG_STRING_NEWLINE \ - "libpng version x 1.4.0beta39 - November 23, 2008" PNG_STRING_NEWLINE \ + "libpng version x 1.4.0beta40 - November 25, 2008" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2008 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE); #else - return ((png_charp) "libpng version 1.4.0beta39 - November 23, 2008\ + return ((png_charp) "libpng version 1.4.0beta40 - November 25, 2008\ Copyright (c) 1998-2008 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); @@ -745,76 +745,9 @@ } #endif /* PNG_SIZE_T */ -/* Added at libpng version 1.4.0 (moved from pngset.c) */ +/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */ #if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -int /* private */ -png_check_cHRM(png_structp png_ptr, - double white_x, double white_y, double red_x, double red_y, - double green_x, double green_y, double blue_x, double blue_y) -{ - int ret = 1; - png_debug(1, "in png_check_cHRM function"); - if (png_ptr == NULL) - ret = 0; - if (!(white_x || white_y || red_x || red_y || green_x || green_y || - blue_x || blue_y)) - { - png_warning(png_ptr, - "Ignoring attempt to set all-zero chromaticity values"); - ret = 0; - } - if (white_x < 0.0 || white_y < 0.0 || - red_x < 0.0 || red_y < 0.0 || - green_x < 0.0 || green_y < 0.0 || - blue_x < 0.0 || blue_y < 0.0) - { - png_warning(png_ptr, - "Ignoring attempt to set negative chromaticity value"); - ret = 0; - } - if (white_x > 21474.83 || white_y > 21474.83 || - red_x > 21474.83 || red_y > 21474.83 || - green_x > 21474.83 || green_y > 21474.83 || - blue_x > 21474.83 || blue_y > 21474.83) - { - png_warning(png_ptr, - "Ignoring attempt to set chromaticity value exceeding 21474.83"); - ret = 0; - } - if (white_x > .8 || white_y > .8 || white_x + white_y > 1.0) - { - png_warning(png_ptr, "Invalid cHRM white point"); - ret = 0; - } - if (red_x + red_y > 1.0) - { - png_warning(png_ptr, "Invalid cHRM red point"); - ret = 0; - } - if (green_x + green_y > 1.0) - { - png_warning(png_ptr, "Invalid cHRM green point"); - ret = 0; - } - if (blue_x + blue_y > 1.0) - { - png_warning(png_ptr, "Invalid cHRM blue point"); - ret = 0; - } - if (((green_x - red_x) * (blue_y - red_y)) == ((green_y - red_y) * - (blue_x - red_x))) - { - png_warning(png_ptr, - "Ignoring attempt to set cHRM RGB triangle with zero area"); - ret = 0; - } - return ret; -} -#endif /* PNG_FLOATING_POINT_SUPPORTED */ - -#ifdef PNG_FIXED_POINT_SUPPORTED /* Multiply two 32-bit numbers, V1 and V2, using 32-bit arithmetic, to produce a 64 bit result in the HI/LO words. @@ -866,18 +799,10 @@ if (png_ptr == NULL) return 0; - if (!(white_x || white_y || red_x || red_y || green_x || green_y || - blue_x || blue_y)) - { - png_warning(png_ptr, - "Ignoring attempt to set all-zero chromaticity values"); - ret = 0; - } - - if (white_x < 0 || white_y < 0 || - red_x < 0 || red_y < 0 || - green_x < 0 || green_y < 0 || - blue_x < 0 || blue_y < 0) + if (white_x < 0 || white_y <= 0 || + red_x < 0 || red_y < 0 || + green_x < 0 || green_y < 0 || + blue_x < 0 || blue_y < 0) { png_warning(png_ptr, "Ignoring attempt to set negative chromaticity value"); @@ -896,7 +821,7 @@ "Ignoring attempt to set chromaticity value exceeding 21474.83"); ret = 0; } - if (white_x > 80000L || white_y > 80000L || white_x + white_y > 100000L) + if (white_x + white_y > 100000L) { png_warning(png_ptr, "Invalid cHRM white point"); ret = 0; @@ -929,6 +854,5 @@ return ret; } -#endif /* PNG_FIXED_POINT_SUPPORTED */ #endif /* PNG_cHRM_SUPPORTED */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */