diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-08-31 21:31:34 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-09-23 21:55:29 +0200 |
commit | 75cb1cd248690e2c1b1d46081e2a25e6d2aa57f6 (patch) | |
tree | 1d2b07db2d178e9e3514fedffa38288c936966cc /lib/charset.c | |
parent | 7086a71aa8a7312db7c58b3989ccce5caf4aedc7 (diff) |
lib: charset: remove obsolete functions
Remove functions:
- utf8_to_utf16()
- utf16_strcpy()
- utf16_strdup()
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/charset.c')
-rw-r--r-- | lib/charset.c | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/lib/charset.c b/lib/charset.c index e82622a7f8..39c8329830 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -256,29 +256,6 @@ size_t u16_strnlen(const u16 *in, size_t count) return i; } -uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src) -{ - uint16_t *tmp = dest; - - while ((*dest++ = *src++) != '\0') - /* nothing */; - return tmp; - -} - -uint16_t *utf16_strdup(const uint16_t *s) -{ - uint16_t *new; - - if (!s) - return NULL; - new = malloc((u16_strlen(s) + 1) * 2); - if (!new) - return NULL; - utf16_strcpy(new, s); - return new; -} - /* Convert UTF-16 to UTF-8. */ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size) { @@ -331,59 +308,3 @@ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size) return dest; } - -uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size) -{ - while (size--) { - int extension_bytes; - uint32_t code; - - extension_bytes = 0; - if (*src <= 0x7f) { - code = *src++; - /* Exit on zero byte */ - if (!code) - size = 0; - } else if (*src <= 0xbf) { - /* Illegal code */ - code = '?'; - } else if (*src <= 0xdf) { - code = *src++ & 0x1f; - extension_bytes = 1; - } else if (*src <= 0xef) { - code = *src++ & 0x0f; - extension_bytes = 2; - } else if (*src <= 0xf7) { - code = *src++ & 0x07; - extension_bytes = 3; - } else { - /* Illegal code */ - code = '?'; - } - - for (; extension_bytes && size; --size, --extension_bytes) { - if ((*src & 0xc0) == 0x80) { - code <<= 6; - code |= *src++ & 0x3f; - } else { - /* Illegal code */ - code = '?'; - ++src; - --size; - break; - } - } - - if (code < 0x10000) { - *dest++ = code; - } else { - /* - * Simplified expression for - * (((code - 0x10000) >> 10) & 0x3ff) | 0xd800 - */ - *dest++ = (code >> 10) + 0xd7c0; - *dest++ = (code & 0x3ff) | 0xdc00; - } - } - return dest; -} |