The initial type change does the trick for the formula itself. And yes, the code relies on an integer being 64bit


Ilia Alshanetsky




On 15-Apr-09, at 2:05 PM, Matt Wilmas wrote:

Hi Ilia,

----- Original Message -----
From: "Ilia Alshanetsky"
Sent: Wednesday, April 15, 2009

iliaa Wed Apr 15 14:24:38 2009 UTC

Modified files:              (Branch: PHP_5_3)
  /php-src/ext/standard mail.c
Log:

Fixed bug #47969 (ezmlm_hash() returns different values depend on OS)

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.9&r2=1.87.2.1.2.7.2.10&diff_format=u
[...]
@@ -76,7 +76,7 @@
PHP_FUNCTION(ezmlm_hash)
{
char *str = NULL;
- unsigned long h = 5381L;
+ unsigned int h = 5381;

You're relying on int being 32-bit?  Couldn't it be 64-bit as well? 
http://en.wikipedia.org/wiki/64-bit#64-bit_data_models

BTW, (unsigned long) cast is still used in the loop, although I guess it's not affecting that expression... And the cast in RETURN_LONG((int) h); isn't needed, but that was true before. Just noticed while checking if I was missing something else. :-)


- Matt


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to