Fix length bug and size warning

This commit is contained in:
prpr 2022-04-08 00:19:15 +00:00
parent 9ba7bd84db
commit ce1b447c99

View File

@ -9,7 +9,7 @@ add_unicode(char **d, size_t *len, uint16_t u)
// 1 byte
if (*len < 1) return 0;
(*d)[0] = u;
(*d)++, *len--;
(*d)++, (*len)--;
return 1;
}
if (u < 0x800)
@ -22,7 +22,9 @@ add_unicode(char **d, size_t *len, uint16_t u)
*d += 2, *len -= 2;
return 1;
}
#if 0
if (u < 0x10000)
#endif
{
// 3 bytes
if (*len < 3) return 0;