Remove two more unused utf32 functions.

Test: builds
Change-Id: I6ab2104fc6836e9edb772e8368199e6171e9d87a
This commit is contained in:
Elliott Hughes 2019-07-16 07:56:23 -07:00
parent 8987f061c4
commit 9658fc0823
2 changed files with 0 additions and 54 deletions

View file

@ -452,48 +452,6 @@ static inline void utf8_shift_and_mask(uint32_t* codePoint, const uint8_t byte)
*codePoint |= 0x3F & byte;
}
size_t utf8_to_utf32_length(const char *src, size_t src_len)
{
if (src == nullptr || src_len == 0) {
return 0;
}
size_t ret = 0;
const char* cur;
const char* end;
size_t num_to_skip;
for (cur = src, end = src + src_len, num_to_skip = 1;
cur < end;
cur += num_to_skip, ret++) {
const char first_char = *cur;
num_to_skip = 1;
if ((first_char & 0x80) == 0) { // ASCII
continue;
}
int32_t mask;
for (mask = 0x40; (first_char & mask); num_to_skip++, mask >>= 1) {
}
}
return ret;
}
void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst)
{
if (src == nullptr || src_len == 0 || dst == nullptr) {
return;
}
const char* cur = src;
const char* const end = src + src_len;
char32_t* cur_utf32 = dst;
while (cur < end) {
size_t num_read;
*cur_utf32++ = static_cast<char32_t>(utf32_at_internal(cur, &num_read));
cur += num_read;
}
*cur_utf32 = 0;
}
static inline uint32_t utf8_to_utf32_codepoint(const uint8_t *src, size_t length)
{
uint32_t unicode;

View file

@ -128,18 +128,6 @@ void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst, size_t dst_le
*/
ssize_t utf8_length(const char *src);
/**
* Measure the length of a UTF-32 string.
*/
size_t utf8_to_utf32_length(const char *src, size_t src_len);
/**
* Stores a UTF-32 string converted from "src" in "dst". "dst" must be large
* enough to store the entire converted string as measured by
* utf8_to_utf32_length plus space for a NUL terminator.
*/
void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst);
/**
* Returns the UTF-16 length of UTF-8 string "src". Returns -1 in case
* it's invalid utf8. No buffer over-read occurs because of bound checks. Using overreadIsFatal you