[Spice-devel] [PATCH] build: require c99 and fix uint64_t format warning on 32bits

Marc-André Lureau marcandre.lureau at redhat.com
Fri Nov 12 04:37:06 PST 2010


---
 configure.ac  |    5 +++++
 server/reds.c |    6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0ab6dd8..ec0f5f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,11 @@ SPICE_COMMON_SRCDIR='$(top_srcdir)'/common
 
 AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes])
 AC_PROG_CC
+AC_PROG_CC_C99
+if test x"$ac_cv_prog_cc_c99" = xno; then
+    AC_MSG_ERROR([C99 compiler is required.])
+fi
+
 AS_IF([test "$CXXFLAGS" = ""], [], [_cxxflags_is_set=yes])
 AC_PROG_CXX
 AC_PROG_INSTALL
diff --git a/server/reds.c b/server/reds.c
index 7ab4925..6a14388 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -18,6 +18,7 @@
 
 #include <stdint.h>
 #include <stdio.h>
+#include <inttypes.h>
 #include <unistd.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -1766,12 +1767,13 @@ static void reds_main_handle_message(void *opaque, size_t size, uint32_t type, v
                 if (roundtrip <= latency) {
                     // probably high load on client or server result with incorrect values
                     latency = 0;
-                    red_printf("net test: invalid values, latency %lu roundtrip %lu. assuming high"
+                    red_printf("net test: invalid values, latency %" PRIu64
+                               " roundtrip %" PRIu64 ". assuming high"
                                "bandwidth", latency, roundtrip);
                     break;
                 }
                 bitrate_per_sec = (uint64_t)(NET_TEST_BYTES * 8) * 1000000 / (roundtrip - latency);
-                red_printf("net test: latency %f ms, bitrate %lu bps (%f Mbps)%s",
+                red_printf("net test: latency %f ms, bitrate %" PRIu64 " bps (%f Mbps)%s",
                            (double)latency / 1000,
                            bitrate_per_sec,
                            (double)bitrate_per_sec / 1024 / 1024,
-- 
1.7.3.2



More information about the Spice-devel mailing list