diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-12-16 15:40:30 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-12-21 18:52:45 -0800 |
commit | 4d43b4554f8e35bf8122ae9d2f1bbc0e56fe6d37 (patch) | |
tree | cab81410b9eda17b218f6f56986dfa2549481775 /AuRead.c | |
parent | f2b24dd74614ce807cacf764c6eddd834feffc5a (diff) |
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 <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'AuRead.c')
-rw-r--r-- | AuRead.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -35,7 +35,7 @@ read_short (unsigned short *shortp, FILE *file) { unsigned char file_short[2]; - if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) + if (fread ((char *) file_short, sizeof (file_short), 1, file) != 1) return 0; *shortp = file_short[0] * 256 + file_short[1]; return 1; @@ -55,7 +55,7 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file) data = malloc ((unsigned) len); if (!data) return 0; - if (fread (data, (int) sizeof (char), (int) len, file) != len) { + if (fread (data, sizeof (char), len, file) != len) { bzero (data, len); free (data); return 0; |