Patch for gd.c
| From: | Moriyoshi Koizumi | Date: | Fri, 22 Nov 2002 21:08:24 +0000 |
| Subject: | Patch for gd.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-91461@lists.php.net to get a copy of this message | ||
Hi,
This tiny patch prevents the warnings when applying imagecolordeallocate()
on true colour values. I suppose this new behaviour would be more
consistent because we can use imagecolorallocate() with true colour images.
Then what do you guys think about this issue?
Moriyoshi
Index: ext/gd/gd.c =================================================================== RCS file: /repository/php4/ext/gd/gd.c,v retrieving revision 1.223 diff -u -r1.223 gd.c --- ext/gd/gd.c 14 Nov 2002 15:09:53 -0000 1.223 +++ ext/gd/gd.c 22 Nov 2002 20:59:19 -0000 @@ -1874,6 +1874,11 @@ gdImageColorDeallocate(im, col); RETURN_TRUE; } else { +#if HAVE_LIBGD20 + if (gdImageTrueColor(im)) { + RETURN_TRUE; + } +#endif php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color index %d out of range", col); RETURN_FALSE; }
Index: ext/gd/gd.c =================================================================== RCS file: /repository/php4/ext/gd/gd.c,v retrieving revision 1.223 diff -u -r1.223 gd.c --- ext/gd/gd.c 14 Nov 2002 15:09:53 -0000 1.223 +++ ext/gd/gd.c 22 Nov 2002 20:59:19 -0000 @@ -1874,6 +1874,11 @@ gdImageColorDeallocate(im, col); RETURN_TRUE; } else { +#if HAVE_LIBGD20 + if (gdImageTrueColor(im)) { + RETURN_TRUE; + } +#endif php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color index %d out of range", col); RETURN_FALSE; }