]> granicus.if.org Git - php/commitdiff
MFH: wbmp conversion warning fix.
authorIlia Alshanetsky <iliaa@php.net>
Sun, 22 Feb 2004 18:03:24 +0000 (18:03 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 22 Feb 2004 18:03:24 +0000 (18:03 +0000)
ext/gd/gd.c

index 4e4084bd5786173d6e3c9a8fd0415e261e4a8c87..5515b55acbed58c73a4658552fae601fd0baf383 100644 (file)
@@ -1617,8 +1617,11 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
 
                switch(image_type) {
                        case PHP_GDIMG_CONVERT_WBM:
-                               if(q<0||q>255) {
+                               if (q == -1) {
+                                       q = 0;
+                               } else if (q < 0 || q > 255) {
                                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
+                                       q = 0;
                                }
                                gdImageWBMP(im, q, fp);
                                break;
@@ -1661,8 +1664,11 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
 
                switch(image_type) {
                        case PHP_GDIMG_CONVERT_WBM:
-                               if(q<0||q>255) {
+                               if (q == -1) {
+                                       q = 0;
+                               } else if (q < 0 || q > 255) {
                                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
+                                       q = 0;
                                }
                                gdImageWBMP(im, q, tmp);
                                break;