From 7275b5a177f7d93633ff37ab470d83c548819bdc Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Sun, 22 Feb 2004 18:03:24 +0000 Subject: [PATCH] MFH: wbmp conversion warning fix. --- ext/gd/gd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 4e4084bd57..5515b55acb 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -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; -- 2.50.1