/* Low-level I/O routines for BFDs.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1990-2017 Free Software Foundation, Inc.
Written by Cygnus Support.
#endif
file_ptr
-real_ftell (FILE *file)
+_bfd_real_ftell (FILE *file)
{
#if defined (HAVE_FTELLO64)
return ftello64 (file);
}
int
-real_fseek (FILE *file, file_ptr offset, int whence)
+_bfd_real_fseek (FILE *file, file_ptr offset, int whence)
{
#if defined (HAVE_FSEEKO64)
return fseeko64 (file, offset, whence);
}
FILE *
-real_fopen (const char *filename, const char *modes)
+_bfd_real_fopen (const char *filename, const char *modes)
{
#ifdef VMS
char *vms_attr;
- /* On VMS, fopen allows file attributes as optionnal arguments.
+ /* On VMS, fopen allows file attributes as optional arguments.
We need to use them but we'd better to use the common prototype.
In fopen-vms.h, they are separated from the mode with a comma.
Split here. */
. {* For the following, on successful completion a value of 0 is returned.
. Otherwise, a value of -1 is returned (and <<bfd_error>> is set). *}
. int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
-. bfd_boolean (*bclose) (struct bfd *abfd);
+. int (*bclose) (struct bfd *abfd);
. int (*bflush) (struct bfd *abfd);
. int (*bstat) (struct bfd *abfd, struct stat *sb);
. {* Mmap a part of the files. ADDR, LEN, PROT, FLAGS and OFFSET are the usual
bfd *parent_bfd = abfd;
ptr = abfd->iovec->btell (abfd);
- while (parent_bfd->my_archive != NULL)
+ while (parent_bfd->my_archive != NULL
+ && !bfd_is_thin_archive (parent_bfd->my_archive))
{
ptr -= parent_bfd->origin;
parent_bfd = parent_bfd->my_archive;
if (direction == SEEK_CUR && position == 0)
return 0;
- if (abfd->format != bfd_archive && abfd->my_archive == 0)
+ if (abfd->my_archive == NULL || bfd_is_thin_archive (abfd->my_archive))
{
if (direction == SEEK_SET && (bfd_vma) position == abfd->where)
return 0;
{
bfd *parent_bfd = abfd;
- while (parent_bfd->my_archive != NULL)
+ while (parent_bfd->my_archive != NULL
+ && !bfd_is_thin_archive (parent_bfd->my_archive))
{
file_position += parent_bfd->origin;
parent_bfd = parent_bfd->my_archive;
return 0;
}
-static bfd_boolean
+static int
memory_bclose (struct bfd *abfd)
{
struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
free (bim);
abfd->iostream = NULL;
- return TRUE;
+ return 0;
}
static int