summaryrefslogtreecommitdiff
path: root/src/basic/json.c
diff options
context:
space:
mode:
authorShawn Landden <shawn@churchofgit.com>2015-12-13 14:26:43 -0800
committerDaniel Mack <daniel@zonque.org>2016-01-27 14:10:02 +0100
commitc932fb71cc90461b88ecdffe47c071d001d78fb4 (patch)
tree7cf4835039617e8840434e28dec2ea0fb37b71ca /src/basic/json.c
parent9766c16bd08bd6714064ee950798a6db0874b048 (diff)
utf8.[ch] et al: use char32_t and char16_t instead of int, int32_t, int16_t
rework C11 utf8.[ch] to use char32_t instead of uint32_t when referring to unicode chars, to make things more expressive. [ @zonque: * rebased to current master * use AC_CHECK_DECLS to detect availibility of char{16,32}_t * make utf8_encoded_to_unichar() return int ]
Diffstat (limited to 'src/basic/json.c')
-rw-r--r--src/basic/json.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/json.c b/src/basic/json.c
index 1523e9fb09..3a3d1ad1e1 100644
--- a/src/basic/json.c
+++ b/src/basic/json.c
@@ -322,7 +322,7 @@ static int json_parse_string(const char **p, char **ret) {
else if (*c == 't')
ch = '\t';
else if (*c == 'u') {
- uint16_t x;
+ char16_t x;
int r;
r = unhex_ucs2(c + 1, &x);
@@ -335,11 +335,11 @@ static int json_parse_string(const char **p, char **ret) {
return -ENOMEM;
if (!utf16_is_surrogate(x))
- n += utf8_encode_unichar(s + n, x);
+ n += utf8_encode_unichar(s + n, (char32_t) x);
else if (utf16_is_trailing_surrogate(x))
return -EINVAL;
else {
- uint16_t y;
+ char16_t y;
if (c[0] != '\\' || c[1] != 'u')
return -EINVAL;