From 78d148b352731f8af910251e3700d3eaa9d59cf7 Mon Sep 17 00:00:00 2001 From: FlavioJS Date: Mon, 9 Apr 2007 13:03:34 +0000 Subject: * Changed db key from 'unsigned char*' to 'const char*'. * Defined out the dump function in util.h/c. Notes: saw some suspicious code in npc.c so kept the 'const char*' propagation to a minimum for now git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10193 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/utils.c | 77 +++++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'src/common/utils.c') diff --git a/src/common/utils.c b/src/common/utils.c index 2f5cf8705..d6a017c95 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -1,6 +1,12 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder +#include "../common/cbasetypes.h" +#include "../common/mmo.h" +#include "../common/malloc.h" +#include "../common/showmsg.h" +#include "utils.h" + #include #include #include @@ -14,42 +20,41 @@ #include #endif -#include "utils.h" -#include "../common/mmo.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/cbasetypes.h" - -void dump(unsigned char* buffer, int num) +#ifdef UTIL_DUMP +void dump(const unsigned char* buffer, int num) { - int icnt, jcnt; - - printf(" Hex ASCII\n"); - printf(" ----------------------------------------------- ----------------"); - - for (icnt = 0; icnt < num; icnt += 16) { - printf("\n%p ", &buffer[icnt]); - for (jcnt = icnt; jcnt < icnt + 16; ++jcnt) { - if (jcnt < num) { - printf("%02hX ", buffer[jcnt]); - } else - printf(" "); - } - - printf(" | "); - - for (jcnt = icnt; jcnt < icnt + 16; ++jcnt) { - if (jcnt < num) { - if (buffer[jcnt] > 31 && buffer[jcnt] < 127) - printf("%c", buffer[jcnt]); - else - printf("."); - } else - printf(" "); - } - } - printf("\n"); + int icnt, jcnt; + + printf(" Hex ASCII\n"); + printf(" ----------------------------------------------- ----------------"); + + for (icnt = 0; icnt < num; icnt += 16) + { + printf("\n%p ", &buffer[icnt]); + for (jcnt = icnt; jcnt < icnt + 16; ++jcnt) + { + if (jcnt < num) + printf("%02hX ", buffer[jcnt]); + else + printf(" "); + } + + printf(" | "); + + for (jcnt = icnt; jcnt < icnt + 16; ++jcnt) + { + if (jcnt < num) { + if (buffer[jcnt] > 31 && buffer[jcnt] < 127) + printf("%c", buffer[jcnt]); + else + printf("."); + } else + printf(" "); + } + } + printf("\n"); } +#endif // Allocate a StringBuf [MouseJstr] struct StringBuf * StringBuf_Malloc() @@ -141,7 +146,7 @@ char * StringBuf_Value(struct StringBuf *sbuf) #ifdef WIN32 -char* checkpath(char *path, const char *srcpath) +static char* checkpath(char *path, const char *srcpath) { // just make sure the char*path is not const char *p=path; if(NULL!=path && NULL!=srcpath) @@ -202,7 +207,7 @@ void findfile(const char *p, const char *pat, void (func)(const char*)) #define MAX_DIR_PATH 2048 -char* checkpath(char *path, const char*srcpath) +static char* checkpath(char *path, const char*srcpath) { // just make sure the char*path is not const char *p=path; if(NULL!=path && NULL!=srcpath) -- cgit v1.2.3-60-g2f50