diff options
author | Jonathan Beck | 2009-01-08 18:51:42 +0100 |
---|---|---|
committer | Jonathan Beck | 2009-01-08 18:51:42 +0100 |
commit | f53b61c82be8aa6223ab6a524c2287d892f9864c (patch) | |
tree | 99f67152a644ded15d0bd7cd16664c4eb1eb7c00 /src/utils.c | |
parent | 5514a3b2a9734d311e4f6014585f922e0b748cab (diff) | |
parent | ef98ef7211bc6277e9a87349f0405957ab264936 (diff) | |
download | libimobiledevice-f53b61c82be8aa6223ab6a524c2287d892f9864c.tar.gz libimobiledevice-f53b61c82be8aa6223ab6a524c2287d892f9864c.tar.bz2 |
Merge branch 'nikias' into plist
Conflicts:
src/lockdown.c
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/utils.c b/src/utils.c index ceb1f5d..fb98471 100644 --- a/src/utils.c +++ b/src/utils.c @@ -56,11 +56,35 @@ void log_debug_msg(const char *format, ...) inline void log_debug_buffer(const char *data, const int length) { #ifndef STRIP_DEBUG_CODE + int i; + int j; + unsigned char c; - /* run the real fprintf */ - if (toto_debug) - fwrite(data, 1, length, stderr); - + if (toto_debug) { + for (i = 0; i < length; i += 16) { + fprintf(stderr, "%04x: ", i); + for (j = 0; j < 16; j++) { + if (i + j >= length) { + fprintf(stderr, " "); + continue; + } + fprintf(stderr, "%02hhx ", *(data + i + j)); + } + fprintf(stderr, " | "); + for (j = 0; j < 16; j++) { + if (i + j >= length) + break; + c = *(data + i + j); + if ((c < 32) || (c > 127)) { + fprintf(stderr, "."); + continue; + } + fprintf(stderr, "%c", c); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } #endif } |