Lines Matching refs:str8
182 char* str8 = nullptr;
190 str8 = reinterpret_cast<char*>(calloc(utf8Len, sizeof(char)));
191 if (str8 == nullptr) {
195 StrncpyStr16ToStr8(str16, str16Len, str8, utf8Len);
196 return str8;
199 bool String16ToString8(const u16string& str16, string& str8)
208 UTILS_LOGD("Str16 to str8 failed, because str8Temp is nullptr!");
212 str8 = str8Temp;
264 int Utf8ToUtf16Length(const char* str8, size_t str8Len)
266 const char* const str8end = str8 + str8Len;
268 while (str8 < str8end) {
270 size_t u8charlen = Utf8CodePointLen(*str8);
271 if (str8 + u8charlen - 1 >= str8end) {
272 UTILS_LOGE("Get str16 length failed because str8 unicode is illegal!");
275 uint32_t codepoint = Utf8ToUtf32CodePoint(str8, u8charlen);
279 str8 += u8charlen;
281 if (str8 != str8end) {
328 // inner function and str8 is not null
329 char16_t* Char8ToChar16(const char* str8, size_t str8Len)
332 int utf16Len = Utf8ToUtf16Length(str8, str8Len);
346 StrncpyStr8ToStr16(str8, str8Len, str16, utf16Len);
350 bool String8ToString16(const string& str8, u16string& str16)
352 size_t str8len = str8.length();
357 char16_t* str16Temp = Char8ToChar16(str8.c_str(), str8len);
359 UTILS_LOGD("str8 to str16 failed, str16Temp is nullptr!");