diff options
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r-- | bfd/bfdio.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c index 43a7684d7b..841c781f4b 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -87,6 +87,7 @@ FILE * real_fopen (const char *filename, const char *modes) { #ifdef VMS + char vms_modes[4]; char *vms_attr; /* On VMS, fopen allows file attributes as optionnal arguments. @@ -184,8 +185,7 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd) this element. */ if (abfd->arelt_data != NULL) { - bfd_size_type maxbytes = arelt_size (abfd); - + size_t maxbytes = ((struct areltdata *) abfd->arelt_data)->parsed_size; if (abfd->where + size > maxbytes) { if (abfd->where >= maxbytes) @@ -233,14 +233,10 @@ bfd_tell (bfd *abfd) if (abfd->iovec) { - bfd *parent_bfd = abfd; ptr = abfd->iovec->btell (abfd); - while (parent_bfd->my_archive != NULL) - { - ptr -= parent_bfd->origin; - parent_bfd = parent_bfd->my_archive; - } + if (abfd->my_archive) + ptr -= abfd->origin; } else ptr = 0; @@ -312,16 +308,8 @@ bfd_seek (bfd *abfd, file_ptr position, int direction) } file_position = position; - if (direction == SEEK_SET) - { - bfd *parent_bfd = abfd; - - while (parent_bfd->my_archive != NULL) - { - file_position += parent_bfd->origin; - parent_bfd = parent_bfd->my_archive; - } - } + if (direction == SEEK_SET && abfd->my_archive != NULL) + file_position += abfd->origin; if (abfd->iovec) result = abfd->iovec->bseek (abfd, file_position, direction); |