From: AxelLuttgens at swing dot be
Operating system: Darwin 7.0.0 (Panther)
PHP version: 4.3.3
PHP Bug Type: Compile Warning
Bug description: Warnings while compiling exif.c

Description:
------------
When compiling PHP, I get two warnings related to lines 1555 and 1582 of
exif.c; both warnings read:

warning: passing arg 3 of `php_addslashes' from incompatible pointer type

Function php_addslashes gets called 4 times in file ext/exif/exif.c (/*
$Id: exif.c,v 1.118.2.23 2003/06/25 13:21:54 edink Exp $ */).

In function exif_iif_add_value, where argument 'length' is of type
size_t:
line 1555: info_value->s = php_addslashes(value, length, &length, 0
TSRMLS_CC);
line 1582: info_value->s = php_addslashes(value, length, &length, 0
TSRMLS_CC);

In function exif_iif_add_str:
line 1708: info_data->value.s = php_addslashes(value, strlen(value),
NULL, 0 TSRMLS_CC);

In function exif_iif_add_buffer, where argument 'length' is of type int:
line 1756: info_data->value.s = php_addslashes(value, length, &length,
0 TSRMLS_CC);

In ext/standard/string.c, definition of php_addsclashes reads as:

PHPAPI char *php_addslashes(char *str, int length, int *new_length, int
should_free TSRMLS_DC)
{
...
}

which is consistent with what appears in ext/standard/php_string.h:

PHPAPI char *php_addslashes(char *str, int length, int *new_length, int
freeit TSRMLS_DC);

Clearly, line 1708 is a don't care, and line 1756 is just compliant with
the definition of php_addslashes.
But lines 1555 and 1582 both use a length of type size_t instead of type
int.

I am wondering what the compiler really compiles (as it just warns and
goes on).
Could this be a source of confusion (such as an unsigned long being
interpreted as a signed one)?

And would it be safe to just change the definition of function
exif_iif_add_value so as to set type of argument 'lentgh' to int instead
of size_t?


--
Edit bug report at [url]http://bugs.php.net/?id=26056&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=26056&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=26056&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=26056&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=26056&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=26056&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=26056&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=26056&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=26056&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=26056&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=26056&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=26056&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=26056&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=26056&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=26056&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=26056&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=26056&r=float[/url]