summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-07-16 07:56:23 -0700
committerElliott Hughes <enh@google.com>2019-07-16 07:56:23 -0700
commit9658fc0823f70ebc75ad93713ac2ac7aec6619cd (patch)
tree00fa012096691c0e98d4182052080318fbc8e23f
parent8987f061c4e0cd9d024e39e56f3cabd2fdfb13df (diff)
Remove two more unused utf32 functions.
Test: builds Change-Id: I6ab2104fc6836e9edb772e8368199e6171e9d87a
-rw-r--r--libutils/Unicode.cpp42
-rw-r--r--libutils/include/utils/Unicode.h12
2 files changed, 0 insertions, 54 deletions
diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp
index 24a745ac5..b08e061c0 100644
--- a/libutils/Unicode.cpp
+++ b/libutils/Unicode.cpp
@@ -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;
diff --git a/libutils/include/utils/Unicode.h b/libutils/include/utils/Unicode.h
index a2aaa47ae..fc6712d9b 100644
--- a/libutils/include/utils/Unicode.h
+++ b/libutils/include/utils/Unicode.h
@@ -129,18 +129,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
* can ask to log a message and fail in case the invalid utf8 could have caused an override if no