MCPcopy Create free account
hub / github.com/devkitPro/libctru / utf8_to_utf32

Function utf8_to_utf32

libctru/source/util/utf/utf8_to_utf32.c:4–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include "3ds/util/utf.h"
3
4ssize_t
5utf8_to_utf32(uint32_t *out,
6 const uint8_t *in,
7 size_t len)
8{
9 ssize_t rc = 0;
10 ssize_t units;
11 uint32_t code;
12
13 do
14 {
15 units = decode_utf8(&code, in);
16 if(units == -1)
17 return -1;
18
19 if(code > 0)
20 {
21 in += units;
22
23 if(out != NULL)
24 {
25 if(rc < len)
26 *out++ = code;
27 }
28
29 if(SSIZE_MAX - 1 >= rc)
30 ++rc;
31 else
32 return -1;
33 }
34 } while(code > 0);
35
36 return rc;
37}

Callers

nothing calls this directly

Calls 1

decode_utf8Function · 0.85

Tested by

no test coverage detected