[Spice-devel] [PATCH spice-streaming-agent v2 3/4] Add PRIu64 format for uint64_t
Frediano Ziglio
fziglio at redhat.com
Thu Feb 15 10:00:06 UTC 2018
From: Christophe de Dinechin <dinechin at redhat.com>
Otherwise, clang complains:
spice-streaming-agent.cpp:414:66: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
fprintf(f_log, "%lu: Frame of %zu bytes:\n", get_time(), frame.buffer_size);
~~~ ^~~~~~~~~~
%llu
1 warning generated.
Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
---
Change since v1:
- split long lines.
---
src/spice-streaming-agent.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 4f2c267..4ec5e42 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -7,6 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>
@@ -351,7 +352,8 @@ do_capture(const std::string &streamport, FILE *f_log)
uint64_t time_after = get_time();
syslog(LOG_DEBUG,
- "got a frame -- size is %zu (%lu ms) (%lu ms from last frame)(%lu us)\n",
+ "got a frame -- size is %zu (%" PRIu64 " ms) "
+ "(%" PRIu64 " ms from last frame)(%" PRIu64 " us)\n",
frame.buffer_size, (time_after - time_before)/1000,
(time_after - time_last)/1000,
(time_before - time_last));
@@ -374,7 +376,8 @@ do_capture(const std::string &streamport, FILE *f_log)
if (log_binary) {
fwrite(frame.buffer, frame.buffer_size, 1, f_log);
} else {
- fprintf(f_log, "%lu: Frame of %zu bytes:\n", get_time(), frame.buffer_size);
+ fprintf(f_log, "%" PRIu64 ": Frame of %zu bytes:\n",
+ get_time(), frame.buffer_size);
hexdump(frame.buffer, frame.buffer_size, f_log);
}
}
--
2.14.3
More information about the Spice-devel
mailing list