3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

fix bug in replace built-in and move length-equality propagation to branch final check

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-02-09 11:08:33 +00:00
parent 3ef6d91038
commit 133e3693de
3 changed files with 115 additions and 38 deletions

View file

@ -140,8 +140,8 @@ zstring zstring::replace(zstring const& src, zstring const& dst) const {
return zstring(*this);
}
bool found = false;
for (unsigned i = 0; i <= length() - src.length(); ++i) {
bool eq = !found;
for (unsigned i = 0; i < length(); ++i) {
bool eq = !found && i + src.length() <= length();
for (unsigned j = 0; eq && j < src.length(); ++j) {
eq = m_buffer[i+j] == src[j];
}
@ -154,9 +154,6 @@ zstring zstring::replace(zstring const& src, zstring const& dst) const {
result.m_buffer.push_back(m_buffer[i]);
}
}
for (unsigned i = length() - src.length() + 1; i < length(); ++i) {
result.m_buffer.push_back(m_buffer[i]);
}
return result;
}