pajoye          Tue Jan 17 15:44:12 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src/ext/gd     gd.c 
  Log:
  - return false on error
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.312.2.13&r2=1.312.2.14&diff_format=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.312.2.13 php-src/ext/gd/gd.c:1.312.2.14
--- php-src/ext/gd/gd.c:1.312.2.13      Tue Jan 17 15:23:29 2006
+++ php-src/ext/gd/gd.c Tue Jan 17 15:44:12 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: gd.c,v 1.312.2.13 2006/01/17 15:23:29 pajoye Exp $ */
+/* $Id: gd.c,v 1.312.2.14 2006/01/17 15:44:12 pajoye Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
    Cold Spring Harbor Labs. */
@@ -1967,6 +1967,7 @@
 {
        zval **IM, **red, **green, **blue;
        gdImagePtr im;
+       int ct = (-1);
 
        if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, 
&green, &blue) == FAILURE) {
                ZEND_WRONG_PARAM_COUNT();
@@ -1977,8 +1978,11 @@
        convert_to_long_ex(red);
        convert_to_long_ex(green);
        convert_to_long_ex(blue);
-
-       RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), 
Z_LVAL_PP(blue)));
+       ct = gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), 
Z_LVAL_PP(blue));
+       if (ct < 0) {
+               RETURN_FALSE;
+       }
+       RETURN_LONG(ct);
 }
 /* }}} */
 

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

Reply via email to