diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index f442da8cd79..a9280c5e8a1 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1364,7 +1364,7 @@ SPL_METHOD(Array, seek) zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", opos); } /* }}} */ -int static spl_array_object_count_elements_helper(spl_array_object *intern, long *count TSRMLS_DC) /* {{{ */ +int static spl_array_object_count_elements_helper(spl_array_object *intern, php_int_t *count TSRMLS_DC) /* {{{ */ { HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); HashPosition pos; @@ -1392,7 +1392,7 @@ int static spl_array_object_count_elements_helper(spl_array_object *intern, long } } /* }}} */ -int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ +int spl_array_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); @@ -1404,7 +1404,7 @@ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ MAKE_STD_ZVAL(intern->retval); ZVAL_ZVAL(intern->retval, rv, 1, 1); convert_to_long(intern->retval); - *count = (long) Z_LVAL_P(intern->retval); + *count = (php_int_t) Z_LVAL_P(intern->retval); return SUCCESS; } *count = 0; @@ -1418,7 +1418,7 @@ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ Return the number of elements in the Iterator. */ SPL_METHOD(Array, count) { - long count; + php_int_t count; spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { @@ -1808,7 +1808,7 @@ SPL_METHOD(Array, unserialize) outexcept: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %ld of %d bytes", (long)((char*)p - buf), buf_len); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset " ZEND_INT_FMT " of " ZEND_UINT_FMT " bytes", (php_int_t)((char*)p - buf), buf_len); return; } /* }}} */ diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 3303fbdeaeb..49812581323 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -43,7 +43,7 @@ ZEND_GET_MODULE(spl_fixedarray) #endif typedef struct _spl_fixedarray { /* {{{ */ - long size; + php_int_t size; zval **elements; } spl_fixedarray; /* }}} */ @@ -75,7 +75,7 @@ typedef struct _spl_fixedarray_it { /* {{{ */ #define SPL_FIXEDARRAY_OVERLOADED_CURRENT 0x0008 #define SPL_FIXEDARRAY_OVERLOADED_NEXT 0x0010 -static void spl_fixedarray_init(spl_fixedarray *array, long size TSRMLS_DC) /* {{{ */ +static void spl_fixedarray_init(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */ { if (size > 0) { array->size = 0; /* reset size in case ecalloc() fails */ @@ -88,7 +88,7 @@ static void spl_fixedarray_init(spl_fixedarray *array, long size TSRMLS_DC) /* { } /* }}} */ -static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* {{{ */ +static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */ { if (size == array->size) { /* nothing to do */ @@ -103,7 +103,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* /* clearing the array */ if (size == 0) { - long i; + php_int_t i; for (i = 0; i < array->size; i++) { if (array->elements[i]) { @@ -119,7 +119,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* array->elements = erealloc(array->elements, sizeof(zval *) * size); memset(array->elements + array->size, '\0', sizeof(zval *) * (size - array->size)); } else { /* size < array->size */ - long i; + php_int_t i; for (i = size; i < array->size; i++) { if (array->elements[i]) { @@ -196,7 +196,7 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj TSRMLS_DC) /* { static void spl_fixedarray_object_free_storage(void *object TSRMLS_DC) /* {{{ */ { spl_fixedarray_object *intern = (spl_fixedarray_object *)object; - long i; + php_int_t i; if (intern->array) { for (i = 0; i < intern->array->size; i++) { @@ -343,7 +343,7 @@ static zend_object_value spl_fixedarray_object_clone(zval *zobject TSRMLS_DC) /* static inline zval **spl_fixedarray_object_read_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; /* we have to return NULL on error here to avoid memleak because of * ZE duplicating uninitialized_zval_ptr */ @@ -404,7 +404,7 @@ static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, in static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_object *intern, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; if (!offset) { /* '$array[] = value' syntax is not supported */ @@ -456,7 +456,7 @@ static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zv static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; if (Z_TYPE_P(offset) != IS_LONG) { index = spl_offset_convert_to_long(offset TSRMLS_CC); @@ -496,7 +496,7 @@ static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset TSR static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_object *intern, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; int retval; if (Z_TYPE_P(offset) != IS_LONG) { @@ -549,7 +549,7 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c } /* }}} */ -static int spl_fixedarray_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ +static int spl_fixedarray_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ { spl_fixedarray_object *intern; @@ -562,7 +562,7 @@ static int spl_fixedarray_object_count_elements(zval *object, long *count TSRMLS MAKE_STD_ZVAL(intern->retval); ZVAL_ZVAL(intern->retval, rv, 1, 1); convert_to_long(intern->retval); - *count = (long) Z_LVAL_P(intern->retval); + *count = (php_int_t) Z_LVAL_P(intern->retval); return SUCCESS; } } else if (intern->array) { @@ -704,13 +704,13 @@ SPL_METHOD(SplFixedArray, fromArray) zval **element, *value; char *str_index; zend_uint_t num_index, max_index = 0; - long tmp; + php_int_t tmp; for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(data)); zend_hash_get_current_data(Z_ARRVAL_P(data), (void **) &element) == SUCCESS; zend_hash_move_forward(Z_ARRVAL_P(data)) ) { - if (zend_hash_get_current_key(Z_ARRVAL_P(data), &str_index, &num_index, 0) != HASH_KEY_IS_LONG || (long)num_index < 0) { + if (zend_hash_get_current_key(Z_ARRVAL_P(data), &str_index, &num_index, 0) != HASH_KEY_IS_LONG || (php_int_t)num_index < 0) { efree(array); zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "array must contain only positive integer keys"); return; @@ -743,7 +743,7 @@ SPL_METHOD(SplFixedArray, fromArray) } else if (num > 0 && !save_indexes) { zval **element, *value; - long i = 0; + php_int_t i = 0; spl_fixedarray_init(array, num TSRMLS_CC); diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index f44f80d13b6..2a975ae7ee4 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -688,7 +688,7 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator) SPL_METHOD(RecursiveIteratorIterator, getInnerIterator) { spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - long level = object->level; + php_int_t level = object->level; if (zend_parse_parameters_none() == FAILURE) { return; @@ -833,7 +833,7 @@ static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char { union _zend_function *function_handler; spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC); - long level = object->level; + php_int_t level = object->level; zval *zobj; if (!object->iterators) { @@ -1318,7 +1318,7 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) } p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (php_uint_t) *p; func_params = safe_emalloc(sizeof(zval **), arg_count, 0); @@ -2419,7 +2419,7 @@ static inline int spl_limit_it_valid(spl_dual_it_object *intern TSRMLS_DC) } } -static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS_DC) +static inline void spl_limit_it_seek(spl_dual_it_object *intern, php_int_t pos TSRMLS_DC) { zval *zpos; @@ -3536,7 +3536,7 @@ PHP_FUNCTION(iterator_to_array) static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */ { - (*(long*)puser)++; + (*(php_int_t*)puser)++; return ZEND_HASH_APPLY_KEEP; } /* }}} */ @@ -3546,7 +3546,7 @@ static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRM PHP_FUNCTION(iterator_count) { zval *obj; - long count = 0; + php_int_t count = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) { RETURN_FALSE; @@ -3561,7 +3561,7 @@ PHP_FUNCTION(iterator_count) typedef struct { zval *obj; zval *args; - long count; + php_int_t count; zend_fcall_info fci; zend_fcall_info_cache fcc; } spl_iterator_apply_info; diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index c99b2001f30..0315e1fa809 100644 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -139,11 +139,11 @@ typedef struct _spl_dual_it_object { dual_it_type dit_type; union { struct { - long offset; - long count; + php_int_t offset; + php_int_t count; } limit; struct { - long flags; /* CIT_* */ + php_int_t flags; /* CIT_* */ zval *zstr; zval *zchildren; zval *zcache; @@ -155,9 +155,9 @@ typedef struct _spl_dual_it_object { #if HAVE_PCRE || HAVE_BUNDLED_PCRE struct { int use_flags; - long flags; + php_int_t flags; regex_mode mode; - long preg_flags; + php_int_t preg_flags; pcre_cache_entry *pce; char *regex; zend_str_size_uint regex_len;