From: Darren S. <li...@yo...> - 2008-06-04 23:13:31
|
# HG changeset patch # User Darren Salt <li...@yo...> # Date 1212620662 -3600 # Node ID 699b03f9515e1618e87713908b1418d401199ba0 # Parent 1c99f4be72958c5f4a6b07bdcf8d9ecc7bb5d547 Stop xine_hexdump() from segfaulting and fix its output. diff -r 699b03f9515e1618e87713908b1418d401199ba0 -r 1c99f4be72958c5f4a6b07bdcf8d9ecc7bb5d547 src/xine-utils/utils.c --- a/src/xine-utils/utils.c Thu Jun 05 00:04:22 2008 +0100 +++ b/src/xine-utils/utils.c Thu May 29 16:03:35 2008 +0100 @@ -525,7 +525,7 @@ void xine_hexdump (const void *buf_gen, 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, } 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; |