From 7ac4b8520cbd87e51708fab4d0984785d1a493e4 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Tue, 24 Nov 2009 10:21:30 +0000 Subject: [PATCH] Convert my_stricmp, my_strnicmp and wild_match from unsigned char * to char *. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@80 13b04d17-f746-0410-82c6-800466cd88b0 --- include/ircaux.h | 6 +++--- include/modval.h | 6 +++--- source/ircaux.c | 16 ++++++++-------- source/reg.c | 16 ++++++++-------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/ircaux.h b/include/ircaux.h index 46370f9..e52bcd6 100644 --- a/include/ircaux.h +++ b/include/ircaux.h @@ -62,8 +62,8 @@ char * BX_my_ctime (time_t); #define my_stricmp(x, y) strcasecmp(x, y) /* unable to use these for reasons of case sensitivity and finish */ #define my_strnicmp(x, y, n) strncasecmp(x, y, n) #else -int BX_my_stricmp (const unsigned char *, const unsigned char *); -int BX_my_strnicmp (const unsigned char *, const unsigned char *, size_t); +int BX_my_stricmp (const char *, const char *); +int BX_my_strnicmp (const char *, const char *, size_t); #endif int BX_my_strnstr (const unsigned char *, const unsigned char *, size_t); @@ -143,7 +143,7 @@ char *BX_move_to_abs_word (const register char *, char **, int); char *BX_move_word_rel (const register char *, char **, int); char *BX_extract (char *, int, int); char *BX_extract2 (const char *, int, int); -int BX_wild_match (register const unsigned char *, register const unsigned char *); +int BX_wild_match (const char *, const char *); /* Used for connect_by_number */ #define SERVICE_SERVER 0 diff --git a/include/modval.h b/include/modval.h index 7b93ca4..cfcf5b9 100644 --- a/include/modval.h +++ b/include/modval.h @@ -127,8 +127,8 @@ extern Function_ptr *global; #define m_2dup (*(char * (*)(const char *, const char *))global[M_2DUP]) #define m_e3cat (*(char * (*)(char **, const char *, const char *))global[M_E3CAT]) -#define my_stricmp (*(int (*)(const unsigned char *, const unsigned char *))global[MY_STRICMP]) -#define my_strnicmp (*(int (*)(const unsigned char *, const unsigned char *, size_t))global[MY_STRNICMP]) +#define my_stricmp (*(int (*)(const char *, const char *))global[MY_STRICMP]) +#define my_strnicmp (*(int (*)(const char *, const char *, size_t))global[MY_STRNICMP]) #define my_strnstr (*(int (*)(const unsigned char *, const unsigned char *, size_t))global[MY_STRNSTR]) #define chop (*(char * (*)(char *, int))global[CHOP]) @@ -212,7 +212,7 @@ extern Function_ptr *global; #define move_word_rel (*(char *(*)(const char *, char **, int ))global[MOVE_WORD_REL]) #define extract (*(char *(*)(char *, int , int ))global[EXTRACT]) #define extract2 (*(char *(*)(const char *, int , int ))global[EXTRACT2]) -#define wild_match (*(int (*)(const unsigned char *, const unsigned char *))global[WILD_MATCH]) +#define wild_match (*(int (*)(const char *, const char *))global[WILD_MATCH]) /* network.c */ #define connect_by_number (*(int (*)(char *, unsigned short *, int , int , int ))global[CONNECT_BY_NUMBER]) diff --git a/source/ircaux.c b/source/ircaux.c index bfebd6d..6eee6d7 100644 --- a/source/ircaux.c +++ b/source/ircaux.c @@ -729,23 +729,23 @@ unsigned char stricmp_table [] = }; /* my_stricmp: case insensitive version of strcmp */ -int BX_my_stricmp (register const unsigned char *str1, register const unsigned char *str2) +int BX_my_stricmp (const char *str1, const char *str2) { - while (*str1 && *str2 && (stricmp_table[(unsigned short)*str1] == stricmp_table[(unsigned short)*str2])) + while (*str1 && *str2 && (stricmp_table[(unsigned char)*str1] == stricmp_table[(unsigned char)*str2])) str1++, str2++; - return (stricmp_table[(unsigned short)*str1] - - stricmp_table[(unsigned short)*str2]); + return (stricmp_table[(unsigned char)*str1] - + stricmp_table[(unsigned char)*str2]); } /* my_strnicmp: case insensitive version of strncmp */ -int BX_my_strnicmp (register const unsigned char *str1, register const unsigned char *str2, register size_t n) +int BX_my_strnicmp (const char *str1, const char *str2, size_t n) { - while (n && *str1 && *str2 && (stricmp_table[(unsigned short)*str1] == stricmp_table[(unsigned short)*str2])) + while (n && *str1 && *str2 && (stricmp_table[(unsigned char)*str1] == stricmp_table[(unsigned char)*str2])) str1++, str2++, n--; return (n ? - (stricmp_table[(unsigned short)*str1] - - stricmp_table[(unsigned short)*str2]) : 0); + (stricmp_table[(unsigned char)*str1] - + stricmp_table[(unsigned char)*str2]) : 0); } /* my_strnstr: case insensitive version of strstr */ diff --git a/source/reg.c b/source/reg.c index 18438d2..b400e64 100644 --- a/source/reg.c +++ b/source/reg.c @@ -79,7 +79,7 @@ int old_match(const char *pattern, const char *string) } #endif -int new_match (const unsigned char *pattern, const unsigned char *string) +int new_match (const char *pattern, const char *string) { int count = 1; int asterisk = 0; @@ -129,7 +129,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string) if (*pattern == '\\') { pattern++; - if (tolower(*string) != tolower(*pattern)) + if (tolower((unsigned char)*string) != tolower((unsigned char)*pattern)) continue; } @@ -145,7 +145,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string) * if we dont match */ else if (*pattern == '?' || - (tolower(*string) == tolower(*pattern))) + (tolower((unsigned char)*string) == tolower((unsigned char)*pattern))) { asterisk = 0; last_asterisk_point = string; @@ -188,7 +188,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string) if (*pattern == '\\') { pattern++; - if (tolower(*string) != tolower(*pattern)) + if (tolower((unsigned char)*string) != tolower((unsigned char)*pattern)) continue; } @@ -208,7 +208,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string) * If this is not the char we're looking for, then * keep looking. */ - else if (tolower(*string) != tolower(*pattern)) + else if (tolower((unsigned char)*string) != tolower((unsigned char)*pattern)) string++; /* @@ -308,7 +308,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string) * Check to see if the dequoted character and * the next string character are the same. */ - if (tolower(*pattern) != tolower(*string)) + if (tolower((unsigned char)*pattern) != tolower((unsigned char)*string)) return 0; count++, string++, pattern++; @@ -330,7 +330,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string) * and string. Are they the same? If they are, walk * past them and go to the next character. */ - if (tolower(*pattern) == tolower(*string)) + if (tolower((unsigned char)*pattern) == tolower((unsigned char)*string)) { count++, pattern++, string++; } @@ -375,7 +375,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string) * * \\[ and \\] handling done by Jeremy Nelson */ -int BX_wild_match (register const unsigned char *p, register const unsigned char *str) +int BX_wild_match (const char *p, const char *str) { /* * Is there a \[ in the pattern to be expanded?