mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
COMMON: Rewrite BASESTRING::contains() with algorithm from BASESTRING::find()
This commit is contained in:
parent
b886c238fe
commit
6f8764b14c
@ -412,19 +412,18 @@ TEMPLATE bool BASESTRING::contains(const BaseString &otherString) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 sizeMatch = 0;
|
for (const_iterator cur = begin(); cur != end(); ++cur) {
|
||||||
typename BASESTRING::const_iterator itr = otherString.begin();
|
uint i = 0;
|
||||||
|
while (true) {
|
||||||
for (typename BASESTRING::const_iterator itr2 = begin(); itr != otherString.end() && itr2 != end(); itr2++) {
|
if (i == otherString.size()) {
|
||||||
if (*itr == *itr2) {
|
|
||||||
itr++;
|
|
||||||
sizeMatch++;
|
|
||||||
if (sizeMatch == otherString.size())
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
itr2 -= sizeMatch;
|
|
||||||
sizeMatch = 0;
|
if (cur[i] != otherString[i]) {
|
||||||
itr = otherString.begin();
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user