ID:               48635
 Updated by:       ka...@php.net
 Reported By:      guen...@php.net
-Status:           Open
+Status:           Closed
 Bug Type:         GD related
 Operating System: all affected
 PHP Version:      5.2.10
-Assigned To:      
+Assigned To:      kalle
 New Comment:

Pierre told me to backport it to 5.2, so closing this :)


Previous Comments:
------------------------------------------------------------------------

[2009-06-22 12:17:00] guen...@php.net

just found that exactly same patch I suggested was already applied to
5.3 branch, but not backported to 5.2:
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.21.2.8&r2=1.90.2.1.2.21.2.9

------------------------------------------------------------------------

[2009-06-22 01:31:11] guen...@php.net

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 this bug report at http://bugs.php.net/?id=48635&edit=1

Reply via email to