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

Unified Diff: runtime/vm/unicode.h

Issue 11280150: Add support for surrogates when serializing and deserializing for native ports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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
Index: runtime/vm/unicode.h
diff --git a/runtime/vm/unicode.h b/runtime/vm/unicode.h
index 03a4b29d879898c2c83f06aac4a175d4729db209..5c09b2ef0d6a4217aa62f0f5d7f108e45b9b5fb3 100644
--- a/runtime/vm/unicode.h
+++ b/runtime/vm/unicode.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -32,6 +32,11 @@ class Utf8 : AllStatic {
// Returns true if 'utf8_array' is a valid UTF-8 string.
static bool IsValid(const uint8_t* utf8_array, intptr_t array_len);
+ // Returns true if 'utf8_array' is a valid UTF-8 string allowing
+ // UTF-8 encoded UTF-16 surrogate code units.
+ static bool IsValidAllowSurrogates(
+ const uint8_t* utf8_array, intptr_t array_len);
+
static intptr_t Length(int32_t ch);
static intptr_t Length(const String& str);
@@ -41,6 +46,9 @@ class Utf8 : AllStatic {
static intptr_t Decode(const uint8_t* utf8_array,
intptr_t array_len,
int32_t* ch);
+ static intptr_t DecodeAllowSurrogates(const uint8_t* utf8_array,
+ intptr_t array_len,
+ int32_t* ch);
static bool DecodeToLatin1(const uint8_t* utf8_array,
intptr_t array_len,
@@ -50,6 +58,10 @@ class Utf8 : AllStatic {
intptr_t array_len,
uint16_t* dst,
intptr_t len);
+ static bool DecodeToUTF16AllowSurrogates(const uint8_t* utf8_array,
+ intptr_t array_len,
+ uint16_t* dst,
+ intptr_t len);
static bool DecodeToUTF32(const uint8_t* utf8_array,
intptr_t array_len,
int32_t* dst,

Powered by Google App Engine
This is Rietveld 408576698