hw/yagl_log.c: fix printf specifier for target_ulong type
authorIgor Mitsyanko <i.mitsyanko@samsung.com>
Tue, 6 Nov 2012 15:28:02 +0000 (19:28 +0400)
committerEvgeny Voevodin <e.voevodin@samsung.com>
Mon, 26 Nov 2012 09:25:32 +0000 (13:25 +0400)
On 64-bit hosts %lX specifies 64-bit long variable, therefore when its used with 32-bit
target_ulong, it prints bogus 64 bit long value.

Note that PRIX64 macro could be broken on mingw32, maybe we should manually check
host word size in the future.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
hw/yagl_log.c

index 7c749c6a5bae8e283c923aa983d75a955fe61cad..2ad0ca2b31cbca834362764a360f44fc0ee355d2 100644 (file)
@@ -46,7 +46,13 @@ static struct
     { "GLchar", "%" PRIi8 },
     { "GLintptr", "%ld" },
     { "GLsizeiptr", "%ld" },
-    { "target_ulong", "0x%lX" }
+#if TARGET_LONG_SIZE == 4
+    { "target_ulong", "0x%X" }
+#elif TARGET_LONG_SIZE == 8
+    { "target_ulong", "0x%" PRIX64 }
+#else
+#error TARGET_LONG_SIZE undefined
+#endif
 };
 
 static yagl_log_level g_log_level = yagl_log_level_off;