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

Issue 10306002: Do not externalize Dart strings as C strings for "print()". (Closed)

Created:
8 years, 7 months ago by cshapiro
Modified:
8 years, 7 months ago
Reviewers:
turnidge, siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Do not externalize Dart strings as C strings for "print()". Dart strings with embedded '\0' characters cannot be faithfully represented as a C string. This change adds Dart_StringToBytes to the Dart API. This function converts a Dart string to array of UTF-8 code units and returns a length. Builtin::PrintString now calls Dart_StringToBytes instead of Dart_StringToCString and, for I/O, fwrite is called instead of fprintf with the string format specifier. BUG=1098 Committed: https://code.google.com/p/dart/source/detail?r=7260

Patch Set 1 #

Total comments: 3

Patch Set 2 : address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+53 lines, -5 lines) Patch
M runtime/bin/builtin_natives.cc View 1 chunk +8 lines, -5 lines 0 comments Download
M runtime/include/dart_api.h View 1 1 chunk +15 lines, -0 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 2 chunks +30 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
cshapiro
8 years, 7 months ago (2012-05-02 02:53:42 UTC) #1
cshapiro
http://codereview.chromium.org/10306002/diff/1/runtime/vm/dart_api_impl.cc File runtime/vm/dart_api_impl.cc (right): http://codereview.chromium.org/10306002/diff/1/runtime/vm/dart_api_impl.cc#newcode1616 runtime/vm/dart_api_impl.cc:1616: const char** bytes, This is typed wrong, this should ...
8 years, 7 months ago (2012-05-02 22:10:25 UTC) #2
siva
lgtm http://codereview.chromium.org/10306002/diff/1/runtime/vm/dart_api_impl.cc File runtime/vm/dart_api_impl.cc (right): http://codereview.chromium.org/10306002/diff/1/runtime/vm/dart_api_impl.cc#newcode1623 runtime/vm/dart_api_impl.cc:1623: } if (bytes == NULL) { return Api::NewError("%s ...
8 years, 7 months ago (2012-05-02 22:15:48 UTC) #3
cshapiro
8 years, 7 months ago (2012-05-02 22:40:59 UTC) #4
http://codereview.chromium.org/10306002/diff/1/runtime/vm/dart_api_impl.cc
File runtime/vm/dart_api_impl.cc (right):

http://codereview.chromium.org/10306002/diff/1/runtime/vm/dart_api_impl.cc#ne...
runtime/vm/dart_api_impl.cc:1623: }
Done.  As an aside, I think we do not do enough argument validation in the Dart
API.  A bug should be filed to clean that up.

Powered by Google App Engine
This is Rietveld 408576698