diff options
author | Anatol Belski <ab@php.net> | 2014-11-18 21:18:52 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-11-18 21:18:52 +0100 |
commit | c6bad96f306df8e8b656472e618283ced5083cdb (patch) | |
tree | 7e5b52aa07777f0336b0944a228bf66f8f56b31f /ext/spl | |
parent | 4262663e4caa82ba17666781a95bdcb872b4e109 (diff) | |
parent | 64a39dc7b07d4b54d050a3a5c15045fe91c0b651 (diff) | |
download | php-git-c6bad96f306df8e8b656472e618283ced5083cdb.tar.gz |
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (398 commits)
NEWS
add test for bug #68381
Fixed bug #68381 Set FPM log level earlier during init
proper dllexport
move to size_t where zend_string is used internally
fix some datatype mismatches
return after the warning, to fix uninitialized salt usage
fix datatype mismatches
add missing type specifier
fix datatype mismatches
fix unsigned check
"extern" shouldn't be used for definitions
joined identical conditional blocks
simplify fpm tests
SEND_VAR_NO_REF optimization
Add test for bug #68442
Add various tests for FPM - covering recent bugs (68420, 68421, 68423, 68428) - for UDS - for ping and status URI - for multi pool and multi mode
Include small MIT FastCGI client library from https://github.com/adoy/PHP-FastCGI-Client
Get rid of zend_free_op structure (use zval* instead). Get rid of useless TSRMLS arguments.
Add new FPM test for IPv4/IPv6
...
Conflicts:
win32/build/config.w32
Diffstat (limited to 'ext/spl')
-rw-r--r-- | ext/spl/php_spl.c | 8 | ||||
-rw-r--r-- | ext/spl/spl_directory.c | 28 | ||||
-rw-r--r-- | ext/spl/spl_dllist.c | 2 | ||||
-rw-r--r-- | ext/spl/spl_fixedarray.c | 6 | ||||
-rw-r--r-- | ext/spl/spl_heap.c | 12 | ||||
-rw-r--r-- | ext/spl/spl_iterators.c | 15 | ||||
-rw-r--r-- | ext/spl/spl_iterators.h | 2 | ||||
-rw-r--r-- | ext/spl/spl_observer.c | 2 |
8 files changed, 40 insertions, 35 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 1de8e021dd..aa740c40e2 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -255,7 +255,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha zval result; int ret; - class_file_len = spprintf(&class_file, 0, "%s%.*s", lc_name->val, ext_len, ext); + class_file_len = (int)spprintf(&class_file, 0, "%s%.*s", lc_name->val, ext_len, ext); #if DEFAULT_SLASH != '\\' { @@ -320,7 +320,7 @@ PHP_FUNCTION(spl_autoload) pos_len = sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1; } else { pos = file_exts->val; - pos_len = file_exts->len; + pos_len = (int)file_exts->len; } lc_name = zend_string_alloc(class_name->len, 0); @@ -328,7 +328,7 @@ PHP_FUNCTION(spl_autoload) while (pos && *pos && !EG(exception)) { pos1 = strchr(pos, ','); if (pos1) { - pos1_len = pos1 - pos; + pos1_len = (int)(pos1 - pos); } else { pos1_len = pos_len; } @@ -759,7 +759,7 @@ PHPAPI zend_string *php_spl_object_hash(zval *obj TSRMLS_DC) /* {{{*/ if (!SPL_G(hash_mask_init)) { if (!BG(mt_rand_is_seeded)) { - php_mt_srand(GENERATE_SEED() TSRMLS_CC); + php_mt_srand((uint32_t)GENERATE_SEED() TSRMLS_CC); } SPL_G(hash_mask_handle) = (intptr_t)(php_mt_rand(TSRMLS_C) >> 1); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 73588ff1bd..108eafddc4 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -199,7 +199,7 @@ static inline void spl_filesystem_object_get_file_name(spl_filesystem_object *in php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized"); break; case SPL_FS_DIR: - intern->file_name_len = spprintf(&intern->file_name, 0, "%s%c%s", + intern->file_name_len = (int)spprintf(&intern->file_name, 0, "%s%c%s", spl_filesystem_object_get_path(intern, NULL TSRMLS_CC), slash, intern->u.dir.entry.d_name); break; @@ -233,7 +233,7 @@ static void spl_filesystem_dir_open(spl_filesystem_object* intern, char *path TS int skip_dots = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_SKIPDOTS); intern->type = SPL_FS_DIR; - intern->_path_len = strlen(path); + intern->_path_len = (int)strlen(path); intern->u.dir.dirp = php_stream_opendir(path, REPORT_ERRORS, FG(default_context)); if (intern->_path_len > 1 && IS_SLASH_AT(path, intern->_path_len-1)) { @@ -384,7 +384,7 @@ void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, } intern->file_name = use_copy ? estrndup(path, len) : path; - intern->file_name_len = len; + intern->file_name_len = (int)len; while (intern->file_name_len > 1 && IS_SLASH_AT(intern->file_name, intern->file_name_len-1)) { intern->file_name[intern->file_name_len-1] = 0; @@ -398,7 +398,7 @@ void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, p2 = 0; #endif if (p1 || p2) { - intern->_path_len = (p1 > p2 ? p1 : p2) - intern->file_name; + intern->_path_len = (int)((p1 > p2 ? p1 : p2) - intern->file_name); } else { intern->_path_len = 0; } @@ -934,7 +934,8 @@ SPL_METHOD(SplFileInfo, getExtension) p = zend_memrchr(ret->val, '.', ret->len); if (p) { - idx = p - ret->val; + assert(p > ret->val); + idx = (int)(p - ret->val); RETVAL_STRINGL(ret->val + idx + 1, ret->len - idx - 1); zend_string_release(ret); return; @@ -962,7 +963,8 @@ SPL_METHOD(DirectoryIterator, getExtension) p = zend_memrchr(fname->val, '.', fname->len); if (p) { - idx = p - fname->val; + assert(p > fname->val); + idx = (int)(p - fname->val); RETVAL_STRINGL(fname->val + idx + 1, fname->len - idx - 1); zend_string_release(fname); } else { @@ -1389,7 +1391,7 @@ SPL_METHOD(SplFileInfo, getPathInfo) if (path) { char *dpath = estrndup(path, path_len); path_len = php_dirname(dpath, path_len); - spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value TSRMLS_CC); + spl_filesystem_object_create_info(intern, dpath, (int)path_len, 1, ce, return_value TSRMLS_CC); efree(dpath); } } @@ -1516,9 +1518,9 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) subdir = Z_SPLFILESYSTEM_P(return_value); if (subdir) { if (intern->u.dir.sub_path && intern->u.dir.sub_path[0]) { - subdir->u.dir.sub_path_len = spprintf(&subdir->u.dir.sub_path, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name); + subdir->u.dir.sub_path_len = (int)spprintf(&subdir->u.dir.sub_path, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name); } else { - subdir->u.dir.sub_path_len = strlen(intern->u.dir.entry.d_name); + subdir->u.dir.sub_path_len = (int)strlen(intern->u.dir.entry.d_name); subdir->u.dir.sub_path = estrndup(intern->u.dir.entry.d_name, subdir->u.dir.sub_path_len); } subdir->info_class = intern->info_class; @@ -1553,7 +1555,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPathname) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); char *sub_name; - int len; + size_t len; char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH; if (zend_parse_parameters_none() == FAILURE) { @@ -2303,7 +2305,7 @@ SPL_METHOD(SplFileObject, __construct) p2 = 0; #endif if (p1 || p2) { - intern->_path_len = (p1 > p2 ? p1 : p2) - tmp_path; + intern->_path_len = (int)((p1 > p2 ? p1 : p2) - tmp_path); } else { intern->_path_len = 0; } @@ -2627,7 +2629,7 @@ SPL_METHOD(SplFileObject, fputcsv) char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape; char *delim = NULL, *enclo = NULL; size_t d_len = 0, e_len = 0; - int ret; + zend_long ret; zval *fields = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|ss", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) { @@ -2776,7 +2778,7 @@ SPL_METHOD(SplFileObject, fseek) } spl_filesystem_file_free_line(intern TSRMLS_CC); - RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, whence)); + RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, (int)whence)); } /* }}} */ /* {{{ proto int SplFileObject::fgetc() diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 945f7c7ab4..8a61407589 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -1182,7 +1182,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize) goto error; } - intern->flags = Z_LVAL(flags); + intern->flags = (int)Z_LVAL(flags); zval_ptr_dtor(&flags); /* elements */ diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index ee5ef6b990..d63ac2e6e6 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -151,7 +151,7 @@ static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n T if (intern->array) { *table = intern->array->elements; - *n = intern->array->size; + *n = (int)intern->array->size; } else { *table = NULL; *n = 0; @@ -165,10 +165,10 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj TSRMLS_DC) /* { { spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj); HashTable *ht = zend_std_get_properties(obj TSRMLS_CC); - int i = 0; + zend_long i = 0; if (intern->array) { - int j = zend_hash_num_elements(ht); + zend_long j = zend_hash_num_elements(ht); for (i = 0; i < intern->array->size; i++) { if (!Z_ISUNDEF(intern->array->elements[i])) { diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index d29150c1d6..b421c03757 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -160,12 +160,12 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { /* exception or call failure */ return 0; } - return lval; + return lval > 0 ? 1 : (lval < 0 ? -1 : 0); } } compare_function(&result, a, b TSRMLS_CC); - return Z_LVAL(result); + return (int)Z_LVAL(result); } /* }}} */ @@ -184,12 +184,12 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { /* exception or call failure */ return 0; } - return lval; + return lval > 0 ? 1 : (lval < 0 ? -1 : 0); } } compare_function(&result, b, a TSRMLS_CC); - return Z_LVAL(result); + return (int)Z_LVAL(result); } /* }}} */ @@ -215,12 +215,12 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { / /* exception or call failure */ return 0; } - return lval; + return lval > 0 ? 1 : (lval < 0 ? -1 : 0); } } compare_function(&result, a_priority_p, b_priority_p TSRMLS_CC); - return Z_LVAL(result); + return (int)Z_LVAL(result); } /* }}} */ diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 8b09e3ef37..c129115eeb 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -540,7 +540,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla intern->iterators = emalloc(sizeof(spl_sub_iterator)); intern->level = 0; intern->mode = mode; - intern->flags = flags; + intern->flags = (int)flags; intern->max_depth = -1; intern->in_iteration = 0; intern->ce = Z_OBJCE_P(object); @@ -854,8 +854,11 @@ SPL_METHOD(RecursiveIteratorIterator, setMaxDepth) if (max_depth < -1) { zend_throw_exception(spl_ce_OutOfRangeException, "Parameter max_depth must be >= -1", 0 TSRMLS_CC); return; + } else if (max_depth > INT_MAX) { + max_depth = INT_MAX; } - object->max_depth = max_depth; + + object->max_depth = (int)max_depth; } /* }}} */ /* {{{ proto int|false RecursiveIteratorIterator::getMaxDepth() @@ -1423,9 +1426,9 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more TSRMLS_DC); -static inline int spl_cit_check_flags(int flags) +static inline int spl_cit_check_flags(zend_long flags) { - int cnt = 0; + zend_long cnt = 0; cnt += (flags & CIT_CALL_TOSTRING) ? 1 : 0; cnt += (flags & CIT_TOSTRING_USE_KEY) ? 1 : 0; @@ -2051,10 +2054,10 @@ SPL_METHOD(RegexIterator, accept) use_copy = zend_make_printable_zval(subject_ptr, &subject_copy TSRMLS_CC); if (use_copy) { subject = Z_STRVAL(subject_copy); - subject_len = Z_STRLEN(subject_copy); + subject_len = (int)Z_STRLEN(subject_copy); } else { subject = Z_STRVAL_P(subject_ptr); - subject_len = Z_STRLEN_P(subject_ptr); + subject_len = (int)Z_STRLEN_P(subject_ptr); } use_copy = 0; diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index f0740275dc..76f0b45e57 100644 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -134,7 +134,7 @@ typedef struct _spl_dual_it_object { struct { zval data; zval key; - int pos; + zend_long pos; } current; dual_it_type dit_type; union { diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index d3ce72aaa3..f7f884df18 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -398,7 +398,7 @@ static int spl_object_storage_compare_info(zval *e1, zval *e2 TSRMLS_DC) /* {{{ return 1; } - return Z_LVAL(result); + return Z_LVAL(result) > 0 ? 1 : (Z_LVAL(result) < 0 ? -1 : 0); } /* }}} */ |