X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmultibyte%2Fmbrtowc.c;h=291537f800f3705cffd50a570e9186a328c674a1;hb=e72180083e4b0203d1883b6054198decdb60071c;hp=09badebec20e5959f52844e22f5157bf77176ae2;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/multibyte/mbrtowc.c b/src/multibyte/mbrtowc.c index 09badebe..291537f8 100644 --- a/src/multibyte/mbrtowc.c +++ b/src/multibyte/mbrtowc.c @@ -15,22 +15,22 @@ size_t mbrtowc(wchar_t *wc, const char *src, size_t n, mbstate_t *st) { static unsigned internal_state; unsigned c; - const unsigned char *s = src; + const unsigned char *s = (const void *)src; const unsigned N = n; if (!st) st = (void *)&internal_state; c = *(unsigned *)st; if (!s) { - s = ""; + s = (void *)""; wc = (void *)&wc; n = 1; } else if (!wc) wc = (void *)&wc; if (!n) return -2; if (!c) { - if ((unsigned)*s < 0x80) return !!(*wc = *s); - if ((unsigned)*s-SA > SB-SA) goto ilseq; + if (*s < 0x80) return !!(*wc = *s); + if (*s-SA > SB-SA) goto ilseq; c = bittab[*s++-SA]; n--; } @@ -44,7 +44,7 @@ loop: return N-n; } if (n) { - if ((unsigned)*s-0x80 >= 0x40) goto ilseq; + if (*s-0x80u >= 0x40) goto ilseq; goto loop; } }