mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-23 06:32:05 +03:00
fix some pointer signedness issues (this was invalid C)
This commit is contained in:
parent
c247ebdd98
commit
a8c17e6587
@ -12,7 +12,7 @@ wint_t __fgetwc_unlocked(FILE *f)
|
|||||||
|
|
||||||
/* Convert character from buffer if possible */
|
/* Convert character from buffer if possible */
|
||||||
if (f->rpos < f->rend) {
|
if (f->rpos < f->rend) {
|
||||||
l = mbrtowc(&wc, f->rpos, f->rend - f->rpos, &st);
|
l = mbrtowc(&wc, (void *)f->rpos, f->rend - f->rpos, &st);
|
||||||
if (l+2 >= 2) {
|
if (l+2 >= 2) {
|
||||||
f->rpos += l + !l; /* l==0 means 1 byte, null */
|
f->rpos += l + !l; /* l==0 means 1 byte, null */
|
||||||
return wc;
|
return wc;
|
||||||
@ -30,7 +30,7 @@ wint_t __fgetwc_unlocked(FILE *f)
|
|||||||
if (!mbsinit(&st)) errno = EILSEQ;
|
if (!mbsinit(&st)) errno = EILSEQ;
|
||||||
return WEOF;
|
return WEOF;
|
||||||
}
|
}
|
||||||
l = mbrtowc(&wc, &b, 1, &st);
|
l = mbrtowc(&wc, (void *)&b, 1, &st);
|
||||||
if (l == -1) return WEOF;
|
if (l == -1) return WEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ int fputws(const wchar_t *ws, FILE *f)
|
|||||||
|
|
||||||
f->mode |= f->mode+1;
|
f->mode |= f->mode+1;
|
||||||
|
|
||||||
while (ws && (l = wcsrtombs(buf, (void*)&ws, sizeof buf, 0))+1 > 1)
|
while (ws && (l = wcsrtombs((void *)buf, (void*)&ws, sizeof buf, 0))+1 > 1)
|
||||||
if (__fwritex(buf, l, f) < l) {
|
if (__fwritex(buf, l, f) < l) {
|
||||||
FUNLOCK(f);
|
FUNLOCK(f);
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user