From 4d43b4554f8e35bf8122ae9d2f1bbc0e56fe6d37 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 16 Dec 2012 15:40:30 -0800 Subject: Clean up some clang warnings about sign conversion fread & fwrite are defined as taking size_t arguments (an unsigned type), so stop casting their arguments to a signed int just to confuse things. Fixes warnings: AuFileName.c:69:59: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] size = strlen (name) + strlen(&slashDotXauthority[1]) + 2; ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ AuRead.c:58:44: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if (fread (data, (int) sizeof (char), (int) len, file) != len) { ~~~~~ ^~~~~~~~~ AuWrite.c:49:46: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if (fwrite (string, (int) sizeof (char), (int) count, file) != count) ~~~~~~ ^~~~~~~~~~~ Signed-off-by: Alan Coopersmith Reviewed-by: Peter Hutterer --- AuWrite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'AuWrite.c') diff --git a/AuWrite.c b/AuWrite.c index 0924f8d..1eb38a3 100644 --- a/AuWrite.c +++ b/AuWrite.c @@ -36,7 +36,7 @@ write_short (unsigned short s, FILE *file) file_short[0] = (s & (unsigned)0xff00) >> 8; file_short[1] = s & 0xff; - if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) + if (fwrite ((char *) file_short, sizeof (file_short), 1, file) != 1) return 0; return 1; } @@ -46,7 +46,7 @@ write_counted_string (unsigned short count, char *string, FILE *file) { if (write_short (count, file) == 0) return 0; - if (fwrite (string, (int) sizeof (char), (int) count, file) != count) + if (fwrite (string, sizeof (char), count, file) != count) return 0; return 1; } -- cgit v1.2.1