diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-02-13 23:08:18 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-02-13 23:08:18 -0500 |
commit | f9d880d25893dbf4caaa2f4e0c4d9bc8c1aea22a (patch) | |
tree | c596c195cce0d4563d87b5020d9e60e491801959 /src/multibyte/mbrtowc.c | |
parent | 2cdfb7ca26f46f151afbc23d5d94fc68597137f5 (diff) | |
download | musl-f9d880d25893dbf4caaa2f4e0c4d9bc8c1aea22a.tar.gz musl-f9d880d25893dbf4caaa2f4e0c4d9bc8c1aea22a.tar.xz musl-f9d880d25893dbf4caaa2f4e0c4d9bc8c1aea22a.zip |
cleanup multibyte stuff to remove ugly casts, sanitize the ptr align casts
Diffstat (limited to 'src/multibyte/mbrtowc.c')
-rw-r--r-- | src/multibyte/mbrtowc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/multibyte/mbrtowc.c b/src/multibyte/mbrtowc.c index 09badebe..a354573a 100644 --- a/src/multibyte/mbrtowc.c +++ b/src/multibyte/mbrtowc.c @@ -15,7 +15,7 @@ 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; @@ -29,8 +29,8 @@ size_t mbrtowc(wchar_t *wc, const char *src, size_t n, mbstate_t *st) 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; } } |