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

Unified Diff: runtime/bin/platform.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.h ('k') | runtime/bin/platform_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/platform.cc
diff --git a/runtime/bin/platform.cc b/runtime/bin/platform.cc
index 80ed2775717d24680b2ede73e3a262e5db2a6a04..7e76c095e1362f695014b337bafe9b9fe4a41c77 100644
--- a/runtime/bin/platform.cc
+++ b/runtime/bin/platform.cc
@@ -16,15 +16,14 @@ void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) {
void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) {
Dart_EnterScope();
- Dart_SetReturnValue(args,
- Dart_NewStringFromCString(Platform::OperatingSystem()));
+ Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem()));
Dart_ExitScope();
}
void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) {
Dart_EnterScope();
- Dart_SetReturnValue(args, Dart_NewStringFromCString(File::PathSeparator()));
+ Dart_SetReturnValue(args, DartUtils::NewString(File::PathSeparator()));
Dart_ExitScope();
}
@@ -34,7 +33,7 @@ void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) {
const intptr_t HOSTNAME_LENGTH = 256;
char hostname[HOSTNAME_LENGTH];
if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) {
- Dart_SetReturnValue(args, Dart_NewStringFromCString(hostname));
+ Dart_SetReturnValue(args, DartUtils::NewString(hostname));
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
@@ -54,19 +53,22 @@ void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) {
} else {
Dart_Handle result = Dart_NewList(count);
if (Dart_IsError(result)) {
+ Platform::FreeEnvironment(env, count);
Dart_PropagateError(result);
}
for (intptr_t i = 0; i < count; i++) {
- Dart_Handle str = Dart_NewStringFromCString(env[i]);
+ Dart_Handle str = DartUtils::NewString(env[i]);
if (Dart_IsError(str)) {
+ Platform::FreeEnvironment(env, count);
Dart_PropagateError(str);
}
Dart_Handle error = Dart_ListSetAt(result, i, str);
if (Dart_IsError(error)) {
+ Platform::FreeEnvironment(env, count);
Dart_PropagateError(error);
}
}
- delete[] env;
+ Platform::FreeEnvironment(env, count);
Dart_SetReturnValue(args, result);
}
Dart_ExitScope();
« no previous file with comments | « runtime/bin/platform.h ('k') | runtime/bin/platform_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698