replace_all (string *str, string const &find, string const &replace)
{
ssize len = find.length ();
- for (ssize i = str->find (find); i != NPOS; i = str->find (find, i + len))
+ ssize replen = replace.length ();
+ for (ssize i = str->find (find); i != NPOS; i = str->find (find, i + replen))
*str = str->replace (i, len, replace);
return *str;
}