aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2010-11-01 16:04:18 +0000
committerMax Horn2010-11-01 16:04:18 +0000
commit459ef850684e9f11f2dbb5b129a674048a7cef81 (patch)
tree30ef70febf54e0e58dde764a86d9a39d69dd7b13 /common
parentf77b8aee7578bc6ad1afee74d5c6c24e56850f05 (diff)
downloadscummvm-rg350-459ef850684e9f11f2dbb5b129a674048a7cef81.tar.gz
scummvm-rg350-459ef850684e9f11f2dbb5b129a674048a7cef81.tar.bz2
scummvm-rg350-459ef850684e9f11f2dbb5b129a674048a7cef81.zip
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
Diffstat (limited to 'common')
-rw-r--r--common/util.cpp28
1 files changed, 14 insertions, 14 deletions
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");
}