negative values of wchar_t need to be treated in the non-ASCII case so
that they can properly generate EILSEQ rather than getting truncated
to 8bit values and stored in the output.
size_t N = n, l;
if (!s) {
for (n=0, ws2=*ws; *ws2; ws2++) {
- if (*ws2 >= 0x80) {
+ if (*ws2 >= 0x80u) {
l = wcrtomb(buf, *ws2, 0);
if (!(l+1)) return -1;
n += l;
return n;
}
while (n>=4 && **ws) {
- if (**ws >= 0x80) {
+ if (**ws >= 0x80u) {
l = wcrtomb(s, **ws, 0);
if (!(l+1)) return -1;
s += l;
(*ws)++;
}
while (n && **ws) {
- if (**ws >= 0x80) {
+ if (**ws >= 0x80u) {
l = wcrtomb(buf, **ws, 0);
if (!(l+1)) return -1;
if (l>n) return N-n;