mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
COMMON: Fix comparaison operators for U32String
They were supposed to compare two U32String, but due to a copy/paste error they were comparing a U32String with a String. It compiled because there is a String constructor that takes a U32String (and converts it to UTF-8), but it was probably not quite working as expected for non-ASCII characters.
This commit is contained in:
parent
dc88a9fcb1
commit
9ab48df4b6
@ -198,10 +198,10 @@ bool U32String::operator!=(const char *x) const {
|
||||
return !equals(x);
|
||||
}
|
||||
|
||||
bool U32String::operator<(const String &x) const {
|
||||
bool U32String::operator<(const U32String &x) const {
|
||||
for (uint32 i = 0, n = x.size(); i < _size && i < n; ++i) {
|
||||
uint32 sc = _str[i];
|
||||
uint8 xc = x[i];
|
||||
uint32 xc = x[i];
|
||||
if (sc < xc)
|
||||
return true;
|
||||
else if (sc > xc)
|
||||
@ -210,14 +210,14 @@ bool U32String::operator<(const String &x) const {
|
||||
return (_size < x.size());
|
||||
}
|
||||
|
||||
bool U32String::operator<=(const String &x) const {
|
||||
bool U32String::operator<=(const U32String &x) const {
|
||||
return !operator>(x);
|
||||
}
|
||||
|
||||
bool U32String::operator>(const String &x) const {
|
||||
bool U32String::operator>(const U32String &x) const {
|
||||
for (uint i = 0, n = x.size(); i < _size && i < n; ++i) {
|
||||
uint32 sc = _str[i];
|
||||
uint8 xc = x[i];
|
||||
uint32 xc = x[i];
|
||||
if (sc > xc)
|
||||
return true;
|
||||
else if (sc < xc)
|
||||
@ -226,7 +226,7 @@ bool U32String::operator>(const String &x) const {
|
||||
return (_size > x.size());
|
||||
}
|
||||
|
||||
bool U32String::operator>=(const String &x) const {
|
||||
bool U32String::operator>=(const U32String &x) const {
|
||||
return !operator<(x);
|
||||
}
|
||||
|
||||
|
@ -136,10 +136,10 @@ public:
|
||||
bool operator!=(const value_type *x) const;
|
||||
bool operator!=(const char *x) const;
|
||||
|
||||
bool operator<(const String &x) const;
|
||||
bool operator<=(const String &x) const;
|
||||
bool operator>(const String &x) const;
|
||||
bool operator>=(const String &x) const;
|
||||
bool operator<(const U32String &x) const;
|
||||
bool operator<=(const U32String &x) const;
|
||||
bool operator>(const U32String &x) const;
|
||||
bool operator>=(const U32String &x) const;
|
||||
|
||||
/**
|
||||
* Compares whether two U32String are the same based on memory comparison.
|
||||
|
Loading…
x
Reference in New Issue
Block a user