diff options
author | Dmitry Stogov <dmitry@zend.com> | 2016-06-21 20:12:29 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2016-06-21 20:12:29 +0300 |
commit | 1433162083142d9ba97b085209e387b79f9fd6ab (patch) | |
tree | 07368efb983304f49ab8e7be5b450ae570ff473e | |
parent | ccf4ae95bd4801b5599936524b5466e6762c783d (diff) | |
download | php-git-1433162083142d9ba97b085209e387b79f9fd6ab.tar.gz |
Fixed compilation warnings
-rw-r--r-- | Zend/zend_API.h | 2 | ||||
-rw-r--r-- | ext/opcache/Optimizer/compact_literals.c | 4 | ||||
-rw-r--r-- | ext/opcache/Optimizer/zend_cfg.c | 2 | ||||
-rw-r--r-- | ext/opcache/Optimizer/zend_dfg.c | 3 | ||||
-rw-r--r-- | ext/opcache/Optimizer/zend_dump.c | 10 | ||||
-rw-r--r-- | ext/opcache/Optimizer/zend_func_info.c | 16 | ||||
-rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 8 | ||||
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 17 | ||||
-rw-r--r-- | ext/opcache/zend_accelerator_module.c | 4 | ||||
-rw-r--r-- | ext/opcache/zend_persist.c | 16 | ||||
-rw-r--r-- | ext/opcache/zend_persist_calc.c | 6 | ||||
-rw-r--r-- | main/getopt.c | 2 | ||||
-rw-r--r-- | main/rfc1867.c | 4 | ||||
-rw-r--r-- | main/snprintf.c | 28 | ||||
-rw-r--r-- | main/spprintf.c | 8 | ||||
-rw-r--r-- | main/streams/glob_wrapper.c | 1 | ||||
-rw-r--r-- | main/streams/memory.c | 5 | ||||
-rw-r--r-- | main/streams/streams.c | 2 | ||||
-rw-r--r-- | main/streams/transports.c | 3 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_conf.c | 2 |
20 files changed, 71 insertions, 72 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 85ae8b91d4..34612f879f 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -567,7 +567,7 @@ END_EXTERN_C() #endif #define CHECK_ZVAL_NULL_PATH(p) (Z_STRLEN_P(p) != strlen(Z_STRVAL_P(p))) -#define CHECK_NULL_PATH(p, l) (strlen(p) != l) +#define CHECK_NULL_PATH(p, l) (strlen(p) != (size_t)(l)) #define ZVAL_STRINGL(z, s, l) do { \ ZVAL_NEW_STR(z, zend_string_init(s, l, 0)); \ diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index 68178f5873..445b579f59 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -283,7 +283,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx break; case ZEND_RECV_INIT: LITERAL_INFO(opline->op2.constant, LITERAL_VALUE, 0, 0, 1); - if (Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) != -1) { + if (Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) != (uint32_t)-1) { Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = cache_size; cache_size += sizeof(void *); } @@ -297,7 +297,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx case ZEND_RECV: case ZEND_RECV_VARIADIC: case ZEND_VERIFY_RETURN_TYPE: - if (opline->op2.num != -1) { + if (opline->op2.num != (uint32_t)-1) { opline->op2.num = cache_size; cache_size += sizeof(void *); } diff --git a/ext/opcache/Optimizer/zend_cfg.c b/ext/opcache/Optimizer/zend_cfg.c index e986ac0c20..335ad75827 100644 --- a/ext/opcache/Optimizer/zend_cfg.c +++ b/ext/opcache/Optimizer/zend_cfg.c @@ -112,7 +112,7 @@ static void zend_mark_reachable_blocks(const zend_op_array *op_array, zend_cfg * b->start++; b->len--; } - if (b->len == 0 && b->successors[0] == block_map[live_range->end]) { + if (b->len == 0 && (uint32_t)b->successors[0] == block_map[live_range->end]) { /* mark as removed (empty live range) */ live_range->var = (uint32_t)-1; continue; diff --git a/ext/opcache/Optimizer/zend_dfg.c b/ext/opcache/Optimizer/zend_dfg.c index 97fc846d3c..1fc42e8fe8 100644 --- a/ext/opcache/Optimizer/zend_dfg.c +++ b/ext/opcache/Optimizer/zend_dfg.c @@ -26,7 +26,8 @@ int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg zend_basic_block *blocks = cfg->blocks; int blocks_count = cfg->blocks_count; zend_bitset tmp, def, use, in, out; - uint32_t k, var_num; + int k; + uint32_t var_num; int j; set_size = dfg->size; diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c index a2eeb886ee..a611b55cd5 100644 --- a/ext/opcache/Optimizer/zend_dump.c +++ b/ext/opcache/Optimizer/zend_dump.c @@ -887,10 +887,12 @@ void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_flags, cons fprintf(stderr, " ; %s:%u-%u\n", op_array->filename->val, op_array->line_start, op_array->line_end); if (func_info && func_info->num_args > 0) { - for (i = 0; i < MIN(op_array->num_args, func_info->num_args ); i++) { - fprintf(stderr, " ; arg %d ", i); - zend_dump_type_info(func_info->arg_info[i].info.type, func_info->arg_info[i].info.ce, func_info->arg_info[i].info.is_instanceof, dump_flags); - zend_dump_range(&func_info->arg_info[i].info.range); + uint32_t j; + + for (j = 0; j < MIN(op_array->num_args, func_info->num_args ); j++) { + fprintf(stderr, " ; arg %d ", j); + zend_dump_type_info(func_info->arg_info[j].info.type, func_info->arg_info[j].info.ce, func_info->arg_info[j].info.is_instanceof, dump_flags); + zend_dump_range(&func_info->arg_info[j].info.range); fprintf(stderr, "\n"); } } diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 9a1a9e25d4..c53e042e9f 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -53,7 +53,7 @@ typedef struct _func_info_t { static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 1) { uint32_t tmp = MAY_BE_RC1; @@ -83,7 +83,7 @@ static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 1) { return MAY_BE_RC1 | MAY_BE_STRING; } else { @@ -94,7 +94,7 @@ static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && (call_info->num_args == 2 || call_info->num_args == 3)) { uint32_t t1 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); @@ -130,7 +130,7 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_is_type_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 1) { return MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_TRUE | FUNC_MAY_INLINE; } else { @@ -140,7 +140,7 @@ static uint32_t zend_is_type_info(const zend_call_info *call_info, const zend_ss static uint32_t zend_l_ss_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 2) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); @@ -165,7 +165,7 @@ static uint32_t zend_l_ss_info(const zend_call_info *call_info, const zend_ssa * static uint32_t zend_lb_ssn_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 3) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); uint32_t arg2_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline); @@ -192,7 +192,7 @@ static uint32_t zend_lb_ssn_info(const zend_call_info *call_info, const zend_ssa static uint32_t zend_b_s_info(const zend_call_info *call_info, const zend_ssa *ssa) { - if (call_info->caller_init_opline->extended_value == call_info->num_args && + if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args && call_info->num_args == 1) { uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline); @@ -1251,7 +1251,7 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa int zend_func_info_startup(void) { zend_extension dummy; - int i; + size_t i; if (zend_func_info_rid == -1) { zend_func_info_rid = zend_get_resource_handle(&dummy); diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index ee14e49b5c..1e6e50b3ef 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -85,7 +85,7 @@ if (ssa->ops[line-1].result_def >= 0) { \ MACRO(ssa->ops[line-1].result_def); \ } \ - } else if (line+1 < op_array->last && \ + } else if ((uint32_t)line+1 < op_array->last && \ op_array->opcodes[line+1].opcode == ZEND_OP_DATA) { \ if (ssa->ops[line+1].op1_def >= 0) { \ MACRO(ssa->ops[line+1].op1_def); \ @@ -3437,8 +3437,7 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script zend_ssa_var *ssa_vars = ssa->vars; zend_ssa_var_info *ssa_var_info = ssa->var_info; int ssa_vars_count = ssa->vars_count; - uint i; - int j; + int i, j; uint32_t tmp; while (!zend_bitset_empty(worklist, zend_bitset_len(ssa_vars_count))) { @@ -3674,8 +3673,7 @@ static int zend_type_narrowing(const zend_op_array *op_array, const zend_script ALLOCA_FLAG(use_heap); zend_bitset visited = ZEND_BITSET_ALLOCA(2 * bitset_len, use_heap); zend_bitset worklist = visited + bitset_len; - int i; - uint32_t v; + int i, v; zend_op *opline; zend_bool narrowed = 0; diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index be8a57c341..bd141d5215 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1427,7 +1427,7 @@ static void zend_accel_init_auto_globals(void) } } -static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handle, int type, char *key, unsigned int key_length, zend_op_array **op_array_p) +static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handle, int type, char *key, zend_op_array **op_array_p) { zend_persistent_script *new_persistent_script; zend_op_array *orig_active_op_array; @@ -1440,12 +1440,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl /* Try to open file */ if (file_handle->type == ZEND_HANDLE_FILENAME) { - if (accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle) == SUCCESS) { - /* key may be changed by zend_stream_open_function() */ - if (key == ZCG(key)) { - key_length = ZCG(key_len); - } - } else { + if (accelerator_orig_zend_stream_open_function(file_handle->filename, file_handle) != SUCCESS) { *op_array_p = NULL; if (type == ZEND_REQUIRE) { zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); @@ -1484,7 +1479,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl /* check if file is too new (may be it's not written completely yet) */ if (ZCG(accel_directives).file_update_protection && - (ZCG(request_time) - ZCG(accel_directives).file_update_protection < timestamp)) { + ((accel_time_t)(ZCG(request_time) - ZCG(accel_directives).file_update_protection) < timestamp)) { *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; } @@ -1637,7 +1632,7 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type) return zend_accel_load_script(persistent_script, 1); } - persistent_script = opcache_compile_file(file_handle, type, NULL, 0, &op_array); + persistent_script = opcache_compile_file(file_handle, type, NULL, &op_array); if (persistent_script) { from_memory = 0; @@ -1834,7 +1829,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) * If it isn't compile_and_cache_file() changes the flag to 0 */ from_shared_memory = 0; - persistent_script = opcache_compile_file(file_handle, type, key, key ? key_length : 0, &op_array); + persistent_script = opcache_compile_file(file_handle, type, key, &op_array); if (persistent_script) { persistent_script = cache_script_in_shared_memory(persistent_script, key, key ? key_length : 0, &from_shared_memory); } @@ -2060,7 +2055,7 @@ static void accel_activate(void) ZCG(include_path_check) = 1; /* check if ZCG(function_table) wasn't somehow polluted on the way */ - if (ZCG(internal_functions_count) != zend_hash_num_elements(&ZCG(function_table))) { + if (ZCG(internal_functions_count) != (zend_long)zend_hash_num_elements(&ZCG(function_table))) { zend_accel_error(ACCEL_LOG_WARNING, "Internal functions count changed - was %d, now %d", ZCG(internal_functions_count), zend_hash_num_elements(&ZCG(function_table))); } diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 0e1069836c..b8a3410895 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -80,13 +80,13 @@ static zend_function_entry accel_functions[] = { /* Private functions */ ZEND_FE(opcache_get_configuration, arginfo_opcache_none) ZEND_FE(opcache_get_status, arginfo_opcache_get_status) - { NULL, NULL, NULL, 0, 0 } + ZEND_FE_END }; static int validate_api_restriction(void) { if (ZCG(accel_directives).restrict_api && *ZCG(accel_directives).restrict_api) { - int len = strlen(ZCG(accel_directives).restrict_api); + size_t len = strlen(ZCG(accel_directives).restrict_api); if (!SG(request_info).path_translated || strlen(SG(request_info).path_translated) < len || diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 25a504575d..24a3d21ca2 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -89,21 +89,21 @@ static void zend_hash_persist(HashTable *ht, zend_persist_func_t pPersistElement void *data = HT_GET_DATA_ADDR(ht); zend_accel_store(data, HT_USED_SIZE(ht)); HT_SET_DATA_ADDR(ht, data); - } else if (ht->nNumUsed < -(int32_t)ht->nTableMask / 2) { + } else if (ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 2) { /* compact table */ void *old_data = HT_GET_DATA_ADDR(ht); Bucket *old_buckets = ht->arData; - int32_t hash_size; + uint32_t hash_size; if (ht->nNumUsed <= HT_MIN_SIZE) { hash_size = HT_MIN_SIZE; } else { - hash_size = -(int32_t)ht->nTableMask; + hash_size = (uint32_t)(-(int32_t)ht->nTableMask); while (hash_size >> 1 > ht->nNumUsed) { hash_size >>= 1; } } - ht->nTableMask = -hash_size; + ht->nTableMask = (uint32_t)(-(int32_t)hash_size); ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ HT_SET_DATA_ADDR(ht, ZCG(mem)); ZCG(mem) = (void*)((char*)ZCG(mem) + ZEND_ALIGNED_SIZE((hash_size * sizeof(uint32_t)) + (ht->nNumUsed * sizeof(Bucket)))); @@ -171,21 +171,21 @@ static void zend_hash_persist_immutable(HashTable *ht) } if (ht->u.flags & HASH_FLAG_PACKED) { HT_SET_DATA_ADDR(ht, zend_accel_memdup(HT_GET_DATA_ADDR(ht), HT_USED_SIZE(ht))); - } else if (ht->nNumUsed < -(int32_t)ht->nTableMask / 2) { + } else if (ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 2) { /* compact table */ void *old_data = HT_GET_DATA_ADDR(ht); Bucket *old_buckets = ht->arData; - int32_t hash_size; + uint32_t hash_size; if (ht->nNumUsed <= HT_MIN_SIZE) { hash_size = HT_MIN_SIZE; } else { - hash_size = -(int32_t)ht->nTableMask; + hash_size = (uint32_t)(-(int32_t)ht->nTableMask); while (hash_size >> 1 > ht->nNumUsed) { hash_size >>= 1; } } - ht->nTableMask = -hash_size; + ht->nTableMask = (uint32_t)(-(int32_t)hash_size); ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ HT_SET_DATA_ADDR(ht, ZCG(mem)); ZCG(mem) = (void*)((char*)ZCG(mem) + (hash_size * sizeof(uint32_t)) + (ht->nNumUsed * sizeof(Bucket))); diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 22e74d6b36..84cd417204 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -60,14 +60,14 @@ static void zend_hash_persist_calc(HashTable *ht, void (*pPersistElement)(zval * return; } - if (!(ht->u.flags & HASH_FLAG_PACKED) && ht->nNumUsed < -(int32_t)ht->nTableMask / 2) { + if (!(ht->u.flags & HASH_FLAG_PACKED) && ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 2) { /* compact table */ - int32_t hash_size; + uint32_t hash_size; if (ht->nNumUsed <= HT_MIN_SIZE) { hash_size = HT_MIN_SIZE; } else { - hash_size = -(int32_t)ht->nTableMask; + hash_size = (uint32_t)(-(int32_t)ht->nTableMask); while (hash_size >> 1 > ht->nNumUsed) { hash_size >>= 1; } diff --git a/main/getopt.c b/main/getopt.c index cc88bd100a..57b6a3b49c 100644 --- a/main/getopt.c +++ b/main/getopt.c @@ -89,7 +89,7 @@ PHPAPI int php_getopt(int argc, char* const *argv, const opt_struct opts[], char } if ((argv[*optind][0] == '-') && (argv[*optind][1] == '-')) { const char *pos; - int arg_end = (int)strlen(argv[*optind])-1; + size_t arg_end = strlen(argv[*optind])-1; /* '--' indicates end of args if not followed by a known long option name */ if (argv[*optind][2] == '\0') { diff --git a/main/rfc1867.c b/main/rfc1867.c index d8d141fdd6..7543868605 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -620,7 +620,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes char *bound; /* fill buffer if needed */ - if (bytes > self->bytes_in_buffer) { + if (bytes > (size_t)self->bytes_in_buffer) { fill_buffer(self); } @@ -1058,7 +1058,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ wlen = write(fd, buff, blen); #endif - if (wlen == -1) { + if (wlen == (size_t)-1) { /* write failed */ #if DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "write() failed - %s", strerror(errno)); diff --git a/main/snprintf.c b/main/snprintf.c index 261293ccbe..9e86d72221 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -555,11 +555,11 @@ typedef struct buf_area buffy; * to be printed. */ #define FIX_PRECISION( adjust, precision, s, s_len ) \ - if ( adjust ) \ - while ( s_len < precision ) \ - { \ - *--s = '0' ; \ - s_len++ ; \ + if ( adjust ) \ + while ( s_len < (size_t)precision ) \ + { \ + *--s = '0' ; \ + s_len++ ; \ } /* @@ -796,14 +796,14 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / */ switch (*fmt) { case 'Z': { - zvp = (zval*) va_arg(ap, zval*); + zvp = (zval*) va_arg(ap, zval*); free_zcopy = zend_make_printable_zval(zvp, &zcopy); if (free_zcopy) { zvp = &zcopy; } s_len = Z_STRLEN_P(zvp); s = Z_STRVAL_P(zvp); - if (adjust_precision && precision < s_len) { + if (adjust_precision && (size_t)precision < s_len) { s_len = precision; } break; @@ -991,7 +991,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / s = va_arg(ap, char *); if (s != NULL) { s_len = strlen(s); - if (adjust_precision && precision < s_len) { + if (adjust_precision && (size_t)precision < s_len) { s_len = precision; } } else { @@ -1190,14 +1190,14 @@ fmt_error: *--s = prefix_char; s_len++; } - if (adjust_width && adjust == RIGHT && min_width > s_len) { + if (adjust_width && adjust == RIGHT && (size_t)min_width > s_len) { if (pad_char == '0' && prefix_char != NUL) { INS_CHAR(*s, sp, bep, cc) s++; s_len--; min_width--; } - PAD(min_width, s_len, pad_char); + PAD((size_t)min_width, s_len, pad_char); } /* * Print the string s. @@ -1207,8 +1207,8 @@ fmt_error: s++; } - if (adjust_width && adjust == LEFT && min_width > s_len) - PAD(min_width, s_len, pad_char); + if (adjust_width && adjust == LEFT && (size_t)min_width > s_len) + PAD((size_t)min_width, s_len, pad_char); if (free_zcopy) { zval_dtor(&zcopy); } @@ -1263,7 +1263,7 @@ PHPAPI int ap_php_slprintf(char *buf, size_t len, const char *format,...) /* {{{ va_start(ap, format); strx_printv(&cc, buf, len, format, ap); va_end(ap); - if (cc >= len) { + if ((size_t)cc >= len) { cc = (int)len -1; buf[cc] = '\0'; } @@ -1276,7 +1276,7 @@ PHPAPI int ap_php_vslprintf(char *buf, size_t len, const char *format, va_list a int cc; strx_printv(&cc, buf, len, format, ap); - if (cc >= len) { + if ((size_t)cc >= len) { cc = (int)len -1; buf[cc] = '\0'; } diff --git a/main/spprintf.c b/main/spprintf.c index ab8117d3be..30c27c6e74 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -182,7 +182,7 @@ */ #define FIX_PRECISION(adjust, precision, s, s_len) do { \ if (adjust) \ - while (s_len < precision) { \ + while (s_len < (size_t)precision) { \ *--s = '0'; \ s_len++; \ } \ @@ -417,7 +417,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt } s_len = Z_STRLEN_P(zvp); s = Z_STRVAL_P(zvp); - if (adjust_precision && precision < s_len) { + if (adjust_precision && (size_t)precision < s_len) { s_len = precision; } break; @@ -803,7 +803,7 @@ fmt_error: *--s = prefix_char; s_len++; } - if (adjust_width && adjust == RIGHT && min_width > s_len) { + if (adjust_width && adjust == RIGHT && (size_t)min_width > s_len) { if (pad_char == '0' && prefix_char != NUL) { INS_CHAR(xbuf, *s, is_char); s++; @@ -817,7 +817,7 @@ fmt_error: */ INS_STRING(xbuf, s, s_len, is_char); - if (adjust_width && adjust == LEFT && min_width > s_len) { + if (adjust_width && adjust == LEFT && (size_t)min_width > s_len) { PAD_CHAR(xbuf, pad_char, min_width - s_len, is_char); } diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c index 85395107d5..d542e336e3 100644 --- a/main/streams/glob_wrapper.c +++ b/main/streams/glob_wrapper.c @@ -271,6 +271,7 @@ static php_stream_wrapper_ops php_glob_stream_wrapper_ops = { NULL, NULL, NULL, + NULL, NULL }; diff --git a/main/streams/memory.c b/main/streams/memory.c index 56ffe344aa..afa45c3968 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -695,7 +695,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con } /* found parameter ... the heart of cs ppl lies in +1/-1 or was it +2 this time? */ plen = sep - path; - vlen = (semi ? semi - sep : mlen - plen) - 1 /* '=' */; + vlen = (semi ? (size_t)(semi - sep) : (mlen - plen)) - 1 /* '=' */; key = estrndup(path, plen); if (plen != sizeof("mediatype")-1 || memcmp(key, "mediatype", sizeof("mediatype")-1)) { add_assoc_stringl_ex(&meta, key, plen, sep + 1, vlen); @@ -770,7 +770,8 @@ PHPAPI php_stream_wrapper_ops php_stream_rfc2397_wops = { NULL, /* unlink */ NULL, /* rename */ NULL, /* mkdir */ - NULL /* rmdir */ + NULL, /* rmdir */ + NULL, /* stream_metadata */ }; PHPAPI php_stream_wrapper php_stream_rfc2397_wrapper = { diff --git a/main/streams/streams.c b/main/streams/streams.c index d64d5caa6a..1ae27841df 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1753,7 +1753,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const HashTable *wrapper_hash = (FG(stream_wrappers) ? FG(stream_wrappers) : &url_stream_wrappers_hash); php_stream_wrapper *wrapper = NULL; const char *p, *protocol = NULL; - int n = 0; + size_t n = 0; if (path_for_open) { *path_for_open = (char*)path; diff --git a/main/streams/transports.c b/main/streams/transports.c index feaa099c8c..795e2e8a44 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -60,7 +60,8 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in php_stream *stream = NULL; php_stream_transport_factory factory = NULL; const char *p, *protocol = NULL; - int n = 0, failed = 0; + size_t n = 0; + int failed = 0; zend_string *error_text = NULL; struct timeval default_timeout = { 0, 0 }; diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 8aa76f0e1c..dddabb794d 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -1271,7 +1271,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg) /* {{{ */ return; } #endif /* GLOB_NOMATCH */ - zlog(ZLOG_ERROR, "Unable to globalize '%s' (ret=%d) from %s at line %d.", inc, i, filename, ini_lineno); + zlog(ZLOG_ERROR, "Unable to globalize '%s' (ret=%zd) from %s at line %d.", inc, i, filename, ini_lineno); *error = 1; efree(filename); return; |