fix all implicit conversion between signed/unsigned pointers
sadly the C language does not specify any such implicit conversion, so this is not a matter of just fixing warnings (as gcc treats it) but actual errors. i would like to revisit a number of these changes and possibly revise the types used to reduce the number of casts required.
This commit is contained in:
parent
a37452430f
commit
9ae8d5fc71
19 changed files with 44 additions and 48 deletions
|
|
@ -11,12 +11,12 @@ wint_t __fputwc_unlocked(wchar_t c, FILE *f)
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ wint_t ungetwc(wint_t c, FILE *f)
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ static size_t wrap_write(FILE *f, const unsigned char *buf, size_t len)
|
|||
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
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ static void pop_arg(union arg *arg, int type, va_list *ap)
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ int vsnprintf(char *s, size_t n, const char *fmt, va_list ap)
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ static size_t sw_write(FILE *f, const unsigned char *s, size_t l)
|
|||
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--;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue