about summary refs log tree commit diff
path: root/src/stdio
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-25 16:34:03 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-25 16:34:03 -0400
commit9ae8d5fc71a4b61ec826d58f03f7b543755fb1d4 (patch)
treea712bede2bb0cef734418927fee7704732628e83 /src/stdio
parenta37452430f93700aeb122d693959ad79d8e43ada (diff)
downloadmusl-9ae8d5fc71a4b61ec826d58f03f7b543755fb1d4.tar.gz
musl-9ae8d5fc71a4b61ec826d58f03f7b543755fb1d4.tar.xz
musl-9ae8d5fc71a4b61ec826d58f03f7b543755fb1d4.zip
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.
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/fputwc.c4
-rw-r--r--src/stdio/ungetwc.c2
-rw-r--r--src/stdio/vdprintf.c2
-rw-r--r--src/stdio/vfprintf.c2
-rw-r--r--src/stdio/vsnprintf.c4
-rw-r--r--src/stdio/vswprintf.c2
6 files changed, 8 insertions, 8 deletions
diff --git a/src/stdio/fputwc.c b/src/stdio/fputwc.c
index b48bb74d..ec49b5c6 100644
--- a/src/stdio/fputwc.c
+++ b/src/stdio/fputwc.c
@@ -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;
 }
diff --git a/src/stdio/ungetwc.c b/src/stdio/ungetwc.c
index f7cde2e0..6871d034 100644
--- a/src/stdio/ungetwc.c
+++ b/src/stdio/ungetwc.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);
diff --git a/src/stdio/vdprintf.c b/src/stdio/vdprintf.c
index 35ed6e0b..68562e05 100644
--- a/src/stdio/vdprintf.c
+++ b/src/stdio/vdprintf.c
@@ -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
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 19afd6c9..b6bb3bcf 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -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)
diff --git a/src/stdio/vsnprintf.c b/src/stdio/vsnprintf.c
index 5d3f0c5f..1f316ca4 100644
--- a/src/stdio/vsnprintf.c
+++ b/src/stdio/vsnprintf.c
@@ -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);
diff --git a/src/stdio/vswprintf.c b/src/stdio/vswprintf.c
index 31ea1875..2d9f2002 100644
--- a/src/stdio/vswprintf.c
+++ b/src/stdio/vswprintf.c
@@ -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--;