length() comparisons in stringccxmp were reversed...
This commit is contained in:
parent
cdcbb01eab
commit
59ba8e9fce
1 changed files with 76 additions and 76 deletions
|
@ -57,7 +57,7 @@ int stringicmp(const string & s1, const string& s2)
|
||||||
int size1 = s1.length(), size2 = s2.length();
|
int size1 = s1.length(), size2 = s2.length();
|
||||||
char c1, c2;
|
char c1, c2;
|
||||||
|
|
||||||
if (size1 > size2) {
|
if (size1 < size2) {
|
||||||
while (it1 != s1.end()) {
|
while (it1 != s1.end()) {
|
||||||
c1 = ::toupper(*it1);
|
c1 = ::toupper(*it1);
|
||||||
c2 = ::toupper(*it2);
|
c2 = ::toupper(*it2);
|
||||||
|
@ -66,7 +66,7 @@ int stringicmp(const string & s1, const string& s2)
|
||||||
}
|
}
|
||||||
++it1; ++it2;
|
++it1; ++it2;
|
||||||
}
|
}
|
||||||
return size1 == size2 ? 0 : 1;
|
return size1 == size2 ? 0 : -1;
|
||||||
} else {
|
} else {
|
||||||
while (it2 != s2.end()) {
|
while (it2 != s2.end()) {
|
||||||
c1 = ::toupper(*it1);
|
c1 = ::toupper(*it1);
|
||||||
|
@ -76,7 +76,7 @@ int stringicmp(const string & s1, const string& s2)
|
||||||
}
|
}
|
||||||
++it1; ++it2;
|
++it1; ++it2;
|
||||||
}
|
}
|
||||||
return size1 == size2 ? 0 : -1;
|
return size1 == size2 ? 0 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void stringtolower(string& io)
|
void stringtolower(string& io)
|
||||||
|
@ -117,7 +117,7 @@ int stringlowercmp(const string & s1, const string& s2)
|
||||||
int size1 = s1.length(), size2 = s2.length();
|
int size1 = s1.length(), size2 = s2.length();
|
||||||
char c2;
|
char c2;
|
||||||
|
|
||||||
if (size1 > size2) {
|
if (size1 < size2) {
|
||||||
while (it1 != s1.end()) {
|
while (it1 != s1.end()) {
|
||||||
c2 = ::tolower(*it2);
|
c2 = ::tolower(*it2);
|
||||||
if (*it1 != c2) {
|
if (*it1 != c2) {
|
||||||
|
@ -125,7 +125,7 @@ int stringlowercmp(const string & s1, const string& s2)
|
||||||
}
|
}
|
||||||
++it1; ++it2;
|
++it1; ++it2;
|
||||||
}
|
}
|
||||||
return size1 == size2 ? 0 : 1;
|
return size1 == size2 ? 0 : -1;
|
||||||
} else {
|
} else {
|
||||||
while (it2 != s2.end()) {
|
while (it2 != s2.end()) {
|
||||||
c2 = ::tolower(*it2);
|
c2 = ::tolower(*it2);
|
||||||
|
@ -134,7 +134,7 @@ int stringlowercmp(const string & s1, const string& s2)
|
||||||
}
|
}
|
||||||
++it1; ++it2;
|
++it1; ++it2;
|
||||||
}
|
}
|
||||||
return size1 == size2 ? 0 : -1;
|
return size1 == size2 ? 0 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ int stringuppercmp(const string & s1, const string& s2)
|
||||||
int size1 = s1.length(), size2 = s2.length();
|
int size1 = s1.length(), size2 = s2.length();
|
||||||
char c2;
|
char c2;
|
||||||
|
|
||||||
if (size1 > size2) {
|
if (size1 < size2) {
|
||||||
while (it1 != s1.end()) {
|
while (it1 != s1.end()) {
|
||||||
c2 = ::toupper(*it2);
|
c2 = ::toupper(*it2);
|
||||||
if (*it1 != c2) {
|
if (*it1 != c2) {
|
||||||
|
@ -154,7 +154,7 @@ int stringuppercmp(const string & s1, const string& s2)
|
||||||
}
|
}
|
||||||
++it1; ++it2;
|
++it1; ++it2;
|
||||||
}
|
}
|
||||||
return size1 == size2 ? 0 : 1;
|
return size1 == size2 ? 0 : -1;
|
||||||
} else {
|
} else {
|
||||||
while (it2 != s2.end()) {
|
while (it2 != s2.end()) {
|
||||||
c2 = ::toupper(*it2);
|
c2 = ::toupper(*it2);
|
||||||
|
@ -163,7 +163,7 @@ int stringuppercmp(const string & s1, const string& s2)
|
||||||
}
|
}
|
||||||
++it1; ++it2;
|
++it1; ++it2;
|
||||||
}
|
}
|
||||||
return size1 == size2 ? 0 : -1;
|
return size1 == size2 ? 0 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,73 +708,73 @@ typedef int clockid_t;
|
||||||
#undef USE_CLOCK_GETTIME
|
#undef USE_CLOCK_GETTIME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "safewindows.h"
|
#include "safewindows.h"
|
||||||
// Note: struct timespec is defined by pthread.h (from pthreads-w32)
|
// Note: struct timespec is defined by pthread.h (from pthreads-w32)
|
||||||
#ifndef CLOCK_REALTIME
|
#ifndef CLOCK_REALTIME
|
||||||
#define CLOCK_REALTIME 0
|
#define CLOCK_REALTIME 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LARGE_INTEGER getFILETIMEoffset()
|
LARGE_INTEGER getFILETIMEoffset()
|
||||||
{
|
{
|
||||||
SYSTEMTIME s;
|
SYSTEMTIME s;
|
||||||
FILETIME f;
|
FILETIME f;
|
||||||
LARGE_INTEGER t;
|
LARGE_INTEGER t;
|
||||||
|
|
||||||
s.wYear = 1970;
|
s.wYear = 1970;
|
||||||
s.wMonth = 1;
|
s.wMonth = 1;
|
||||||
s.wDay = 1;
|
s.wDay = 1;
|
||||||
s.wHour = 0;
|
s.wHour = 0;
|
||||||
s.wMinute = 0;
|
s.wMinute = 0;
|
||||||
s.wSecond = 0;
|
s.wSecond = 0;
|
||||||
s.wMilliseconds = 0;
|
s.wMilliseconds = 0;
|
||||||
SystemTimeToFileTime(&s, &f);
|
SystemTimeToFileTime(&s, &f);
|
||||||
t.QuadPart = f.dwHighDateTime;
|
t.QuadPart = f.dwHighDateTime;
|
||||||
t.QuadPart <<= 32;
|
t.QuadPart <<= 32;
|
||||||
t.QuadPart |= f.dwLowDateTime;
|
t.QuadPart |= f.dwLowDateTime;
|
||||||
return (t);
|
return (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
int clock_gettime(int X, struct timespec *tv)
|
int clock_gettime(int X, struct timespec *tv)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER t;
|
LARGE_INTEGER t;
|
||||||
FILETIME f;
|
FILETIME f;
|
||||||
double microseconds;
|
double microseconds;
|
||||||
static LARGE_INTEGER offset;
|
static LARGE_INTEGER offset;
|
||||||
static double frequencyToMicroseconds;
|
static double frequencyToMicroseconds;
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
static BOOL usePerformanceCounter = 0;
|
static BOOL usePerformanceCounter = 0;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
LARGE_INTEGER performanceFrequency;
|
LARGE_INTEGER performanceFrequency;
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
usePerformanceCounter = QueryPerformanceFrequency(&performanceFrequency);
|
usePerformanceCounter = QueryPerformanceFrequency(&performanceFrequency);
|
||||||
if (usePerformanceCounter) {
|
if (usePerformanceCounter) {
|
||||||
QueryPerformanceCounter(&offset);
|
QueryPerformanceCounter(&offset);
|
||||||
frequencyToMicroseconds = (double)performanceFrequency.QuadPart / 1000000.;
|
frequencyToMicroseconds = (double)performanceFrequency.QuadPart / 1000000.;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
offset = getFILETIMEoffset();
|
offset = getFILETIMEoffset();
|
||||||
frequencyToMicroseconds = 10.;
|
frequencyToMicroseconds = 10.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (usePerformanceCounter) QueryPerformanceCounter(&t);
|
if (usePerformanceCounter) QueryPerformanceCounter(&t);
|
||||||
else {
|
else {
|
||||||
GetSystemTimeAsFileTime(&f);
|
GetSystemTimeAsFileTime(&f);
|
||||||
t.QuadPart = f.dwHighDateTime;
|
t.QuadPart = f.dwHighDateTime;
|
||||||
t.QuadPart <<= 32;
|
t.QuadPart <<= 32;
|
||||||
t.QuadPart |= f.dwLowDateTime;
|
t.QuadPart |= f.dwLowDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
t.QuadPart -= offset.QuadPart;
|
t.QuadPart -= offset.QuadPart;
|
||||||
microseconds = (double)t.QuadPart / frequencyToMicroseconds;
|
microseconds = (double)t.QuadPart / frequencyToMicroseconds;
|
||||||
t.QuadPart = (long long)microseconds;
|
t.QuadPart = (long long)microseconds;
|
||||||
tv->tv_sec = t.QuadPart / 1000000;
|
tv->tv_sec = t.QuadPart / 1000000;
|
||||||
tv->tv_nsec = (t.QuadPart % 1000000) * 1000;
|
tv->tv_nsec = (t.QuadPart % 1000000) * 1000;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#define USE_CLOCK_GETTIME
|
#define USE_CLOCK_GETTIME
|
||||||
#else /* -> !_WIN32 */
|
#else /* -> !_WIN32 */
|
||||||
|
|
||||||
#ifndef USE_CLOCK_GETTIME
|
#ifndef USE_CLOCK_GETTIME
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue