summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-08-17 13:31:39 +0200
committerAnatol Belski <ab@php.net>2014-08-17 13:31:39 +0200
commit90d6f60bc17bb4fea69feeab506eb02bfeec20fd (patch)
treef759964466d23656e796bd79964a424464655ee2
parent977cf1dc11da0363692374951088696855ae293d (diff)
downloadphp-git-90d6f60bc17bb4fea69feeab506eb02bfeec20fd.tar.gz
mostly fixes to spl, but also some other
-rw-r--r--Zend/zend.h2
-rw-r--r--Zend/zend_API.c2
-rw-r--r--Zend/zend_virtual_cwd.c4
-rw-r--r--ext/pcre/php_pcre.c6
-rw-r--r--ext/spl/spl_array.c48
-rw-r--r--ext/spl/spl_directory.c42
-rw-r--r--ext/spl/spl_directory.h4
-rw-r--r--ext/spl/spl_dllist.c28
-rw-r--r--ext/spl/spl_engine.c4
-rw-r--r--ext/spl/spl_engine.h2
-rw-r--r--ext/spl/spl_fixedarray.c38
-rw-r--r--ext/spl/spl_functions.h2
-rw-r--r--ext/spl/spl_heap.c14
-rw-r--r--ext/spl/spl_iterators.c68
-rw-r--r--ext/spl/spl_iterators.h10
-rw-r--r--ext/spl/spl_observer.c22
-rw-r--r--ext/standard/crypt_sha256.c2
-rw-r--r--ext/standard/crypt_sha512.c2
-rw-r--r--ext/standard/filestat.c4
-rw-r--r--ext/standard/filters.c2
-rw-r--r--ext/standard/fsock.c4
-rw-r--r--ext/standard/quot_print.c2
-rw-r--r--main/php_variables.c2
-rw-r--r--main/php_variables.h2
-rw-r--r--main/rfc1867.c4
25 files changed, 160 insertions, 160 deletions
diff --git a/Zend/zend.h b/Zend/zend.h
index 3f3d4ce3ac..731a8e5a81 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -655,7 +655,7 @@ extern ZEND_API void (*zend_ticks_function)(int ticks TSRMLS_DC);
extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
extern ZEND_API void (*zend_on_timeout)(int seconds TSRMLS_DC);
extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
-extern zend_int_t (*zend_vspprintf)(char **pbuf, zend_size_t max_len, const char *format, va_list ap);
+extern zend_size_t (*zend_vspprintf)(char **pbuf, zend_size_t max_len, const char *format, va_list ap);
extern zend_string *(*zend_vstrpprintf)(zend_size_t max_len, const char *format, va_list ap);
extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index b04de2514a..4bd8760e6a 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2906,7 +2906,7 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
int name_len = name->len;
zend_string *lcname;
ALLOCA_FLAG(use_heap);
- __debugbreak();
+
STR_ALLOCA_ALLOC(lcname, name_len, use_heap);
zend_str_tolower_copy(lcname->val, name->val, name_len + 1);
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index 1b12f6f0b9..92613c7420 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -178,7 +178,7 @@ static int php_check_dots(const char *element, int n)
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
typedef struct {
- unsigned long ReparseTag;
+ zend_uint_t ReparseTag;
unsigned short ReparseDataLength;
unsigned short Reserved;
union {
@@ -187,7 +187,7 @@ typedef struct {
unsigned short SubstituteNameLength;
unsigned short PrintNameOffset;
unsigned short PrintNameLength;
- unsigned long Flags;
+ zend_uint_t Flags;
wchar_t ReparseTarget[1];
} SymbolicLinkReparseBuffer;
struct {
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 3ff51978c9..3990580640 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1437,10 +1437,10 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
php_int_t limit = -1;
zend_string *result;
zend_string *string_key;
- ulong num_key;
+ php_uint_t num_key;
zend_string *callback_name;
int replace_count=0, old_replace_count;
-
+
#ifndef FAST_ZPP
/* Get function parameters and do error-checking. */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|iz/", &regex, &replace, &subject, &limit, &zcount) == FAILURE) {
@@ -1898,7 +1898,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
int size_offsets; /* Size of the offsets array */
int count = 0; /* Count of matched subpatterns */
zend_string *string_key;
- ulong num_key;
+ php_uint_t num_key;
zend_bool invert; /* Whether to return non-matching
entries */
ALLOCA_FLAG(use_heap);
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index d81ad6275f..23f48c802f 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -300,7 +300,7 @@ static zend_object *spl_array_object_clone(zval *zobject TSRMLS_DC)
static zval *spl_array_get_dimension_ptr(int check_inherited, zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */
{
zval *retval;
- long index;
+ php_int_t index;
zend_string *offset_key;
spl_array_object *intern = Z_SPLARRAY_P(object);
HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
@@ -360,11 +360,11 @@ fetch_dim_string:
}
return retval;
case IS_RESOURCE:
- zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle);
+ zend_error(E_STRICT, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle);
index = Z_RES_P(offset)->handle;
goto num_index;
case IS_DOUBLE:
- index = (long)Z_DVAL_P(offset);
+ index = (php_int_t)Z_DVAL_P(offset);
goto num_index;
case IS_FALSE:
index = 0;
@@ -378,13 +378,13 @@ num_index:
if ((retval = zend_hash_index_find(ht, index)) == NULL) {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE, "Undefined offset: %ld", index);
+ zend_error(E_NOTICE, "Undefined offset: %pd", index);
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE, "Undefined offset: %ld", index);
+ zend_error(E_NOTICE, "Undefined offset: %pd", index);
case BP_VAR_W: {
zval value;
ZVAL_UNDEF(&value);
@@ -450,7 +450,7 @@ static zval *spl_array_read_dimension(zval *object, zval *offset, int type, zval
static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
- long index;
+ php_int_t index;
HashTable *ht;
if (check_inherited && intern->fptr_offset_set) {
@@ -535,7 +535,7 @@ static void spl_array_write_dimension(zval *object, zval *offset, zval *value TS
static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset TSRMLS_DC) /* {{{ */
{
- long index;
+ php_int_t index;
HashTable *ht;
spl_array_object *intern = Z_SPLARRAY_P(object);
@@ -585,7 +585,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval
}
break;
case IS_DOUBLE:
- index = (long)Z_DVAL_P(offset);
+ index = (php_int_t)Z_DVAL_P(offset);
goto num_index;
case IS_RESOURCE:
index = Z_RES_HANDLE_P(offset);
@@ -605,7 +605,7 @@ num_index:
return;
}
if (zend_hash_index_del(ht, index) == FAILURE) {
- zend_error(E_NOTICE,"Undefined offset: %ld", index);
+ zend_error(E_NOTICE,"Undefined offset: %pd", index);
}
break;
default:
@@ -623,7 +623,7 @@ static void spl_array_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* {
static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */
{
spl_array_object *intern = Z_SPLARRAY_P(object);
- long index;
+ php_int_t index;
zval rv, *value = NULL, *tmp;
if (check_inherited && intern->fptr_offset_has) {
@@ -664,7 +664,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o
break;
case IS_DOUBLE:
- index = (long)Z_DVAL_P(offset);
+ index = (php_int_t)Z_DVAL_P(offset);
goto num_index;
case IS_RESOURCE:
index = Z_RES_HANDLE_P(offset);
@@ -1141,7 +1141,7 @@ static void spl_array_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
/* }}} */
/* {{{ spl_array_set_array */
-static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, long ar_flags, int just_array TSRMLS_DC) {
+static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, php_int_t ar_flags, int just_array TSRMLS_DC) {
if (Z_TYPE_P(array) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(array);
@@ -1223,7 +1223,7 @@ SPL_METHOD(Array, __construct)
zval *object = getThis();
spl_array_object *intern;
zval *array;
- long ar_flags = 0;
+ php_int_t ar_flags = 0;
zend_class_entry *ce_get_iterator = spl_ce_Iterator;
zend_error_handling error_handling;
@@ -1312,9 +1312,9 @@ SPL_METHOD(Array, setFlags)
{
zval *object = getThis();
spl_array_object *intern = Z_SPLARRAY_P(object);
- long ar_flags = 0;
+ php_int_t ar_flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ar_flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ar_flags) == FAILURE) {
return;
}
@@ -1381,13 +1381,13 @@ SPL_METHOD(Array, rewind)
Seek to position. */
SPL_METHOD(Array, seek)
{
- long opos, position;
+ php_int_t opos, position;
zval *object = getThis();
spl_array_object *intern = Z_SPLARRAY_P(object);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
int result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &position) == FAILURE) {
return;
}
@@ -1408,10 +1408,10 @@ SPL_METHOD(Array, seek)
return; /* ok */
}
}
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", opos);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %pd 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;
@@ -1439,7 +1439,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 = Z_SPLARRAY_P(object);
@@ -1450,7 +1450,7 @@ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{
zval_ptr_dtor(&intern->retval);
ZVAL_ZVAL(&intern->retval, &rv, 0, 0);
convert_to_int(&intern->retval);
- *count = (long)Z_IVAL(intern->retval);
+ *count = (php_int_t)Z_IVAL(intern->retval);
return SUCCESS;
}
*count = 0;
@@ -1464,7 +1464,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 = Z_SPLARRAY_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
@@ -1781,7 +1781,7 @@ SPL_METHOD(Array, unserialize)
php_unserialize_data_t var_hash;
zval members, zflags;
HashTable *aht;
- long flags;
+ php_int_t flags;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
return;
@@ -1861,7 +1861,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 %pd of %d bytes", (php_int_t)((char*)p - buf), buf_len);
return;
} /* }}} */
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index f0c377bd33..9c940433df 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -671,19 +671,19 @@ zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend
#define DIT_CTOR_FLAGS 0x00000001
#define DIT_CTOR_GLOB 0x00000002
-void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_flags) /* {{{ */
+void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, php_int_t ctor_flags) /* {{{ */
{
spl_filesystem_object *intern;
char *path;
int parsed, len;
- long flags;
+ php_int_t flags;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);
if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) {
flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO;
- parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags);
+ parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &path, &len, &flags);
} else {
flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF;
parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len);
@@ -813,9 +813,9 @@ SPL_METHOD(DirectoryIterator, seek)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
zval retval;
- long pos;
+ php_int_t pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pos) == FAILURE) {
return;
}
@@ -1453,9 +1453,9 @@ SPL_METHOD(FilesystemIterator, getFlags)
SPL_METHOD(FilesystemIterator, setFlags)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- long flags;
+ php_int_t flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) {
return;
}
@@ -2025,7 +2025,7 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS
{
char *buf;
size_t line_len = 0;
- long line_add = (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) ? 1 : 0;
+ php_int_t line_add = (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) ? 1 : 0;
spl_filesystem_file_free_line(intern TSRMLS_CC);
@@ -2319,14 +2319,14 @@ SPL_METHOD(SplFileObject, __construct)
Construct a new temp file object */
SPL_METHOD(SplTempFileObject, __construct)
{
- long max_memory = PHP_STREAM_MAX_MEM;
+ php_int_t max_memory = PHP_STREAM_MAX_MEM;
char tmp_fname[48];
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_memory) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &max_memory) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@@ -2537,7 +2537,7 @@ SPL_METHOD(SplFileObject, getMaxLineLen)
return;
}
- RETURN_INT((long)intern->u.file.max_line_len);
+ RETURN_INT((php_int_t)intern->u.file.max_line_len);
} /* }}} */
/* {{{ proto bool SplFileObject::hasChildren()
@@ -2740,7 +2740,7 @@ SPL_METHOD(SplFileObject, fflush)
SPL_METHOD(SplFileObject, ftell)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- long ret;
+ php_int_t ret;
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized");
@@ -2761,9 +2761,9 @@ SPL_METHOD(SplFileObject, ftell)
SPL_METHOD(SplFileObject, fseek)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- long pos, whence = SEEK_SET;
+ php_int_t pos, whence = SEEK_SET;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &pos, &whence) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &pos, &whence) == FAILURE) {
return;
}
@@ -2869,9 +2869,9 @@ SPL_METHOD(SplFileObject, fwrite)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char *str;
int str_len;
- long length = 0;
+ php_int_t length = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &length) == FAILURE) {
return;
}
@@ -2926,9 +2926,9 @@ FileFunction(fstat)
SPL_METHOD(SplFileObject, ftruncate)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- long size;
+ php_int_t size;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &size) == FAILURE) {
return;
}
@@ -2950,9 +2950,9 @@ SPL_METHOD(SplFileObject, ftruncate)
SPL_METHOD(SplFileObject, seek)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
- long line_pos;
+ php_int_t line_pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &line_pos) == FAILURE) {
return;
}
if(!intern->u.file.stream) {
@@ -2961,7 +2961,7 @@ SPL_METHOD(SplFileObject, seek)
}
if (line_pos < 0) {
- zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos);
+ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %pd", intern->file_name, line_pos);
RETURN_FALSE;
}
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index 3276d51463..a958e30874 100644
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.h
@@ -68,7 +68,7 @@ struct _spl_filesystem_object {
char *file_name;
int file_name_len;
SPL_FS_OBJ_TYPE type;
- long flags;
+ php_int_t flags;
zend_class_entry *file_class;
zend_class_entry *info_class;
union {
@@ -93,7 +93,7 @@ struct _spl_filesystem_object {
char *current_line;
size_t current_line_len;
size_t max_line_len;
- long current_line_num;
+ php_int_t current_line_num;
zval zresource;
zend_function *func_getCurr;
char delimiter;
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index e6dcc53691..49b7271c22 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -143,9 +143,9 @@ static spl_ptr_llist *spl_ptr_llist_init(spl_ptr_llist_ctor_func ctor, spl_ptr_l
}
/* }}} */
-static long spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */
+static php_int_t spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */
{
- return (long)llist->count;
+ return (php_int_t)llist->count;
}
/* }}} */
@@ -167,7 +167,7 @@ static void spl_ptr_llist_destroy(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */
}
/* }}} */
-static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, long offset, int backward) /* {{{ */
+static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, php_int_t offset, int backward) /* {{{ */
{
spl_ptr_llist_element *current;
@@ -474,7 +474,7 @@ static zend_object *spl_dllist_object_clone(zval *zobject TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int spl_dllist_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
+static int spl_dllist_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */
{
spl_dllist_object *intern = Z_SPLDLLIST_P(object);
@@ -485,7 +485,7 @@ static int spl_dllist_object_count_elements(zval *object, long *count TSRMLS_DC)
zval_ptr_dtor(&intern->retval);
ZVAL_ZVAL(&intern->retval, &rv, 0, 0);
convert_to_int(&intern->retval);
- *count = (long) Z_IVAL(intern->retval);
+ *count = (php_int_t) Z_IVAL(intern->retval);
return SUCCESS;
}
*count = 0;
@@ -673,7 +673,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom)
Return the number of elements in the datastructure. */
SPL_METHOD(SplDoublyLinkedList, count)
{
- long count;
+ php_int_t count;
spl_dllist_object *intern = Z_SPLDLLIST_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
@@ -689,7 +689,7 @@ SPL_METHOD(SplDoublyLinkedList, count)
Return true if the SplDoublyLinkedList is empty. */
SPL_METHOD(SplDoublyLinkedList, isEmpty)
{
- long count;
+ php_int_t count;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -704,10 +704,10 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty)
Set the mode of iteration */
SPL_METHOD(SplDoublyLinkedList, setIteratorMode)
{
- long value;
+ php_int_t value;
spl_dllist_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) == FAILURE) {
return;
}
@@ -747,7 +747,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists)
{
zval *zindex;
spl_dllist_object *intern;
- long index;
+ php_int_t index;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zindex) == FAILURE) {
return;
@@ -764,7 +764,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists)
SPL_METHOD(SplDoublyLinkedList, offsetGet)
{
zval *zindex;
- long index;
+ php_int_t index;
spl_dllist_object *intern;
spl_ptr_llist_element *element;
@@ -808,7 +808,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
spl_ptr_llist_push(intern->llist, value TSRMLS_CC);
} else {
/* $obj[$foo] = ... */
- long index;
+ php_int_t index;
spl_ptr_llist_element *element;
index = spl_offset_convert_to_int(zindex TSRMLS_CC);
@@ -849,7 +849,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
SPL_METHOD(SplDoublyLinkedList, offsetUnset)
{
zval *zindex;
- long index;
+ php_int_t index;
spl_dllist_object *intern;
spl_ptr_llist_element *element;
spl_ptr_llist *llist;
@@ -1221,7 +1221,7 @@ SPL_METHOD(SplDoublyLinkedList, add)
zval *zindex, *value;
spl_dllist_object *intern;
spl_ptr_llist_element *element;
- long index;
+ php_int_t index;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &zindex, &value) == FAILURE) {
return;
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index b0d9a8a1ee..1cae08e652 100644
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -40,7 +40,7 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
}
/* }}} */
-PHPAPI long spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */
+PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */
{
php_uint_t idx;
@@ -51,7 +51,7 @@ PHPAPI long spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */
}
break;
case IS_DOUBLE:
- return (long)Z_DVAL_P(offset);
+ return (php_int_t)Z_DVAL_P(offset);
case IS_INT:
return Z_IVAL_P(offset);
case IS_FALSE:
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
index 1ddf6bcff3..f5a58e835e 100644
--- a/ext/spl/spl_engine.h
+++ b/ext/spl/spl_engine.h
@@ -27,7 +27,7 @@
PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC);
-PHPAPI long spl_offset_convert_to_int(zval *offset TSRMLS_DC);
+PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC);
/* {{{ spl_instantiate_arg_ex1 */
static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, zval *arg1 TSRMLS_DC)
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 8b3486d627..6109b35b6d 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;
/* }}} */
@@ -81,7 +81,7 @@ static inline spl_fixedarray_object *spl_fixed_array_from_obj(zend_object *obj)
#define Z_SPLFIXEDARRAY_P(zv) spl_fixed_array_from_obj(Z_OBJ_P((zv)))
-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 */
@@ -94,7 +94,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 */
@@ -109,7 +109,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++) {
zval_ptr_dtor(&(array->elements[i]));
@@ -123,7 +123,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /*
array->elements = safe_erealloc(array->elements, size, sizeof(zval), 0);
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++) {
zval_ptr_dtor(&(array->elements[i]));
@@ -194,7 +194,7 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj TSRMLS_DC) /* {
static void spl_fixedarray_object_free_storage(zend_object *object TSRMLS_DC) /* {{{ */
{
spl_fixedarray_object *intern = spl_fixed_array_from_obj(object);
- long i;
+ php_int_t i;
if (intern->array) {
for (i = 0; i < intern->array->size; i++) {
@@ -328,7 +328,7 @@ static zend_object *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 */
@@ -384,7 +384,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 */
@@ -438,7 +438,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_INT) {
index = spl_offset_convert_to_int(offset TSRMLS_CC);
@@ -476,7 +476,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_INT) {
@@ -528,7 +528,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;
@@ -540,7 +540,7 @@ static int spl_fixedarray_object_count_elements(zval *object, long *count TSRMLS
zval_ptr_dtor(&intern->retval);
ZVAL_ZVAL(&intern->retval, &rv, 0, 0);
convert_to_int(&intern->retval);
- *count = (long) Z_IVAL(intern->retval);
+ *count = (php_int_t) Z_IVAL(intern->retval);
return SUCCESS;
}
} else if (intern->array) {
@@ -559,9 +559,9 @@ SPL_METHOD(SplFixedArray, __construct)
{
zval *object = getThis();
spl_fixedarray_object *intern;
- long size = 0;
+ php_int_t size = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &size) == FAILURE) {
return;
}
@@ -684,11 +684,11 @@ SPL_METHOD(SplFixedArray, fromArray)
if (num > 0 && save_indexes) {
zval *element;
zend_string *str_index;
- ulong num_index, max_index = 0;
- long tmp;
+ php_uint_t num_index, max_index = 0;
+ php_int_t tmp;
ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(data), num_index, str_index) {
- if (str_index != NULL || (long)num_index < 0) {
+ if (str_index != NULL || (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;
@@ -714,7 +714,7 @@ SPL_METHOD(SplFixedArray, fromArray)
} else if (num > 0 && !save_indexes) {
zval *element;
- long i = 0;
+ php_int_t i = 0;
spl_fixedarray_init(array, num TSRMLS_CC);
@@ -759,7 +759,7 @@ SPL_METHOD(SplFixedArray, setSize)
{
zval *object = getThis();
spl_fixedarray_object *intern;
- long size;
+ php_int_t size;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) {
return;
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
index 568984f928..f3d8f26a07 100644
--- a/ext/spl/spl_functions.h
+++ b/ext/spl/spl_functions.h
@@ -47,7 +47,7 @@ typedef zend_object* (*create_object_func_t)(zend_class_entry *class_type TSRMLS
spl_register_property(spl_ce_ ## class_name, prop_name, sizeof(prop_name)-1, prop_flags TSRMLS_CC);
#define REGISTER_SPL_CLASS_CONST_INT(class_name, const_name, value) \
- zend_declare_class_constant_int(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
+ zend_declare_class_constant_int(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC);
void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC);
void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC);
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index 90fa9af9ed..1dbfe935ff 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -105,7 +105,7 @@ static void spl_ptr_heap_zval_ctor(zval *elem TSRMLS_DC) { /* {{{ */
}
/* }}} */
-static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, long *result TSRMLS_DC) { /* {{{ */
+static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, php_int_t *result TSRMLS_DC) { /* {{{ */
zval zresult;
zend_call_method_with_2_params(object, heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b);
@@ -155,7 +155,7 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) {
if (object) {
spl_heap_object *heap_object = Z_SPLHEAP_P(object);
if (heap_object->fptr_cmp) {
- long lval = 0;
+ php_int_t lval = 0;
if (spl_ptr_heap_cmp_cb_helper(object, heap_object, a, b, &lval TSRMLS_CC) == FAILURE) {
/* exception or call failure */
return 0;
@@ -179,7 +179,7 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) {
if (object) {
spl_heap_object *heap_object = Z_SPLHEAP_P(object);
if (heap_object->fptr_cmp) {
- long lval = 0;
+ php_int_t lval = 0;
if (spl_ptr_heap_cmp_cb_helper(object, heap_object, a, b, &lval TSRMLS_CC) == FAILURE) {
/* exception or call failure */
return 0;
@@ -210,7 +210,7 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { /
if (object) {
spl_heap_object *heap_object = Z_SPLHEAP_P(object);
if (heap_object->fptr_cmp) {
- long lval = 0;
+ php_int_t lval = 0;
if (spl_ptr_heap_cmp_cb_helper((zval *)object, heap_object, a_priority_p, b_priority_p, &lval TSRMLS_CC) == FAILURE) {
/* exception or call failure */
return 0;
@@ -572,7 +572,7 @@ static HashTable* spl_pqueue_object_get_debug_info(zval *obj, int *is_temp TSRML
Return the number of elements in the heap. */
SPL_METHOD(SplHeap, count)
{
- long count;
+ php_int_t count;
spl_heap_object *intern = Z_SPLHEAP_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
@@ -765,10 +765,10 @@ SPL_METHOD(SplPriorityQueue, top)
Set the flags of extraction*/
SPL_METHOD(SplPriorityQueue, setExtractFlags)
{
- long value;
+ php_int_t value;
spl_heap_object *intern;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) == FAILURE) {
return;
}
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 1c8c942753..87cdb70007 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -473,7 +473,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
spl_recursive_it_object *intern;
zval *iterator;
zend_class_entry *ce_iterator;
- long mode, flags;
+ php_int_t mode, flags;
int inc_refcount = 1;
zend_error_handling error_handling;
@@ -486,7 +486,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
mode = RIT_SELF_FIRST;
flags = RTIT_BYPASS_KEY;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|izi", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
zval *aggregate = iterator;
zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", iterator);
@@ -515,7 +515,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
mode = RIT_LEAVES_ONLY;
flags = 0;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ll", &iterator, &mode, &flags) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ii", &iterator, &mode, &flags) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
zval *aggregate = iterator;
zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", iterator);
@@ -703,9 +703,9 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth)
SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
{
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis());
- long level = object->level;
+ php_int_t level = object->level;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &level) == FAILURE) {
return;
}
if (level < 0 || level > object->level) {
@@ -846,9 +846,9 @@ SPL_METHOD(RecursiveIteratorIterator, nextElement)
SPL_METHOD(RecursiveIteratorIterator, setMaxDepth)
{
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis());
- long max_depth = -1;
+ php_int_t max_depth = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_depth) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &max_depth) == FAILURE) {
return;
}
if (max_depth < -1) {
@@ -879,7 +879,7 @@ static union _zend_function *spl_recursive_it_get_method(zend_object **zobject,
{
union _zend_function *function_handler;
spl_recursive_it_object *object = spl_recursive_it_from_obj(*zobject);
- long level = object->level;
+ php_int_t level = object->level;
zval *zobj;
if (!object->iterators) {
@@ -1088,12 +1088,12 @@ SPL_METHOD(RecursiveTreeIterator, __construct)
Sets prefix parts as used in getPrefix() */
SPL_METHOD(RecursiveTreeIterator, setPrefixPart)
{
- long part;
+ php_int_t part;
char* prefix;
int prefix_len;
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis());
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &part, &prefix, &prefix_len) == FAILURE) {
return;
}
@@ -1387,7 +1387,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);
@@ -1457,7 +1457,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_LimitIterator: {
intern->u.limit.offset = 0; /* start at beginning */
intern->u.limit.count = -1; /* get all */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ii", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@@ -1475,8 +1475,8 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
}
case DIT_CachingIterator:
case DIT_RecursiveCachingIterator: {
- long flags = CIT_CALL_TOSTRING;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &zobject, ce_inner, &flags) == FAILURE) {
+ php_int_t flags = CIT_CALL_TOSTRING;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|i", &zobject, ce_inner, &flags) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@@ -1539,17 +1539,17 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_RegexIterator:
case DIT_RecursiveRegexIterator: {
zend_string *regex;
- long mode = REGIT_MODE_MATCH;
+ php_int_t mode = REGIT_MODE_MATCH;
intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5;
intern->u.regex.flags = 0;
intern->u.regex.preg_flags = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|lll", &zobject, ce_inner, &regex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|iii", &zobject, ce_inner, &regex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
if (mode < 0 || mode >= REGIT_MODE_MAX) {
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %ld", mode);
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %pd", mode);
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
@@ -2159,14 +2159,14 @@ SPL_METHOD(RegexIterator, getMode)
SPL_METHOD(RegexIterator, setMode)
{
spl_dual_it_object *intern;
- long mode;
+ php_int_t mode;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &mode) == FAILURE) {
return;
}
if (mode < 0 || mode >= REGIT_MODE_MAX) {
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %ld", mode);
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %pd", mode);
return;/* NULL */
}
@@ -2195,9 +2195,9 @@ SPL_METHOD(RegexIterator, getFlags)
SPL_METHOD(RegexIterator, setFlags)
{
spl_dual_it_object *intern;
- long flags;
+ php_int_t flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) {
return;
}
@@ -2230,9 +2230,9 @@ SPL_METHOD(RegexIterator, getPregFlags)
SPL_METHOD(RegexIterator, setPregFlags)
{
spl_dual_it_object *intern;
- long preg_flags;
+ php_int_t preg_flags;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &preg_flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &preg_flags) == FAILURE) {
return;
}
@@ -2472,17 +2472,17 @@ 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;
spl_dual_it_free(intern TSRMLS_CC);
if (pos < intern->u.limit.offset) {
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %pd which is below the offset %pd", pos, intern->u.limit.offset);
return;
}
if (pos >= intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offset %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %pd which is behind offset %pd plus count %pd", pos, intern->u.limit.offset, intern->u.limit.count);
return;
}
if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) {
@@ -2560,9 +2560,9 @@ SPL_METHOD(LimitIterator, next)
SPL_METHOD(LimitIterator, seek)
{
spl_dual_it_object *intern;
- long pos;
+ php_int_t pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pos) == FAILURE) {
return;
}
@@ -2938,11 +2938,11 @@ SPL_METHOD(CachingIterator, getFlags)
SPL_METHOD(CachingIterator, setFlags)
{
spl_dual_it_object *intern;
- long flags;
+ php_int_t flags;
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) {
return;
}
@@ -3574,7 +3574,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;
}
/* }}} */
@@ -3584,7 +3584,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;
@@ -3599,7 +3599,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 f51fc3a990..851436350b 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;
zend_string *regex;
} regex;
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index fcc6af387c..77bb9d11af 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -81,9 +81,9 @@ PHPAPI zend_object_handlers spl_handler_SplObjectStorage;
typedef struct _spl_SplObjectStorage { /* {{{ */
HashTable storage;
- long index;
+ php_int_t index;
HashPosition pos;
- long flags;
+ php_int_t flags;
zend_function *fptr_get_hash;
HashTable *debug_info;
zend_object std;
@@ -603,14 +603,14 @@ SPL_METHOD(SplObjectStorage, contains)
SPL_METHOD(SplObjectStorage, count)
{
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis());
- long mode = COUNT_NORMAL;
+ php_int_t mode = COUNT_NORMAL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) {
return;
}
if (mode == COUNT_RECURSIVE) {
- long ret = zend_hash_num_elements(&intern->storage);
+ php_int_t ret = zend_hash_num_elements(&intern->storage);
zval *element;
ZEND_HASH_FOREACH_VAL(&intern->storage, element) {
@@ -800,7 +800,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
php_unserialize_data_t var_hash;
zval entry, pmembers, pcount, inf;
spl_SplObjectStorageElement *element;
- long count;
+ php_int_t count;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) {
return;
@@ -909,7 +909,7 @@ SPL_METHOD(SplObjectStorage, 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 %ld of %d bytes", (php_int_t)((char*)p - buf), buf_len);
return;
} /* }}} */
@@ -986,12 +986,12 @@ typedef enum {
SPL_METHOD(MultipleIterator, __construct)
{
spl_SplObjectStorage *intern;
- long flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC;
+ php_int_t flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flags) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
@@ -1022,7 +1022,7 @@ SPL_METHOD(MultipleIterator, setFlags)
spl_SplObjectStorage *intern;
intern = Z_SPLOBJSTORAGE_P(getThis());
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &intern->flags) == FAILURE) {
return;
}
}
@@ -1118,7 +1118,7 @@ SPL_METHOD(MultipleIterator, valid)
spl_SplObjectStorage *intern;
spl_SplObjectStorageElement *element;
zval *it, retval;
- long expect, valid;
+ php_int_t expect, valid;
intern = Z_SPLOBJSTORAGE_P(getThis());
diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c
index ccfa66bd60..bf731b256f 100644
--- a/ext/standard/crypt_sha256.c
+++ b/ext/standard/crypt_sha256.c
@@ -372,7 +372,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1) == 0) {
const char *num = salt + sizeof(sha256_rounds_prefix) - 1;
char *endp;
- unsigned long int srounds = strtoul(num, &endp, 10);
+ php_uint_t srounds = ZEND_STRTOUI(num, &endp, 10);
if (*endp == '$') {
salt = endp + 1;
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c
index ebabed9d24..f0732e3e17 100644
--- a/ext/standard/crypt_sha512.c
+++ b/ext/standard/crypt_sha512.c
@@ -405,7 +405,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0) {
const char *num = salt + sizeof(sha512_rounds_prefix) - 1;
char *endp;
- unsigned long int srounds = strtoul(num, &endp, 10);
+ php_uint_t srounds = ZEND_STRTOUI(num, &endp, 10);
if (*endp == '$') {
salt = endp + 1;
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 15af20198e..8e24fec657 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -158,7 +158,7 @@ static int php_disk_total_space(char *path, double *space TSRMLS_DC) /* {{{ */
/* i know - this is ugly, but i works <thies@thieso.net> */
bytestotal = TotalNumberOfBytes.HighPart *
- (double) (((unsigned long)1) << 31) * 2.0 +
+ (double) (((php_uint_t)1) << 31) * 2.0 +
TotalNumberOfBytes.LowPart;
} else { /* If it's not available, we just use GetDiskFreeSpace */
if (GetDiskFreeSpace(path,
@@ -290,7 +290,7 @@ static int php_disk_free_space(char *path, double *space TSRMLS_DC) /* {{{ */
/* i know - this is ugly, but i works <thies@thieso.net> */
bytesfree = FreeBytesAvailableToCaller.HighPart *
- (double) (((unsigned long)1) << 31) * 2.0 +
+ (double) (((php_uint_t)1) << 31) * 2.0 +
FreeBytesAvailableToCaller.LowPart;
} else { /* If it's not available, we just use GetDiskFreeSpace */
if (GetDiskFreeSpace(path,
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index f794cbad38..9a0dc672c4 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -1320,7 +1320,7 @@ static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *fie
static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len)
{
- unsigned long l;
+ php_uint_t l;
php_conv_err_t err;
*pretval = 0;
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index f47331f6af..17163b0234 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -36,7 +36,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
long port = -1;
zval *zerrno = NULL, *zerrstr = NULL;
double timeout = FG(default_socket_timeout);
- unsigned long conv;
+ php_uint_t conv;
struct timeval tv;
char *hashkey = NULL;
php_stream *stream = NULL;
@@ -63,7 +63,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
/* prepare the timeout value for use */
- conv = (unsigned long) (timeout * 1000000.0);
+ conv = (php_uint_t) (timeout * 1000000.0);
tv.tv_sec = conv / 1000000;
tv.tv_usec = conv % 1000000;
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index aa3d256c3a..c2e659d43e 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -147,7 +147,7 @@ PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t lengt
PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t length) /* {{{ */
{
- unsigned long lp = 0;
+ php_uint_t lp = 0;
unsigned char c, *d;
char *hex = "0123456789ABCDEF";
zend_string *ret;
diff --git a/main/php_variables.c b/main/php_variables.c
index 94ec65f7de..8a38e97d60 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -43,7 +43,7 @@ PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_arra
}
/* binary-safe version */
-PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array TSRMLS_DC)
+PHPAPI void php_register_variable_safe(char *var, char *strval, php_size_t str_len, zval *track_vars_array TSRMLS_DC)
{
zval new_entry;
assert(strval != NULL);
diff --git a/main/php_variables.h b/main/php_variables.h
index 2331c582e6..c33308b5a2 100644
--- a/main/php_variables.h
+++ b/main/php_variables.h
@@ -38,7 +38,7 @@ void php_startup_auto_globals(TSRMLS_D);
extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC);
PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array TSRMLS_DC);
/* binary-safe version */
-PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, zval *track_vars_array TSRMLS_DC);
+PHPAPI void php_register_variable_safe(char *var, char *val, php_size_t val_len, zval *track_vars_array TSRMLS_DC);
PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC);
PHPAPI int php_hash_environment(TSRMLS_D);
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 4c0f2adbf3..2d76d6c975 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -58,7 +58,7 @@ static php_rfc1867_basename_t php_rfc1867_basename = NULL;
PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC) = NULL;
-static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC);
+static void safe_php_register_variable(char *var, char *strval, php_size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC);
/* The longest property name we use in an uploaded file array */
#define MAX_SIZE_OF_INDEX sizeof("[tmp_name]")
@@ -161,7 +161,7 @@ static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */
}
/* }}} */
-static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */
+static void safe_php_register_variable(char *var, char *strval, php_size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */
{
if (override_protection || !is_protected_variable(var TSRMLS_CC)) {
php_register_variable_safe(var, strval, val_len, track_vars_array TSRMLS_CC);