com php-src: fixed range(): ext/standard/array.c
| From: | Anatol Belski | Date: | Mon, 11 Nov 2013 10:52:44 +0000 |
| Subject: | com php-src: fixed range(): ext/standard/array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73933@lists.php.net to get a copy of this message | ||
Commit: ebc2816318700995c255cebef55ade7e0cd7eeab
Author: Anatol Belski <ab@php.net> Mon, 11 Nov 2013 11:52:44 +0100
Parents: c23baba6934e72b5cb46df4117e04b234fc85216
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ebc2816318700995c255cebef55ade7e0cd7eeab
Log:
fixed range()
Changed paths:
M ext/standard/array.c
Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index a7136ba..acb0ffb 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1624,7 +1624,7 @@ PHP_FUNCTION(range)
if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING &&
Z_STRSIZE_P(zlow) >= 1 && Z_STRSIZE_P(zhigh) >= 1) {
int type1, type2;
unsigned char *low, *high;
- long lstep = (long) step;
+ php_int_t lstep = (php_int_t) step;
type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRSIZE_P(zlow), NULL, NULL, 0);
type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRSIZE_P(zhigh), NULL, NULL, 0);
@@ -1672,7 +1672,7 @@ PHP_FUNCTION(range)
} else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) {
double low, high, value;
- long i;
+ php_int_t i;
double_str:
convert_to_double(zlow);
convert_to_double(zhigh);
@@ -1703,13 +1703,13 @@ double_str:
}
} else {
double low, high;
- long lstep;
+ php_int_t lstep;
long_str:
convert_to_double(zlow);
convert_to_double(zhigh);
low = Z_DVAL_P(zlow);
high = Z_DVAL_P(zhigh);
- lstep = (long) step;
+ lstep = (php_int_t) step;
if (low > high) { /* Negative steps */
if (low - high < lstep || lstep <= 0) {
@@ -1717,7 +1717,7 @@ long_str:
goto err;
}
for (; low >= high; low -= lstep) {
- add_next_index_long(return_value, (long)low);
+ add_next_index_long(return_value, (php_int_t)low);
}
} else if (high > low) { /* Positive steps */
if (high - low < lstep || lstep <= 0) {
@@ -1725,10 +1725,10 @@ long_str:
goto err;
}
for (; low <= high; low += lstep) {
- add_next_index_long(return_value, (long)low);
+ add_next_index_long(return_value, (php_int_t)low);
}
} else {
- add_next_index_long(return_value, (long)low);
+ add_next_index_long(return_value, (php_int_t)low);
}
}
err: