From:             guen...@php.net
Operating system: all affected
PHP version:      5.2.10
PHP Bug Type:     GD related
Bug description:  wrong variable assignment breaks strict compiler on NetWare

Description:
------------
I've just compiled PHP 5.2.10, and my strict NetWare compiler breaks in
libgd/gd.c:
libgd\gd.c:3881: illegal implicit conversion from 'int' to
libgd\gd.c:3881: 'struct gdImageStruct *'
libgd\gd.c:3882: illegal implicit conversion from 'struct gdImageStruct *'
to
libgd\gd.c:3882: 'int'

when I look at the code it seems to me that the compiler is right, and
this commit:
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.24&r2=1.90.2.1.2.25
looks plain wrong for me: the prototype of gdImageColorAllocateAlpha()
is:
int gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a)

and at all other places where gdImageColorAllocateAlpha() is used its
return value is correctly assigned an int, and not a gdImagePtr.

suggested patch which makes it compile again:

--- gd.c.orig   Thu Apr 23 18:28:39 2009
+++ gd.c        Mon Jun 22 03:25:53 2009
@@ -3864,7 +3864,7 @@
        int         x, y, i, j, new_a;
        float       new_r, new_g, new_b;
        int         new_pxl, pxl=0;
-       gdImagePtr  srcback, srctrans;
+       gdImagePtr  srcback;
        typedef int (*FuncPtr)(gdImagePtr, int, int);
        FuncPtr f;
 
@@ -3878,8 +3878,8 @@
                return 0;
        }
        srcback->saveAlphaFlag = 1;
-       srctrans = gdImageColorAllocateAlpha(srcback, 0, 0, 0, 127);
-       gdImageFill(srcback, 0, 0, srctrans);
+       new_pxl = gdImageColorAllocateAlpha(srcback, 0, 0, 0, 127);
+       gdImageFill(srcback, 0, 0, new_pxl);
 
        gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy);
 



-- 
Edit bug report at http://bugs.php.net/?id=48635&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48635&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48635&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48635&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48635&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48635&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48635&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48635&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48635&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48635&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48635&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48635&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48635&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48635&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48635&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48635&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48635&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48635&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48635&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48635&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48635&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48635&r=mysqlcfg

Reply via email to