[Spice-devel] [PATCH 04/14] Add PRIu64 format for uint64_t
Frediano Ziglio
fziglio at redhat.com
Thu Feb 15 05:49:24 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>
> ---
> src/spice-streaming-agent.cpp | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index 760c211..5fb20d1 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>
> @@ -387,7 +388,7 @@ 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));
> @@ -410,7 +411,7 @@ 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);
> }
> }
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Frediano
More information about the Spice-devel
mailing list