From 560650a8a99a591398cd7f4c2df893aa5a9db2c2 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 2 Dec 2002 00:42:25 +0000 Subject: [PATCH] renamed and altered SZ_HexDumpToConsole to be Com_HexDumpToConsole which takes a qbyte * and a size, instead of a sizebuf_t added SZ_HexDumptoConsole which just calls Com_HexDumpToConsole git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2663 d7cf8633-e32d-0410-b094-e92efae38249 --- common.c | 17 +++++++++++------ common.h | 2 ++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/common.c b/common.c index a10d08b7..c6a16ee0 100644 --- a/common.c +++ b/common.c @@ -467,14 +467,14 @@ void SZ_Print (sizebuf_t *buf, const char *data) } static char *hexchar = "0123456789ABCDEF"; -void SZ_HexDumpToConsole(const sizebuf_t *buf) +void Com_HexDumpToConsole(const qbyte *data, int size) { int i; char text[1024]; char *cur, *flushpointer; cur = text; flushpointer = text + 512; - for (i = 0;i < buf->cursize;i++) + for (i = 0;i < size;i++) { if ((i & 15) == 0) { @@ -491,13 +491,13 @@ void SZ_HexDumpToConsole(const sizebuf_t *buf) *cur++ = ' '; if (i & 1) { - *cur++ = hexchar[(buf->data[i] >> 4) & 15] | 0x80; - *cur++ = hexchar[(buf->data[i] >> 0) & 15] | 0x80; + *cur++ = hexchar[(data[i] >> 4) & 15] | 0x80; + *cur++ = hexchar[(data[i] >> 0) & 15] | 0x80; } else { - *cur++ = hexchar[(buf->data[i] >> 4) & 15]; - *cur++ = hexchar[(buf->data[i] >> 0) & 15]; + *cur++ = hexchar[(data[i] >> 4) & 15]; + *cur++ = hexchar[(data[i] >> 0) & 15]; } if (cur >= flushpointer) { @@ -515,6 +515,11 @@ void SZ_HexDumpToConsole(const sizebuf_t *buf) } } +void SZ_HexDumpToConsole(const sizebuf_t *buf) +{ + Com_HexDumpToConsole(buf->data, buf->cursize); +} + //============================================================================ diff --git a/common.h b/common.h index 1aac4caa..1a917ca5 100644 --- a/common.h +++ b/common.h @@ -46,6 +46,8 @@ void SZ_Write (sizebuf_t *buf, const void *data, int length); void SZ_Print (sizebuf_t *buf, const char *data); // strcats onto the sizebuf void SZ_HexDumpToConsole(const sizebuf_t *buf); +void Com_HexDumpToConsole(const qbyte *data, int size); + //============================================================================ #if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG) #if defined(__i386__) || defined(__ia64__) || defined(WIN32) || (defined(__alpha__) || defined(__alpha)) || defined(__arm__) || (defined(__mips__) && defined(__MIPSEL__)) || defined(__LITTLE_ENDIAN__) -- 2.39.2