diff options
Diffstat (limited to 'libutils/String16.cpp')
-rw-r--r-- | libutils/String16.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/libutils/String16.cpp b/libutils/String16.cpp index 65396caca..ad335c399 100644 --- a/libutils/String16.cpp +++ b/libutils/String16.cpp @@ -17,12 +17,7 @@ #include <utils/String16.h> #include <utils/Log.h> -#include <utils/Unicode.h> -#include <utils/String8.h> -#include <utils/threads.h> -#include <memory.h> -#include <stdio.h> #include <ctype.h> #include "SharedBuffer.h" @@ -72,12 +67,12 @@ static char16_t* allocFromUTF8(const char* u8str, size_t u8len) u8cur = (const uint8_t*) u8str; char16_t* u16str = (char16_t*)buf->data(); - utf8_to_utf16(u8cur, u8len, u16str); + utf8_to_utf16(u8cur, u8len, u16str, ((size_t) u16len) + 1); //printf("Created UTF-16 string from UTF-8 \"%s\":", in); //printHexData(1, str, buf->size(), 16, 1); //printf("\n"); - + return u16str; } @@ -127,7 +122,7 @@ String16::String16(const char16_t* o) mString = str; return; } - + mString = getEmptyString(); } @@ -142,7 +137,7 @@ String16::String16(const char16_t* o, size_t len) mString = str; return; } - + mString = getEmptyString(); } @@ -228,7 +223,7 @@ status_t String16::append(const String16& other) } else if (otherLen == 0) { return NO_ERROR; } - + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize((myLen+otherLen+1)*sizeof(char16_t)); if (buf) { @@ -249,7 +244,7 @@ status_t String16::append(const char16_t* chrs, size_t otherLen) } else if (otherLen == 0) { return NO_ERROR; } - + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize((myLen+otherLen+1)*sizeof(char16_t)); if (buf) { |