@@ -255,7 +255,7 @@ PHP_FUNCTION(ksort)
255
255
256
256
PHPAPI int php_count_recursive (zval * array , long mode TSRMLS_DC ) /* {{{ */
257
257
{
258
- long cnt = 0 ;
258
+ php_int_t cnt = 0 ;
259
259
zval * element ;
260
260
261
261
if (Z_TYPE_P (array ) == IS_ARRAY ) {
@@ -289,7 +289,7 @@ PHP_FUNCTION(count)
289
289
{
290
290
zval * array ;
291
291
long mode = COUNT_NORMAL ;
292
- long cnt ;
292
+ php_int_t cnt ;
293
293
zval * element ;
294
294
295
295
#ifndef FAST_ZPP
@@ -1230,7 +1230,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{
1230
1230
* array , /* array to check in */
1231
1231
* entry , /* pointer to array entry */
1232
1232
res ; /* comparison result */
1233
- ulong num_idx ;
1233
+ php_uint_t num_idx ;
1234
1234
zend_string * str_idx ;
1235
1235
zend_bool strict = 0 ; /* strict comparison or not */
1236
1236
@@ -1360,7 +1360,7 @@ PHP_FUNCTION(extract)
1360
1360
long extract_type = EXTR_OVERWRITE ;
1361
1361
zval * entry ;
1362
1362
zend_string * var_name ;
1363
- ulong num_key ;
1363
+ php_uint_t num_key ;
1364
1364
int var_exists , count = 0 ;
1365
1365
int extract_refs = 0 ;
1366
1366
zend_array * symbol_table ;
@@ -1554,9 +1554,9 @@ PHP_FUNCTION(compact)
1554
1554
PHP_FUNCTION (array_fill )
1555
1555
{
1556
1556
zval * val ;
1557
- long start_key , num ;
1557
+ php_int_t start_key , num ;
1558
1558
1559
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "llz " , & start_key , & num , & val ) == FAILURE ) {
1559
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "iiz " , & start_key , & num , & val ) == FAILURE ) {
1560
1560
return ;
1561
1561
}
1562
1562
@@ -1652,7 +1652,7 @@ PHP_FUNCTION(range)
1652
1652
if (Z_TYPE_P (zlow ) == IS_STRING && Z_TYPE_P (zhigh ) == IS_STRING && Z_STRSIZE_P (zlow ) >= 1 && Z_STRSIZE_P (zhigh ) >= 1 ) {
1653
1653
int type1 , type2 ;
1654
1654
unsigned char low , high ;
1655
- long lstep = (long ) step ;
1655
+ php_int_t lstep = (php_int_t ) step ;
1656
1656
1657
1657
type1 = is_numeric_string (Z_STRVAL_P (zlow ), Z_STRSIZE_P (zlow ), NULL , NULL , 0 );
1658
1658
type2 = is_numeric_string (Z_STRVAL_P (zhigh ), Z_STRSIZE_P (zhigh ), NULL , NULL , 0 );
@@ -1709,7 +1709,7 @@ PHP_FUNCTION(range)
1709
1709
1710
1710
} else if (Z_TYPE_P (zlow ) == IS_DOUBLE || Z_TYPE_P (zhigh ) == IS_DOUBLE || is_step_double ) {
1711
1711
double low , high , value ;
1712
- long i ;
1712
+ php_int_t i ;
1713
1713
double_str :
1714
1714
low = zval_get_double (zlow );
1715
1715
high = zval_get_double (zhigh );
@@ -1742,11 +1742,11 @@ PHP_FUNCTION(range)
1742
1742
}
1743
1743
} else {
1744
1744
double low , high ;
1745
- long lstep ;
1745
+ php_int_t lstep ;
1746
1746
long_str :
1747
1747
low = zval_get_double (zlow );
1748
1748
high = zval_get_double (zhigh );
1749
- lstep = (long ) step ;
1749
+ lstep = (php_int_t ) step ;
1750
1750
1751
1751
Z_TYPE_INFO (tmp ) = IS_INT ;
1752
1752
if (low > high ) { /* Negative steps */
@@ -1755,7 +1755,7 @@ PHP_FUNCTION(range)
1755
1755
goto err ;
1756
1756
}
1757
1757
for (; low >= high ; low -= lstep ) {
1758
- Z_IVAL (tmp ) = (long )low ;
1758
+ Z_IVAL (tmp ) = (php_int_t )low ;
1759
1759
zend_hash_next_index_insert_new (Z_ARRVAL_P (return_value ), & tmp );
1760
1760
}
1761
1761
} else if (high > low ) { /* Positive steps */
@@ -1764,11 +1764,11 @@ PHP_FUNCTION(range)
1764
1764
goto err ;
1765
1765
}
1766
1766
for (; low <= high ; low += lstep ) {
1767
- Z_IVAL (tmp ) = (long )low ;
1767
+ Z_IVAL (tmp ) = (php_int_t )low ;
1768
1768
zend_hash_next_index_insert_new (Z_ARRVAL_P (return_value ), & tmp );
1769
1769
}
1770
1770
} else {
1771
- Z_IVAL (tmp ) = (long )low ;
1771
+ Z_IVAL (tmp ) = (php_int_t )low ;
1772
1772
zend_hash_next_index_insert_new (Z_ARRVAL_P (return_value ), & tmp );
1773
1773
}
1774
1774
}
@@ -1995,7 +1995,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
1995
1995
zval * stack , /* Input stack */
1996
1996
* val ; /* Value to be popped */
1997
1997
zend_string * key = NULL ;
1998
- ulong index ;
1998
+ php_uint_t index ;
1999
1999
2000
2000
#ifndef FAST_ZPP
2001
2001
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a/" , & stack ) == FAILURE ) {
@@ -2145,13 +2145,13 @@ PHP_FUNCTION(array_splice)
2145
2145
HashTable old_hash ;
2146
2146
uint idx ;
2147
2147
Bucket * p ; /* Bucket used for traversing hash */
2148
- long i ,
2148
+ php_int_t i ,
2149
2149
offset ,
2150
2150
length = 0 ,
2151
2151
repl_num = 0 ; /* Number of replacement elements */
2152
2152
int num_in ; /* Number of elements in the input array */
2153
2153
2154
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a/l|lz /" , & array , & offset , & length , & repl_array ) == FAILURE ) {
2154
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a/i|iz /" , & array , & offset , & length , & repl_array ) == FAILURE ) {
2155
2155
return ;
2156
2156
}
2157
2157
@@ -2190,7 +2190,7 @@ PHP_FUNCTION(array_splice)
2190
2190
/* ..and the length */
2191
2191
if (length < 0 ) {
2192
2192
size = num_in - offset + length ;
2193
- } else if (((unsigned long ) offset + (unsigned long ) length ) > (unsigned ) num_in ) {
2193
+ } else if (((php_uint_t ) offset + (php_uint_t ) length ) > (unsigned ) num_in ) {
2194
2194
size = num_in - offset ;
2195
2195
}
2196
2196
@@ -2222,16 +2222,16 @@ PHP_FUNCTION(array_slice)
2222
2222
zval * input , /* Input array */
2223
2223
* z_length = NULL , /* How many elements to get */
2224
2224
* entry ; /* An array entry */
2225
- long offset , /* Offset to get elements from */
2225
+ php_int_t offset , /* Offset to get elements from */
2226
2226
length = 0 ;
2227
2227
zend_bool preserve_keys = 0 ; /* Whether to preserve keys while copying to the new array or not */
2228
2228
int num_in , /* Number of elements in the input array */
2229
2229
pos ; /* Current position in the array */
2230
2230
zend_string * string_key ;
2231
- ulong num_key ;
2231
+ php_uint_t num_key ;
2232
2232
2233
2233
#ifndef FAST_ZPP
2234
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "al |zb" , & input , & offset , & z_length , & preserve_keys ) == FAILURE ) {
2234
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "ai |zb" , & input , & offset , & z_length , & preserve_keys ) == FAILURE ) {
2235
2235
return ;
2236
2236
}
2237
2237
#else
@@ -2265,7 +2265,7 @@ PHP_FUNCTION(array_slice)
2265
2265
/* ..and the length */
2266
2266
if (length < 0 ) {
2267
2267
length = num_in - offset + length ;
2268
- } else if (((unsigned long ) offset + (unsigned long ) length ) > (unsigned ) num_in ) {
2268
+ } else if (((php_uint_t ) offset + (php_uint_t ) length ) > (unsigned ) num_in ) {
2269
2269
length = num_in - offset ;
2270
2270
}
2271
2271
@@ -2404,7 +2404,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC
2404
2404
{
2405
2405
zval * src_entry , * dest_entry , * src_zval , * dest_zval ;
2406
2406
zend_string * string_key ;
2407
- ulong num_key ;
2407
+ php_uint_t num_key ;
2408
2408
int ret ;
2409
2409
2410
2410
ZEND_HASH_FOREACH_KEY_VAL (src , num_key , string_key , src_entry ) {
@@ -2564,7 +2564,7 @@ PHP_FUNCTION(array_keys)
2564
2564
new_val ; /* New value */
2565
2565
int add_key ; /* Flag to indicate whether a key should be added */
2566
2566
zend_bool strict = 0 ; /* do strict comparison */
2567
- ulong num_idx ;
2567
+ php_uint_t num_idx ;
2568
2568
zend_string * str_idx ;
2569
2569
int (* is_equal_func )(zval * , zval * , zval * TSRMLS_DC ) = is_equal_function ;
2570
2570
@@ -2775,7 +2775,7 @@ PHP_FUNCTION(array_reverse)
2775
2775
zval * input , /* Input array */
2776
2776
* entry ; /* An entry in the input array */
2777
2777
zend_string * string_key ;
2778
- ulong num_key ;
2778
+ php_uint_t num_key ;
2779
2779
zend_bool preserve_keys = 0 ; /* whether to preserve keys */
2780
2780
2781
2781
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a|b" , & input , & preserve_keys ) == FAILURE ) {
@@ -2810,20 +2810,20 @@ PHP_FUNCTION(array_pad)
2810
2810
zval * pads ; /* Array to pass to splice */
2811
2811
HashTable * new_hash ;/* Return value from splice */
2812
2812
HashTable old_hash ;
2813
- long pad_size ; /* Size to pad to */
2814
- long pad_size_abs ; /* Absolute value of pad_size */
2813
+ php_int_t pad_size ; /* Size to pad to */
2814
+ php_int_t pad_size_abs ; /* Absolute value of pad_size */
2815
2815
int input_size ; /* Size of the input array */
2816
2816
int num_pads ; /* How many pads do we need */
2817
2817
int do_pad ; /* Whether we should do padding at all */
2818
2818
int i ;
2819
2819
2820
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "alz " , & input , & pad_size , & pad_value ) == FAILURE ) {
2820
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "aiz " , & input , & pad_size , & pad_value ) == FAILURE ) {
2821
2821
return ;
2822
2822
}
2823
2823
2824
2824
/* Do some initial calculations */
2825
2825
input_size = zend_hash_num_elements (Z_ARRVAL_P (input ));
2826
- pad_size_abs = abs (pad_size );
2826
+ pad_size_abs = ZEND_ABS (pad_size );
2827
2827
if (pad_size_abs < 0 ) {
2828
2828
php_error_docref (NULL TSRMLS_CC , E_WARNING , "You may only pad up to 1048576 elements at a time" );
2829
2829
zval_dtor (return_value );
@@ -2874,7 +2874,7 @@ PHP_FUNCTION(array_pad)
2874
2874
PHP_FUNCTION (array_flip )
2875
2875
{
2876
2876
zval * array , * entry , data ;
2877
- ulong num_idx ;
2877
+ php_uint_t num_idx ;
2878
2878
zend_string * str_idx ;
2879
2879
2880
2880
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a" , & array ) == FAILURE ) {
@@ -2912,10 +2912,10 @@ PHP_FUNCTION(array_change_key_case)
2912
2912
zval * array , * entry ;
2913
2913
zend_string * string_key ;
2914
2914
zend_string * new_key ;
2915
- ulong num_key ;
2916
- long change_to_upper = 0 ;
2915
+ php_uint_t num_key ;
2916
+ php_int_t change_to_upper = 0 ;
2917
2917
2918
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a|l " , & array , & change_to_upper ) == FAILURE ) {
2918
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a|i " , & array , & change_to_upper ) == FAILURE ) {
2919
2919
return ;
2920
2920
}
2921
2921
@@ -4141,12 +4141,12 @@ PHP_FUNCTION(array_multisort)
4141
4141
PHP_FUNCTION (array_rand )
4142
4142
{
4143
4143
zval * input ;
4144
- long randval , num_req = 1 ;
4144
+ php_int_t randval , num_req = 1 ;
4145
4145
int num_avail ;
4146
4146
zend_string * string_key ;
4147
- ulong num_key ;
4147
+ php_uint_t num_key ;
4148
4148
4149
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a|l " , & input , & num_req ) == FAILURE ) {
4149
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a|i " , & input , & num_req ) == FAILURE ) {
4150
4150
return ;
4151
4151
}
4152
4152
@@ -4247,7 +4247,7 @@ PHP_FUNCTION(array_product)
4247
4247
4248
4248
if (Z_TYPE (entry_n ) == IS_INT && Z_TYPE_P (return_value ) == IS_INT ) {
4249
4249
dval = (double )Z_IVAL_P (return_value ) * (double )Z_IVAL (entry_n );
4250
- if ( (double )LONG_MIN <= dval && dval <= (double )LONG_MAX ) {
4250
+ if ( (double )PHP_INT_MIN <= dval && dval <= (double )PHP_INT_MAX ) {
4251
4251
Z_IVAL_P (return_value ) *= Z_IVAL (entry_n );
4252
4252
continue ;
4253
4253
}
@@ -4328,7 +4328,7 @@ PHP_FUNCTION(array_filter)
4328
4328
zend_string * string_key ;
4329
4329
zend_fcall_info fci = empty_fcall_info ;
4330
4330
zend_fcall_info_cache fci_cache = empty_fcall_info_cache ;
4331
- ulong num_key ;
4331
+ php_uint_t num_key ;
4332
4332
4333
4333
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "a|fl" , & array , & fci , & fci_cache , & use_type ) == FAILURE ) {
4334
4334
return ;
@@ -4620,15 +4620,15 @@ PHP_FUNCTION(array_key_exists)
4620
4620
PHP_FUNCTION (array_chunk )
4621
4621
{
4622
4622
int argc = ZEND_NUM_ARGS (), num_in ;
4623
- long size , current = 0 ;
4623
+ php_int_t size , current = 0 ;
4624
4624
zend_string * str_key ;
4625
- ulong num_key ;
4625
+ php_uint_t num_key ;
4626
4626
zend_bool preserve_keys = 0 ;
4627
4627
zval * input = NULL ;
4628
4628
zval chunk ;
4629
4629
zval * entry ;
4630
4630
4631
- if (zend_parse_parameters (argc TSRMLS_CC , "al |b" , & input , & size , & preserve_keys ) == FAILURE ) {
4631
+ if (zend_parse_parameters (argc TSRMLS_CC , "ai |b" , & input , & size , & preserve_keys ) == FAILURE ) {
4632
4632
return ;
4633
4633
}
4634
4634
/* Do bounds checking for size parameter. */
0 commit comments