summaryrefslogtreecommitdiff
path: root/unicode.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-23 09:16:34 -0500
committerGitHub <noreply@github.com>2019-01-23 09:16:34 -0500
commit5d60610cb0014b93fc16482e55bab2d49fbef1bc (patch)
tree3e5d05307955dd1ddcd49f7fe00bae759f6ab102 /unicode.c
parentf0353900aed11f72f2f100cca1fcb60d34fc1c06 (diff)
parentb87e2a4916684944c31d452166631b39a01e57c6 (diff)
Merge pull request #30 from ianyfan/cleanup
Cleanup
Diffstat (limited to 'unicode.c')
-rw-r--r--unicode.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/unicode.c b/unicode.c
index 5070e08..3d81a34 100644
--- a/unicode.c
+++ b/unicode.c
@@ -13,41 +13,6 @@ size_t utf8_chsize(uint32_t ch) {
return 4;
}
-static const uint8_t masks[] = {
- 0x7F,
- 0x1F,
- 0x0F,
- 0x07,
- 0x03,
- 0x01
-};
-
-uint32_t utf8_decode(const char **char_str) {
- uint8_t **s = (uint8_t **)char_str;
-
- uint32_t cp = 0;
- if (**s < 128) {
- // shortcut
- cp = **s;
- ++*s;
- return cp;
- }
- int size = utf8_size((char *)*s);
- if (size == -1) {
- ++*s;
- return UTF8_INVALID;
- }
- uint8_t mask = masks[size - 1];
- cp = **s & mask;
- ++*s;
- while (--size) {
- cp <<= 6;
- cp |= **s & 0x3f;
- ++*s;
- }
- return cp;
-}
-
size_t utf8_encode(char *str, uint32_t ch) {
size_t len = 0;
uint8_t first;