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

Unified Diff: vm/unicode.h

Issue 11419259: Fix bug in Utf8::CodePointCount which was causing some strings with latin1 (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 | « vm/symbols.cc ('k') | vm/unicode.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/unicode.h
===================================================================
--- vm/unicode.h (revision 15591)
+++ vm/unicode.h (working copy)
@@ -43,9 +43,12 @@
kSupplementary, // Supplementary code point [U+010000, U+10FFFF].
};
- static intptr_t CodePointCount(const uint8_t* utf8_array,
- intptr_t array_len,
- Type* type);
+ // Returns the most restricted coding form in which the sequence of utf8
+ // characters in 'utf8_array' can be represented in, and the number of
+ // code units needed in that form.
+ static intptr_t CodeUnitCount(const uint8_t* utf8_array,
+ intptr_t array_len,
+ Type* type);
// Returns true if 'utf8_array' is a valid UTF-8 string.
static bool IsValid(const uint8_t* utf8_array, intptr_t array_len);
@@ -83,7 +86,7 @@
static const int32_t kMaxFourByteChar = Utf::kMaxCodePoint;
static bool IsTrailByte(uint8_t code_unit) {
- return (code_unit & 0xc0) == 0x80;
+ return (code_unit & 0xC0) == 0x80;
}
static bool IsNonShortestForm(uint32_t code_point, size_t num_code_units) {
@@ -91,12 +94,12 @@
}
static bool IsLatin1SequenceStart(uint8_t code_unit) {
- // Check is codepoint is <= U+00FF
- return (code_unit <= Utf8::kMaxOneByteChar);
+ // Check if utf8 sequence is the start of a codepoint <= U+00FF
+ return (code_unit <= 0xC3);
}
static bool IsSupplementarySequenceStart(uint8_t code_unit) {
- // Check is codepoint is >= U+10000.
+ // Check if utf8 sequence is the start of a codepoint >= U+10000.
return (code_unit >= 0xF0);
}
« no previous file with comments | « vm/symbols.cc ('k') | vm/unicode.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698