fixed some incompatible types

This commit is contained in:
Anatol Belski 2014-08-20 09:52:23 +02:00
parent f27c52d846
commit fdbbe5fa30
5 changed files with 21 additions and 17 deletions

View file

@ -107,8 +107,8 @@ static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL;
#ifdef ZEND_WIN32 #ifdef ZEND_WIN32
# define INCREMENT(v) InterlockedIncrement(&ZCSG(v)) # define INCREMENT(v) InterlockedIncrement64(&ZCSG(v))
# define DECREMENT(v) InterlockedDecrement(&ZCSG(v)) # define DECREMENT(v) InterlockedDecrement64(&ZCSG(v))
# define LOCKVAL(v) (ZCSG(v)) # define LOCKVAL(v) (ZCSG(v))
#endif #endif
@ -743,12 +743,12 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle
switch (file_handle->type) { switch (file_handle->type) {
case ZEND_HANDLE_FD: case ZEND_HANDLE_FD:
if (fstat(file_handle->handle.fd, &statbuf) == -1) { if (zend_fstat(file_handle->handle.fd, &statbuf) == -1) {
return 0; return 0;
} }
break; break;
case ZEND_HANDLE_FP: case ZEND_HANDLE_FP:
if (fstat(fileno(file_handle->handle.fp), &statbuf) == -1) { if (zend_fstat(fileno(file_handle->handle.fp), &statbuf) == -1) {
if (zend_get_stream_timestamp(file_handle->filename, &statbuf TSRMLS_CC) != SUCCESS) { if (zend_get_stream_timestamp(file_handle->filename, &statbuf TSRMLS_CC) != SUCCESS) {
return 0; return 0;
} }
@ -1620,8 +1620,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T
ZCSG(hits)++; /* TBFixed: may lose one hit */ ZCSG(hits)++; /* TBFixed: may lose one hit */
persistent_script->dynamic_members.hits++; /* see above */ persistent_script->dynamic_members.hits++; /* see above */
#else #else
InterlockedIncrement(&ZCSG(hits)); INCREMENT(hits);
InterlockedIncrement(&persistent_script->dynamic_members.hits); InterlockedIncrement64(&persistent_script->dynamic_members.hits);
#endif #endif
/* see bug #15471 (old BTS) */ /* see bug #15471 (old BTS) */

View file

@ -170,7 +170,11 @@ typedef struct _zend_persistent_script {
*/ */
struct zend_persistent_script_dynamic_members { struct zend_persistent_script_dynamic_members {
time_t last_used; time_t last_used;
#ifdef ZEND_WIN32
LONGLONG hits;
#else
zend_uint_t hits; zend_uint_t hits;
#endif
unsigned int memory_consumption; unsigned int memory_consumption;
unsigned int checksum; unsigned int checksum;
time_t revalidate; time_t revalidate;
@ -258,8 +262,8 @@ typedef struct _zend_accel_shared_globals {
zend_accel_restart_reason restart_reason; zend_accel_restart_reason restart_reason;
zend_bool cache_status_before_restart; zend_bool cache_status_before_restart;
#ifdef ZEND_WIN32 #ifdef ZEND_WIN32
zend_uint_t mem_usage; LONGLONG mem_usage;
zend_uint_t restart_in; LONGLONG restart_in;
#endif #endif
zend_bool restart_in_progress; zend_bool restart_in_progress;
time_t revalidate_at; time_t revalidate_at;

View file

@ -407,7 +407,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
char buf[32]; char buf[32];
php_info_print_table_row(2, "Startup", "OK"); php_info_print_table_row(2, "Startup", "OK");
php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model()); php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model());
snprintf(buf, sizeof(buf), ZEND_UINT_FMT, ZCSG(hits)); snprintf(buf, sizeof(buf), ZEND_UINT_FMT, (zend_uint_t)ZCSG(hits));
php_info_print_table_row(2, "Cache hits", buf); php_info_print_table_row(2, "Cache hits", buf);
snprintf(buf, sizeof(buf), "%pd", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); snprintf(buf, sizeof(buf), "%pd", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
php_info_print_table_row(2, "Cache misses", buf); php_info_print_table_row(2, "Cache misses", buf);
@ -488,7 +488,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC)
array_init(&persistent_script_report); array_init(&persistent_script_report);
add_assoc_str(&persistent_script_report, "full_path", STR_DUP(script->full_path, 0)); add_assoc_str(&persistent_script_report, "full_path", STR_DUP(script->full_path, 0));
add_assoc_int(&persistent_script_report, "hits", script->dynamic_members.hits); add_assoc_int(&persistent_script_report, "hits", (zend_int_t)script->dynamic_members.hits);
add_assoc_int(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption); add_assoc_int(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption);
ta = localtime(&script->dynamic_members.last_used); ta = localtime(&script->dynamic_members.last_used);
str = asctime(ta); str = asctime(ta);
@ -562,7 +562,7 @@ static ZEND_FUNCTION(opcache_get_status)
add_assoc_int(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries); add_assoc_int(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries);
add_assoc_int(&statistics, "num_cached_keys", ZCSG(hash).num_entries); add_assoc_int(&statistics, "num_cached_keys", ZCSG(hash).num_entries);
add_assoc_int(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries); add_assoc_int(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries);
add_assoc_int(&statistics, "hits", ZCSG(hits)); add_assoc_int(&statistics, "hits", (zend_int_t)ZCSG(hits));
add_assoc_int(&statistics, "start_time", ZCSG(start_time)); add_assoc_int(&statistics, "start_time", ZCSG(start_time));
add_assoc_int(&statistics, "last_restart_time", ZCSG(last_restart_time)); add_assoc_int(&statistics, "last_restart_time", ZCSG(last_restart_time));
add_assoc_int(&statistics, "oom_restarts", ZCSG(oom_restarts)); add_assoc_int(&statistics, "oom_restarts", ZCSG(oom_restarts));

View file

@ -276,12 +276,12 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC)
if (!val) { if (!val) {
val = ""; val = "";
} }
if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), (unsigned int *)&new_val_len TSRMLS_CC)) { if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), (php_size_t *)&new_val_len TSRMLS_CC)) {
php_register_variable_safe(key, val, new_val_len, track_vars_array TSRMLS_CC); php_register_variable_safe(key, val, new_val_len, track_vars_array TSRMLS_CC);
} }
APR_ARRAY_FOREACH_CLOSE() APR_ARRAY_FOREACH_CLOSE()
if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), (unsigned int *)&new_val_len TSRMLS_CC)) { if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), (php_size_t *)&new_val_len TSRMLS_CC)) {
php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array TSRMLS_CC); php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array TSRMLS_CC);
} }
} }

View file

@ -44,10 +44,10 @@ static int php_embed_deactivate(TSRMLS_D)
return SUCCESS; return SUCCESS;
} }
static inline size_t php_embed_single_write(const char *str, uint str_length) static inline size_t php_embed_single_write(const char *str, php_size_t str_length)
{ {
#ifdef PHP_WRITE_STDOUT #ifdef PHP_WRITE_STDOUT
long ret; php_int_t ret;
ret = write(STDOUT_FILENO, str, str_length); ret = write(STDOUT_FILENO, str, str_length);
if (ret <= 0) return 0; if (ret <= 0) return 0;
@ -61,10 +61,10 @@ static inline size_t php_embed_single_write(const char *str, uint str_length)
} }
static int php_embed_ub_write(const char *str, uint str_length TSRMLS_DC) static php_size_t php_embed_ub_write(const char *str, php_size_t str_length TSRMLS_DC)
{ {
const char *ptr = str; const char *ptr = str;
uint remaining = str_length; php_size_t remaining = str_length;
size_t ret; size_t ret;
while (remaining > 0) { while (remaining > 0) {