From aa2b91126827e6460a86ba0622a1f41328a7303e Mon Sep 17 00:00:00 2001 From: ultramage Date: Fri, 5 Jan 2007 15:57:01 +0000 Subject: - Major reconfiguration of the trunk VS8 project files, read the changelog for details - Also removed some deprecated code that was causing linking conflicts - And fixed a missing md5calc reference in stable's VS8 files git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9619 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/utils.c | 89 ------------------------------------------------------ src/common/utils.h | 10 ------ 2 files changed, 99 deletions(-) (limited to 'src') diff --git a/src/common/utils.c b/src/common/utils.c index 25ada1ce5..c06e57083 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -51,95 +51,6 @@ void dump(unsigned char *buffer, int num) printf("\n"); } -//NOTE: There is no need to use this function as the standard sqrt is plenty fast as it is. [Skotlex] -int newt_sqrt(int input) -{ - int new_value, value = input/2, count = 0; - if (!value) //Division by zero fix, pointed out by Shinomori. [Skotlex] - return input; - do - { - new_value = (value + input/value)>>1; - if (abs(value - new_value) <= 1) - return new_value; - value = new_value; - } - while (count++ < 25); - return new_value; -} - -#if defined(_WIN32) && !defined(MINGW) -char *rindex(char *str, char c) -{ - char *sptr; - - sptr = str; - while(*sptr) - ++sptr; - if (c == '\0') - return(sptr); - while(str != sptr) - if (*sptr-- == c) - return(++sptr); - return(NULL); -} - -int strcasecmp(const char *arg1, const char *arg2) -{ - int chk, i; - - if (arg1 == NULL || arg2 == NULL) { - ShowError("strcasecmp: received a NULL pointer, %p or %p.\n", arg1, arg2); - return (0); - } - - for (i = 0; arg1[i] || arg2[i]; i++) - if ((chk = LOWER(arg1[i]) - LOWER(arg2[i])) != 0) - return (chk); /* not equal */ - - return (0); -} - -int strncasecmp(const char *arg1, const char *arg2, size_t n) -{ - int chk, i; - - if (arg1 == NULL || arg2 == NULL) { - ShowError("strncasecmp(): received a NULL pointer, %p or %p.\n", arg1, arg2); - return (0); - } - - for (i = 0; (arg1[i] || arg2[i]) && (n > 0); i++, n--) - if ((chk = LOWER(arg1[i]) - LOWER(arg2[i])) != 0) - return (chk); /* not equal */ - - return (0); -} - -void str_upper(char *name) -{ - - int len = (int)strlen(name); - while (len--) { - if (*name >= 'a' && *name <= 'z') - *name -= ('a' - 'A'); - name++; - } -} - -void str_lower(char *name) -{ - int len = (int)strlen(name); - - while (len--) { - if (*name >= 'A' && *name <= 'Z') - *name += ('a' - 'A'); - name++; - } -} - -#endif - // Allocate a StringBuf [MouseJstr] struct StringBuf * StringBuf_Malloc() { diff --git a/src/common/utils.h b/src/common/utils.h index 120224852..efd477c9b 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -13,17 +13,7 @@ #define LOWER(c) (((c)>='A' && (c) <= 'Z') ? ((c)+('a'-'A')) : (c)) #define UPPER(c) (((c)>='a' && (c) <= 'z') ? ((c)+('A'-'a')) : (c) ) -/* strcasecmp -> stricmp -> str_cmp */ -#if defined(_WIN32) && !defined(MINGW) - int strcasecmp(const char *arg1, const char *arg2); - int strncasecmp(const char *arg1, const char *arg2, size_t n); - void str_upper(char *name); - void str_lower(char *name); - char *rindex(char *str, char c); -#endif - void dump(unsigned char *buffer, int num); -int newt_sqrt(int value); //Newton aproximation for getting a fast sqrt. struct StringBuf { char *buf_; -- cgit v1.2.3-70-g09d2