static void
print_contents (bfd *abfd)
{
- size_t ncopied = 0;
+ bfd_size_type ncopied = 0;
+ bfd_size_type size;
char *cbuf = (char *) xmalloc (BUFSIZE);
struct stat buf;
- size_t size;
+
if (bfd_stat_arch_elt (abfd, &buf) != 0)
/* xgettext:c-format */
fatal (_("internal stat error on %s"), bfd_get_filename (abfd));
size = buf.st_size;
while (ncopied < size)
{
+ bfd_size_type nread;
+ bfd_size_type tocopy = size - ncopied;
- size_t nread;
- size_t tocopy = size - ncopied;
if (tocopy > BUFSIZE)
tocopy = BUFSIZE;
- nread = bfd_bread (cbuf, (bfd_size_type) tocopy, abfd);
+ nread = bfd_bread (cbuf, tocopy, abfd);
if (nread != tocopy)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
bfd_get_filename (bfd_my_archive (abfd)));
- /* fwrite in mingw32 may return int instead of size_t. Cast the
- return value to size_t to avoid comparison between signed and
+ /* fwrite in mingw32 may return int instead of bfd_size_type. Cast the
+ return value to bfd_size_type to avoid comparison between signed and
unsigned values. */
- if ((size_t) fwrite (cbuf, 1, nread, stdout) != nread)
+ if ((bfd_size_type) fwrite (cbuf, 1, nread, stdout) != nread)
fatal ("stdout: %s", strerror (errno));
ncopied += tocopy;
}
{
FILE *ostream;
char *cbuf = (char *) xmalloc (BUFSIZE);
- size_t nread, tocopy;
- size_t ncopied = 0;
- size_t size;
+ bfd_size_type nread, tocopy;
+ bfd_size_type ncopied = 0;
+ bfd_size_type size;
struct stat buf;
if (bfd_stat_arch_elt (abfd, &buf) != 0)
if (tocopy > BUFSIZE)
tocopy = BUFSIZE;
- nread = bfd_bread (cbuf, (bfd_size_type) tocopy, abfd);
+ nread = bfd_bread (cbuf, tocopy, abfd);
if (nread != tocopy)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
output_file = ostream;
}
- /* fwrite in mingw32 may return int instead of size_t. Cast
- the return value to size_t to avoid comparison between
+ /* fwrite in mingw32 may return int instead of bfd_size_type. Cast
+ the return value to bfd_size_type to avoid comparison between
signed and unsigned values. */
- if ((size_t) fwrite (cbuf, 1, nread, ostream) != nread)
+ if ((bfd_size_type) fwrite (cbuf, 1, nread, ostream) != nread)
fatal ("%s: %s", output_filename, strerror (errno));
ncopied += tocopy;
}
char timebuf[40];
time_t when = buf.st_mtime;
const char *ctime_result = (const char *) ctime (&when);
+ bfd_size_type size;
/* POSIX format: skip weekday and seconds from ctime output. */
sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
mode_string (buf.st_mode, modebuf);
modebuf[10] = '\0';
+ size = buf.st_size;
/* POSIX 1003.2/D11 says to skip first character (entry type). */
- fprintf (file, "%s %ld/%ld %6ld %s ", modebuf + 1,
+ fprintf (file, "%s %ld/%ld %6" BFD_VMA_FMT "u %s ", modebuf + 1,
(long) buf.st_uid, (long) buf.st_gid,
- (long) buf.st_size, timebuf);
+ size, timebuf);
}
}