version 1.29, 2005/06/06 14:27:55
|
version 1.29.2.1, 2005/09/29 03:25:00
|
|
|
#include <cstring> | #include <cstring> |
#include "System.h" | #include "System.h" |
#include "Socket.h" | #include "Socket.h" |
|
#include "CharSet.h" |
| |
#ifdef PEGASUS_PLATFORM_WIN32_IX86_MSVC | #ifdef PEGASUS_PLATFORM_WIN32_IX86_MSVC |
# include <windows.h> | # include <windows.h> |
|
|
return true; | return true; |
} | } |
| |
// ATTN: Move to platform-specific System implementation files and call |
|
// strcasecmp where it is available. |
|
Sint32 System::strcasecmp(const char* s1, const char* s2) | Sint32 System::strcasecmp(const char* s1, const char* s2) |
{ | { |
while (*s1 && *s2) |
// Note: this is faster than glibc strcasecmp(). |
{ |
|
int r = tolower(*s1++) - tolower(*s2++); |
|
| |
if (r) |
Uint8* p = (Uint8*)s1; |
return r; |
Uint8* q = (Uint8*)s2; |
} |
int r; |
|
|
|
for (;;) |
|
{ |
|
if ((r = CharSet::to_lower(p[0]) - CharSet::to_lower(q[0])) || !p[0] || |
|
(r = CharSet::to_lower(p[1]) - CharSet::to_lower(q[1])) || !p[1] || |
|
(r = CharSet::to_lower(p[2]) - CharSet::to_lower(q[2])) || !p[2] || |
|
(r = CharSet::to_lower(p[3]) - CharSet::to_lower(q[3])) || !p[3]) |
|
break; |
| |
if (*s2) |
p += 4; |
return -1; |
q += 4; |
else if (*s1) |
} |
return 1; |
|
| |
return 0; |
return r; |
} | } |
| |
// Return the just the file name from the path into basename | // Return the just the file name from the path into basename |