mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
MFB: correction for previous fix to bug #38770 (pack/unpack is broken on 64bit)
fix pack test, correct space to tabs
This commit is contained in:
parent
ab5d9f9342
commit
c1104b0262
2 changed files with 9 additions and 7 deletions
|
@ -738,7 +738,7 @@ PHP_FUNCTION(unpack)
|
||||||
issigned = input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)] & 0x80;
|
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) {
|
} else if (sizeof(long) > 4 && (input[inputpos + machine_endian_long_map[3]] & 0x80) == 0x80) {
|
||||||
v = ~INT_MAX;
|
v = ~INT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
v |= php_unpack(&input[inputpos], sizeof(int), issigned, int_map);
|
v |= php_unpack(&input[inputpos], sizeof(int), issigned, int_map);
|
||||||
add_assoc_long(return_value, n, v);
|
add_assoc_long(return_value, n, v);
|
||||||
|
@ -753,15 +753,17 @@ PHP_FUNCTION(unpack)
|
||||||
int *map = machine_endian_long_map;
|
int *map = machine_endian_long_map;
|
||||||
long v = 0;
|
long v = 0;
|
||||||
|
|
||||||
if (type == 'l') {
|
if (type == 'l' || type == 'L') {
|
||||||
issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80;
|
issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80;
|
||||||
} else if (type == 'N') {
|
} else if (type == 'N') {
|
||||||
|
issigned = input[inputpos] & 0x80;
|
||||||
map = big_endian_long_map;
|
map = big_endian_long_map;
|
||||||
} else if (type == 'V') {
|
} else if (type == 'V') {
|
||||||
|
issigned = input[inputpos + 3] & 0x80;
|
||||||
map = little_endian_long_map;
|
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;
|
v = ~INT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ Array
|
||||||
)
|
)
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
[1] => 0
|
[1] => -1
|
||||||
)
|
)
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
|
@ -185,7 +185,7 @@ Array
|
||||||
)
|
)
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
[1] => 0
|
[1] => -1
|
||||||
)
|
)
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
|
@ -233,7 +233,7 @@ Array
|
||||||
)
|
)
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
[1] => 0
|
[1] => -1
|
||||||
)
|
)
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
|
@ -305,7 +305,7 @@ Array
|
||||||
)
|
)
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
[1] => 0
|
[1] => -1
|
||||||
)
|
)
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue