aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utf.c11
-rw-r--r--utf.h6
2 files changed, 9 insertions, 8 deletions
diff --git a/utf.c b/utf.c
index a8f5a49..e399e99 100644
--- a/utf.c
+++ b/utf.c
@@ -1,8 +1,9 @@
-#include <uchar.h>
+#include <stddef.h>
+#include <stdint.h>
#include "utf.h"
size_t
-utf8enc(char32_t c, char *s)
+utf8enc(uint_least32_t c, char *s)
{
if (c < 0x80) {
s[0] = c;
@@ -30,11 +31,11 @@ utf8enc(char32_t c, char *s)
}
size_t
-utf8dec(const char *s, size_t n, char32_t *c)
+utf8dec(const char *s, size_t n, uint_least32_t *c)
{
size_t i, l;
unsigned char b;
- char32_t x;
+ uint_least32_t x;
b = s[0];
if (b < 0x80) {
@@ -64,7 +65,7 @@ utf8dec(const char *s, size_t n, char32_t *c)
}
size_t
-utf16enc(char32_t c, char16_t *s)
+utf16enc(uint_least32_t c, uint_least16_t *s)
{
if (c < 0xd800 || c - 0xe000 < 0x2000) {
s[0] = c;
diff --git a/utf.h b/utf.h
index 3f360ad..5851468 100644
--- a/utf.h
+++ b/utf.h
@@ -1,3 +1,3 @@
-size_t utf8enc(char32_t, char *);
-size_t utf8dec(const char *, size_t, char32_t *);
-size_t utf16enc(char32_t, char16_t *);
+size_t utf8enc(uint_least32_t, char *);
+size_t utf8dec(const char *, size_t, uint_least32_t *);
+size_t utf16enc(uint_least32_t, uint_least16_t *);