aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2016-02-10 13:29:40 -0500
committerJohn Snow <jsnow@redhat.com>2016-02-10 13:29:40 -0500
commitc691320faa6a1749042134716a628e22abb81ed2 (patch)
tree720914932a279aa9a1f4efba5ab42dedc77fe414
parentf34ae00d6d22671d8583892fa702f21f3049ef72 (diff)
fdc: always compile-check debug prints
Coverity noticed that some variables are only used by debug prints, and called them unused. Always compile the print statements. While we're here, print to stderr as well. Bonus: Fix a debug printf I broke in f31937aa8 Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Touched up commit message. --js] Message-id: 1454971529-14830-1-git-send-email-jsnow@redhat.com
-rw-r--r--hw/block/fdc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index a6f22ef200..9838d21cf5 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -41,14 +41,15 @@
/********************************************************/
/* debug Floppy devices */
-//#define DEBUG_FLOPPY
-#ifdef DEBUG_FLOPPY
+#define DEBUG_FLOPPY 0
+
#define FLOPPY_DPRINTF(fmt, ...) \
- do { printf("FLOPPY: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define FLOPPY_DPRINTF(fmt, ...)
-#endif
+ do { \
+ if (DEBUG_FLOPPY) { \
+ fprintf(stderr, "FLOPPY: " fmt , ## __VA_ARGS__); \
+ } \
+ } while (0)
/********************************************************/
/* Floppy drive emulation */
@@ -353,7 +354,7 @@ static int pick_geometry(FDrive *drv)
parse = &fd_formats[size_match];
FLOPPY_DPRINTF("User requested floppy drive type '%s', "
"but inserted medium appears to be a "
- "%d sector '%s' type\n",
+ "%"PRId64" sector '%s' type\n",
FloppyDriveType_lookup[drv->drive],
nb_sectors,
FloppyDriveType_lookup[parse->drive]);