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
This commit is contained in:
Kevin Easton
2009-11-24 10:21:30 +00:00
parent f8c9021184
commit 7ac4b8520c
4 changed files with 22 additions and 22 deletions

View File

@@ -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_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) #define my_strnicmp(x, y, n) strncasecmp(x, y, n)
#else #else
int BX_my_stricmp (const unsigned char *, const unsigned char *); int BX_my_stricmp (const char *, const char *);
int BX_my_strnicmp (const unsigned char *, const unsigned char *, size_t); int BX_my_strnicmp (const char *, const char *, size_t);
#endif #endif
int BX_my_strnstr (const unsigned char *, const unsigned char *, size_t); 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_move_word_rel (const register char *, char **, int);
char *BX_extract (char *, int, int); char *BX_extract (char *, int, int);
char *BX_extract2 (const 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 */ /* Used for connect_by_number */
#define SERVICE_SERVER 0 #define SERVICE_SERVER 0

View File

@@ -127,8 +127,8 @@ extern Function_ptr *global;
#define m_2dup (*(char * (*)(const char *, const char *))global[M_2DUP]) #define m_2dup (*(char * (*)(const char *, const char *))global[M_2DUP])
#define m_e3cat (*(char * (*)(char **, const char *, const char *))global[M_E3CAT]) #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_stricmp (*(int (*)(const char *, const char *))global[MY_STRICMP])
#define my_strnicmp (*(int (*)(const unsigned char *, const unsigned char *, size_t))global[MY_STRNICMP]) #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 my_strnstr (*(int (*)(const unsigned char *, const unsigned char *, size_t))global[MY_STRNSTR])
#define chop (*(char * (*)(char *, int))global[CHOP]) #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 move_word_rel (*(char *(*)(const char *, char **, int ))global[MOVE_WORD_REL])
#define extract (*(char *(*)(char *, int , int ))global[EXTRACT]) #define extract (*(char *(*)(char *, int , int ))global[EXTRACT])
#define extract2 (*(char *(*)(const char *, int , int ))global[EXTRACT2]) #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 */ /* network.c */
#define connect_by_number (*(int (*)(char *, unsigned short *, int , int , int ))global[CONNECT_BY_NUMBER]) #define connect_by_number (*(int (*)(char *, unsigned short *, int , int , int ))global[CONNECT_BY_NUMBER])

View File

@@ -729,23 +729,23 @@ unsigned char stricmp_table [] =
}; };
/* my_stricmp: case insensitive version of strcmp */ /* 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++; str1++, str2++;
return (stricmp_table[(unsigned short)*str1] - return (stricmp_table[(unsigned char)*str1] -
stricmp_table[(unsigned short)*str2]); stricmp_table[(unsigned char)*str2]);
} }
/* my_strnicmp: case insensitive version of strncmp */ /* 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--; str1++, str2++, n--;
return (n ? return (n ?
(stricmp_table[(unsigned short)*str1] - (stricmp_table[(unsigned char)*str1] -
stricmp_table[(unsigned short)*str2]) : 0); stricmp_table[(unsigned char)*str2]) : 0);
} }
/* my_strnstr: case insensitive version of strstr */ /* my_strnstr: case insensitive version of strstr */

View File

@@ -79,7 +79,7 @@ int old_match(const char *pattern, const char *string)
} }
#endif #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 count = 1;
int asterisk = 0; int asterisk = 0;
@@ -129,7 +129,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string)
if (*pattern == '\\') if (*pattern == '\\')
{ {
pattern++; pattern++;
if (tolower(*string) != tolower(*pattern)) if (tolower((unsigned char)*string) != tolower((unsigned char)*pattern))
continue; continue;
} }
@@ -145,7 +145,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string)
* if we dont match * if we dont match
*/ */
else if (*pattern == '?' || else if (*pattern == '?' ||
(tolower(*string) == tolower(*pattern))) (tolower((unsigned char)*string) == tolower((unsigned char)*pattern)))
{ {
asterisk = 0; asterisk = 0;
last_asterisk_point = string; last_asterisk_point = string;
@@ -188,7 +188,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string)
if (*pattern == '\\') if (*pattern == '\\')
{ {
pattern++; pattern++;
if (tolower(*string) != tolower(*pattern)) if (tolower((unsigned char)*string) != tolower((unsigned char)*pattern))
continue; 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 * If this is not the char we're looking for, then
* keep looking. * keep looking.
*/ */
else if (tolower(*string) != tolower(*pattern)) else if (tolower((unsigned char)*string) != tolower((unsigned char)*pattern))
string++; string++;
/* /*
@@ -308,7 +308,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string)
* Check to see if the dequoted character and * Check to see if the dequoted character and
* the next string character are the same. * the next string character are the same.
*/ */
if (tolower(*pattern) != tolower(*string)) if (tolower((unsigned char)*pattern) != tolower((unsigned char)*string))
return 0; return 0;
count++, string++, pattern++; 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 * and string. Are they the same? If they are, walk
* past them and go to the next character. * 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++; count++, pattern++, string++;
} }
@@ -375,7 +375,7 @@ int new_match (const unsigned char *pattern, const unsigned char *string)
* *
* \\[ and \\] handling done by Jeremy Nelson * \\[ 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? * Is there a \[ in the pattern to be expanded?