aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2007-01-25 15:40:22 +0000
committerKazu Hirata <kazu@codesourcery.com>2007-01-25 15:40:22 +0000
commit84f1d8266b1db6ef286fefdfb99f6e14b65967d3 (patch)
treefdc04cf66421f95ee8841a45f054e0b9b6325570
parent64ee10b619d964d076beec103b1400a84bf1bc69 (diff)
downloadgdb-84f1d8266b1db6ef286fefdfb99f6e14b65967d3.zip
gdb-84f1d8266b1db6ef286fefdfb99f6e14b65967d3.tar.gz
gdb-84f1d8266b1db6ef286fefdfb99f6e14b65967d3.tar.bz2
* ar.c (print_contents, extract_file): Cast the return value
of fwrite to size_t.
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/ar.c12
2 files changed, 15 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 13d20eb..5f99b21 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-25 Kazu Hirata <kazu@codesourcery.com>
+
+ * ar.c (print_contents, extract_file): Cast the return value
+ of fwrite to size_t.
+
2007-01-12 Alan Modra <amodra@bigpond.net.au>
* ar.c (open_inarch): Check fwrite return. Use size_t.
diff --git a/binutils/ar.c b/binutils/ar.c
index 1152242..1fbacf9 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;
}