version 1.74.2.1, 2009/10/20 13:21:19
|
version 1.76, 2009/12/15 10:52:33
|
|
|
return r; | return r; |
} | } |
| |
bool System::strncasecmp( |
|
const char* s1, |
|
size_t s1_l, |
|
const char* s2, |
|
size_t s2_l) |
|
{ |
|
// Function is even faster than System::strcasecmp() |
|
if (s1_l != s2_l) |
|
{ |
|
return false; |
|
} |
|
Uint8* p = (Uint8*)s1; |
|
Uint8* q = (Uint8*)s2; |
|
register int len = s1_l; |
|
// lets do a loop-unrolling optimized compare here |
|
while (len >= 8) |
|
{ |
|
if ((_toLowerTable[p[0]]-_toLowerTable[q[0]]) || |
|
(_toLowerTable[p[1]]-_toLowerTable[q[1]]) || |
|
(_toLowerTable[p[2]]-_toLowerTable[q[2]]) || |
|
(_toLowerTable[p[3]]-_toLowerTable[q[3]]) || |
|
(_toLowerTable[p[4]]-_toLowerTable[q[4]]) || |
|
(_toLowerTable[p[5]]-_toLowerTable[q[5]]) || |
|
(_toLowerTable[p[6]]-_toLowerTable[q[6]]) || |
|
(_toLowerTable[p[7]]-_toLowerTable[q[7]])) |
|
{ |
|
return false; |
|
} |
|
len -= 8; |
|
p += 8; |
|
q += 8; |
|
} |
|
while (len >= 4) |
|
{ |
|
if ((_toLowerTable[p[0]]-_toLowerTable[q[0]]) || |
|
(_toLowerTable[p[1]]-_toLowerTable[q[1]]) || |
|
(_toLowerTable[p[2]]-_toLowerTable[q[2]]) || |
|
(_toLowerTable[p[3]]-_toLowerTable[q[3]])) |
|
{ |
|
return false; |
|
} |
|
len -= 4; |
|
p += 4; |
|
q += 4; |
|
} |
|
while (len--) |
|
{ |
|
if ((_toLowerTable[p[0]]-_toLowerTable[q[0]])) |
|
{ |
|
return false; |
|
} |
|
p++; |
|
q++; |
|
} |
|
return true; |
|
} |
|
|
|
|
|
// Return the just the file name from the path into basename | // Return the just the file name from the path into basename |
char *System::extract_file_name(const char *fullpath, char *basename) | char *System::extract_file_name(const char *fullpath, char *basename) |
{ | { |
|
|
#ifdef PEGASUS_ENABLE_IPV6 | #ifdef PEGASUS_ENABLE_IPV6 |
struct in6_addr ip6 = PEGASUS_IPV6_LOOPBACK_INIT; | struct in6_addr ip6 = PEGASUS_IPV6_LOOPBACK_INIT; |
#endif | #endif |
Uint32 ip4 = PEGASUS_IPV4_LOOPBACK_INIT; |
|
switch (af) | switch (af) |
{ | { |
#ifdef PEGASUS_ENABLE_IPV6 | #ifdef PEGASUS_ENABLE_IPV6 |
|
|
Uint32 tmp; | Uint32 tmp; |
memcpy(&tmp, binIPAddress, sizeof(Uint32)); | memcpy(&tmp, binIPAddress, sizeof(Uint32)); |
Uint32 n = ntohl(tmp); | Uint32 n = ntohl(tmp); |
return !memcmp(&ip4, &n, sizeof (ip4)); |
return n >= PEGASUS_IPV4_LOOPBACK_RANGE_START && |
|
n <= PEGASUS_IPV4_LOOPBACK_RANGE_END; |
} | } |
} | } |
| |
|
|
#endif | #endif |
| |
// System ID constants for Logger::put and Logger::trace | // System ID constants for Logger::put and Logger::trace |
|
#ifdef PEGASUS_FLAVOR |
|
const String System::CIMLISTENER = "cimlistener" PEGASUS_FLAVOR; |
|
#else |
const String System::CIMLISTENER = "cimlistener"; // Listener systme ID | const String System::CIMLISTENER = "cimlistener"; // Listener systme ID |
|
#endif |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |