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

Unified Diff: runtime/bin/dbg_message.cc

Issue 558853004: Preserve the contents of Dart strings with unmatched surrogate halfs by avoiding a UTF16 -> UTF8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync and build Created 6 years, 3 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 | « no previous file | runtime/bin/vmservice/observatory/deployed/web/index.html_bootstrap.dart.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dbg_message.cc
diff --git a/runtime/bin/dbg_message.cc b/runtime/bin/dbg_message.cc
index 8d22bb442272bc116719e595e77656a943ab8eaa..30eb7307216ce8beefcf2187106acf4f098582a3 100644
--- a/runtime/bin/dbg_message.cc
+++ b/runtime/bin/dbg_message.cc
@@ -132,20 +132,20 @@ static void FormatEncodedCharsTrunc(dart::TextBuffer* buf,
Dart_Handle res = Dart_StringLength(str, &str_len);
ASSERT_NOT_ERROR(res);
intptr_t num_chars = (str_len > max_chars) ? max_chars : str_len;
- uint16_t* codepoints =
+ uint16_t* codeunits =
reinterpret_cast<uint16_t*>(malloc(num_chars * sizeof(uint16_t)));
- ASSERT(codepoints != NULL);
+ ASSERT(codeunits != NULL);
intptr_t actual_len = num_chars;
- res = Dart_StringToUTF16(str, codepoints, &actual_len);
+ res = Dart_StringToUTF16(str, codeunits, &actual_len);
ASSERT_NOT_ERROR(res);
ASSERT(num_chars == actual_len);
for (int i = 0; i < num_chars; i++) {
- buf->AddEscapedChar(codepoints[i]);
+ buf->EscapeAndAddCodeUnit(codeunits[i]);
}
if (str_len > max_chars) {
buf->Printf("...");
}
- free(codepoints);
+ free(codeunits);
}
@@ -153,17 +153,17 @@ static void FormatEncodedChars(dart::TextBuffer* buf, Dart_Handle str) {
intptr_t str_len = 0;
Dart_Handle res = Dart_StringLength(str, &str_len);
ASSERT_NOT_ERROR(res);
- uint16_t* codepoints =
+ uint16_t* codeunits =
reinterpret_cast<uint16_t*>(malloc(str_len * sizeof(uint16_t)));
- ASSERT(codepoints != NULL);
+ ASSERT(codeunits != NULL);
intptr_t actual_len = str_len;
- res = Dart_StringToUTF16(str, codepoints, &actual_len);
+ res = Dart_StringToUTF16(str, codeunits, &actual_len);
ASSERT_NOT_ERROR(res);
ASSERT(str_len == actual_len);
for (int i = 0; i < str_len; i++) {
- buf->AddEscapedChar(codepoints[i]);
+ buf->EscapeAndAddCodeUnit(codeunits[i]);
}
- free(codepoints);
+ free(codeunits);
}
« no previous file with comments | « no previous file | runtime/bin/vmservice/observatory/deployed/web/index.html_bootstrap.dart.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698