php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58098 compilation breaks with CodeWarrior compiler
Submitted: 2008-03-11 10:00 UTC Modified: 2008-03-12 12:05 UTC
From: guenter@php.net Assigned:
Status: Closed Package: mailparse (PECL)
PHP Version: 5_2 CVS-2008-03-11 OS: NetWare
Private report: No CVE-ID: None
 [2008-03-11 10:00 UTC] guenter@php.net
Description:
------------
Stupid CodeWarrior compiler which we use to compile for NetWare platform
doesnt handle line 827 of php_mailparse_mime.c:
	struct find_part_struct find = { name, NULL };
it seems that the compiler is too stupid to take vars here, and breaks compilation. Can you perhaps use single assignment here?
Then I get a warning about var i not beeing initialized before used in line 58; looking at this I found that the compiler is right, and in addition valuepos isnt used at all - so I removed both.
See patch below which fixes both issues.

--- php_mailparse_mime.c.orig	Tue Jan 08 21:20:20 2008
+++ php_mailparse_mime.c	Tue Mar 11 15:50:54 2008
@@ -53,9 +53,7 @@
 void rfc2231_to_mime(smart_str* value_buf, char* value, int charset_p, int prevcharset_p)
 {
 	char *strp, *startofvalue = NULL;
-	int quotes=0;
-	int valuepos;
-	int i;
+	int quotes = 0;
 
 	/* Process string, get positions and replace	*/
 	/* Set to start of buffer*/
@@ -77,7 +75,6 @@
 						*strp=0; 
 					} else {
 					 startofvalue = strp+1;
-					 valuepos = i;
 					}
 
 					quotes++;
@@ -824,7 +821,10 @@
 
 PHP_MAILPARSE_API php_mimepart *php_mimepart_find_by_name(php_mimepart *parent, const char *name TSRMLS_DC)
 {
-	struct find_part_struct find = { name, NULL };
+	struct find_part_struct find;
+
+	find.searchfor = name;
+	find.foundpart = NULL;
 	php_mimepart_enum_parts(parent, find_part_callback, &find TSRMLS_CC);
 	return find.foundpart;
 }




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-12 12:05 UTC] shire@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

Sounds good to me, thank you for the patch.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Mar 24 06:01:26 2019 UTC