cvs: php-src(PHP_5_2) /ext/standard pack.c /ext/standard/tests/strings pack.phpt
| From: | Brian Shire | Date: | Tue, 03 Apr 2007 19:50:40 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/standard pack.c /ext/standard/tests/strings pack.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-43701@lists.php.net to get a copy of this message | ||
shire Tue Apr 3 19:50:40 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard pack.c
/php-src/ext/standard/tests/strings pack.phpt
Log:
correction for previous fix to bug #38770 (pack/unpack is broken on 64bit)
fix pack test, correct space to tabs
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/pack.c?r1=1.57.2.5.2.3&r2=1.57.2.5.2.4&diff_format=u
Index: php-src/ext/standard/pack.c
diff -u php-src/ext/standard/pack.c:1.57.2.5.2.3 php-src/ext/standard/pack.c:1.57.2.5.2.4
--- php-src/ext/standard/pack.c:1.57.2.5.2.3 Sat Feb 24 02:17:27 2007
+++ php-src/ext/standard/pack.c Tue Apr 3 19:50:40 2007
@@ -15,7 +15,7 @@
| Author: Chris Schneider <cschneid@relog.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: pack.c,v 1.57.2.5.2.3 2007/02/24 02:17:27 helly Exp $ */
+/* $Id: pack.c,v 1.57.2.5.2.4 2007/04/03 19:50:40 shire Exp $ */
#include "php.h"
@@ -760,7 +760,7 @@
issigned = input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)] & 0x80;
} else if (sizeof(long) > 4 && (input[inputpos + machine_endian_long_map[3]] &
0x80) == 0x80) {
v = ~INT_MAX;
- }
+ }
v |= php_unpack(&input[inputpos], sizeof(int), issigned, int_map);
add_assoc_long(return_value, n, v);
@@ -775,15 +775,17 @@
int *map = machine_endian_long_map;
long v = 0;
- if (type == 'l') {
+ if (type == 'l' || type == 'L') {
issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80;
} else if (type == 'N') {
+ issigned = input[inputpos] & 0x80;
map = big_endian_long_map;
} else if (type == 'V') {
+ issigned = input[inputpos + 3] & 0x80;
map = little_endian_long_map;
}
- if (sizeof(long) > 4 && (input[inputpos + machine_endian_long_map[3]] & 0x80)
== 0x80) {
+ if (sizeof(long) > 4 && issigned) {
v = ~INT_MAX;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/pack.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/standard/tests/strings/pack.phpt
diff -u php-src/ext/standard/tests/strings/pack.phpt:1.1.2.2
php-src/ext/standard/tests/strings/pack.phpt:1.1.2.3
--- php-src/ext/standard/tests/strings/pack.phpt:1.1.2.2 Sat Dec 30 02:00:51 2006
+++ php-src/ext/standard/tests/strings/pack.phpt Tue Apr 3 19:50:40 2007
@@ -145,7 +145,7 @@
)
Array
(
- [1] => 0
+ [1] => -1
)
Array
(
@@ -185,7 +185,7 @@
)
Array
(
- [1] => 0
+ [1] => -1
)
Array
(
@@ -233,7 +233,7 @@
)
Array
(
- [1] => 0
+ [1] => -1
)
Array
(
@@ -305,7 +305,7 @@
)
Array
(
- [1] => 0
+ [1] => -1
)
Array
(