Browse Source

more of warning fixes, mostly pointer signedness mismatches

Denis Vlasenko 15 years ago
parent
commit
c6df9c9452

+ 1 - 1
extra/locale/gen_collate.c

@@ -3993,5 +3993,5 @@ static void dump_collate(FILE *fp)
 
 	fprintf(fp,"}; /* %8lu */\n", collate_pos);
 
-	fprintf(fp,"#define __lc_collate_data_LEN  %d\n\n", collate_pos);
+	fprintf(fp,"#define __lc_collate_data_LEN  %lu\n\n", collate_pos);
 }

+ 1 - 1
libc/misc/locale/locale.c

@@ -254,7 +254,7 @@ static void update_hr_locale(const unsigned char *spec)
 					if (at) {
 						const char *q;
 						*n++ = '@';
-						q = LOCALE_AT_MODIFIERS;
+						q = (char*) LOCALE_AT_MODIFIERS;
 						do {
 							if (q[1] == at) {
 								n = stpcpy(n, q+2);

+ 3 - 2
libc/stdio/_scanf.c

@@ -592,6 +592,7 @@ enum {
 /**********************************************************************/
 
 #ifdef L_vfwscanf
+/* FIXME: "warning: the right operand of ">" changes sign when promoted" */
 #if WINT_MIN > EOF
 #error Unfortunately, we currently need wint_t to be able to store EOF.  Sorry.
 #endif
@@ -717,7 +718,7 @@ void attribute_hidden __init_scan_cookie(register struct scan_cookie *sc,
 
 #ifdef __UCLIBC_HAS_GLIBC_DIGIT_GROUPING__
 	if (*(sc->grouping = __UCLIBC_CURLOCALE_DATA.grouping)) {
-		sc->thousands_sep = __UCLIBC_CURLOCALE_DATA.thousands_sep;
+		sc->thousands_sep = (const unsigned char *) __UCLIBC_CURLOCALE_DATA.thousands_sep;
 		sc->tslen = __UCLIBC_CURLOCALE_DATA.thousands_sep_len;
 #ifdef __UCLIBC_HAS_WCHAR__
 		sc->thousands_sep_wc = __UCLIBC_CURLOCALE_DATA.thousands_sep_wc;
@@ -727,7 +728,7 @@ void attribute_hidden __init_scan_cookie(register struct scan_cookie *sc,
 
 #ifdef __UCLIBC_HAS_FLOATS__
 #ifdef __UCLIBC_HAS_LOCALE__
-	sc->decpt = __UCLIBC_CURLOCALE_DATA.decimal_point;
+	sc->decpt = (const unsigned char *) __UCLIBC_CURLOCALE_DATA.decimal_point;
 	sc->decpt_len = __UCLIBC_CURLOCALE_DATA.decimal_point_len;
 #else  /* __UCLIBC_HAS_LOCALE__ */
 	sc->fake_decpt = sc->decpt = (unsigned char *) decpt_str;

+ 2 - 2
libc/stdio/_wfwrite.c

@@ -38,7 +38,7 @@ size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
 		}
 		if (count) {
 			wmemcpy((wchar_t *)(stream->__bufpos), ws, count);
-			stream->__bufpos = (char *)(((wchar_t *)(stream->__bufpos)) + count);
+			stream->__bufpos = (unsigned char *)(((wchar_t *)(stream->__bufpos)) + count);
 		}
 		__STDIO_STREAM_VALIDATE(stream);
 		return n;
@@ -59,7 +59,7 @@ size_t attribute_hidden _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
 					++r;		  /* 0 is returned when nul is reached. */
 					pw = ws + count + r; /* pw was set to NULL, so correct. */
 				}
-				if (__stdio_fwrite(buf, r, stream) == r) {
+				if (__stdio_fwrite((const unsigned char *)buf, r, stream) == r) {
 					count = pw - ws;
 					continue;
 				}

+ 3 - 3
libc/stdio/vswprintf.c

@@ -46,8 +46,8 @@ int vswprintf(wchar_t *__restrict buf, size_t size,
 		size = ((SIZE_MAX - (size_t) buf)/sizeof(wchar_t));
 	}
 
-	f.__bufstart = (char *) buf;
-	f.__bufend = (char *)(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_DISABLE_PUTC(&f);
@@ -58,7 +58,7 @@ int vswprintf(wchar_t *__restrict buf, size_t size,
 	if (f.__bufpos == f.__bufend) {
 		rv = -1;
 		if (size) {
-			f.__bufpos = (char *)(((wchar_t *) f.__bufpos) - 1);
+			f.__bufpos = (unsigned char *) (((wchar_t *) f.__bufpos) - 1);
 		}
 	}
 	if (size) {

+ 1 - 1
libc/sysdeps/linux/common/bits/uClibc_locale.h

@@ -174,7 +174,7 @@ typedef struct __uclibc_locale_struct {
 	const unsigned char *idx8ctype;
 	const unsigned char *tbl8ctype;
 	const unsigned char *idx8uplow;
-    const unsigned char *tbl8uplow;
+	const unsigned char *tbl8uplow;
 #ifdef __UCLIBC_HAS_WCHAR__
 	const unsigned char *idx8c2wc;
 	const uint16_t *tbl8c2wc;	/* char > 0x7f to wide char */