From a3139d4b1512195485cde49d919a13cdaec62660 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 5 May 2015 00:04:22 +0200 Subject: cmLocalGenerator: Remove EscapeForShellOldStyle to only caller. --- Source/cmCustomCommandGenerator.cxx | 31 ++++++++++++++++++++++++++++++- Source/cmLocalGenerator.cxx | 29 ----------------------------- Source/cmLocalGenerator.h | 3 --- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 162d7a1..d23f815 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -51,6 +51,35 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const } //---------------------------------------------------------------------------- +std::string escapeForShellOldStyle(const std::string& str) +{ + std::string result; +#if defined(_WIN32) && !defined(__CYGWIN__) + // if there are spaces + std::string temp = str; + if (temp.find(" ") != std::string::npos && + temp.find("\"")==std::string::npos) + { + result = "\""; + result += str; + result += "\""; + return result; + } + return str; +#else + for(const char* ch = str.c_str(); *ch != '\0'; ++ch) + { + if(*ch == ' ') + { + result += '\\'; + } + result += *ch; + } + return result; +#endif +} + +//---------------------------------------------------------------------------- void cmCustomCommandGenerator ::AppendArguments(unsigned int c, std::string& cmd) const @@ -63,7 +92,7 @@ cmCustomCommandGenerator cmd += " "; if(this->OldStyle) { - cmd += this->LG->EscapeForShellOldStyle(arg); + cmd += escapeForShellOldStyle(arg); } else { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 88c88cd..1c3114e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3392,35 +3392,6 @@ cmLocalGenerator } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForShellOldStyle(const std::string& str) -{ - std::string result; -#if defined(_WIN32) && !defined(__CYGWIN__) - // if there are spaces - std::string temp = str; - if (temp.find(" ") != std::string::npos && - temp.find("\"")==std::string::npos) - { - result = "\""; - result += str; - result += "\""; - return result; - } - return str; -#else - for(const char* ch = str.c_str(); *ch != '\0'; ++ch) - { - if(*ch == ' ') - { - result += '\\'; - } - result += *ch; - } - return result; -#endif -} - -//---------------------------------------------------------------------------- static bool cmLocalGeneratorIsShellOperator(const std::string& str) { static std::set shellOperators; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 49ac9a6..af333fd 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -298,9 +298,6 @@ public: bool forEcho = false, bool useWatcomQuote = false); - /** Backwards-compatibility version of EscapeForShell. */ - std::string EscapeForShellOldStyle(const std::string& str); - /** Escape the given string as an argument in a CMake script. */ static std::string EscapeForCMake(const std::string& str); -- cgit v0.12