|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48635 wrong variable assignment breaks strict compiler on NetWare
Submitted: 2009-06-22 01:31 UTC Modified: 2009-06-23 00:54 UTC
From: Assigned: kalle (profile)
Status: Closed Package: GD related
PHP Version: 5.2.10 OS: all affected
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2009-06-22 01:31 UTC]
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:
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);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-22 12:17 UTC]
just found that exactly same patch I suggested was already applied to 5.3 branch, but not backported to 5.2:
 [2009-06-23 00:54 UTC]
Pierre told me to backport it to 5.2, so closing this :)
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon May 29 23:03:39 2023 UTC