summaryrefslogtreecommitdiff
path: root/src/common/utils.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-09 13:03:34 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-04-09 13:03:34 +0000
commit78d148b352731f8af910251e3700d3eaa9d59cf7 (patch)
treeb5a744f0f90649b1e9f8fd4f782f9e2ae1b026fe /src/common/utils.c
parentcc716ca00420c23bdb02831f8fc205d4588e1f75 (diff)
downloadhercules-78d148b352731f8af910251e3700d3eaa9d59cf7.tar.gz
hercules-78d148b352731f8af910251e3700d3eaa9d59cf7.tar.bz2
hercules-78d148b352731f8af910251e3700d3eaa9d59cf7.tar.xz
hercules-78d148b352731f8af910251e3700d3eaa9d59cf7.zip
* 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
Diffstat (limited to 'src/common/utils.c')
-rw-r--r--src/common/utils.c77
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)