Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/archive.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* BFD back-end for archive files (libraries).
    22   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    3    2000
     3   2000, 2001, 2002
    44   Free Software Foundation, Inc.
    55   Written by Cygnus Support.  Mostly Gumby Henkel-Wallace's fault.
     
    133133#include "aout/ar.h"
    134134#include "aout/ranlib.h"
    135 #include <ctype.h>
     135#include "safe-ctype.h"
    136136
    137137#ifndef errno
     
    141141#ifdef GNU960
    142142#define BFD_GNU960_ARMAG(abfd)  (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB)
    143 #endif
    144 
    145 /* Define offsetof for those systems which lack it */
    146 
    147 #ifndef offsetof
    148 #define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
    149143#endif
    150144
     
    167161#define arch_hdr(bfd) ((struct ar_hdr *)arch_eltdata(bfd)->arch_header)
    168162
    169 static char *get_extended_arelt_filename PARAMS ((bfd *arch,
    170                                                   const char *name));
    171 static boolean do_slurp_bsd_armap PARAMS ((bfd *abfd));
    172 static boolean do_slurp_coff_armap PARAMS ((bfd *abfd));
    173 static const char *normalize PARAMS ((bfd *, const char *file));
    174 static struct areltdata *bfd_ar_hdr_from_filesystem PARAMS ((bfd *abfd,
    175                                                              const char *,
    176                                                              bfd *member));
    177 
    178 
    179 boolean
     163static char *get_extended_arelt_filename
     164  PARAMS ((bfd *arch, const char *name));
     165static bfd_boolean do_slurp_bsd_armap
     166  PARAMS ((bfd *abfd));
     167static bfd_boolean do_slurp_coff_armap
     168  PARAMS ((bfd *abfd));
     169bfd_boolean bfd_elf64_archive_slurp_armap
     170  PARAMS ((bfd *abfd));
     171static const char *normalize
     172  PARAMS ((bfd *, const char *file));
     173static struct areltdata *bfd_ar_hdr_from_filesystem
     174  PARAMS ((bfd *abfd, const char *, bfd *member));
     175
     176
     177bfd_boolean
    180178_bfd_generic_mkarchive (abfd)
    181179     bfd *abfd;
    182180{
    183   abfd->tdata.aout_ar_data = ((struct artdata *)
    184                               bfd_zalloc (abfd, sizeof (struct artdata)));
    185 
     181  bfd_size_type amt = sizeof (struct artdata);
     182
     183  abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
    186184  if (bfd_ardata (abfd) == NULL)
    187     return false;
     185    return FALSE;
    188186
    189187  bfd_ardata (abfd)->cache = NULL;
     
    193191  bfd_ardata (abfd)->tdata = NULL;
    194192
    195   return true;
     193  return TRUE;
    196194}
    197195
     
    254252
    255253SYNOPSIS
    256         boolean bfd_set_archive_head(bfd *output, bfd *new_head);
     254        bfd_boolean bfd_set_archive_head(bfd *output, bfd *new_head);
    257255
    258256DESCRIPTION
     
    261259*/
    262260
    263 boolean
     261bfd_boolean
    264262bfd_set_archive_head (output_archive, new_head)
    265263     bfd *output_archive;
     
    268266
    269267  output_archive->archive_head = new_head;
    270   return true;
     268  return TRUE;
    271269}
    272270
     
    287285
    288286/* Kind of stupid to call cons for each one, but we don't do too many */
    289 boolean
     287bfd_boolean
    290288_bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt)
    291289     bfd *arch_bfd, *new_elt;
    292290     file_ptr filepos;
    293291{
    294   struct ar_cache *new_cache = ((struct ar_cache *)
    295                                 bfd_zalloc (arch_bfd,
    296                                             sizeof (struct ar_cache)));
    297 
     292  bfd_size_type amt = sizeof (struct ar_cache);
     293
     294  struct ar_cache *new_cache = (struct ar_cache *) bfd_zalloc (arch_bfd, amt);
    298295  if (new_cache == NULL)
    299     return false;
     296    return FALSE;
    300297
    301298  new_cache->ptr = filepos;
     
    313310    }
    314311
    315   return true;
     312  return TRUE;
    316313}
    317314
     
    367364  struct ar_hdr hdr;
    368365  char *hdrp = (char *) &hdr;
    369   unsigned int parsed_size;
     366  size_t parsed_size;
    370367  struct areltdata *ared;
    371368  char *filename = NULL;
    372   unsigned int namelen = 0;
    373   unsigned int allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
     369  bfd_size_type namelen = 0;
     370  bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
    374371  char *allocptr = 0;
    375372
    376   if (bfd_read ((PTR) hdrp, 1, sizeof (struct ar_hdr), abfd)
     373  if (bfd_bread ((PTR) hdrp, (bfd_size_type) sizeof (struct ar_hdr), abfd)
    377374      != sizeof (struct ar_hdr))
    378375    {
     
    417414           && hdr.ar_name[1] == '1'
    418415           && hdr.ar_name[2] == '/'
    419            && isdigit ((unsigned char) hdr.ar_name[3]))
     416           && ISDIGIT (hdr.ar_name[3]))
    420417    {
    421418      /* BSD-4.4 extended name */
     
    430427                  + sizeof (struct areltdata)
    431428                  + sizeof (struct ar_hdr));
    432       if (bfd_read (filename, 1, namelen, abfd) != namelen)
     429      if (bfd_bread (filename, namelen, abfd) != namelen)
    433430        {
    434431          if (bfd_get_error () != bfd_error_system_call)
     
    445442
    446443      char *e;
    447       e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
     444      e = (char *) memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
    448445      if (e == NULL)
    449446        {
    450           e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
     447          e = (char *) memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
    451448          if (e == NULL)
    452             e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
     449            e = (char *) memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
    453450        }
    454451
     
    485482                                   sizeof (struct ar_hdr));
    486483      if (namelen)
    487         memcpy (ared->filename, hdr.ar_name, namelen);
     484        memcpy (ared->filename, hdr.ar_name, (size_t) namelen);
    488485      ared->filename[namelen] = '\0';
    489486    }
     
    611608  struct artdata *tdata_hold;
    612609  char armag[SARMAG + 1];
    613 
    614   tdata_hold = abfd->tdata.aout_ar_data;
    615 
    616   if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG)
     610  bfd_size_type amt;
     611
     612  if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG)
    617613    {
    618614      if (bfd_get_error () != bfd_error_system_call)
     
    630626#endif
    631627
    632   /* We are setting bfd_ardata(abfd) here, but since bfd_ardata
    633      involves a cast, we can't do it as the left operand of assignment.  */
    634   abfd->tdata.aout_ar_data = ((struct artdata *)
    635                               bfd_zalloc (abfd, sizeof (struct artdata)));
    636 
     628  tdata_hold = bfd_ardata (abfd);
     629
     630  amt = sizeof (struct artdata);
     631  bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
    637632  if (bfd_ardata (abfd) == NULL)
    638     return NULL;
     633    {
     634      bfd_ardata (abfd) = tdata_hold;
     635      return NULL;
     636    }
    639637
    640638  bfd_ardata (abfd)->first_file_filepos = SARMAG;
     
    645643  bfd_ardata (abfd)->tdata = NULL;
    646644
    647   if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd)))
    648     {
    649       bfd_release (abfd, bfd_ardata (abfd));
    650       abfd->tdata.aout_ar_data = tdata_hold;
     645  if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))
     646      || !BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
     647    {
    651648      if (bfd_get_error () != bfd_error_system_call)
    652649        bfd_set_error (bfd_error_wrong_format);
    653       return NULL;
    654     }
    655 
    656   if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd)))
    657     {
    658650      bfd_release (abfd, bfd_ardata (abfd));
    659       abfd->tdata.aout_ar_data = tdata_hold;
    660       if (bfd_get_error () != bfd_error_system_call)
    661         bfd_set_error (bfd_error_wrong_format);
     651      bfd_ardata (abfd) = tdata_hold;
    662652      return NULL;
    663653    }
     
    681671      if (first != NULL)
    682672        {
    683           boolean fail;
    684 
    685           first->target_defaulted = false;
    686           fail = false;
     673          bfd_boolean fail;
     674
     675          first->target_defaulted = FALSE;
     676          fail = FALSE;
    687677          if (bfd_check_format (first, bfd_object)
    688678              && first->xvec != abfd->xvec)
    689679            {
     680#if 0
     681              /* We ought to close `first' here, but we can't, because
     682                 we have no way to remove it from the archive cache.
     683                 It's close to impossible to figure out when we can
     684                 release bfd_ardata.  FIXME.  */
    690685              (void) bfd_close (first);
    691686              bfd_release (abfd, bfd_ardata (abfd));
    692               abfd->tdata.aout_ar_data = tdata_hold;
    693               bfd_set_error (bfd_error_wrong_format);
     687#endif
     688              bfd_set_error (bfd_error_wrong_object_format);
     689              bfd_ardata (abfd) = tdata_hold;
    694690              return NULL;
    695691            }
    696 
    697           /* We ought to close first here, but we can't, because we
    698              have no way to remove it from the archive cache.  FIXME.  */
     692          /* And we ought to close `first' here too.  */
    699693        }
    700694    }
     
    706700   support 64 bit archives presently; so far as I know, none actually
    707701   exist.  Supporting them would require changing these constants, and
    708    changing some bfd_h_get_32 to bfd_h_get_64.  */
     702   changing some H_GET_32 to H_GET_64.  */
    709703
    710704/* The size of an external symdef structure.  */
     
    720714#define BSD_STRING_COUNT_SIZE 4
    721715
    722 /* Returns false on error, true otherwise */
    723 
    724 static boolean
     716/* Returns FALSE on error, TRUE otherwise */
     717
     718static bfd_boolean
    725719do_slurp_bsd_armap (abfd)
    726720     bfd *abfd;
     
    731725  struct artdata *ardata = bfd_ardata (abfd);
    732726  char *stringbase;
    733   unsigned int parsed_size;
     727  bfd_size_type parsed_size, amt;
    734728  carsym *set;
    735729
    736730  mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
    737731  if (mapdata == NULL)
    738     return false;
     732    return FALSE;
    739733  parsed_size = mapdata->parsed_size;
    740734  bfd_release (abfd, (PTR) mapdata);    /* Don't need it any more.  */
     
    742736  raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
    743737  if (raw_armap == (bfd_byte *) NULL)
    744     return false;
    745 
    746   if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
     738    return FALSE;
     739
     740  if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size)
    747741    {
    748742      if (bfd_get_error () != bfd_error_system_call)
     
    750744    byebye:
    751745      bfd_release (abfd, (PTR) raw_armap);
    752       return false;
    753     }
    754 
    755   ardata->symdef_count = bfd_h_get_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE;
     746      return FALSE;
     747    }
     748
     749  ardata->symdef_count = H_GET_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE;
    756750
    757751  if (ardata->symdef_count * BSD_SYMDEF_SIZE >
     
    768762                + ardata->symdef_count * BSD_SYMDEF_SIZE
    769763                + BSD_STRING_COUNT_SIZE);
    770   ardata->symdefs = (carsym *) bfd_alloc (abfd,
    771                                           (ardata->symdef_count
    772                                            * sizeof (carsym)));
     764  amt = (bfd_size_type) ardata->symdef_count * sizeof (carsym);
     765  ardata->symdefs = (carsym *) bfd_alloc (abfd, amt);
    773766  if (!ardata->symdefs)
    774     return false;
     767    return FALSE;
    775768
    776769  for (counter = 0, set = ardata->symdefs;
     
    778771       counter++, set++, rbase += BSD_SYMDEF_SIZE)
    779772    {
    780       set->name = bfd_h_get_32 (abfd, rbase) + stringbase;
    781       set->file_offset = bfd_h_get_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
     773      set->name = H_GET_32 (abfd, rbase) + stringbase;
     774      set->file_offset = H_GET_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
    782775    }
    783776
     
    788781     we are done using the strings from it.  For now, it seems
    789782     to be allocated on an objalloc anyway...  */
    790   bfd_has_map (abfd) = true;
    791   return true;
    792 }
    793 
    794 /* Returns false on error, true otherwise.  */
    795 
    796 static boolean
     783  bfd_has_map (abfd) = TRUE;
     784  return TRUE;
     785}
     786
     787/* Returns FALSE on error, TRUE otherwise.  */
     788
     789static bfd_boolean
    797790do_slurp_coff_armap (abfd)
    798791     bfd *abfd;
     
    802795  struct artdata *ardata = bfd_ardata (abfd);
    803796  char *stringbase;
    804   unsigned int stringsize;
     797  bfd_size_type stringsize;
    805798  unsigned int parsed_size;
    806799  carsym *carsyms;
    807   unsigned int nsymz;           /* Number of symbols in armap.  */
     800  bfd_size_type nsymz;          /* Number of symbols in armap.  */
    808801  bfd_vma (*swap) PARAMS ((const bfd_byte *));
    809802  char int_buf[sizeof (long)];
    810   unsigned int carsym_size, ptrsize, i;
     803  bfd_size_type carsym_size, ptrsize;
     804  unsigned int i;
    811805
    812806  mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
    813807  if (mapdata == NULL)
    814     return false;
     808    return FALSE;
    815809  parsed_size = mapdata->parsed_size;
    816810  bfd_release (abfd, (PTR) mapdata);    /* Don't need it any more.  */
    817811
    818   if (bfd_read ((PTR) int_buf, 1, 4, abfd) != 4)
     812  if (bfd_bread ((PTR) int_buf, (bfd_size_type) 4, abfd) != 4)
    819813    {
    820814      if (bfd_get_error () != bfd_error_system_call)
    821815        bfd_set_error (bfd_error_malformed_archive);
    822       return false;
     816      return FALSE;
    823817    }
    824818  /* It seems that all numeric information in a coff archive is always
     
    853847  ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1);
    854848  if (ardata->symdefs == NULL)
    855     return false;
     849    return FALSE;
    856850  carsyms = ardata->symdefs;
    857851  stringbase = ((char *) ardata->symdefs) + carsym_size;
     
    861855  if (raw_armap == NULL)
    862856    goto release_symdefs;
    863   if (bfd_read ((PTR) raw_armap, 1, ptrsize, abfd) != ptrsize
    864       || bfd_read ((PTR) stringbase, 1, stringsize, abfd) != stringsize)
     857  if (bfd_bread ((PTR) raw_armap, ptrsize, abfd) != ptrsize
     858      || (bfd_bread ((PTR) stringbase, stringsize, abfd) != stringsize))
    865859    {
    866860      if (bfd_get_error () != bfd_error_system_call)
     
    885879  ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
    886880
    887   bfd_has_map (abfd) = true;
     881  bfd_has_map (abfd) = TRUE;
    888882  bfd_release (abfd, (PTR) raw_armap);
    889883
     
    892886    struct areltdata *tmp;
    893887
    894     bfd_seek (abfd,   ardata->first_file_filepos, SEEK_SET);
     888    bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
    895889    tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd);
    896890    if (tmp != NULL)
     
    900894          {
    901895            ardata->first_file_filepos +=
    902               (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~1;
     896              (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~(unsigned) 1;
    903897          }
    904898        bfd_release (abfd, tmp);
     
    906900  }
    907901
    908   return true;
     902  return TRUE;
    909903
    910904release_raw_armap:
     
    912906release_symdefs:
    913907  bfd_release (abfd, (PTR) (ardata)->symdefs);
    914   return false;
     908  return FALSE;
    915909}
    916910
    917911/* This routine can handle either coff-style or bsd-style armaps.
    918    Returns false on error, true otherwise */
    919 
    920 boolean
     912   Returns FALSE on error, TRUE otherwise */
     913
     914bfd_boolean
    921915bfd_slurp_armap (abfd)
    922916     bfd *abfd;
    923917{
    924918  char nextname[17];
    925   int i = bfd_read ((PTR) nextname, 1, 16, abfd);
     919  int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
    926920
    927921  if (i == 0)
    928     return true;
     922    return TRUE;
    929923  if (i != 16)
    930     return false;
    931 
    932   if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
    933     return false;
     924    return FALSE;
     925
     926  if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
     927    return FALSE;
    934928
    935929  if (!strncmp (nextname, "__.SYMDEF       ", 16)
     
    940934  else if (!strncmp (nextname, "/SYM64/         ", 16))
    941935    {
    942       /* Irix 6 archive--must be recognized by code in elf64-mips.c.  */
     936      /* 64bit ELF (Irix 6) archive.  */
     937#ifdef BFD64
     938      return bfd_elf64_archive_slurp_armap (abfd);
     939#else
    943940      bfd_set_error (bfd_error_wrong_format);
    944       return false;
    945     }
    946 
    947   bfd_has_map (abfd) = false;
    948   return true;
    949 }
    950 
    951 
    952 /* Returns false on error, true otherwise */
     941      return FALSE;
     942#endif
     943    }
     944
     945  bfd_has_map (abfd) = FALSE;
     946  return TRUE;
     947}
     948
     949
     950/* Returns FALSE on error, TRUE otherwise */
    953951/* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
    954952   header is in a slightly different order and the map name is '/'.
     
    957955#define HPUX_SYMDEF_COUNT_SIZE 2
    958956
    959 boolean
     957bfd_boolean
    960958bfd_slurp_bsd_armap_f2 (abfd)
    961959     bfd *abfd;
     
    968966  char *stringbase;
    969967  unsigned int stringsize;
     968  bfd_size_type amt;
    970969  carsym *set;
    971   int i = bfd_read ((PTR) nextname, 1, 16, abfd);
     970  int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
    972971
    973972  if (i == 0)
    974     return true;
     973    return TRUE;
    975974  if (i != 16)
    976     return false;
     975    return FALSE;
    977976
    978977  /* The archive has at least 16 bytes in it.  */
    979   if (bfd_seek (abfd, -16L, SEEK_CUR) != 0)
    980     return false;
     978  if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
     979    return FALSE;
    981980
    982981  if (!strncmp (nextname, "__.SYMDEF       ", 16)
     
    986985  if (strncmp (nextname, "/               ", 16))
    987986    {
    988       bfd_has_map (abfd) = false;
    989       return true;
     987      bfd_has_map (abfd) = FALSE;
     988      return TRUE;
    990989    }
    991990
    992991  mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
    993992  if (mapdata == NULL)
    994     return false;
    995 
    996   raw_armap = (bfd_byte *) bfd_zalloc (abfd, mapdata->parsed_size);
     993    return FALSE;
     994
     995  amt = mapdata->parsed_size;
     996  raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt);
    997997  if (raw_armap == NULL)
    998998    {
    999999    byebye:
    10001000      bfd_release (abfd, (PTR) mapdata);
    1001       return false;
    1002     }
    1003 
    1004   if (bfd_read ((PTR) raw_armap, 1, mapdata->parsed_size, abfd) !=
    1005       mapdata->parsed_size)
     1001      return FALSE;
     1002    }
     1003
     1004  if (bfd_bread ((PTR) raw_armap, amt, abfd) != amt)
    10061005    {
    10071006      if (bfd_get_error () != bfd_error_system_call)
     
    10121011    }
    10131012
    1014   ardata->symdef_count = bfd_h_get_16 (abfd, (PTR) raw_armap);
     1013  ardata->symdef_count = H_GET_16 (abfd, (PTR) raw_armap);
    10151014
    10161015  if (ardata->symdef_count * BSD_SYMDEF_SIZE
     
    10241023  ardata->cache = 0;
    10251024
    1026   stringsize = bfd_h_get_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE);
     1025  stringsize = H_GET_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE);
    10271026  /* Skip sym count and string sz.  */
    10281027  stringbase = ((char *) raw_armap
     
    10301029                + BSD_STRING_COUNT_SIZE);
    10311030  rbase = (bfd_byte *) stringbase + stringsize;
    1032   ardata->symdefs = (carsym *) bfd_alloc (abfd,
    1033                                           (ardata->symdef_count
    1034                                            * BSD_SYMDEF_SIZE));
     1031  amt = (bfd_size_type) ardata->symdef_count * BSD_SYMDEF_SIZE;
     1032  ardata->symdefs = (carsym *) bfd_alloc (abfd, amt);
    10351033  if (!ardata->symdefs)
    1036     return false;
     1034    return FALSE;
    10371035
    10381036  for (counter = 0, set = ardata->symdefs;
     
    10401038       counter++, set++, rbase += BSD_SYMDEF_SIZE)
    10411039    {
    1042       set->name = bfd_h_get_32 (abfd, rbase) + stringbase;
    1043       set->file_offset = bfd_h_get_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
     1040      set->name = H_GET_32 (abfd, rbase) + stringbase;
     1041      set->file_offset = H_GET_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
    10441042    }
    10451043
     
    10501048     we are done using the strings from it.  For now, it seems
    10511049     to be allocated on an objalloc anyway...  */
    1052   bfd_has_map (abfd) = true;
    1053   return true;
     1050  bfd_has_map (abfd) = TRUE;
     1051  return TRUE;
    10541052}
    10551053
     
    10651063  extended the format by using the prefix // for the special element.  */
    10661064
    1067 /* Returns false on error, true otherwise.  */
    1068 
    1069 boolean
     1065/* Returns FALSE on error, TRUE otherwise.  */
     1066
     1067bfd_boolean
    10701068_bfd_slurp_extended_name_table (abfd)
    10711069     bfd *abfd;
     
    10731071  char nextname[17];
    10741072  struct areltdata *namedata;
     1073  bfd_size_type amt;
    10751074
    10761075  /* FIXME:  Formatting sucks here, and in case of failure of BFD_READ,
    1077      we probably don't want to return true.  */
     1076     we probably don't want to return TRUE.  */
    10781077  bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET);
    1079   if (bfd_read ((PTR) nextname, 1, 16, abfd) == 16)
    1080     {
    1081       if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
    1082         return false;
     1078  if (bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd) == 16)
     1079    {
     1080      if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
     1081        return FALSE;
    10831082
    10841083      if (strncmp (nextname, "ARFILENAMES/    ", 16) != 0 &&
     
    10861085        {
    10871086          bfd_ardata (abfd)->extended_names = NULL;
    1088           return true;
     1087          return TRUE;
    10891088        }
    10901089
    10911090      namedata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
    10921091      if (namedata == NULL)
    1093         return false;
    1094 
    1095       bfd_ardata (abfd)->extended_names =
    1096         bfd_zalloc (abfd, namedata->parsed_size);
     1092        return FALSE;
     1093
     1094      amt = namedata->parsed_size;
     1095      bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt);
    10971096      if (bfd_ardata (abfd)->extended_names == NULL)
    10981097        {
    10991098        byebye:
    11001099          bfd_release (abfd, (PTR) namedata);
    1101           return false;
     1100          return FALSE;
    11021101        }
    11031102
    1104       if (bfd_read ((PTR) bfd_ardata (abfd)->extended_names, 1,
    1105                     namedata->parsed_size, abfd) != namedata->parsed_size)
     1103      if (bfd_bread ((PTR) bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
    11061104        {
    11071105          if (bfd_get_error () != bfd_error_system_call)
     
    11401138#endif
    11411139    }
    1142   return true;
     1140  return TRUE;
    11431141}
    11441142
     
    11531151     const char *file;
    11541152{
    1155   CONST char *first;
    1156   CONST char *last;
     1153  const char *first;
     1154  const char *last;
    11571155  char *copy;
    11581156
     
    11721170    }
    11731171
    1174   copy = (char *) bfd_alloc (abfd, last - first + 1);
     1172  copy = (char *) bfd_alloc (abfd, (bfd_size_type) (last - first + 1));
    11751173  if (copy == NULL)
    11761174    return NULL;
     
    12101208/* Build a BFD style extended name table.  */
    12111209
    1212 boolean
     1210bfd_boolean
    12131211_bfd_archive_bsd_construct_extended_name_table (abfd, tabloc, tablen, name)
    12141212     bfd *abfd;
     
    12181216{
    12191217  *name = "ARFILENAMES/";
    1220   return _bfd_construct_extended_name_table (abfd, false, tabloc, tablen);
     1218  return _bfd_construct_extended_name_table (abfd, FALSE, tabloc, tablen);
    12211219}
    12221220
    12231221/* Build an SVR4 style extended name table.  */
    12241222
    1225 boolean
     1223bfd_boolean
    12261224_bfd_archive_coff_construct_extended_name_table (abfd, tabloc, tablen, name)
    12271225     bfd *abfd;
     
    12311229{
    12321230  *name = "//";
    1233   return _bfd_construct_extended_name_table (abfd, true, tabloc, tablen);
     1231  return _bfd_construct_extended_name_table (abfd, TRUE, tabloc, tablen);
    12341232}
    12351233
     
    12381236   table, and in tablen the length of the table.  If it makes an entry
    12391237   it clobbers the filename so that the element may be written without
    1240    further massage.  Returns true if it ran successfully, false if
     1238   further massage.  Returns TRUE if it ran successfully, FALSE if
    12411239   something went wrong.  A successful return may still involve a
    12421240   zero-length tablen!  */
    12431241
    1244 boolean
     1242bfd_boolean
    12451243_bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
    12461244     bfd *abfd;
    1247      boolean trailing_slash;
     1245     bfd_boolean trailing_slash;
    12481246     char **tabloc;
    12491247     bfd_size_type *tablen;
    12501248{
    12511249  unsigned int maxname = abfd->xvec->ar_max_namelen;
    1252   unsigned int total_namelen = 0;
     1250  bfd_size_type total_namelen = 0;
    12531251  bfd *current;
    12541252  char *strptr;
     
    12641262      normal = normalize (current, current->filename);
    12651263      if (normal == NULL)
    1266         return false;
     1264        return FALSE;
    12671265
    12681266      thislen = strlen (normal);
     
    13001298
    13011299  if (total_namelen == 0)
    1302     return true;
     1300    return TRUE;
    13031301
    13041302  *tabloc = bfd_zalloc (abfd, total_namelen);
    13051303  if (*tabloc == NULL)
    1306     return false;
     1304    return FALSE;
    13071305
    13081306  *tablen = total_namelen;
     
    13171315      normal = normalize (current, current->filename);
    13181316      if (normal == NULL)
    1319         return false;
     1317        return FALSE;
    13201318
    13211319      thislen = strlen (normal);
     
    13521350    }
    13531351
    1354   return true;
     1352  return TRUE;
    13551353}
    13561354
     
    13991397  struct ar_hdr *hdr;
    14001398  char *temp, *temp1;
     1399  bfd_size_type amt;
    14011400
    14021401  if (member && (member->flags & BFD_IN_MEMORY) != 0)
     
    14161415    }
    14171416
    1418   ared = (struct areltdata *) bfd_zalloc (abfd, sizeof (struct ar_hdr) +
    1419                                           sizeof (struct areltdata));
     1417  amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
     1418  ared = (struct areltdata *) bfd_zalloc (abfd, amt);
    14201419  if (ared == NULL)
    14211420    return NULL;
     
    14691468   stronger stomach to try to code around such a thing!  */
    14701469
    1471 struct ar_hdr *bfd_special_undocumented_glue PARAMS ((bfd *, const char *));
     1470struct ar_hdr *bfd_special_undocumented_glue
     1471  PARAMS ((bfd *, const char *));
    14721472
    14731473struct ar_hdr *
     
    15441544bfd_dont_truncate_arname (abfd, pathname, arhdr)
    15451545     bfd *abfd;
    1546      CONST char *pathname;
     1546     const char *pathname;
    15471547     char *arhdr;
    15481548{
     
    15841584bfd_bsd_truncate_arname (abfd, pathname, arhdr)
    15851585     bfd *abfd;
    1586      CONST char *pathname;
     1586     const char *pathname;
    15871587     char *arhdr;
    15881588{
    15891589  struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
    1590   int length;
    1591   CONST char *filename = strrchr (pathname, '/');
    1592   int maxlen = ar_maxnamelen (abfd);
     1590  size_t length;
     1591  const char *filename = strrchr (pathname, '/');
     1592  size_t maxlen = ar_maxnamelen (abfd);
    15931593
    15941594#ifdef HAVE_DOS_BASED_FILE_SYSTEM
     
    16351635bfd_gnu_truncate_arname (abfd, pathname, arhdr)
    16361636     bfd *abfd;
    1637      CONST char *pathname;
     1637     const char *pathname;
    16381638     char *arhdr;
    16391639{
    16401640  struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
    1641   int length;
    1642   CONST char *filename = strrchr (pathname, '/');
    1643   int maxlen = ar_maxnamelen (abfd);
     1641  size_t length;
     1642  const char *filename = strrchr (pathname, '/');
     1643  size_t maxlen = ar_maxnamelen (abfd);
    16441644
    16451645#ifdef HAVE_DOS_BASED_FILE_SYSTEM
     
    16811681/* The BFD is open for write and has its format set to bfd_archive.  */
    16821682
    1683 boolean
     1683bfd_boolean
    16841684_bfd_write_archive_contents (arch)
    16851685     bfd *arch;
     
    16891689  bfd_size_type elength = 0;
    16901690  const char *ename = NULL;
    1691   boolean makemap = bfd_has_map (arch);
    1692   boolean hasobjects = false;   /* If no .o's, don't bother to make a map.  */
     1691  bfd_boolean makemap = bfd_has_map (arch);
     1692  /* If no .o's, don't bother to make a map.  */
     1693  bfd_boolean hasobjects = FALSE;
    16931694  bfd_size_type wrote;
    16941695  unsigned int i;
     
    17081709        {
    17091710          bfd_set_error (bfd_error_invalid_operation);
    1710           return false;
     1711          return FALSE;
    17111712        }
    17121713      if (!current->arelt_data)
     
    17151716            (PTR) bfd_ar_hdr_from_filesystem (arch, current->filename, current);
    17161717          if (!current->arelt_data)
    1717             return false;
     1718            return FALSE;
    17181719
    17191720          /* Put in the file name.  */
     
    17301731#endif
    17311732            )
    1732             hasobjects = true;
     1733            hasobjects = TRUE;
    17331734        }
    17341735    }
     
    17361737  if (!BFD_SEND (arch, _bfd_construct_extended_name_table,
    17371738                 (arch, &etable, &elength, &ename)))
    1738     return false;
     1739    return FALSE;
    17391740
    17401741  if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0)
    1741     return false;
     1742    return FALSE;
    17421743#ifdef GNU960
    1743   wrote = bfd_write (BFD_GNU960_ARMAG (arch), 1, SARMAG, arch);
     1744  wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), (bfd_size_type) SARMAG, arch);
    17441745#else
    1745   wrote = bfd_write (ARMAG, 1, SARMAG, arch);
     1746  wrote = bfd_bwrite (ARMAG, (bfd_size_type) SARMAG, arch);
    17461747#endif
    17471748  if (wrote != SARMAG)
    1748     return false;
     1749    return FALSE;
    17491750
    17501751  if (makemap && hasobjects)
    17511752    {
    1752       if (_bfd_compute_and_write_armap (arch, elength) != true)
    1753         return false;
     1753      if (! _bfd_compute_and_write_armap (arch, (unsigned int) elength))
     1754        return FALSE;
    17541755    }
    17551756
     
    17621763      /* Round size up to even number in archive header.  */
    17631764      sprintf (&(hdr.ar_size[0]), "%-10d",
    1764                (int) ((elength + 1) & ~1));
     1765               (int) ((elength + 1) & ~(bfd_size_type) 1));
    17651766      strncpy (hdr.ar_fmag, ARFMAG, 2);
    17661767      for (i = 0; i < sizeof (struct ar_hdr); i++)
    17671768        if (((char *) (&hdr))[i] == '\0')
    17681769          (((char *) (&hdr))[i]) = ' ';
    1769       if ((bfd_write ((char *) &hdr, 1, sizeof (struct ar_hdr), arch)
     1770      if ((bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
    17701771           != sizeof (struct ar_hdr))
    1771           || bfd_write (etable, 1, elength, arch) != elength)
    1772         return false;
     1772          || bfd_bwrite (etable, elength, arch) != elength)
     1773        return FALSE;
    17731774      if ((elength % 2) == 1)
    17741775        {
    1775           if (bfd_write ("\012", 1, 1, arch) != 1)
    1776             return false;
     1776          if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1)
     1777            return FALSE;
    17771778        }
    17781779    }
     
    17851786
    17861787      /* Write ar header.  */
    1787       if (bfd_write ((char *) hdr, 1, sizeof (*hdr), arch) != sizeof (*hdr))
    1788         return false;
     1788      if (bfd_bwrite ((PTR) hdr, (bfd_size_type) sizeof (*hdr), arch)
     1789          != sizeof (*hdr))
     1790        return FALSE;
    17891791      if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
    1790         return false;
     1792        return FALSE;
    17911793      while (remaining)
    17921794        {
     
    17951797            amt = remaining;
    17961798          errno = 0;
    1797           if (bfd_read (buffer, amt, 1, current) != amt)
     1799          if (bfd_bread (buffer, (bfd_size_type) amt, current) != amt)
    17981800            {
    17991801              if (bfd_get_error () != bfd_error_system_call)
    18001802                bfd_set_error (bfd_error_malformed_archive);
    1801               return false;
     1803              return FALSE;
    18021804            }
    1803           if (bfd_write (buffer, amt, 1, arch) != amt)
    1804             return false;
     1805          if (bfd_bwrite (buffer, (bfd_size_type) amt, arch) != amt)
     1806            return FALSE;
    18051807          remaining -= amt;
    18061808        }
    18071809      if ((arelt_size (current) % 2) == 1)
    18081810        {
    1809           if (bfd_write ("\012", 1, 1, arch) != 1)
    1810             return false;
     1811          if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1)
     1812            return FALSE;
    18111813        }
    18121814    }
     
    18311833    }
    18321834
    1833   return true;
     1835  return TRUE;
    18341836}
    18351837
     
    18371839/* Note that the namidx for the first symbol is 0.  */
    18381840
    1839 boolean
     1841bfd_boolean
    18401842_bfd_compute_and_write_armap (arch, elength)
    18411843     bfd *arch;
     
    18461848  file_ptr elt_no = 0;
    18471849  struct orl *map = NULL;
    1848   int orl_max = 1024;           /* fine initial default */
    1849   int orl_count = 0;
     1850  unsigned int orl_max = 1024;          /* fine initial default */
     1851  unsigned int orl_count = 0;
    18501852  int stridx = 0;               /* string index */
    18511853  asymbol **syms = NULL;
    18521854  long syms_max = 0;
    1853   boolean ret;
     1855  bfd_boolean ret;
     1856  bfd_size_type amt;
    18541857
    18551858  /* Dunno if this is the best place for this info...  */
     
    18581861  elength += elength % 2;
    18591862
    1860   map = (struct orl *) bfd_malloc (orl_max * sizeof (struct orl));
     1863  amt = (bfd_size_type) orl_max * sizeof (struct orl);
     1864  map = (struct orl *) bfd_malloc (amt);
    18611865  if (map == NULL)
    18621866    goto error_return;
     
    18641868  /* We put the symbol names on the arch objalloc, and then discard
    18651869     them when done.  */
    1866   first_name = bfd_alloc (arch, 1);
     1870  first_name = bfd_alloc (arch, (bfd_size_type) 1);
    18671871  if (first_name == NULL)
    18681872    goto error_return;
     
    18781882       current = current->next, elt_no++)
    18791883    {
    1880       if ((bfd_check_format (current, bfd_object) == true)
    1881           && ((bfd_get_file_flags (current) & HAS_SYMS)))
     1884      if (bfd_check_format (current, bfd_object)
     1885          && (bfd_get_file_flags (current) & HAS_SYMS) != 0)
    18821886        {
    18831887          long storage;
     
    18961900                    free (syms);
    18971901                  syms_max = storage;
    1898                   syms = (asymbol **) bfd_malloc ((size_t) syms_max);
     1902                  syms = (asymbol **) bfd_malloc ((bfd_size_type) syms_max);
    18991903                  if (syms == NULL)
    19001904                    goto error_return;
     
    19171921                      && ! bfd_is_und_section (sec))
    19181922                    {
    1919                       size_t namelen;
     1923                      bfd_size_type namelen;
    19201924                      struct orl *new_map;
    19211925
     
    19241928                        {
    19251929                          orl_max *= 2;
    1926                           new_map =
    1927                             ((struct orl *)
    1928                              bfd_realloc (map, orl_max * sizeof (struct orl)));
     1930                          amt = (bfd_size_type) orl_max * sizeof (struct orl);
     1931                          new_map = (struct orl *) bfd_realloc (map, amt);
    19291932                          if (new_map == (struct orl *) NULL)
    19301933                            goto error_return;
     
    19341937
    19351938                      namelen = strlen (syms[src_count]->name);
    1936                       map[orl_count].name = ((char **)
    1937                                              bfd_alloc (arch,
    1938                                                         sizeof (char *)));
     1939                      amt = sizeof (char *);
     1940                      map[orl_count].name = (char **) bfd_alloc (arch, amt);
    19391941                      if (map[orl_count].name == NULL)
    19401942                        goto error_return;
     
    19431945                        goto error_return;
    19441946                      strcpy (*(map[orl_count].name), syms[src_count]->name);
    1945                       (map[orl_count]).pos = (file_ptr) current;
    1946                       (map[orl_count]).namidx = stridx;
     1947                      map[orl_count].u.abfd = current;
     1948                      map[orl_count].namidx = stridx;
    19471949
    19481950                      stridx += namelen + 1;
     
    19801982    bfd_release (arch, first_name);
    19811983
    1982   return false;
    1983 }
    1984 
    1985 boolean
     1984  return FALSE;
     1985}
     1986
     1987bfd_boolean
    19861988bsd_write_armap (arch, elength, map, orl_count, stridx)
    19871989     bfd *arch;
     
    20222024    if (((char *) (&hdr))[i] == '\0')
    20232025      (((char *) (&hdr))[i]) = ' ';
    2024   if (bfd_write ((char *) &hdr, 1, sizeof (struct ar_hdr), arch)
     2026  if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
    20252027      != sizeof (struct ar_hdr))
    2026     return false;
    2027   bfd_h_put_32 (arch, (bfd_vma) ranlibsize, temp);
    2028   if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp))
    2029     return false;
     2028    return FALSE;
     2029  H_PUT_32 (arch, ranlibsize, temp);
     2030  if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp))
     2031    return FALSE;
    20302032
    20312033  for (count = 0; count < orl_count; count++)
     
    20332035      bfd_byte buf[BSD_SYMDEF_SIZE];
    20342036
    2035       if (((bfd *) (map[count]).pos) != last_elt)
     2037      if (map[count].u.abfd != last_elt)
    20362038        {
    20372039          do
     
    20412043              current = current->next;
    20422044            }
    2043           while (current != (bfd *) (map[count]).pos);
     2045          while (current != map[count].u.abfd);
    20442046        }                       /* if new archive element */
    20452047
    20462048      last_elt = current;
    2047       bfd_h_put_32 (arch, map[count].namidx, buf);
    2048       bfd_h_put_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
    2049       if (bfd_write (buf, BSD_SYMDEF_SIZE, 1, arch) != BSD_SYMDEF_SIZE)
    2050         return false;
     2049      H_PUT_32 (arch, map[count].namidx, buf);
     2050      H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
     2051      if (bfd_bwrite (buf, (bfd_size_type) BSD_SYMDEF_SIZE, arch)
     2052          != BSD_SYMDEF_SIZE)
     2053        return FALSE;
    20512054    }
    20522055
    20532056  /* Now write the strings themselves.  */
    2054   bfd_h_put_32 (arch, stringsize, temp);
    2055   if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp))
    2056     return false;
     2057  H_PUT_32 (arch, stringsize, temp);
     2058  if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp))
     2059    return FALSE;
    20572060  for (count = 0; count < orl_count; count++)
    20582061    {
    20592062      size_t len = strlen (*map[count].name) + 1;
    20602063
    2061       if (bfd_write (*map[count].name, 1, len, arch) != len)
    2062         return false;
     2064      if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
     2065        return FALSE;
    20632066    }
    20642067
     
    20672070  if (padit)
    20682071    {
    2069       if (bfd_write ("", 1, 1, arch) != 1)
    2070         return false;
    2071     }
    2072 
    2073   return true;
     2072      if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
     2073        return FALSE;
     2074    }
     2075
     2076  return TRUE;
    20742077}
    20752078
     
    20772080   file, so the linker will accept it.
    20782081
    2079    Return true if the timestamp was OK, or an unusual problem happened.
    2080    Return false if we updated the timestamp.  */
    2081 
    2082 boolean
     2082   Return TRUE if the timestamp was OK, or an unusual problem happened.
     2083   Return FALSE if we updated the timestamp.  */
     2084
     2085bfd_boolean
    20832086_bfd_archive_bsd_update_armap_timestamp (arch)
    20842087     bfd *arch;
     
    20932096  if (bfd_stat (arch, &archstat) == -1)
    20942097    {
    2095       perror (_("Reading archive file mod timestamp"));
     2098      bfd_perror (_("Reading archive file mod timestamp"));
    20962099
    20972100      /* Can't read mod time for some reason.  */
    2098       return true;
     2101      return TRUE;
    20992102    }
    21002103  if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp)
    21012104    /* OK by the linker's rules.  */
    2102     return true;
     2105    return TRUE;
    21032106
    21042107  /* Update the timestamp.  */
     
    21162119                                      + offsetof (struct ar_hdr, ar_date[0]));
    21172120  if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0
    2118       || (bfd_write (hdr.ar_date, sizeof (hdr.ar_date), 1, arch)
     2121      || (bfd_bwrite (hdr.ar_date, (bfd_size_type) sizeof (hdr.ar_date), arch)
    21192122          != sizeof (hdr.ar_date)))
    21202123    {
    2121       /* FIXME: bfd can't call perror.  */
    2122       perror (_("Writing updated armap timestamp"));
     2124      bfd_perror (_("Writing updated armap timestamp"));
    21232125
    21242126      /* Some error while writing.  */
    2125       return true;
     2127      return TRUE;
    21262128    }
    21272129
    21282130  /* We updated the timestamp successfully.  */
    2129   return false;
     2131  return FALSE;
    21302132}
    21312133
     
    21452147*/
    21462148
    2147 boolean
     2149bfd_boolean
    21482150coff_write_armap (arch, elength, map, symbol_count, stridx)
    21492151     bfd *arch;
     
    21542156{
    21552157  /* The size of the ranlib is the number of exported symbols in the
    2156      archive * the number of bytes in a int, + an int for the count.  */
     2158     archive * the number of bytes in an int, + an int for the count.  */
    21572159  unsigned int ranlibsize = (symbol_count * 4) + 4;
    21582160  unsigned int stringsize = stridx;
    21592161  unsigned int mapsize = stringsize + ranlibsize;
    2160   file_ptr archive_member_file_ptr;
     2162  unsigned int archive_member_file_ptr;
    21612163  bfd *current = arch->archive_head;
    21622164  unsigned int count;
     
    21902192  /* Write the ar header for this item and the number of symbols.  */
    21912193
    2192   if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch)
     2194  if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
    21932195      != sizeof (struct ar_hdr))
    2194     return false;
    2195 
    2196   bfd_write_bigendian_4byte_int (arch, symbol_count);
     2196    return FALSE;
     2197
     2198  if (!bfd_write_bigendian_4byte_int (arch, symbol_count))
     2199    return FALSE;
    21972200
    21982201  /* Two passes, first write the file offsets for each symbol -
     
    22092212         out the object file's address in the archive.  */
    22102213
    2211       while (count < symbol_count && ((bfd *) (map[count]).pos) == current)
     2214      while (count < symbol_count && map[count].u.abfd == current)
    22122215        {
    2213           bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr);
     2216          if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr))
     2217            return FALSE;
    22142218          count++;
    22152219        }
     
    22272231      size_t len = strlen (*map[count].name) + 1;
    22282232
    2229       if (bfd_write (*map[count].name, 1, len, arch) != len)
    2230         return false;
     2233      if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
     2234        return FALSE;
    22312235    }
    22322236
     
    22352239  if (padit)
    22362240    {
    2237       if (bfd_write ("", 1, 1, arch) != 1)
    2238         return false;
    2239     }
    2240 
    2241   return true;
    2242 }
     2241      if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
     2242        return FALSE;
     2243    }
     2244
     2245  return TRUE;
     2246}
Note: See TracChangeset for help on using the changeset viewer.