OSDN Git Service
(root)
/
winmerge-jp
/
winmerge-jp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
78073e8
)
string_replace(): Fix infinite loop if (replace) contains an occurrence of (find...
author
Jochen Tucht
<jtuc@users.sourceforge.net>
Sun, 16 May 2010 15:19:15 +0000
(15:19 +0000)
committer
Jochen Tucht
<jtuc@users.sourceforge.net>
Sun, 16 May 2010 15:19:15 +0000
(15:19 +0000)
Src/Common/UnicodeString.cpp
patch
|
blob
|
history
diff --git
a/Src/Common/UnicodeString.cpp
b/Src/Common/UnicodeString.cpp
index
3b24f13
..
df2a52d
100644
(file)
--- a/
Src/Common/UnicodeString.cpp
+++ b/
Src/Common/UnicodeString.cpp
@@
-57,11
+57,12
@@
String string_makelower(const String &str)
*/
void string_replace(String &target, const String &find, const String &replace)
{
- const std::string::size_type replace_len = find.length();
- std::string::size_type pos = 0;
+ const String::size_type find_len = find.length();
+ const String::size_type replace_len = replace.length();
+ String::size_type pos = 0;
while ((pos = target.find(find, pos)) != String::npos)
{
- target.replace(pos,
replace
_len, replace);
+ target.replace(pos,
find
_len, replace);
pos += replace_len;
}
}