Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Unified Diff: runtime/bin/process_win.cc

Issue 9701061: Change quoting in Process implementation on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Extract backslash char code once Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/process_impl.dart ('k') | tests/standalone/src/io/ProcessCheckArgumentsScript.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_win.cc
diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc
index 31c140cc20db5b9aa32b0fa5bbaf7a06bfe946c8..00b51ed60a4e0d1628dfeeb2830f06f059651130 100644
--- a/runtime/bin/process_win.cc
+++ b/runtime/bin/process_win.cc
@@ -560,9 +560,8 @@ int Process::Start(const char* path,
for (int i = 0; i < arguments_length; i++) {
command_line_length += strlen(arguments[i]);
}
- // Account for two occurrences of '"' around the command, one space
- // and two occurrences of '"' per argument and a terminating '\0'.
- command_line_length += 2 + (3 * arguments_length) + 1;
+ // Account for null termination and one space per argument.
+ command_line_length += arguments_length + 1;
static const int kMaxCommandLineLength = 32768;
if (command_line_length > kMaxCommandLineLength) {
int error_code = SetOsErrorMessage(os_error_message, os_error_message_len);
@@ -575,12 +574,12 @@ int Process::Start(const char* path,
char* command_line = new char[command_line_length];
int len = 0;
int remaining = command_line_length;
- int written = snprintf(command_line + len, remaining, "\"%s\"", path);
+ int written = snprintf(command_line + len, remaining, "%s", path);
len += written;
remaining -= written;
ASSERT(remaining >= 0);
for (int i = 0; i < arguments_length; i++) {
- written = snprintf(command_line + len, remaining, " \"%s\"", arguments[i]);
+ written = snprintf(command_line + len, remaining, " %s", arguments[i]);
len += written;
remaining -= written;
ASSERT(remaining >= 0);
« no previous file with comments | « runtime/bin/process_impl.dart ('k') | tests/standalone/src/io/ProcessCheckArgumentsScript.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698