mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 07:00:09 +01:00
weston-log: Fix warning on 32-bit architectures
On 32-bit ARM, tv_usec is of type long long int. Cast to int64_t and
use PRId64 from inttypes.h instead of %ld/%li to silence these format
warnings:
.../libweston/weston-log.c: In function 'weston_log_scope_timestamp':
.../libweston/weston-log.c:961:22: warning: format '%ld' expects argument of type 'long int', but argument 5 has type '__suseconds64_t' {aka 'long long int'} [-Wformat=]
.../libweston/weston-log.c: In function 'weston_log_timestamp':
.../libweston/weston-log.c:1015:27: warning: format '%li' expects argument of type 'long int', but argument 6 has type '__suseconds64_t' {aka 'long long int'} [-Wformat=]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
de3a3fca1b
commit
200f4cf461
1 changed files with 5 additions and 4 deletions
|
|
@ -34,6 +34,7 @@
|
||||||
#include "weston-debug-server-protocol.h"
|
#include "weston-debug-server-protocol.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -958,8 +959,8 @@ weston_log_scope_timestamp(struct weston_log_scope *scope,
|
||||||
"%Y-%m-%d %H:%M:%S", bdt);
|
"%Y-%m-%d %H:%M:%S", bdt);
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
snprintf(buf, len, "[%s.%03ld][%s]", string,
|
snprintf(buf, len, "[%s.%03" PRId64 "][%s]", string,
|
||||||
tv.tv_usec / 1000,
|
(int64_t)(tv.tv_usec / 1000),
|
||||||
(scope) ? scope->name : "no scope");
|
(scope) ? scope->name : "no scope");
|
||||||
} else {
|
} else {
|
||||||
snprintf(buf, len, "[?][%s]",
|
snprintf(buf, len, "[?][%s]",
|
||||||
|
|
@ -1012,8 +1013,8 @@ weston_log_timestamp(char *buf, size_t len, int *cached_tm_mday)
|
||||||
|
|
||||||
strftime(timestr, sizeof(timestr), "%H:%M:%S", brokendown_time);
|
strftime(timestr, sizeof(timestr), "%H:%M:%S", brokendown_time);
|
||||||
/* if datestr is empty it prints only timestr*/
|
/* if datestr is empty it prints only timestr*/
|
||||||
snprintf(buf, len, "%s[%s.%03li]", datestr,
|
snprintf(buf, len, "%s[%s.%03" PRId64 "]", datestr,
|
||||||
timestr, (tv.tv_usec / 1000));
|
timestr, (int64_t)(tv.tv_usec / 1000));
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue