length() comparisons in stringccxmp were reversed...
--HG-- branch : WINDOWSPORT
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user