From: Ilia Alshanetsky Date: Sun, 22 Feb 2004 18:03:09 +0000 (+0000) Subject: wbmp conversion warning fix. X-Git-Tag: RELEASE_0_2_0~233 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52b962ca2ffdbe37b86752522d4f70fc209471cd;p=php wbmp conversion warning fix. --- diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 3065fd81b2..f090f1d63d 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1721,7 +1721,9 @@ 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; } @@ -1766,9 +1768,12 @@ 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) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q); - } + 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; case PHP_GDIMG_TYPE_JPG: