diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-06-05 00:04:22 +0100 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-06-05 00:04:22 +0100 |
commit | 8f1264ac2d3cb3e81f3ce64973b150fc82681286 (patch) | |
tree | 978dc43a120ac633c39012edafb6f33a49f11f51 | |
parent | f5345900a0e36a83841ad06b11aa4bdb22ebb883 (diff) | |
download | xine-lib-8f1264ac2d3cb3e81f3ce64973b150fc82681286.tar.gz xine-lib-8f1264ac2d3cb3e81f3ce64973b150fc82681286.tar.bz2 |
Stop xine_hexdump() from segfaulting and fix its output.
-rw-r--r-- | src/xine-utils/utils.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 4a2ecb6c2..3d9939f91 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -525,7 +525,7 @@ void xine_usec_sleep(unsigned usec) { void xine_hexdump (const void *buf_gen, int length) { static const char separator[70] = "---------------------------------------------------------------------"; - const uint8_t *const buf = (const uint8_t*)buf; + const uint8_t *const buf = (const uint8_t*)buf_gen; int j = 0; /* printf ("Hexdump: %i Bytes\n", length);*/ @@ -544,11 +544,7 @@ void xine_hexdump (const void *buf_gen, int length) { } for (i=j; i < imax; i++) { - uint8_t c = buf[i]; - if ((c>=32) && (c<127)) - c = '.'; - - fputc(c, stdout); + fputc ((buf[i] >= 32 && buf[i] <= 126) ? buf[i] : '.', stdout); } j=i; |