diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-10-07 15:08:24 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-07 15:08:24 -0700 |
commit | 270928bd4a1db1dc0d989f4e9897a81ab865e30e (patch) | |
tree | f9188005feb5a9756922f584d40cdc38bf9103ce /libs | |
parent | 4cc8bafb4b10614dc881ed8121ce4754811e161d (diff) | |
parent | 715311fa5aeb39fd0904209e1428a3656c721c3d (diff) | |
download | frameworks_base-270928bd4a1db1dc0d989f4e9897a81ab865e30e.zip frameworks_base-270928bd4a1db1dc0d989f4e9897a81ab865e30e.tar.gz frameworks_base-270928bd4a1db1dc0d989f4e9897a81ab865e30e.tar.bz2 |
Merge changes Idbfeb3cc,I03e8e2e7,Iff9eed78
* changes:
Fix regression in CursorWindow.getString() Bug: 5332296
Clean up CursorWindow lifetime. Bug: 5332296
Fix regression in CursorWindow.copyStingToBuffer. Bug: 5332296
Diffstat (limited to 'libs')
-rw-r--r-- | libs/utils/Unicode.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/utils/Unicode.cpp b/libs/utils/Unicode.cpp index 78c61b4..41cbf03 100644 --- a/libs/utils/Unicode.cpp +++ b/libs/utils/Unicode.cpp @@ -542,11 +542,7 @@ ssize_t utf8_to_utf16_length(const uint8_t* u8str, size_t u8len) return u16measuredLen; } -/** - * Convert a UTF-8 string to UTF-16. The destination UTF-16 buffer must have - * space for NULL at the end. - */ -void utf8_to_utf16(const uint8_t* u8str, size_t u8len, char16_t* u16str) +char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* u8str, size_t u8len, char16_t* u16str) { const uint8_t* const u8end = u8str + u8len; const uint8_t* u8cur = u8str; @@ -569,7 +565,12 @@ void utf8_to_utf16(const uint8_t* u8str, size_t u8len, char16_t* u16str) u8cur += u8len; } - *u16cur = 0; + return u16cur; +} + +void utf8_to_utf16(const uint8_t* u8str, size_t u8len, char16_t* u16str) { + char16_t* end = utf8_to_utf16_no_null_terminator(u8str, u8len, u16str); + *end = 0; } } |