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

Unified Diff: bin/builtin_natives.cc

Issue 11275107: Fix length computation in Dart_StringToUTF8. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: 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 | « no previous file | include/dart_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/builtin_natives.cc
===================================================================
--- bin/builtin_natives.cc (revision 14418)
+++ bin/builtin_natives.cc (working copy)
@@ -103,17 +103,16 @@
// test/debug functionality in standalone dart mode.
void Builtin::PrintString(FILE* out, Dart_Handle str) {
- const char* chars = NULL;
-
- Dart_Handle result = Dart_StringToCString(str, &chars);
+ intptr_t length = 0;
+ uint8_t* chars = NULL;
+ Dart_Handle result = Dart_StringToUTF8(str, &chars, &length);
if (Dart_IsError(result)) {
// TODO(turnidge): Consider propagating some errors here. What if
// an isolate gets interrupted by the embedder in the middle of
- // Dart_StringToBytes? We need to make sure not to swallow the
+ // Dart_StringToUTF8? We need to make sure not to swallow the
// interrupt.
Bill Hesse 2012/11/02 09:16:00 I agree that errors should be propagated. I belie
siva 2012/11/06 01:35:22 Agree but probably should be done in a different C
fputs(Dart_GetError(result), out);
} else {
- intptr_t length = strlen(chars);
fwrite(chars, sizeof(*chars), length, out);
}
fputc('\n', out);
« no previous file with comments | « no previous file | include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698