From 459ef850684e9f11f2dbb5b129a674048a7cef81 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 1 Nov 2010 16:04:18 +0000 Subject: COMMON: Switch hexdump() to debugN instead of printf Rational: hexdump() is used for debug output. An even better alternative might be to change it to return a string, instead of printing anything. This way, it could be used inside e.g. GUI debug consoles. This is left as an exercise to the interested developer :). svn-id: r54010 --- common/util.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'common') diff --git a/common/util.cpp b/common/util.cpp index 2fffdca8a6..533795ca9e 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -38,20 +38,20 @@ void hexdump(const byte *data, int len, int bytesPerLine, int startOffset) { byte c; int offset = startOffset; while (len >= bytesPerLine) { - printf("%06x: ", offset); + debugN("%06x: ", offset); for (i = 0; i < bytesPerLine; i++) { - printf("%02x ", data[i]); + debugN("%02x ", data[i]); if (i % 4 == 3) - printf(" "); + debugN(" "); } - printf(" |"); + debugN(" |"); for (i = 0; i < bytesPerLine; i++) { c = data[i]; if (c < 32 || c >= 127) c = '.'; - printf("%c", c); + debugN("%c", c); } - printf("|\n"); + debugN("|\n"); data += bytesPerLine; len -= bytesPerLine; offset += bytesPerLine; @@ -60,25 +60,25 @@ void hexdump(const byte *data, int len, int bytesPerLine, int startOffset) { if (len <= 0) return; - printf("%06x: ", offset); + debugN("%06x: ", offset); for (i = 0; i < bytesPerLine; i++) { if (i < len) - printf("%02x ", data[i]); + debugN("%02x ", data[i]); else - printf(" "); + debugN(" "); if (i % 4 == 3) - printf(" "); + debugN(" "); } - printf(" |"); + debugN(" |"); for (i = 0; i < len; i++) { c = data[i]; if (c < 32 || c >= 127) c = '.'; - printf("%c", c); + debugN("%c", c); } for (; i < bytesPerLine; i++) - printf(" "); - printf("|\n"); + debugN(" "); + debugN("|\n"); } -- cgit v1.2.3