diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2015-08-02 00:06:49 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-08-05 13:51:31 -0400 |
commit | 2eee2943cce2a7aea7a11b93f2459f5f333eb84c (patch) | |
tree | ae2008b724c084a40ab3c0af890254a779c2e31e /Source/cmXCodeObject.cxx | |
parent | f7a9ed7e90cd2661b279d0bcd44d43620b8eeda1 (diff) | |
download | cmake-2eee2943cce2a7aea7a11b93f2459f5f333eb84c.tar.gz |
Xcode: Invert quoting logic to whitelist of characters
Our explicit list of characters that require quoting does not account
for non-ascii characters (e.g. UTF-8) that also need quoting. Invert
the logic to quote a string unless it contains exclusively a set of
characters we whitelist.
Diffstat (limited to 'Source/cmXCodeObject.cxx')
-rw-r--r-- | Source/cmXCodeObject.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index ba6e39517f..c59c3609ff 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -243,7 +243,11 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String) bool needQuote = (String.empty() || String.find("//") != String.npos || - String.find_first_of(" <>+-*=@[](){},~") != String.npos); + String.find_first_not_of( + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "$_./") != String.npos); const char* quote = needQuote? "\"" : ""; // Print the string, quoted and escaped as necessary. |