summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-08-20 09:52:23 +0200
committerAnatol Belski <ab@php.net>2014-08-20 09:52:23 +0200
commitfdbbe5fa30ce524d9b0a8b376561d598bf0eb80c (patch)
tree0c20acc336cf5db04210639869a349eccec44fff
parentf27c52d846e4c6d748015a4bc33fb3cc8c7647a6 (diff)
downloadphp-git-fdbbe5fa30ce524d9b0a8b376561d598bf0eb80c.tar.gz
fixed some incompatible types
-rw-r--r--ext/opcache/ZendAccelerator.c12
-rw-r--r--ext/opcache/ZendAccelerator.h8
-rw-r--r--ext/opcache/zend_accelerator_module.c6
-rw-r--r--sapi/apache2handler/sapi_apache2.c4
-rw-r--r--sapi/embed/php_embed.c8
5 files changed, 21 insertions, 17 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index b8f9f08b36..46c406d99d 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -107,8 +107,8 @@ static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL;
#ifdef ZEND_WIN32
-# define INCREMENT(v) InterlockedIncrement(&ZCSG(v))
-# define DECREMENT(v) InterlockedDecrement(&ZCSG(v))
+# define INCREMENT(v) InterlockedIncrement64(&ZCSG(v))
+# define DECREMENT(v) InterlockedDecrement64(&ZCSG(v))
# define LOCKVAL(v) (ZCSG(v))
#endif
@@ -743,12 +743,12 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle
switch (file_handle->type) {
case ZEND_HANDLE_FD:
- if (fstat(file_handle->handle.fd, &statbuf) == -1) {
+ if (zend_fstat(file_handle->handle.fd, &statbuf) == -1) {
return 0;
}
break;
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) {
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 */
persistent_script->dynamic_members.hits++; /* see above */
#else
- InterlockedIncrement(&ZCSG(hits));
- InterlockedIncrement(&persistent_script->dynamic_members.hits);
+ INCREMENT(hits);
+ InterlockedIncrement64(&persistent_script->dynamic_members.hits);
#endif
/* see bug #15471 (old BTS) */
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index 79f352e5b7..c228301362 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -170,7 +170,11 @@ typedef struct _zend_persistent_script {
*/
struct zend_persistent_script_dynamic_members {
time_t last_used;
+#ifdef ZEND_WIN32
+ LONGLONG hits;
+#else
zend_uint_t hits;
+#endif
unsigned int memory_consumption;
unsigned int checksum;
time_t revalidate;
@@ -258,8 +262,8 @@ typedef struct _zend_accel_shared_globals {
zend_accel_restart_reason restart_reason;
zend_bool cache_status_before_restart;
#ifdef ZEND_WIN32
- zend_uint_t mem_usage;
- zend_uint_t restart_in;
+ LONGLONG mem_usage;
+ LONGLONG restart_in;
#endif
zend_bool restart_in_progress;
time_t revalidate_at;
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index f6581c1ba6..c6720419fa 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -407,7 +407,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
char buf[32];
php_info_print_table_row(2, "Startup", "OK");
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);
snprintf(buf, sizeof(buf), "%pd", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
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);
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);
ta = localtime(&script->dynamic_members.last_used);
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_keys", ZCSG(hash).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, "last_restart_time", ZCSG(last_restart_time));
add_assoc_int(&statistics, "oom_restarts", ZCSG(oom_restarts));
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 10b61cc2a3..669f25f786 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -276,12 +276,12 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC)
if (!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);
}
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);
}
}
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index b4fc5aaf10..2f2f31fb85 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.c
@@ -44,10 +44,10 @@ static int php_embed_deactivate(TSRMLS_D)
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
- long ret;
+ php_int_t ret;
ret = write(STDOUT_FILENO, str, str_length);
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;
- uint remaining = str_length;
+ php_size_t remaining = str_length;
size_t ret;
while (remaining > 0) {