From 8d84ba41dee869935243da46e4bf61fc84117676 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 30 May 2014 03:14:48 +0200 Subject: [PATCH] Allow + in filenames without escaping Due to #690, file.c++ used to be escaped. + seems as safe as -, so allow it to not be escaped, to keep compile command lines with a fairly common extension slightly cleaner. --- src/util.cc | 1 + src/util_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util.cc b/src/util.cc index 24d231f..484b0c1 100644 --- a/src/util.cc +++ b/src/util.cc @@ -183,6 +183,7 @@ static inline bool IsKnownShellSafeCharacter(char ch) { switch (ch) { case '_': + case '+': case '-': case '.': case '/': diff --git a/src/util_test.cc b/src/util_test.cc index f827e5a..b58d15e 100644 --- a/src/util_test.cc +++ b/src/util_test.cc @@ -148,7 +148,7 @@ TEST(PathEscaping, TortureTest) { } TEST(PathEscaping, SensiblePathsAreNotNeedlesslyEscaped) { - const char* path = "some/sensible/path/without/crazy/characters.cc"; + const char* path = "some/sensible/path/without/crazy/characters.c++"; string result; GetWin32EscapedString(path, &result); @@ -160,7 +160,7 @@ TEST(PathEscaping, SensiblePathsAreNotNeedlesslyEscaped) { } TEST(PathEscaping, SensibleWin32PathsAreNotNeedlesslyEscaped) { - const char* path = "some\\sensible\\path\\without\\crazy\\characters.cc"; + const char* path = "some\\sensible\\path\\without\\crazy\\characters.c++"; string result; GetWin32EscapedString(path, &result); -- 2.7.4