com php-src: fixed unpack: ext/standard/pack.c
| From: | Anatol Belski | Date: | Sun, 10 Nov 2013 13:02:38 +0000 |
| Subject: | com php-src: fixed unpack: ext/standard/pack.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73919@lists.php.net to get a copy of this message | ||
Commit: 7cf68266b33770d893484bc589257918e43661f1
Author: Anatol Belski <ab@php.net> Sun, 10 Nov 2013 14:02:38 +0100
Parents: 637e9fc5bb5e8666b148bc53b76a754241c5ebb8
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7cf68266b33770d893484bc589257918e43661f1
Log:
fixed unpack
Changed paths:
M ext/standard/pack.c
Diff:
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 3bf7e08..a3b4b46 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -496,9 +496,9 @@ PHP_FUNCTION(pack)
/* {{{ php_unpack
*/
-static long php_unpack(char *data, zend_str_size_int size, int issigned, int *map)
+static php_int_t php_unpack(char *data, zend_str_size_int size, int issigned, int *map)
{
- long result;
+ php_int_t result;
char *cresult = (char *) &result;
int i;
@@ -833,7 +833,7 @@ PHP_FUNCTION(unpack)
case 'V': {
int issigned = 0;
int *map = machine_endian_long_map;
- long v = 0;
+ php_int_t v = 0;
if (type == 'l' || type == 'L') {
issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80;
@@ -845,12 +845,12 @@ PHP_FUNCTION(unpack)
map = little_endian_long_map;
}
- if (sizeof(long) > 4 && issigned) {
+ if (SIZEOF_ZEND_INT > 4 && issigned) {
v = ~INT_MAX;
}
v |= php_unpack(&input[inputpos], 4, issigned, map);
- if (sizeof(long) > 4) {
+ if (SIZEOF_ZEND_INT > 4) {
if (type == 'l') {
v = (signed int) v;
} else {