From 7d8d326d93130cd3db19a5b510736e8af30762ca Mon Sep 17 00:00:00 2001 From: John Biddiscombe Date: Mon, 8 Apr 2002 19:31:21 -0400 Subject: [PATCH] ERR: ReplaceString didn't work properly if replace was longer than with as length added to start pos on next search was replaceLength instead of withLength --- Source/cmSystemTools.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0b05373cc..22acac868 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -182,6 +182,7 @@ void cmSystemTools::ReplaceString(std::string& source, const char* with) { std::string::size_type lengthReplace = strlen(replace); + std::string::size_type lengthWith = strlen(with); std::string rest; std::string::size_type start = source.find(replace); while(start != std::string::npos) @@ -190,7 +191,7 @@ void cmSystemTools::ReplaceString(std::string& source, source = source.substr(0, start); source += with; source += rest; - start = source.find(replace, start + lengthReplace ); + start = source.find(replace, start + lengthWith ); } }