/* Support for memory-mapped windows into a BFD.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
static int ok_to_map = 1;
-bfd_boolean
+bool
bfd_get_file_window (bfd *abfd,
file_ptr offset,
bfd_size_type size,
bfd_window *windowp,
- bfd_boolean writable)
+ bool writable)
{
static size_t pagesize;
bfd_window_internal *i = windowp->i;
{
i = bfd_zmalloc (sizeof (bfd_window_internal));
if (i == NULL)
- return FALSE;
+ return false;
i->data = NULL;
}
#ifdef HAVE_MMAP
int fd;
/* Find the real file and the real offset into it. */
- while (abfd->my_archive != NULL)
+ while (abfd->my_archive != NULL
+ && !bfd_is_thin_archive (abfd->my_archive))
{
offset += abfd->origin;
abfd = abfd->my_archive;
}
+ offset += abfd->origin;
/* Seek into the file, to ensure it is open if cacheable. */
if (abfd->iostream == NULL
i->mapped = 1;
i->refcount = 1;
windowp->i = i;
- return TRUE;
+ return true;
}
else if (debug_windows)
{
if (size_to_alloc == 0)
{
windowp->i = i;
- return TRUE;
+ return true;
}
goto free_and_fail;
}
windowp->data = i->data;
windowp->size = i->size;
windowp->i = i;
- return TRUE;
+ return true;
free_and_fail:
/* We have a bfd_window_internal, but an error occurred. Free it. */
free (i);
- return FALSE;
+ return false;
}
#endif /* USE_MMAP */