-static int fuzzycmp(const char *a, const char *b)
+static int fuzzycmp(const unsigned char *a, const unsigned char *b)
{
for (; *a && *b; a++, b++) {
while (*a && (*a|32U)-'a'>26 && *a-'0'>10U) a++;
return *a != *b;
}
-static size_t find_charmap(const char *name)
+static size_t find_charmap(const void *name)
{
const unsigned char *s;
for (s=charmaps; *s; ) {
if (!fuzzycmp(name, s)) {
- for (; *s; s+=strlen(s)+1);
+ for (; *s; s+=strlen((void *)s)+1);
return s+1-charmaps;
}
- s += strlen(s)+1;
+ s += strlen((void *)s)+1;
if (!*s) s += ((128-s[2])*s[1]+7)/8 + 3;
}
return -1;
case UTF_32LE:
l = 4;
if (*inb < 4) goto starved;
- c = get_32(*in, type);
+ c = get_32((void *)*in, type);
}
if (c-0xd800u < 0x800u || c >= 0x110000u) goto ilseq;
break;
case UTF_16LE:
l = 2;
if (*inb < 2) goto starved;
- c = get_16(*in, type);
+ c = get_16((void *)*in, type);
if ((unsigned)(c-0xdc00) < 0x400) goto ilseq;
if ((unsigned)(c-0xd800) < 0x400) {
if (type-UCS2BE < 2U) goto ilseq;
l = 4;
if (*inb < 4) goto starved;
- d = get_16(*in + 2, from);
+ d = get_16((void *)(*in + 2), from);
if ((unsigned)(c-0xdc00) >= 0x400) goto ilseq;
c = ((c-0xd800)<<10) | (d-0xdc00);
}
case UTF_16LE:
if (c < 0x10000) {
if (*outb < 2) goto toobig;
- put_16(*out, c, totype);
+ put_16((void *)*out, c, totype);
*out += 2;
*outb -= 2;
break;
}
if (type-UCS2BE < 2U) goto ilseq;
if (*outb < 4) goto toobig;
- put_16(*out, (c>>10)|0xd800, totype);
- put_16(*out + 2, (c&0x3ff)|0xdc00, totype);
+ put_16((void *)*out, (c>>10)|0xd800, totype);
+ put_16((void *)(*out + 2), (c&0x3ff)|0xdc00, totype);
*out += 4;
*outb -= 4;
break;
case UTF_32BE:
case UTF_32LE:
if (*outb < 4) goto toobig;
- put_32(*out, c, totype);
+ put_32((void *)*out, c, totype);
*out += 4;
*outb -= 4;
break;
key++;
q++;
}
- des_setkey(ctx, (char *)keybuf);
+ des_setkey(ctx, (void *)keybuf);
/*
* setting - 2 bytes of salt
#endif
des_init(&des_ctx);
- return des_crypt(&des_ctx, (char *)data, clear, salt);
+ return des_crypt(&des_ctx, (char *)data, (void *)clear, (void *)salt);
}
weak_alias(__crypt_r, crypt_r);
c = *(unsigned *)st;
if (!s) {
- s = "";
+ s = (void *)"";
wc = (void *)&wc;
n = 1;
} else if (!wc) wc = (void *)&wc;
{
const unsigned char *s;
if (strlen(host)-1 > 254 || mbstowcs(0, host, 0) > 255) return 0;
- for (s=host; *s>=0x80 || *s=='.' || *s=='-' || isalnum(*s); s++);
+ for (s=(void *)host; *s>=0x80 || *s=='.' || *s=='-' || isalnum(*s); s++);
return !*s;
}
void siglongjmp(sigjmp_buf buf, int ret)
{
- long *flag = buf + sizeof(jmp_buf)/sizeof(long);
+ unsigned long *flag = buf + sizeof(jmp_buf)/sizeof(long);
sigset_t *mask = (void *)(flag + 1);
if (*flag)
sigprocmask (SIG_SETMASK, mask, NULL);
if (c != f->lbf && f->wpos + 1 < f->wend) *f->wpos++ = c;
else c = __overflow(f, c);
} else if (f->wpos + MB_LEN_MAX < f->wend) {
- l = wctomb(f->wpos, c);
+ l = wctomb((void *)f->wpos, c);
if (l < 0) c = WEOF;
else f->wpos += l;
} else {
l = wctomb(mbc, c);
- if (l < 0 || __fwritex(mbc, l, f) < l) c = WEOF;
+ if (l < 0 || __fwritex((void *)mbc, l, f) < l) c = WEOF;
}
return c;
}
if (c == WEOF) return c;
/* Try conversion early so we can fail without locking if invalid */
- if (!isascii(c) && (l = wctomb(mbc, c)) < 0)
+ if (!isascii(c) && (l = wctomb((void *)mbc, c)) < 0)
return WEOF;
FLOCK(f);
int vdprintf(int fd, const char *fmt, va_list ap)
{
int r;
- char buf[BUFSIZ];
+ unsigned char buf[BUFSIZ];
FILE f = {
.fd = fd, .lbf = EOF, .write = wrap_write,
.buf = buf+UNGET, .buf_size = sizeof buf - UNGET
static void out(FILE *f, const char *s, size_t l)
{
- __fwritex(s, l, f);
+ __fwritex((void *)s, l, f);
}
static void pad(FILE *f, char c, int w, int l, int fl)
return -1;
} else if (n > 0) {
if (n > (char *)0+SIZE_MAX-s) n = (char *)0+SIZE_MAX-s;
- f.wpos = s;
- f.wbase = f.wend = s+n-1;
+ f.wpos = (void *)s;
+ f.wbase = f.wend = (void *)(s+n-1);
f.wstop = f.wend - 1;
}
r = vfprintf(&f, fmt, ap);
size_t l0 = l;
int i = 0;
struct cookie *c = f->cookie;
- while (c->l && l && (i=mbtowc(c->ws, s, l))>=0) {
+ while (c->l && l && (i=mbtowc(c->ws, (void *)s, l))>=0) {
s+=i;
l-=i;
c->l--;
long double strtold(const char *s1, char **p)
{
- const unsigned char *s = s1;
+ const unsigned char *s = (void *)s1;
long double x = 0;
long double frac;
int sign = 0;
}
}
if ((*s|32) == 'p') {
- e = strtol(s+1, (void *)&s, 10);
+ e = strtol((void *)(s+1), (void *)&s, 10);
for (; e>0; e--) x *= 2.0;
for (; e<0; e++) x *= 0.5;
}
}
}
if ((*s|32)=='e') {
- e = strtol(++s, (void *)&s, 10);
+ e = strtol((void *)++s, (void *)&s, 10);
for (; e>0; e--) x *= 10.0;
for (; e<0; e++) x /= 10.0;
}
uintmax_t strtoumax(const char *s1, char **p, int base)
{
- const unsigned char *s = s1;
+ const unsigned char *s = (void *)s1;
size_t x1, z1;
uintmax_t x, z=0;
int sign = 0;
int strcasecmp(const char *_l, const char *_r)
{
- const unsigned char *l=_l, *r=_r;
+ const unsigned char *l=(void *)_l, *r=(void *)_r;
for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++);
return tolower(*l) - tolower(*r);
}
#define BITOP(a,b,op) \
((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
-size_t strcspn(const char *_s, const char *_c)
+size_t strcspn(const char *s, const char *c)
{
- const unsigned char *s = _s;
- const unsigned char *c = _c;
- const unsigned char *a = s;
+ const char *a = s;
size_t byteset[32/sizeof(size_t)];
if (!c[0]) return strlen(s);
if (!c[1]) return (s=strchr(s, *c)) ? s-a : strlen(a);
memset(byteset, 0, sizeof byteset);
- for (; *c && BITOP(byteset, *c, |=); c++);
- for (; *s && !BITOP(byteset, *s, &); s++);
+ for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++);
+ for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++);
return s-a;
}
int strncasecmp(const char *_l, const char *_r, size_t n)
{
- const unsigned char *l=_l, *r=_r;
+ const unsigned char *l=(void *)_l, *r=(void *)_r;
if (!n--) return 0;
for (; *l && *r && n && (*l == *r || tolower(*l) == tolower(*r)); l++, r++, n--);
return tolower(*l) - tolower(*r);
int strncmp(const char *_l, const char *_r, size_t n)
{
- const unsigned char *l=_l, *r=_r;
+ const unsigned char *l=(void *)_l, *r=(void *)_r;
if (!n--) return 0;
for (; *l && *r && n && *l == *r ; l++, r++, n--);
return *l - *r;
#define BITOP(a,b,op) \
((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
-size_t strspn(const char *_s, const char *_c)
+size_t strspn(const char *s, const char *c)
{
- const unsigned char *s = _s;
- const unsigned char *c = _c;
- const unsigned char *a = s;
+ const char *a = s;
size_t byteset[32/sizeof(size_t)] = { 0 };
if (!c[0]) return 0;
return s-a;
}
- for (; *c && BITOP(byteset, *c, |=); c++);
- for (; *s && BITOP(byteset, *s, &); s++);
+ for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++);
+ for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++);
return s-a;
}
if (z-h < l) {
/* Fast estimate for MIN(l,63) */
size_t grow = l | 63;
- const char *z2 = memchr(z, 0, grow);
+ const unsigned char *z2 = memchr(z, 0, grow);
if (z2) {
z = z2;
if (z-h < l) return 0;
h = strchr(h, *n);
if (!h || !n[1]) return (char *)h;
if (!h[1]) return 0;
- if (!n[2]) return twobyte_strstr(h, n);
+ if (!n[2]) return twobyte_strstr((void *)h, (void *)n);
if (!h[2]) return 0;
- if (!n[3]) return threebyte_strstr(h, n);
+ if (!n[3]) return threebyte_strstr((void *)h, (void *)n);
if (!h[3]) return 0;
- if (!n[4]) return fourbyte_strstr(h, n);
+ if (!n[4]) return fourbyte_strstr((void *)h, (void *)n);
- return twoway_strstr(h, n);
+ return twoway_strstr((void *)h, (void *)n);
}