[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/gd/libgd/gd_png.c trunk/ext/gd/libgd/gd_png.c

2010-05-24 Thread Rasmus Lerdorf
rasmus   Mon, 24 May 2010 23:52:11 +

Revision: http://svn.php.net/viewvc?view=revision&revision=299726

Log:
Check for -1 as well here

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c
U   php/php-src/trunk/ext/gd/libgd/gd_png.c

Modified: php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c
===
--- php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c  2010-05-24 23:27:39 UTC 
(rev 299725)
+++ php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c  2010-05-24 23:52:11 UTC 
(rev 299726)
@@ -515,8 +515,8 @@
/*  png_set_filter(png_ptr, 0, PNG_FILTER_NONE);  */

/* 2.0.12: this is finally a parameter */
-   if (level < 0 || level > 9) {
-   php_gd_error("gd-png error: compression level must be between 0 
and 9");
+   if (level != -1 && (level < 0 || level > 9)) {
+   php_gd_error("gd-png error: compression level must be 0 through 
9");
return;
}
png_set_compression_level(png_ptr, level);

Modified: php/php-src/trunk/ext/gd/libgd/gd_png.c
===
--- php/php-src/trunk/ext/gd/libgd/gd_png.c 2010-05-24 23:27:39 UTC (rev 
299725)
+++ php/php-src/trunk/ext/gd/libgd/gd_png.c 2010-05-24 23:52:11 UTC (rev 
299726)
@@ -515,8 +515,8 @@
/*  png_set_filter(png_ptr, 0, PNG_FILTER_NONE);  */

/* 2.0.12: this is finally a parameter */
-   if (level < 0 || level > 9) {
-   php_gd_error("gd-png error: compression level must be between 0 
and 9");
+   if (level != -1 && (level < 0 || level > 9)) {
+   php_gd_error("gd-png error: compression level must be 0 through 
9");
return;
}
png_set_compression_level(png_ptr, level);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/gd/libgd/gd_png.c trunk/ext/gd/libgd/gd_png.c

2010-05-24 Thread Rasmus Lerdorf
rasmus   Mon, 24 May 2010 23:27:39 +

Revision: http://svn.php.net/viewvc?view=revision&revision=299725

Log:
Let's have a sane error message here instead of some cryptic zlib error

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c
U   php/php-src/trunk/ext/gd/libgd/gd_png.c

Modified: php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c
===
--- php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c  2010-05-24 22:17:41 UTC 
(rev 299724)
+++ php/php-src/branches/PHP_5_3/ext/gd/libgd/gd_png.c  2010-05-24 23:27:39 UTC 
(rev 299725)
@@ -515,6 +515,10 @@
/*  png_set_filter(png_ptr, 0, PNG_FILTER_NONE);  */

/* 2.0.12: this is finally a parameter */
+   if (level < 0 || level > 9) {
+   php_gd_error("gd-png error: compression level must be between 0 
and 9");
+   return;
+   }
png_set_compression_level(png_ptr, level);
if (basefilter >= 0) {
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, basefilter);

Modified: php/php-src/trunk/ext/gd/libgd/gd_png.c
===
--- php/php-src/trunk/ext/gd/libgd/gd_png.c 2010-05-24 22:17:41 UTC (rev 
299724)
+++ php/php-src/trunk/ext/gd/libgd/gd_png.c 2010-05-24 23:27:39 UTC (rev 
299725)
@@ -515,6 +515,10 @@
/*  png_set_filter(png_ptr, 0, PNG_FILTER_NONE);  */

/* 2.0.12: this is finally a parameter */
+   if (level < 0 || level > 9) {
+   php_gd_error("gd-png error: compression level must be between 0 
and 9");
+   return;
+   }
png_set_compression_level(png_ptr, level);
if (basefilter >= 0) {
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, basefilter);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php