Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1015)

Unified Diff: bfd/bfdio.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bfd/bfd-in2.h ('k') | bfd/cache.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bfd/bfdio.c
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 841c781f4bd8e08f4abc842199bf1ad4dc147cd4..43a7684d7badefd2a4184efc1c74f1fe7180f614 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -87,7 +87,6 @@ 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.
@@ -185,7 +184,8 @@ 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)
@@ -233,10 +233,14 @@ bfd_tell (bfd *abfd)
if (abfd->iovec)
{
+ bfd *parent_bfd = abfd;
ptr = abfd->iovec->btell (abfd);
- if (abfd->my_archive)
- ptr -= abfd->origin;
+ while (parent_bfd->my_archive != NULL)
+ {
+ ptr -= parent_bfd->origin;
+ parent_bfd = parent_bfd->my_archive;
+ }
}
else
ptr = 0;
@@ -308,8 +312,16 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
}
file_position = position;
- if (direction == SEEK_SET && abfd->my_archive != NULL)
- file_position += abfd->origin;
+ 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 (abfd->iovec)
result = abfd->iovec->bseek (abfd, file_position, direction);
« no previous file with comments | « bfd/bfd-in2.h ('k') | bfd/cache.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698