commit 70ed6152e1e163b9ca240fe8b91aa3feb942ac84 Author: Francois Gouget Date: Tue Dec 20 18:45:18 2011 +0100 bfd: Always use bfd_size_type to manipulate the size of an archive element. Other types may not be able to deal with archive elements larger than 2GB. diff --git a/bfd/archive.c b/bfd/archive.c index 01acf98..c1438ef 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -748,7 +748,7 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file) filestart = bfd_ardata (archive)->first_file_filepos; else { - unsigned int size = arelt_size (last_file); + bfd_size_type size = arelt_size (last_file); filestart = last_file->proxy_origin; if (! bfd_is_thin_archive (archive)) @@ -946,7 +946,7 @@ do_slurp_coff_armap (bfd *abfd) struct artdata *ardata = bfd_ardata (abfd); char *stringbase; bfd_size_type stringsize; - unsigned int parsed_size; + bfd_size_type parsed_size; carsym *carsyms; bfd_size_type nsymz; /* Number of symbols in armap. */ bfd_vma (*swap) (const void *); @@ -2174,7 +2174,7 @@ _bfd_write_archive_contents (bfd *arch) current = current->archive_next) { char buffer[DEFAULT_BUFFERSIZE]; - unsigned int remaining = arelt_size (current); + bfd_size_type remaining = arelt_size (current); /* Write ar header. */ if (!_bfd_write_ar_hdr (arch, current)) diff --git a/bfd/bfdio.c b/bfd/bfdio.c index 841c781..5bc8061 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -185,7 +185,7 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd) this element. */ if (abfd->arelt_data != NULL) { - size_t maxbytes = ((struct areltdata *) abfd->arelt_data)->parsed_size; + bfd_size_type maxbytes = arelt_size (abfd); if (abfd->where + size > maxbytes) { if (abfd->where >= maxbytes) diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index a4ba4b6..683c1cc 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -90,8 +90,8 @@ struct artdata { /* Goes in bfd's arelt_data slot */ struct areltdata { char * arch_header; /* it's actually a string */ - unsigned int parsed_size; /* octets of filesize not including ar_hdr */ - unsigned int extra_size; /* BSD4.4: extra bytes after the header. */ + bfd_size_type parsed_size; /* octets of filesize not including ar_hdr */ + bfd_size_type extra_size; /* BSD4.4: extra bytes after the header. */ char *filename; /* null-terminated */ file_ptr origin; /* for element of a thin archive */ }; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 7f142d0..6d27901 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -95,8 +95,8 @@ struct artdata { /* Goes in bfd's arelt_data slot */ struct areltdata { char * arch_header; /* it's actually a string */ - unsigned int parsed_size; /* octets of filesize not including ar_hdr */ - unsigned int extra_size; /* BSD4.4: extra bytes after the header. */ + bfd_size_type parsed_size; /* octets of filesize not including ar_hdr */ + bfd_size_type extra_size; /* BSD4.4: extra bytes after the header. */ char *filename; /* null-terminated */ file_ptr origin; /* for element of a thin archive */ };