summaryrefslogtreecommitdiffstats
path: root/base/utf_string_conversion_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/utf_string_conversion_utils.h')
-rw-r--r--base/utf_string_conversion_utils.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/base/utf_string_conversion_utils.h b/base/utf_string_conversion_utils.h
index 3fcb689..a8a76c5 100644
--- a/base/utf_string_conversion_utils.h
+++ b/base/utf_string_conversion_utils.h
@@ -12,12 +12,11 @@
namespace base {
inline bool IsValidCodepoint(uint32 code_point) {
- // Excludes non-characters (U+FDD0..U+FDEF, and all codepoints ending in
- // 0xFFFE or 0xFFFF), surrogate code points (U+D800..U+DFFF), and codepoints
- // larger than U+10FFFF (the highest codepoint allowed).
- return code_point < 0xD800u || (code_point >= 0xE000u &&
- code_point < 0xFDD0u) || (code_point > 0xFDEFu &&
- code_point <= 0x10FFFFu && (code_point & 0xFFFEu) != 0xFFFEu);
+ // Excludes the surrogate code points ([0xD800, 0xDFFF]) and
+ // codepoints larger than 0x10FFFF (the highest codepoint allowed).
+ // Non-characters and unassigned codepoints are allowed.
+ return code_point < 0xD800u ||
+ (code_point >= 0xE000u && code_point <= 0x10FFFFu);
}
// ReadUnicodeCharacter --------------------------------------------------------