From: kazu Date: Thu, 25 Jan 2007 15:40:22 +0000 (+0000) Subject: * ar.c (print_contents, extract_file): Cast the return value X-Git-Tag: drop_9x_support_start~344 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3d38f479c297086f7c8eb6b88919cb6674f59687;p=pf3gnuchains%2Fpf3gnuchains4x.git * ar.c (print_contents, extract_file): Cast the return value of fwrite to size_t. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 13d20eb818..5f99b21423 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2007-01-25 Kazu Hirata + + * ar.c (print_contents, extract_file): Cast the return value + of fwrite to size_t. + 2007-01-12 Alan Modra * ar.c (open_inarch): Check fwrite return. Use size_t. diff --git a/binutils/ar.c b/binutils/ar.c index 115224221e..1fbacf9101 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -805,7 +805,11 @@ print_contents (bfd *abfd) /* xgettext:c-format */ fatal (_("%s is not a valid archive"), bfd_get_filename (bfd_my_archive (abfd))); - if (fwrite (cbuf, 1, nread, stdout) != nread) + + /* fwrite in mingw32 may return int instead of size_t. Cast the + return value to size_t to avoid comparison between signed and + unsigned values. */ + if ((size_t) fwrite (cbuf, 1, nread, stdout) != nread) fatal ("stdout: %s", strerror (errno)); ncopied += tocopy; } @@ -885,7 +889,11 @@ extract_file (bfd *abfd) output_file = ostream; } - if (fwrite (cbuf, 1, nread, ostream) != nread) + + /* fwrite in mingw32 may return int instead of size_t. Cast + the return value to size_t to avoid comparison between + signed and unsigned values. */ + if ((size_t) fwrite (cbuf, 1, nread, ostream) != nread) fatal ("%s: %s", output_filename, strerror (errno)); ncopied += tocopy; }