#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)); \
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 *);
}
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 *);
}
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;
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;
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");
}
}
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;
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 {
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);
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 {
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);
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);
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);
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);
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); \
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))) {
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;
}
}
-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;
/* 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);
/* 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;
}
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;
* 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);
}
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)));
}
/* 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 ||
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))));
}
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)));
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;
}
}
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') {
char *bound;
/* fill buffer if needed */
- if (bytes > self->bytes_in_buffer) {
+ if (bytes > (size_t)self->bytes_in_buffer) {
fill_buffer(self);
}
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));
* 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++ ; \
}
/*
*/
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;
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 {
*--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.
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);
}
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';
}
int cc;
strx_printv(&cc, buf, len, format, ap);
- if (cc >= len) {
+ if ((size_t)cc >= len) {
cc = (int)len -1;
buf[cc] = '\0';
}
*/
#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++; \
} \
}
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;
*--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++;
*/
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);
}
NULL,
NULL,
NULL,
+ NULL,
NULL
};
}
/* 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);
NULL, /* unlink */
NULL, /* rename */
NULL, /* mkdir */
- NULL /* rmdir */
+ NULL, /* rmdir */
+ NULL, /* stream_metadata */
};
PHPAPI php_stream_wrapper php_stream_rfc2397_wrapper = {
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;
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 };
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;