]> granicus.if.org Git - php/commitdiff
fixed some incompatible types
authorAnatol Belski <ab@php.net>
Wed, 20 Aug 2014 07:52:23 +0000 (09:52 +0200)
committerAnatol Belski <ab@php.net>
Wed, 20 Aug 2014 07:52:23 +0000 (09:52 +0200)
ext/opcache/ZendAccelerator.c
ext/opcache/ZendAccelerator.h
ext/opcache/zend_accelerator_module.c
sapi/apache2handler/sapi_apache2.c
sapi/embed/php_embed.c

index b8f9f08b3639305b69cab2859b93e9b5fa3ff089..46c406d99de38288504fe03ec99fbf53dc9c286c 100644 (file)
@@ -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) */
index 79f352e5b7131623333267cc48e26eea20c0af7c..c2283013625876d5ae52b7c4e688b128b647bf54 100644 (file)
@@ -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;
index f6581c1ba6eafd01abe222d0cbbabee73a6f96ad..c6720419fa08a0516a11efc139f56abbff4e3d4a 100644 (file)
@@ -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));
index 10b61cc2a38aebfd5a022c263e4a0898b0c3da49..669f25f78639b7431c082a62a75d3c2d98ddc92f 100644 (file)
@@ -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);
        }
 }
index b4fc5aaf101dd094ccd3dc89a9859c2057b79644..2f2f31fb85003d8bdd6c60c8940ea3d601d9a4d4 100644 (file)
@@ -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) {