]> granicus.if.org Git - php/commitdiff
Fix some format specificers
authorDavid Carlier <devnexen@gmail.com>
Sat, 9 Dec 2017 10:37:41 +0000 (10:37 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 16 Dec 2017 14:27:32 +0000 (15:27 +0100)
time_t is of 64 bits type on some systems as well.

ext/opcache/ZendAccelerator.c
ext/opcache/zend_accelerator_module.c
ext/standard/microtime.c

index d765787a3c63c01fb0b857260937843be264cc7b..be1519214801d78b4c63151c4855ba7fd05c2f09 100644 (file)
@@ -840,7 +840,7 @@ static inline int accel_is_inactive(void)
        if (ZCG(accel_directives).force_restart_timeout
                && ZCSG(force_restart_time)
                && time(NULL) >= ZCSG(force_restart_time)) {
-               zend_accel_error(ACCEL_LOG_WARNING, "Forced restart at %ld (after " ZEND_LONG_FMT " seconds), locked by %d", time(NULL), ZCG(accel_directives).force_restart_timeout, mem_usage_check.l_pid);
+               zend_accel_error(ACCEL_LOG_WARNING, "Forced restart at %ld (after " ZEND_LONG_FMT " seconds), locked by %d", (long)time(NULL), ZCG(accel_directives).force_restart_timeout, mem_usage_check.l_pid);
                kill_all_lockers(&mem_usage_check);
 
                return FAILURE; /* next request should be able to restart it */
index aa627f028b360f2e3db5444e0ee411337c4c99b5..de3e4c9ec03da6be8097280ca59ac411ac9c5e8f 100644 (file)
@@ -487,14 +487,14 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
                        php_info_print_table_row(2, "Cache misses", buf);
                        snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
                        php_info_print_table_row(2, "Used memory", buf);
-                       snprintf(buf, sizeof(buf), ZEND_LONG_FMT, zend_shared_alloc_get_free_memory());
+                       snprintf(buf, sizeof(buf), "%zu", zend_shared_alloc_get_free_memory());
                        php_info_print_table_row(2, "Free memory", buf);
-                       snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZSMMG(wasted_shared_memory));
+                       snprintf(buf, sizeof(buf), "%zu", ZSMMG(wasted_shared_memory));
                        php_info_print_table_row(2, "Wasted memory", buf);
                        if (ZCSG(interned_strings).start && ZCSG(interned_strings).end) {
-                               snprintf(buf, sizeof(buf), ZEND_LONG_FMT, (char*)ZCSG(interned_strings).top - (char*)ZCSG(interned_strings).start);
+                               snprintf(buf, sizeof(buf), "%zu", (size_t)((char*)ZCSG(interned_strings).top - (char*)ZCSG(interned_strings).start));
                                php_info_print_table_row(2, "Interned Strings Used memory", buf);
-                               snprintf(buf, sizeof(buf), ZEND_LONG_FMT, (char*)ZCSG(interned_strings).end - (char*)ZCSG(interned_strings).top);
+                               snprintf(buf, sizeof(buf), "%zu", (size_t)((char*)ZCSG(interned_strings).end - (char*)ZCSG(interned_strings).top));
                                php_info_print_table_row(2, "Interned Strings Free memory", buf);
                        }
                        snprintf(buf, sizeof(buf), "%d", ZCSG(hash).num_direct_entries);
index aa63a6e42e9dab5c83d143ea946c2fec4f72efd2..94d3a5cd9d9bb104046ffde03ef46be3f69f1675 100644 (file)
@@ -82,7 +82,7 @@ static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode)
        } else {
                char ret[100];
 
-               snprintf(ret, 100, "%.8F %ld", tp.tv_usec / MICRO_IN_SEC, tp.tv_sec);
+               snprintf(ret, 100, "%.8F %ld", tp.tv_usec / MICRO_IN_SEC, (long)tp.tv_sec);
                RETURN_STRING(ret);
        }
 }