diff options
Diffstat (limited to 'src/common/utils.c')
-rw-r--r-- | src/common/utils.c | 77 |
1 files changed, 41 insertions, 36 deletions
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 <stdio.h> #include <stdarg.h> #include <stdlib.h> @@ -14,42 +20,41 @@ #include <sys/stat.h> #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) |