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

Unified Diff: runtime/bin/main.cc

Issue 1194883002: Improve the encoding/decoding to/from system encoding on Windows (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments from lrn@ Created 5 years, 6 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/file_win.cc ('k') | runtime/bin/platform_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index bd5e8779e5c51d3f128b5ceee8775db8d59a5b60..cebd7e676ceb80d2f5c2a101db8992316311f70d 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -404,24 +404,6 @@ static bool ProcessMainOptions(const char* option,
}
-// Convert all the arguments to UTF8. On Windows, the arguments are
-// encoded in the current code page and not UTF8.
-//
-// Returns true if the arguments are converted. In that case
-// each of the arguments need to be deallocated using free.
-static bool Utf8ConvertArgv(int argc, char** argv) {
- int unicode_argc = 0;
- wchar_t** unicode_argv = ShellUtils::GetUnicodeArgv(&unicode_argc);
- if (unicode_argv == NULL) return false;
- for (int i = 0; i < unicode_argc; i++) {
- wchar_t* arg = unicode_argv[i];
- argv[i] = StringUtils::WideToUtf8(arg);
- }
- ShellUtils::FreeUnicodeArgv(unicode_argv);
- return true;
-}
-
-
// Parse out the command line arguments. Returns -1 if the arguments
// are incorrect, 0 otherwise.
static int ParseArguments(int argc,
@@ -893,7 +875,7 @@ void main(int argc, char** argv) {
// On Windows, the argv strings are code page encoded and not
// utf8. We need to convert them to utf8.
- bool argv_converted = Utf8ConvertArgv(argc, argv);
+ bool argv_converted = ShellUtils::GetUtf8Argv(argc, argv);
// Parse command line arguments.
if (ParseArguments(argc,
« no previous file with comments | « runtime/bin/file_win.cc ('k') | runtime/bin/platform_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698