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

Unified Diff: runtime/vm/unicode.cc

Issue 1330533002: Revert "Allow individual unicode surrogates strings" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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 | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/unicode.cc
diff --git a/runtime/vm/unicode.cc b/runtime/vm/unicode.cc
index 8e1649e91714c5de1f530152318d5264c23f7425..615e87b56127c64c6f0d72ebc05d5de8d55e0697 100644
--- a/runtime/vm/unicode.cc
+++ b/runtime/vm/unicode.cc
@@ -102,7 +102,8 @@ bool Utf8::IsValid(const uint8_t* utf8_array, intptr_t array_len) {
if (!((is_malformed == false) &&
(j == num_trail_bytes) &&
!Utf::IsOutOfRange(ch) &&
- !IsNonShortestForm(ch, j))) {
+ !IsNonShortestForm(ch, j) &&
+ !Utf16::IsSurrogate(ch))) {
return false;
}
}
@@ -200,7 +201,8 @@ intptr_t Utf8::Decode(const uint8_t* utf8_array,
if (!((is_malformed == false) &&
(i == num_trail_bytes) &&
!Utf::IsOutOfRange(ch) &&
- !IsNonShortestForm(ch, i))) {
+ !IsNonShortestForm(ch, i) &&
+ !Utf16::IsSurrogate(ch))) {
*dst = -1;
return 0;
}
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698