fix compile issue

This commit is contained in:
bumbread 2022-07-16 04:41:38 +11:00
parent bf428a9924
commit 11474a78c6
3 changed files with 4 additions and 4 deletions

View File

@ -35,8 +35,7 @@ typedef struct lldiv_t {
#define RAND_MAX 65536 #define RAND_MAX 65536
#define MB_LEN_MAX 4 #define MB_CUR_MAX 5
#define MB_CUR_MAX 4
// Microsoft extension, COUNTOF(x) counts array elements // Microsoft extension, COUNTOF(x) counts array elements
#ifndef COUNTOF #ifndef COUNTOF

View File

@ -12,7 +12,7 @@ struct mbstate_t {
union { union {
char16_t leftover; char16_t leftover;
char16_t high_surrogate; char16_t high_surrogate;
} };
}; };
size_t mbrtoc16( size_t mbrtoc16(

View File

@ -82,10 +82,11 @@ size_t c16rtomb(
} }
else goto invalid_char; else goto invalid_char;
// Write the codepoint that we decided to write to multibyte string // Write the codepoint that we decided to write to multibyte string
int written_len = utf8_chenc(s, 4, codepoint_to_write); int written_len = utf8_chenc((char8_t *)s, 4, codepoint_to_write);
if(written_len < 0) { if(written_len < 0) {
goto invalid_char; goto invalid_char;
} }
s[written_len] = 0;
return (size_t)written_len; return (size_t)written_len;
invalid_char: invalid_char:
errno = EILSEQ; errno = EILSEQ;