diff options
Diffstat (limited to 'bfd/format.c')
-rw-r--r-- | bfd/format.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/bfd/format.c b/bfd/format.c index 8cc7b7a..9af6efc 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -1,23 +1,23 @@ /* Generic BFD support for file formats. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* SECTION @@ -52,7 +52,7 @@ FUNCTION bfd_check_format SYNOPSIS - bfd_boolean bfd_check_format(bfd *abfd, bfd_format format); + bfd_boolean bfd_check_format (bfd *abfd, bfd_format format); DESCRIPTION Verify if the file attached to the BFD @var{abfd} is compatible @@ -98,7 +98,8 @@ FUNCTION bfd_check_format_matches SYNOPSIS - bfd_boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching); + bfd_boolean bfd_check_format_matches (bfd *abfd, bfd_format format, + char ***matching); DESCRIPTION Like <<bfd_check_format>>, except when it returns FALSE with @@ -210,7 +211,7 @@ bfd_check_format_matches (abfd, format, matching) if (*target == &binary_vec) continue; - abfd->xvec = *target; /* Change BFD's target temporarily */ + abfd->xvec = *target; /* Change BFD's target temporarily. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return FALSE; @@ -224,7 +225,8 @@ bfd_check_format_matches (abfd, format, matching) temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); if (temp) - { /* This format checks out as ok! */ + { + /* This format checks out as ok! */ right_targ = temp; /* If this is the default target, accept it, even if other @@ -279,6 +281,7 @@ bfd_check_format_matches (abfd, format, matching) { /* Try partial matches. */ right_targ = ar_right_targ; + if (right_targ == bfd_default_vector[0]) { match_count = 1; @@ -286,12 +289,11 @@ bfd_check_format_matches (abfd, format, matching) else { match_count = ar_match_index - _bfd_target_vector_entries; + if (matching && match_count > 1) - { - memcpy (matching_vector, - matching_vector + _bfd_target_vector_entries, - sizeof (*matching_vector) * match_count); - } + memcpy (matching_vector, + matching_vector + _bfd_target_vector_entries, + sizeof (*matching_vector) * match_count); } } @@ -361,7 +363,7 @@ FUNCTION bfd_set_format SYNOPSIS - bfd_boolean bfd_set_format(bfd *abfd, bfd_format format); + bfd_boolean bfd_set_format (bfd *abfd, bfd_format format); DESCRIPTION This function sets the file format of the BFD @var{abfd} to the @@ -402,7 +404,7 @@ FUNCTION bfd_format_string SYNOPSIS - const char *bfd_format_string(bfd_format format); + const char *bfd_format_string (bfd_format format); DESCRIPTION Return a pointer to a const string |