[PATCH] libc: cleanup some compile warnings

Hans-Christian Egtvedt hcegtvedt at atmel.com
Fri Oct 26 08:40:37 UTC 2007


Signed-off-by: Hans-Christian Egtvedt <hcegtvedt at atmel.com>
---
 libc/inet/rpc/create_xid.c  |    2 +-
 libc/inet/rpc/xdr.c         |   12 ++++++------
 libc/inet/rpc/xdr_intXX_t.c |    4 ++--
 libc/stdio/_scanf.c         |    8 ++++----
 libc/stdio/_vfprintf.c      |    8 ++++----
 libc/stdio/vsnprintf.c      |    4 ++--
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/libc/inet/rpc/create_xid.c b/libc/inet/rpc/create_xid.c
index 18b9c6e..745a7f7 100644
--- a/libc/inet/rpc/create_xid.c
+++ b/libc/inet/rpc/create_xid.c
@@ -54,7 +54,7 @@ u_long _create_xid (void)
       is_initialized = 1;
     }
 
-  lrand48_r (&__rpc_lrand48_data, &res);
+  lrand48_r (&__rpc_lrand48_data, (long int *)&res);
 
   __UCLIBC_MUTEX_UNLOCK(mylock);
 
diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c
index e800991..7f57c0d 100644
--- a/libc/inet/rpc/xdr.c
+++ b/libc/inet/rpc/xdr.c
@@ -274,12 +274,12 @@ xdr_hyper (XDR *xdrs, quad_t *llp)
     {
       t1 = (long) ((*llp) >> 32);
       t2 = (long) (*llp);
-      return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2));
+      return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, (long *) &t2));
     }
 
   if (xdrs->x_op == XDR_DECODE)
     {
-      if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
+      if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, (long *) &t2))
 	return FALSE;
       *llp = ((quad_t) t1) << 32;
       *llp |= t2;
@@ -309,12 +309,12 @@ xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
     {
       t1 = (unsigned long) ((*ullp) >> 32);
       t2 = (unsigned long) (*ullp);
-      return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2));
+      return (XDR_PUTLONG(xdrs, (long *) &t1) && XDR_PUTLONG(xdrs, (long *) &t2));
     }
 
   if (xdrs->x_op == XDR_DECODE)
     {
-      if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
+      if (!XDR_GETLONG(xdrs, (long *) &t1) || !XDR_GETLONG(xdrs, (long *) &t2))
 	return FALSE;
       *ullp = ((u_quad_t) t1) << 32;
       *ullp |= t2;
@@ -353,10 +353,10 @@ xdr_u_short (XDR *xdrs, u_short *usp)
     {
     case XDR_ENCODE:
       l = (u_long) * usp;
-      return XDR_PUTLONG (xdrs, &l);
+      return XDR_PUTLONG (xdrs, (long *) &l);
 
     case XDR_DECODE:
-      if (!XDR_GETLONG (xdrs, &l))
+      if (!XDR_GETLONG (xdrs, (long *) &l))
 	{
 	  return FALSE;
 	}
diff --git a/libc/inet/rpc/xdr_intXX_t.c b/libc/inet/rpc/xdr_intXX_t.c
index d36d162..ff21775 100644
--- a/libc/inet/rpc/xdr_intXX_t.c
+++ b/libc/inet/rpc/xdr_intXX_t.c
@@ -34,9 +34,9 @@ xdr_int64_t (XDR *xdrs, int64_t *ip)
     case XDR_ENCODE:
       t1 = (int32_t) ((*ip) >> 32);
       t2 = (int32_t) (*ip);
-      return (XDR_PUTINT32(xdrs, &t1) && XDR_PUTINT32(xdrs, &t2));
+      return (XDR_PUTINT32(xdrs, &t1) && XDR_PUTINT32(xdrs, (int32_t *) &t2));
     case XDR_DECODE:
-      if (!XDR_GETINT32(xdrs, &t1) || !XDR_GETINT32(xdrs, &t2))
+      if (!XDR_GETINT32(xdrs, &t1) || !XDR_GETINT32(xdrs, (int32_t *) &t2))
         return FALSE;
       *ip = ((int64_t) t1) << 32;
       *ip |= t2;
diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c
index bc95d02..9bc8def 100644
--- a/libc/stdio/_scanf.c
+++ b/libc/stdio/_scanf.c
@@ -731,7 +731,7 @@ void attribute_hidden __init_scan_cookie(register struct scan_cookie *sc,
 	sc->decpt = __UCLIBC_CURLOCALE_DATA.decimal_point;
 	sc->decpt_len = __UCLIBC_CURLOCALE_DATA.decimal_point_len;
 #else  /* __UCLIBC_HAS_LOCALE__ */
-	sc->fake_decpt = sc->decpt = decpt_str;
+	sc->fake_decpt = sc->decpt = (unsigned char *) decpt_str;
 	sc->decpt_len = 1;
 #endif /* __UCLIBC_HAS_LOCALE__ */
 #ifdef __UCLIBC_HAS_WCHAR__
@@ -2087,7 +2087,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc)
 			}
 			++psfs->cnt;
 			_store_inttype(psfs->cur_ptr, psfs->dataargtype,
-						   (uintmax_t) STRTOUIM(buf, NULL, base, 1-usflag));
+						   (uintmax_t) STRTOUIM((char *) buf, NULL, base, 1-usflag));
 		}
 		return 0;
 	}
@@ -2101,7 +2101,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc)
 	p = sc->fake_decpt;
 	do {
 		if (!*p) {
-			strcpy(b, sc->decpt);
+			strcpy((char *) b, (char *) sc->decpt);
 			b += sc->decpt_len;
 			break;
 		}
@@ -2236,7 +2236,7 @@ int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc)
 	{
 		__fpmax_t x;
 		char *e;
-		x = __strtofpmax(buf, &e, exp_adjust);
+		x = __strtofpmax((char *) buf, &e, exp_adjust);
 		assert(!*e);
 		if (psfs->store) {
 			if (psfs->dataargtype & PA_FLAG_LONG_LONG) {
diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c
index 571b99c..30ce7ca 100644
--- a/libc/stdio/_vfprintf.c
+++ b/libc/stdio/_vfprintf.c
@@ -1427,7 +1427,7 @@ static size_t _charpad(FILE * __restrict stream, int padchar, size_t numpad)
 	FMT_TYPE pad[1];
 
 	*pad = padchar;
-	while (todo && (OUTNSTR(stream, pad, 1) == 1)) {
+	while (todo && (OUTNSTR(stream, (const unsigned char *) pad, 1) == 1)) {
 		--todo;
 	}
 
@@ -1831,7 +1831,7 @@ static int _do_one_spec(FILE * __restrict stream,
 			}
 		}
 #else  /* __UCLIBC_HAS_WCHAR__ */
-		if (_outnstr(stream, s, slen) != slen) {
+		if (_outnstr(stream, (const unsigned char *) s, slen) != slen) {
 			return -1;
 		}
 #endif /* __UCLIBC_HAS_WCHAR__ */
@@ -1886,7 +1886,7 @@ int VFPRINTF (FILE * __restrict stream,
 	{
 		count = -1;
 	} else if (_PPFS_init(&ppfs, format) < 0) {	/* Bad format string. */
-		OUTNSTR(stream, (const FMT_TYPE *) ppfs.fmtpos,
+		OUTNSTR(stream, (const unsigned char *) ppfs.fmtpos,
 				STRLEN((const FMT_TYPE *)(ppfs.fmtpos)));
 #if defined(L_vfprintf) && !defined(NDEBUG)
 		fprintf(stderr,"\nIMbS: \"%s\"\n\n", format);
@@ -1901,7 +1901,7 @@ int VFPRINTF (FILE * __restrict stream,
 			}
 
 			if (format-s) {		/* output any literal text in format string */
-				if ( (r = OUTNSTR(stream, s, format-s)) != (format-s)) {
+				if ( (r = OUTNSTR(stream, (const unsigned char *) s, format-s)) != (format-s)) {
 					count = -1;
 					break;
 				}
diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c
index 84215eb..51aaf43 100644
--- a/libc/stdio/vsnprintf.c
+++ b/libc/stdio/vsnprintf.c
@@ -55,8 +55,8 @@ int vsnprintf(char *__restrict buf, size_t size,
 
 	/* Set these last since __bufputc initialization depends on
 	 * __user_locking and only gets set if user locking is on. */
-	f.__bufstart = buf;
-	f.__bufend = buf + size;
+	f.__bufstart = (unsigned char *) buf;
+	f.__bufend = (unsigned char *) buf + size;
 	__STDIO_STREAM_INIT_BUFREAD_BUFPOS(&f);
 	__STDIO_STREAM_DISABLE_GETC(&f);
 	__STDIO_STREAM_ENABLE_PUTC(&f);
-- 
1.5.2.5




More information about the uClibc mailing list