diff options
author | Cylen Yao | 2014-06-11 07:41:36 -0500 |
---|---|---|
committer | Android Git Automerger | 2014-06-11 07:41:36 -0500 |
commit | 3b1380385004e535c6214b8199181a055f1e21d0 (patch) | |
tree | 9eccb0d4e550ab3ab5679a2115fbcb557751f7f5 /libutils/Unicode.cpp | |
parent | 9e55879f43b685d07c3c499c21cfee9a2fcd8f33 (diff) | |
parent | 72299bf0d240072174f847d13f1c9498b3ef9fa6 (diff) | |
download | platform-system-core-3b1380385004e535c6214b8199181a055f1e21d0.tar.gz platform-system-core-3b1380385004e535c6214b8199181a055f1e21d0.tar.xz platform-system-core-3b1380385004e535c6214b8199181a055f1e21d0.zip |
am 72299bf0: [Bug]NE when playing mp3 with incorrect UTF16 char
* commit '72299bf0d240072174f847d13f1c9498b3ef9fa6':
[Bug]NE when playing mp3 with incorrect UTF16 char
Diffstat (limited to 'libutils/Unicode.cpp')
-rw-r--r-- | libutils/Unicode.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp index fe8887d92..378d2a786 100644 --- a/libutils/Unicode.cpp +++ b/libutils/Unicode.cpp | |||
@@ -342,7 +342,8 @@ void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst) | |||
342 | while (cur_utf16 < end_utf16) { | 342 | while (cur_utf16 < end_utf16) { |
343 | char32_t utf32; | 343 | char32_t utf32; |
344 | // surrogate pairs | 344 | // surrogate pairs |
345 | if ((*cur_utf16 & 0xFC00) == 0xD800) { | 345 | if((*cur_utf16 & 0xFC00) == 0xD800 && (cur_utf16 + 1) < end_utf16 |
346 | && (*(cur_utf16 + 1) & 0xFC00) == 0xDC00) { | ||
346 | utf32 = (*cur_utf16++ - 0xD800) << 10; | 347 | utf32 = (*cur_utf16++ - 0xD800) << 10; |
347 | utf32 |= *cur_utf16++ - 0xDC00; | 348 | utf32 |= *cur_utf16++ - 0xDC00; |
348 | utf32 += 0x10000; | 349 | utf32 += 0x10000; |