Index: test/win/child_launcher.cc |
diff --git a/test/win/child_launcher.cc b/test/win/child_launcher.cc |
index 2b82e057f6e43f4649785d5a764b1f54815bb184..e35f1cb8d315713167a9305f0cf1b3b11ce35fb9 100644 |
--- a/test/win/child_launcher.cc |
+++ b/test/win/child_launcher.cc |
@@ -15,6 +15,7 @@ |
#include "test/win/child_launcher.h" |
#include "gtest/gtest.h" |
+#include "util/win/command_line.h" |
namespace crashpad { |
namespace test { |
@@ -96,39 +97,5 @@ DWORD ChildLauncher::WaitForExit() { |
return exit_code; |
} |
-// Ref: http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx |
-void AppendCommandLineArgument(const std::wstring& argument, |
- std::wstring* command_line) { |
- // Don't bother quoting if unnecessary. |
- if (!argument.empty() && |
- argument.find_first_of(L" \t\n\v\"") == std::wstring::npos) { |
- command_line->append(argument); |
- } else { |
- command_line->push_back(L'"'); |
- for (std::wstring::const_iterator i = argument.begin();; ++i) { |
- size_t backslash_count = 0; |
- while (i != argument.end() && *i == L'\\') { |
- ++i; |
- ++backslash_count; |
- } |
- if (i == argument.end()) { |
- // Escape all backslashes, but let the terminating double quotation mark |
- // we add below be interpreted as a metacharacter. |
- command_line->append(backslash_count * 2, L'\\'); |
- break; |
- } else if (*i == L'"') { |
- // Escape all backslashes and the following double quotation mark. |
- command_line->append(backslash_count * 2 + 1, L'\\'); |
- command_line->push_back(*i); |
- } else { |
- // Backslashes aren't special here. |
- command_line->append(backslash_count, L'\\'); |
- command_line->push_back(*i); |
- } |
- } |
- command_line->push_back(L'"'); |
- } |
-} |
- |
} // namespace test |
} // namespace crashpad |