utf: use correct format specifier

This commit is contained in:
anna 2021-07-14 16:42:15 +02:00
parent 30a29150c3
commit 54869dcd6c
Signed by: fef
GPG Key ID: EC22E476DC2D3D84
1 changed files with 2 additions and 2 deletions

View File

@ -129,7 +129,7 @@ usize utf8_to_nchr(nchar *dest, const char *restrict utf8chr, error *err)
/* Payload bitmask for first byte in the sequence per sequence length */ /* Payload bitmask for first byte in the sequence per sequence length */
static const char cmasks[] = { 0x00, 0x7f, 0x1f, 0x0f, 0x07 }; static const char cmasks[] = { 0x00, 0x7f, 0x1f, 0x0f, 0x07 };
/* Minimum Unicode values per sequence length */ /* Minimum Unicode values per sequence length */
static const nchar mins[] = { 0xffffffff, 0, 0x80, 0x800, 0x10000 }; static const nchar mins[] = { 0xffffffff, 0x00, 0x80, 0x800, 0x10000 };
/* Error bitmasks for (unused) bytes 2-4 per sequence length */ /* Error bitmasks for (unused) bytes 2-4 per sequence length */
static const uint_fast8_t emasks[] = { 0x00, 0x03, 0x07, 0x3f, 0xff }; static const uint_fast8_t emasks[] = { 0x00, 0x03, 0x07, 0x3f, 0xff };
@ -196,7 +196,7 @@ usize utf8_to_nchr(nchar *dest, const char *restrict utf8chr, error *err)
*dest = '\0'; *dest = '\0';
if ((eflags & 0x01) != 0) { if ((eflags & 0x01) != 0) {
yeet(err, EINVAL, yeet(err, EINVAL,
"Non canonical UTF-8 encoding: %lu byte character stored in %u bytes", "Non canonical UTF-8 encoding: %zu byte character stored in %u bytes",
utf8_nchr_size(c, nil), len); utf8_nchr_size(c, nil), len);
} else if ((eflags & 0x02) != 0) { } else if ((eflags & 0x02) != 0) {
yeet(err, EINVAL, "Illegal UTF-8 sequence start byte: 0x%02x", utf8chr[0]); yeet(err, EINVAL, "Illegal UTF-8 sequence start byte: 0x%02x", utf8chr[0]);