diff options
author | Max Horn | 2003-05-04 13:46:06 +0000 |
---|---|---|
committer | Max Horn | 2003-05-04 13:46:06 +0000 |
commit | 4ba32812aac31a357bcc231bc4e1ee58149321ad (patch) | |
tree | 3fd3b574641e80fbb55688107e74a984123e466b /common | |
parent | 8700fa5ff641aec42af3eab397514fb05bc51530 (diff) | |
download | scummvm-rg350-4ba32812aac31a357bcc231bc4e1ee58149321ad.tar.gz scummvm-rg350-4ba32812aac31a357bcc231bc4e1ee58149321ad.tar.bz2 scummvm-rg350-4ba32812aac31a357bcc231bc4e1ee58149321ad.zip |
hexdump defaults to 16 bytes/line now, and prints an offest
svn-id: r7317
Diffstat (limited to 'common')
-rw-r--r-- | common/util.cpp | 14 | ||||
-rw-r--r-- | common/util.h | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/common/util.cpp b/common/util.cpp index a1ccbc6d70..1dc9855c6c 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -102,9 +102,14 @@ void hexdump(const byte * data, int len, int bytes_per_line) { assert(1 <= bytes_per_line && bytes_per_line <= 32); int i; byte c; + int offset = 0; while (len >= bytes_per_line) { - for (i = 0; i < bytes_per_line; i++) + printf("%06x: ", offset); + for (i = 0; i < bytes_per_line; i++) { printf("%02x ", data[i]); + if (i % 4 == 3) + printf(" "); + } printf(" |"); for (i = 0; i < bytes_per_line; i++) { c = data[i]; @@ -115,13 +120,18 @@ void hexdump(const byte * data, int len, int bytes_per_line) { printf("|\n"); data += bytes_per_line; len -= bytes_per_line; + offset += bytes_per_line; } if (len <= 0) return; - for (i = 0; i < len; i++) + printf("%06x: ", offset); + for (i = 0; i < len; i++) { printf("%02x ", data[i]); + if (i % 4 == 3) + printf(" "); + } for (; i < bytes_per_line; i++) printf(" "); printf(" |"); diff --git a/common/util.h b/common/util.h index 9fc73acdcb..7123a8e4a1 100644 --- a/common/util.h +++ b/common/util.h @@ -45,7 +45,7 @@ void ClearBlendCache(byte *palette, int weight); /* * Print hexdump of the data passed in */ -void hexdump(const byte * data, int len, int bytes_per_line = 8); +void hexdump(const byte * data, int len, int bytes_per_line = 16); class RandomSource { private: |