just avoid memicmp completely
This commit is contained in:
@@ -822,20 +822,6 @@ CString WcharToUTF8( wchar_t c )
|
|||||||
return CString(buf, cnt);
|
return CString(buf, cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(WIN32)
|
|
||||||
/* XXX autoconf this */
|
|
||||||
int memicmp(const char *s1, const char *s2, size_t n)
|
|
||||||
{
|
|
||||||
for(size_t i = 0; i < n; ++i)
|
|
||||||
{
|
|
||||||
char c1 = tolower(s1[i]);
|
|
||||||
char c2 = tolower(s2[i]);
|
|
||||||
if(c1 < c2) return -1;
|
|
||||||
if(c1 > c2) return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Replace &#nnnn; (decimal) &xnnnn; (hex) with corresponding UTF-8 characters. */
|
/* Replace &#nnnn; (decimal) &xnnnn; (hex) with corresponding UTF-8 characters. */
|
||||||
void Replace_Unicode_Markers( CString &Text )
|
void Replace_Unicode_Markers( CString &Text )
|
||||||
|
|||||||
@@ -243,9 +243,16 @@ struct char_traits_char_nocase: public char_traits<char>
|
|||||||
static bool lt( char c1, char c2 )
|
static bool lt( char c1, char c2 )
|
||||||
{ return toupper(c1) < toupper(c2); }
|
{ return toupper(c1) < toupper(c2); }
|
||||||
|
|
||||||
static int compare( const char* s1, const char* s2, size_t n ) {
|
static int compare( const char* s1, const char* s2, size_t n )
|
||||||
return memicmp( s1, s2, n );
|
{
|
||||||
//return strncasecmp( s1, s2, n );
|
for(size_t i = 0; i < n; ++i)
|
||||||
|
{
|
||||||
|
const char c1 = (char) tolower(s1[i]);
|
||||||
|
const char c2 = (char) tolower(s2[i]);
|
||||||
|
if(c1 < c2) return -1;
|
||||||
|
if(c1 > c2) return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char fasttoupper(char a)
|
static inline char fasttoupper(char a)
|
||||||
@@ -255,11 +262,12 @@ struct char_traits_char_nocase: public char_traits<char>
|
|||||||
return a+('A'-'a');
|
return a+('A'-'a');
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *find( const char* s, int n, char a ) {
|
static const char *find( const char* s, int n, char a )
|
||||||
|
{
|
||||||
a = fasttoupper(a);
|
a = fasttoupper(a);
|
||||||
while( n-- > 0 && fasttoupper(*s) != a ) {
|
while( n-- > 0 && fasttoupper(*s) != a )
|
||||||
++s;
|
++s;
|
||||||
}
|
|
||||||
if(fasttoupper(*s) == a)
|
if(fasttoupper(*s) == a)
|
||||||
return s;
|
return s;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user