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

Unified Diff: runtime/bin/platform_win.cc

Issue 11275281: Update dart:io to convert strings between UTF8 and current code page (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 1 month 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/platform_macos.cc ('k') | runtime/bin/process_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/platform_win.cc
diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc
index d5ca62fc4e70f3495e53d0f088ee8127a7531ce9..0af539d2b8f902c90c5c56564e935e184343eaa2 100644
--- a/runtime/bin/platform_win.cc
+++ b/runtime/bin/platform_win.cc
@@ -5,7 +5,6 @@
#include "bin/platform.h"
#include "bin/socket.h"
-
bool Platform::Initialize() {
// Nothing to do on Windows.
return true;
@@ -36,7 +35,7 @@ bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) {
char** Platform::Environment(intptr_t* count) {
- char* strings = GetEnvironmentStringsA();
+ char* strings = GetEnvironmentStrings();
if (strings == NULL) return NULL;
char* tmp = strings;
intptr_t i = 0;
@@ -46,13 +45,20 @@ char** Platform::Environment(intptr_t* count) {
}
*count = i;
char** result = new char*[i];
+ tmp = strings;
for (intptr_t current = 0; current < i; current++) {
- result[current] = strings;
- strings += (strlen(strings) + 1);
+ result[current] = StringUtils::SystemStringToUtf8(tmp);
+ tmp += (strlen(tmp) + 1);
}
+ FreeEnvironmentStrings(strings);
return result;
}
+void Platform::FreeEnvironment(char** env, int count) {
+ for (int i = 0; i < count; i++) free(env[i]);
+ delete[] env;
+}
+
char* Platform::StrError(int error_code) {
static const int kBufferSize = 1024;
« no previous file with comments | « runtime/bin/platform_macos.cc ('k') | runtime/bin/process_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698