diff options
author | Alan Modra <amodra@gmail.com> | 2023-08-07 14:40:35 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-08-09 08:48:09 +0930 |
commit | 226f9f4fadb087875ef98a0a55d614236c6241b3 (patch) | |
tree | e6c63b104143dd86acf739d5633649582668224e | |
parent | feddea4b466ce4f2bb2301fd2d4bef56e8d09ccc (diff) | |
download | gdb-226f9f4fadb087875ef98a0a55d614236c6241b3.zip gdb-226f9f4fadb087875ef98a0a55d614236c6241b3.tar.gz gdb-226f9f4fadb087875ef98a0a55d614236c6241b3.tar.bz2 |
Rename bfd_bread and bfd_bwrite
These were renamed from bfd_read and bfd_write back in 2001 when they
lost an unnecessary parameter. Rename them back, and get rid of a few
casts that are only needed without prototyped functions (K&R C).
93 files changed, 928 insertions, 965 deletions
diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c index fae8bb6..a441b3b 100644 --- a/bfd/aix5ppc-core.c +++ b/bfd/aix5ppc-core.c @@ -67,7 +67,7 @@ xcoff64_core_p (bfd *abfd) goto xcoff64_core_p_error; if (sizeof (struct core_dumpxx) - != bfd_bread (&core, sizeof (struct core_dumpxx), abfd)) + != bfd_read (&core, sizeof (struct core_dumpxx), abfd)) goto xcoff64_core_p_error; if (bfd_stat (abfd, &statbuf) < 0) @@ -199,7 +199,7 @@ xcoff64_core_p (bfd *abfd) return NULL; if (sizeof (struct __ld_info64) != - bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd)) + bfd_read (&ldinfo, sizeof (struct __ld_info64), abfd)) return NULL; if (ldinfo.ldinfo_core) @@ -227,7 +227,7 @@ xcoff64_core_p (bfd *abfd) for (i = 0; i < core.c_vmregions; i++) if (sizeof (struct vm_infox) != - bfd_bread (&vminfo, sizeof (struct vm_infox), abfd)) + bfd_read (&vminfo, sizeof (struct vm_infox), abfd)) return NULL; if (vminfo.vminfo_offset) @@ -273,7 +273,7 @@ xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) return return_value; if (sizeof (struct core_dumpxx) != - bfd_bread (&core, sizeof (struct core_dumpxx), core_bfd)) + bfd_read (&core, sizeof (struct core_dumpxx), core_bfd)) return return_value; if (bfd_seek (core_bfd, core.c_loader, SEEK_SET) != 0) @@ -288,7 +288,7 @@ xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) while (1) { - if (bfd_bread (s, 1, core_bfd) != 1) + if (bfd_read (s, 1, core_bfd) != 1) goto xcoff64_core_file_matches_executable_p_end_1; if (*s == '\0') diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 7765f5c..f427ffc 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -136,7 +136,7 @@ MY (object_p) (bfd *abfd) bfd_cleanup cleanup; size_t amt = EXEC_BYTES_SIZE; - if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt) + if (bfd_read (&exec_bytes, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 1a8fd85..0c0e397 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -1272,7 +1272,7 @@ NAME (aout, set_section_contents) (bfd *abfd, if (count != 0) { if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_bwrite (location, count, abfd) != count) + || bfd_write (location, count, abfd) != count) return false; } @@ -1324,7 +1324,7 @@ aout_get_external_symbols (bfd *abfd) /* Get the size of the strings. */ if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 - || bfd_bread ((void *) string_chars, amt, abfd) != amt) + || bfd_read (string_chars, amt, abfd) != amt) return false; stringsize = GET_WORD (abfd, string_chars); if (stringsize == 0) @@ -1354,7 +1354,7 @@ aout_get_external_symbols (bfd *abfd) if (stringsize >= BYTES_IN_WORD) { amt = stringsize - BYTES_IN_WORD; - if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt) + if (bfd_read (strings + BYTES_IN_WORD, amt, abfd) != amt) { free (strings); return false; @@ -1850,7 +1850,7 @@ emit_stringtab (bfd *abfd, struct bfd_strtab_hash *tab) /* The string table starts with the size. */ PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer); - if (bfd_bwrite ((void *) buffer, amt, abfd) != amt) + if (bfd_write (buffer, amt, abfd) != amt) return false; return _bfd_stringtab_emit (abfd, tab); @@ -1896,7 +1896,7 @@ NAME (aout, write_syms) (bfd *abfd) goto error_return; amt = EXTERNAL_NLIST_SIZE; - if (bfd_bwrite ((void *) &nsp, amt, abfd) != amt) + if (bfd_write (&nsp, amt, abfd) != amt) goto error_return; /* NB: `KEEPIT' currently overlays `udata.p', so set this only @@ -2431,7 +2431,7 @@ NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section) } } - if (bfd_bwrite ((void *) native, natsize, abfd) != natsize) + if (bfd_write (native, natsize, abfd) != natsize) { bfd_release (abfd, native); return false; @@ -3729,7 +3729,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data) amt = EXTERNAL_NLIST_SIZE; if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0 - || bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt) + || bfd_write (&outsym, amt, output_bfd) != amt) /* FIXME: No way to handle errors. */ abort (); @@ -3942,7 +3942,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo, amt = obj_reloc_entry_size (flaginfo->output_bfd); if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 - || bfd_bwrite (rel_ptr, amt, flaginfo->output_bfd) != amt) + || bfd_write (rel_ptr, amt, flaginfo->output_bfd) != amt) return false; *reloff_ptr += obj_reloc_entry_size (flaginfo->output_bfd); @@ -4766,7 +4766,7 @@ aout_link_input_section (struct aout_final_link_info *flaginfo, if (rel_size > 0) { if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || bfd_bread (relocs, rel_size, input_bfd) != rel_size) + || bfd_read (relocs, rel_size, input_bfd) != rel_size) return false; } } @@ -4801,7 +4801,7 @@ aout_link_input_section (struct aout_final_link_info *flaginfo, { if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) return false; - if (bfd_bwrite (relocs, rel_size, flaginfo->output_bfd) != rel_size) + if (bfd_write (relocs, rel_size, flaginfo->output_bfd) != rel_size) return false; *reloff_ptr += rel_size; @@ -5293,7 +5293,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd) return false; outsym_size = outsym - flaginfo->output_syms; outsym_size *= EXTERNAL_NLIST_SIZE; - if (bfd_bwrite ((void *) flaginfo->output_syms, outsym_size, output_bfd) + if (bfd_write (flaginfo->output_syms, outsym_size, output_bfd) != outsym_size) return false; flaginfo->symoff += outsym_size; @@ -5663,7 +5663,7 @@ NAME (aout, final_link) (bfd *abfd, bfd_byte b[BYTES_IN_WORD]; memset (b, 0, BYTES_IN_WORD); - if (bfd_bwrite (b, (bfd_size_type) BYTES_IN_WORD, abfd) != BYTES_IN_WORD) + if (bfd_write (b, BYTES_IN_WORD, abfd) != BYTES_IN_WORD) goto error_return; } diff --git a/bfd/archive.c b/bfd/archive.c index f6cae7a..47b37bb 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -517,7 +517,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag) char fmag_save; int scan; - if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr)) + if (bfd_read (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_no_more_archived_files); @@ -577,7 +577,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag) filename = (allocptr + sizeof (struct areltdata) + sizeof (struct ar_hdr)); - if (bfd_bread (filename, namelen, abfd) != namelen) + if (bfd_read (filename, namelen, abfd) != namelen) { free (allocptr); if (bfd_get_error () != bfd_error_system_call) @@ -898,7 +898,7 @@ bfd_generic_archive_p (bfd *abfd) char armag[SARMAG + 1]; size_t amt; - if (bfd_bread (armag, SARMAG, abfd) != SARMAG) + if (bfd_read (armag, SARMAG, abfd) != SARMAG) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1098,7 +1098,7 @@ do_slurp_coff_armap (bfd *abfd) parsed_size = mapdata->parsed_size; free (mapdata); - if (bfd_bread (int_buf, 4, abfd) != 4) + if (bfd_read (int_buf, 4, abfd) != 4) return false; /* It seems that all numeric information in a coff archive is always @@ -1145,7 +1145,7 @@ do_slurp_coff_armap (bfd *abfd) carsyms = ardata->symdefs; stringbase = ((char *) ardata->symdefs) + carsym_size; - if (bfd_bread (stringbase, stringsize, abfd) != stringsize) + if (bfd_read (stringbase, stringsize, abfd) != stringsize) goto release_symdefs; /* OK, build the carsyms. */ @@ -1199,14 +1199,14 @@ bool bfd_slurp_armap (bfd *abfd) { char nextname[17]; - int i = bfd_bread (nextname, 16, abfd); + int i = bfd_read (nextname, 16, abfd); if (i == 0) return true; if (i != 16) return false; - if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) + if (bfd_seek (abfd, -16, SEEK_CUR) != 0) return false; if (startswith (nextname, "__.SYMDEF ") @@ -1232,10 +1232,10 @@ bfd_slurp_armap (bfd *abfd) struct ar_hdr hdr; char extname[21]; - if (bfd_bread (&hdr, sizeof (hdr), abfd) != sizeof (hdr)) + if (bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr)) return false; /* Read the extended name. We know its length. */ - if (bfd_bread (extname, 20, abfd) != 20) + if (bfd_read (extname, 20, abfd) != 20) return false; if (bfd_seek (abfd, -(file_ptr) (sizeof (hdr) + 20), SEEK_CUR) != 0) return false; @@ -1271,13 +1271,13 @@ _bfd_slurp_extended_name_table (bfd *abfd) if (bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET) != 0) return false; - if (bfd_bread (nextname, 16, abfd) == 16) + if (bfd_read (nextname, 16, abfd) == 16) { struct areltdata *namedata; bfd_size_type amt; ufile_ptr filesize; - if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) + if (bfd_seek (abfd, -16, SEEK_CUR) != 0) return false; if (! startswith (nextname, "ARFILENAMES/ ") @@ -1311,7 +1311,7 @@ _bfd_slurp_extended_name_table (bfd *abfd) return false; } - if (bfd_bread (bfd_ardata (abfd)->extended_names, amt, abfd) != amt) + if (bfd_read (bfd_ardata (abfd)->extended_names, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -1804,7 +1804,7 @@ _bfd_generic_write_ar_hdr (bfd *archive, bfd *abfd) { struct ar_hdr *hdr = arch_hdr (abfd); - if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr)) + if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr)) return false; return true; } @@ -1829,10 +1829,10 @@ _bfd_bsd44_write_ar_hdr (bfd *archive, bfd *abfd) arch_eltdata (abfd)->parsed_size + padded_len)) return false; - if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr)) + if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr)) return false; - if (bfd_bwrite (fullname, len, archive) != len) + if (bfd_write (fullname, len, archive) != len) return false; if (len & 3) @@ -1840,13 +1840,13 @@ _bfd_bsd44_write_ar_hdr (bfd *archive, bfd *abfd) static const char pad[3] = { 0, 0, 0 }; len = 4 - (len & 3); - if (bfd_bwrite (pad, len, archive) != len) + if (bfd_write (pad, len, archive) != len) return false; } } else { - if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr)) + if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr)) return false; } return true; @@ -2186,12 +2186,12 @@ _bfd_write_archive_contents (bfd *arch) (arch, &etable, &elength, &ename))) return false; - if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (arch, 0, SEEK_SET) != 0) return false; armag = ARMAG; if (bfd_is_thin_archive (arch)) armag = ARMAGT; - wrote = bfd_bwrite (armag, SARMAG, arch); + wrote = bfd_write (armag, SARMAG, arch); if (wrote != SARMAG) return false; @@ -2212,13 +2212,13 @@ _bfd_write_archive_contents (bfd *arch) (elength + 1) & ~(bfd_size_type) 1)) return false; memcpy (hdr.ar_fmag, ARFMAG, 2); - if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch) + if ((bfd_write (&hdr, sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) - || bfd_bwrite (etable, elength, arch) != elength) + || bfd_write (etable, elength, arch) != elength) return false; if ((elength % 2) == 1) { - if (bfd_bwrite (&ARFMAG[1], 1, arch) != 1) + if (bfd_write (&ARFMAG[1], 1, arch) != 1) return false; } } @@ -2242,7 +2242,7 @@ _bfd_write_archive_contents (bfd *arch) goto input_err; if (bfd_is_thin_archive (arch)) continue; - if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (current, 0, SEEK_SET) != 0) goto input_err; while (remaining) @@ -2252,16 +2252,16 @@ _bfd_write_archive_contents (bfd *arch) if (amt > remaining) amt = remaining; errno = 0; - if (bfd_bread (buffer, amt, current) != amt) + if (bfd_read (buffer, amt, current) != amt) goto input_err; - if (bfd_bwrite (buffer, amt, arch) != amt) + if (bfd_write (buffer, amt, arch) != amt) goto input_err; remaining -= amt; } if ((arelt_size (current) % 2) == 1) { - if (bfd_bwrite (&ARFMAG[1], 1, arch) != 1) + if (bfd_write (&ARFMAG[1], 1, arch) != 1) goto input_err; } } @@ -2546,11 +2546,11 @@ _bfd_bsd_write_armap (bfd *arch, if (!_bfd_ar_sizepad (hdr.ar_size, sizeof (hdr.ar_size), mapsize)) return false; memcpy (hdr.ar_fmag, ARFMAG, 2); - if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch) + if (bfd_write (&hdr, sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) return false; H_PUT_32 (arch, ranlibsize, temp); - if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp)) + if (bfd_write (temp, sizeof (temp), arch) != sizeof (temp)) return false; firstreal = first; @@ -2588,20 +2588,20 @@ _bfd_bsd_write_armap (bfd *arch, last_elt = current; H_PUT_32 (arch, map[count].namidx, buf); H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE); - if (bfd_bwrite (buf, BSD_SYMDEF_SIZE, arch) + if (bfd_write (buf, BSD_SYMDEF_SIZE, arch) != BSD_SYMDEF_SIZE) return false; } /* Now write the strings themselves. */ H_PUT_32 (arch, stringsize, temp); - if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp)) + if (bfd_write (temp, sizeof (temp), arch) != sizeof (temp)) return false; for (count = 0; count < orl_count; count++) { size_t len = strlen (*map[count].name) + 1; - if (bfd_bwrite (*map[count].name, len, arch) != len) + if (bfd_write (*map[count].name, len, arch) != len) return false; } @@ -2609,7 +2609,7 @@ _bfd_bsd_write_armap (bfd *arch, bug-compatible for sun's ar we use a null. */ if (padit) { - if (bfd_bwrite ("", 1, arch) != 1) + if (bfd_write ("", 1, arch) != 1) return false; } @@ -2658,7 +2658,7 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch) bfd_ardata (arch)->armap_datepos = (SARMAG + offsetof (struct ar_hdr, ar_date[0])); if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0 - || (bfd_bwrite (hdr.ar_date, sizeof (hdr.ar_date), arch) + || (bfd_write (hdr.ar_date, sizeof (hdr.ar_date), arch) != sizeof (hdr.ar_date))) { bfd_perror (_("Writing updated armap timestamp")); @@ -2758,7 +2758,7 @@ _bfd_coff_write_armap (bfd *arch, memcpy (hdr.ar_fmag, ARFMAG, 2); /* Write the ar header for this item and the number of symbols. */ - if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch) + if (bfd_write (&hdr, sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) return false; @@ -2809,7 +2809,7 @@ _bfd_coff_write_armap (bfd *arch, { size_t len = strlen (*map[count].name) + 1; - if (bfd_bwrite (*map[count].name, len, arch) != len) + if (bfd_write (*map[count].name, len, arch) != len) return false; } @@ -2817,7 +2817,7 @@ _bfd_coff_write_armap (bfd *arch, bug-compatible for arc960 we use a null. */ if (padit) { - if (bfd_bwrite ("", 1, arch) != 1) + if (bfd_write ("", 1, arch) != 1) return false; } diff --git a/bfd/archive64.c b/bfd/archive64.c index 7eb8331..63d2393 100644 --- a/bfd/archive64.c +++ b/bfd/archive64.c @@ -52,13 +52,13 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd) ardata->symdefs = NULL; /* Get the name of the first element. */ - i = bfd_bread (nextname, 16, abfd); + i = bfd_read (nextname, 16, abfd); if (i == 0) return true; if (i != 16) return false; - if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0) + if (bfd_seek (abfd, -16, SEEK_CUR) != 0) return false; /* Archives with traditional armaps are still permitted. */ @@ -84,7 +84,7 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd) return false; } - if (bfd_bread (int_buf, 8, abfd) != 8) + if (bfd_read (int_buf, 8, abfd) != 8) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -118,7 +118,7 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd) raw_armap = (bfd_byte *) _bfd_alloc_and_read (abfd, ptrsize, ptrsize); if (raw_armap == NULL - || bfd_bread (stringbase, stringsize, abfd) != stringsize) + || bfd_read (stringbase, stringsize, abfd) != stringsize) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -196,12 +196,12 @@ _bfd_archive_64_bit_write_armap (bfd *arch, /* Write the ar header for this item and the number of symbols */ - if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch) + if (bfd_write (&hdr, sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) return false; bfd_putb64 ((bfd_vma) symbol_count, buf); - if (bfd_bwrite (buf, 8, arch) != 8) + if (bfd_write (buf, 8, arch) != 8) return false; /* Two passes, first write the file offsets for each symbol - @@ -222,7 +222,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch, count++) { bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf); - if (bfd_bwrite (buf, 8, arch) != 8) + if (bfd_write (buf, 8, arch) != 8) return false; } @@ -239,7 +239,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch, { size_t len = strlen (*map[count].name) + 1; - if (bfd_bwrite (*map[count].name, len, arch) != len) + if (bfd_write (*map[count].name, len, arch) != len) return false; } @@ -247,7 +247,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch, However, the Irix 6.2 tools do not appear to do this. */ while (padding != 0) { - if (bfd_bwrite ("", 1, arch) != 1) + if (bfd_write ("", 1, arch) != 1) return false; --padding; } diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index cc62ab1..c405592 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -2722,9 +2722,9 @@ bfd_vma bfd_emul_get_commonpagesize (const char *); char *bfd_demangle (bfd *, const char *, int); /* Extracted from bfdio.c. */ -bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); +bfd_size_type bfd_read (void *, bfd_size_type, bfd *); -bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); +bfd_size_type bfd_write (const void *, bfd_size_type, bfd *); file_ptr bfd_tell (bfd *); diff --git a/bfd/bfdio.c b/bfd/bfdio.c index e0d47b3..59ac126 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -231,10 +231,10 @@ DESCRIPTION /* FUNCTION - bfd_bread + bfd_read SYNOPSIS - bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); + bfd_size_type bfd_read (void *, bfd_size_type, bfd *); DESCRIPTION Attempt to read SIZE bytes from ABFD's iostream to PTR. @@ -242,7 +242,7 @@ DESCRIPTION */ bfd_size_type -bfd_bread (void *ptr, bfd_size_type size, bfd *abfd) +bfd_read (void *ptr, bfd_size_type size, bfd *abfd) { file_ptr nread; bfd *element_bfd = abfd; @@ -296,10 +296,10 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd) /* FUNCTION - bfd_bwrite + bfd_write SYNOPSIS - bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); + bfd_size_type bfd_write (const void *, bfd_size_type, bfd *); DESCRIPTION Attempt to write SIZE bytes to ABFD's iostream from PTR. @@ -307,7 +307,7 @@ DESCRIPTION */ bfd_size_type -bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd) +bfd_write (const void *ptr, bfd_size_type size, bfd *abfd) { file_ptr nwrote; diff --git a/bfd/bfdwin.c b/bfd/bfdwin.c index 5ecf2f9..6b4ea5c 100644 --- a/bfd/bfdwin.c +++ b/bfd/bfdwin.c @@ -292,7 +292,7 @@ bfd_get_file_window (bfd *abfd, i->refcount = 1; if (bfd_seek (abfd, offset, SEEK_SET) != 0) goto free_and_fail; - i->size = bfd_bread (i->data, size, abfd); + i->size = bfd_read (i->data, size, abfd); if (i->size != size) goto free_and_fail; i->mapped = 0; diff --git a/bfd/binary.c b/bfd/binary.c index 65fe26f..c31ef3c 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -103,7 +103,7 @@ binary_get_section_contents (bfd *abfd, bfd_size_type count) { if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_bread (location, count, abfd) != count) + || bfd_read (location, count, abfd) != count) return false; return true; } diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c index 8fc8a35..345f06b 100644 --- a/bfd/cisco-core.c +++ b/bfd/cisco-core.c @@ -95,10 +95,10 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc) size_t amt; flagword flags; - if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0) + if (bfd_seek (abfd, crash_info_loc, SEEK_SET) != 0) return NULL; - nread = bfd_bread (buf, (bfd_size_type) 4, abfd); + nread = bfd_read (buf, 4, abfd); if (nread != 4) { if (bfd_get_error () != bfd_error_system_call) @@ -107,14 +107,14 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc) } crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf)); - if (bfd_seek (abfd, (file_ptr) crashinfo_offset, SEEK_SET) != 0) + if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0) { /* Most likely we failed because of a bogus (huge) offset */ bfd_set_error (bfd_error_wrong_format); return NULL; } - nread = bfd_bread (&crashinfo, (bfd_size_type) sizeof (crashinfo), abfd); + nread = bfd_read (&crashinfo, sizeof (crashinfo), abfd); if (nread != sizeof (crashinfo)) { if (bfd_get_error () != bfd_error_system_call) diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index 45b3f76..1b34a89 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -2030,9 +2030,9 @@ alpha_ecoff_read_ar_hdr (bfd *abfd) /* This is a compressed file. We must set the size correctly. The size is the eight bytes after the dummy file header. */ - if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0 - || bfd_bread (ab, (bfd_size_type) 8, abfd) != 8 - || bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0) + if (bfd_seek (abfd, FILHSZ, SEEK_CUR) != 0 + || bfd_read (ab, 8, abfd) != 8 + || bfd_seek (abfd, -(FILHSZ + 8), SEEK_CUR) != 0) { free (ret); return NULL; @@ -2077,18 +2077,18 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos, return nbfd; /* We must uncompress this element. We do this by copying it into a - memory buffer, and making bfd_bread and bfd_seek use that buffer. + memory buffer, and making bfd_read and bfd_seek use that buffer. This can use a lot of memory, but it's simpler than getting a temporary file, making that work with the file descriptor caching code, and making sure that it is deleted at all appropriate times. It can be changed if it ever becomes important. */ /* The compressed file starts with a dummy ECOFF file header. */ - if (bfd_seek (nbfd, (file_ptr) FILHSZ, SEEK_SET) != 0) + if (bfd_seek (nbfd, FILHSZ, SEEK_SET) != 0) goto error_return; /* The next eight bytes are the real file size. */ - if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8) + if (bfd_read (ab, 8, nbfd) != 8) goto error_return; size = H_GET_64 (nbfd, ab); @@ -2115,7 +2115,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos, left = size; /* I don't know what the next eight bytes are for. */ - if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8) + if (bfd_read (ab, 8, nbfd) != 8) goto error_return; /* This is the uncompression algorithm. It's a simple @@ -2126,7 +2126,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos, next eight bytes in the output stream. */ memset (dict, 0, sizeof dict); h = 0; - while (bfd_bread (&b, (bfd_size_type) 1, nbfd) == 1) + while (bfd_read (&b, 1, nbfd) == 1) { unsigned int i; @@ -2138,7 +2138,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos, n = dict[h]; else { - if (bfd_bread (&n, 1, nbfd) != 1) + if (bfd_read (&n, 1, nbfd) != 1) goto error_return; dict[h] = n; } diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c index 141c4fa..4baf141 100644 --- a/bfd/coff-ia64.c +++ b/bfd/coff-ia64.c @@ -76,9 +76,8 @@ ia64coff_object_p (bfd *abfd) struct external_PEI_IMAGE_hdr image_hdr; file_ptr offset; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd) - != sizeof (dos_hdr))) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || (bfd_read (&dos_hdr, sizeof (dos_hdr), abfd) != sizeof (dos_hdr))) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -103,7 +102,7 @@ ia64coff_object_p (bfd *abfd) offset = H_GET_32 (abfd, dos_hdr.e_lfanew); if (bfd_seek (abfd, offset, SEEK_SET) != 0 - || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd) + || (bfd_read (&image_hdr, sizeof (image_hdr), abfd) != sizeof (image_hdr))) { if (bfd_get_error () != bfd_error_system_call) diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index a692c1a..06d0fd8 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1368,8 +1368,7 @@ _bfd_xcoff_slurp_armap (bfd *abfd) return false; /* The symbol table starts with a normal archive header. */ - if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd) - != SIZEOF_AR_HDR) + if (bfd_read (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR) return false; /* Skip the name (normally empty). */ @@ -1430,8 +1429,7 @@ _bfd_xcoff_slurp_armap (bfd *abfd) return false; /* The symbol table starts with a normal archive header. */ - if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) - != SIZEOF_AR_HDR_BIG) + if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG) return false; /* Skip the name (normally empty). */ @@ -1506,7 +1504,7 @@ _bfd_xcoff_archive_p (bfd *abfd) char magic[SXCOFFARMAG]; size_t amt = SXCOFFARMAG; - if (bfd_bread (magic, amt, abfd) != amt) + if (bfd_read (magic, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1538,7 +1536,7 @@ _bfd_xcoff_archive_p (bfd *abfd) /* Now read the rest of the file header. */ amt = SIZEOF_AR_FILE_HDR - SXCOFFARMAG; - if (bfd_bread (&hdr.memoff, amt, abfd) != amt) + if (bfd_read (&hdr.memoff, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1565,7 +1563,7 @@ _bfd_xcoff_archive_p (bfd *abfd) /* Now read the rest of the file header. */ amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG; - if (bfd_bread (&hdr.memoff, amt, abfd) != amt) + if (bfd_read (&hdr.memoff, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1702,7 +1700,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd) struct xcoff_ar_hdr hdr; struct xcoff_ar_hdr *hdrp; - if (bfd_bread (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR) + if (bfd_read (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR) return NULL; GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10); @@ -1715,7 +1713,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd) hdrp = (struct xcoff_ar_hdr *) (ret + 1); memcpy (hdrp, &hdr, SIZEOF_AR_HDR); - if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen) + if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen) { free (ret); return NULL; @@ -1731,7 +1729,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd) struct xcoff_ar_hdr_big hdr; struct xcoff_ar_hdr_big *hdrp; - if (bfd_bread (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG) + if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG) return NULL; GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10); @@ -1744,7 +1742,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd) hdrp = (struct xcoff_ar_hdr_big *) (ret + 1); memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG); - if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen) + if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen) { free (ret); return NULL; @@ -1933,14 +1931,12 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED, if (*p == '\0') *p = ' '; - if (bfd_bwrite (&hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd) - != SIZEOF_AR_HDR - || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd) - != SXCOFFARFMAG)) + if (bfd_write (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR + || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG) return false; H_PUT_32 (abfd, orl_count, buf); - if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) + if (bfd_write (buf, 4, abfd) != 4) return false; i = 0; @@ -1949,7 +1945,7 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED, while (map[i].u.abfd == iterator.current.member) { H_PUT_32 (abfd, iterator.current.offset, buf); - if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4) + if (bfd_write (buf, 4, abfd) != 4) return false; ++i; } @@ -1961,7 +1957,7 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED, name = *map[i].name; namlen = strlen (name); - if (bfd_bwrite (name, (bfd_size_type) (namlen + 1), abfd) != namlen + 1) + if (bfd_write (name, namlen + 1, abfd) != namlen + 1) return false; } @@ -1970,7 +1966,7 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED, char b; b = '\0'; - if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) + if (bfd_write (&b, 1, abfd) != 1) return false; } @@ -2013,7 +2009,7 @@ do_pad (bfd *abfd, unsigned int number) return false; while (number--) - if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) + if (bfd_write (&b, 1, abfd) != 1) return false; return true; @@ -2025,15 +2021,15 @@ do_copy (bfd *out_bfd, bfd *in_bfd) bfd_size_type remaining; bfd_byte buffer[DEFAULT_BUFFERSIZE]; - if (bfd_seek (in_bfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (in_bfd, 0, SEEK_SET) != 0) return false; remaining = arelt_size (in_bfd); while (remaining >= DEFAULT_BUFFERSIZE) { - if (bfd_bread (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE - || bfd_bwrite (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE) + if (bfd_read (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE + || bfd_write (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE) return false; remaining -= DEFAULT_BUFFERSIZE; @@ -2041,8 +2037,8 @@ do_copy (bfd *out_bfd, bfd *in_bfd) if (remaining) { - if (bfd_bread (buffer, remaining, in_bfd) != remaining - || bfd_bwrite (buffer, remaining, out_bfd) != remaining) + if (bfd_read (buffer, remaining, in_bfd) != remaining + || bfd_write (buffer, remaining, out_bfd) != remaining) return false; } @@ -2197,7 +2193,7 @@ xcoff_write_armap_big (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED, } } - bfd_bwrite (symbol_table, symbol_table_size, abfd); + bfd_write (symbol_table, symbol_table_size, abfd); free (symbol_table); @@ -2277,7 +2273,7 @@ xcoff_write_armap_big (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED, } } - bfd_bwrite (symbol_table, symbol_table_size, abfd); + bfd_write (symbol_table, symbol_table_size, abfd); free (symbol_table); @@ -2386,7 +2382,7 @@ xcoff_write_archive_contents_old (bfd *abfd) if (offsets == NULL) return false; - if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR, SEEK_SET) != 0) + if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR, SEEK_SET) != 0) return false; makemap = bfd_has_map (abfd); @@ -2420,9 +2416,9 @@ xcoff_write_archive_contents_old (bfd *abfd) BFD_ASSERT (iterator.current.offset == bfd_tell (abfd)); namlen = iterator.current.padded_namlen; - if (bfd_bwrite (ahdrp, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR - || bfd_bwrite (iterator.current.name, namlen, abfd) != namlen - || bfd_bwrite (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG + if (bfd_write (ahdrp, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR + || bfd_write (iterator.current.name, namlen, abfd) != namlen + || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG || bfd_seek (iterator.current.member, 0, SEEK_SET) != 0 || !do_copy (abfd, iterator.current.member) || !do_pad (abfd, iterator.current.trailing_padding)) @@ -2470,21 +2466,19 @@ xcoff_write_archive_contents_old (bfd *abfd) if (*p == '\0') *p = ' '; - if ((bfd_bwrite (&ahdr, (bfd_size_type) SIZEOF_AR_HDR, abfd) - != SIZEOF_AR_HDR) - || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd) - != SXCOFFARFMAG)) + if ((bfd_write (&ahdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR) + || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG) return false; sprintf (decbuf, "%-12ld", (long) count); - if (bfd_bwrite (decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE, abfd) + if (bfd_write (decbuf, XCOFFARMAG_ELEMENT_SIZE, abfd) != XCOFFARMAG_ELEMENT_SIZE) return false; for (i = 0; i < (size_t) count; i++) { sprintf (decbuf, "%-12ld", (long) offsets[i]); - if (bfd_bwrite (decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE, - abfd) != XCOFFARMAG_ELEMENT_SIZE) + if (bfd_write (decbuf, XCOFFARMAG_ELEMENT_SIZE, abfd) + != XCOFFARMAG_ELEMENT_SIZE) return false; } for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next) @@ -2494,7 +2488,7 @@ xcoff_write_archive_contents_old (bfd *abfd) name = normalize_filename (sub); namlen = strlen (name); - if (bfd_bwrite (name, namlen + 1, abfd) != namlen + 1) + if (bfd_write (name, namlen + 1, abfd) != namlen + 1) return false; } @@ -2523,7 +2517,7 @@ xcoff_write_archive_contents_old (bfd *abfd) *p = ' '; if (bfd_seek (abfd, 0, SEEK_SET) != 0 - || (bfd_bwrite (fhdr, SIZEOF_AR_FILE_HDR, abfd) != SIZEOF_AR_FILE_HDR)) + || (bfd_write (fhdr, SIZEOF_AR_FILE_HDR, abfd) != SIZEOF_AR_FILE_HDR)) return false; return true; @@ -2551,7 +2545,7 @@ xcoff_write_archive_contents_big (bfd *abfd) memset (&xtdata, 0, sizeof (xtdata)); memcpy (fhdr->magic, XCOFFARMAGBIG, SXCOFFARMAG); - if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0) + if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0) return false; /* Calculate count and total_namlen. */ @@ -2650,9 +2644,9 @@ xcoff_write_archive_contents_big (bfd *abfd) BFD_ASSERT (iterator.current.offset == bfd_tell (abfd)); namlen = iterator.current.padded_namlen; - if (bfd_bwrite (ahdrp, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG - || bfd_bwrite (iterator.current.name, namlen, abfd) != namlen - || bfd_bwrite (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG + if (bfd_write (ahdrp, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG + || bfd_write (iterator.current.name, namlen, abfd) != namlen + || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG || bfd_seek (iterator.current.member, 0, SEEK_SET) != 0 || !do_copy (abfd, iterator.current.member) || !do_pad (abfd, iterator.current.trailing_padding)) @@ -2755,7 +2749,7 @@ xcoff_write_archive_contents_big (bfd *abfd) mt += namlen + 1; } - if (bfd_bwrite (member_table, member_table_size, abfd) != member_table_size) + if (bfd_write (member_table, member_table_size, abfd) != member_table_size) return false; free (member_table); @@ -2786,8 +2780,8 @@ xcoff_write_archive_contents_big (bfd *abfd) /* Write out the archive file header. */ if (bfd_seek (abfd, 0, SEEK_SET) != 0 - || bfd_bwrite (fhdr, - SIZEOF_AR_FILE_HDR_BIG, abfd) != SIZEOF_AR_FILE_HDR_BIG) + || (bfd_write (fhdr, SIZEOF_AR_FILE_HDR_BIG, abfd) + != SIZEOF_AR_FILE_HDR_BIG)) return false; return true; @@ -4360,13 +4354,13 @@ xcoff_generate_rtinit (bfd *abfd, const char *init, const char *fini, filehdr.f_symptr = scnhdr.s_relptr + scnhdr.s_nreloc * RELSZ; bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext); - bfd_bwrite (filehdr_ext, FILHSZ, abfd); + bfd_write (filehdr_ext, FILHSZ, abfd); bfd_coff_swap_scnhdr_out (abfd, &scnhdr, scnhdr_ext); - bfd_bwrite (scnhdr_ext, SCNHSZ, abfd); - bfd_bwrite (data_buffer, data_buffer_size, abfd); - bfd_bwrite (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd); - bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd); - bfd_bwrite (string_table, string_table_size, abfd); + bfd_write (scnhdr_ext, SCNHSZ, abfd); + bfd_write (data_buffer, data_buffer_size, abfd); + bfd_write (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd); + bfd_write (syment_ext, filehdr.f_nsyms * SYMESZ, abfd); + bfd_write (string_table, string_table_size, abfd); free (data_buffer); data_buffer = NULL; diff --git a/bfd/coff-stgo32.c b/bfd/coff-stgo32.c index 707b809..8403770 100644 --- a/bfd/coff-stgo32.c +++ b/bfd/coff-stgo32.c @@ -278,7 +278,7 @@ go32exe_check_format (bfd *abfd) bfd_set_error (bfd_error_system_call); /* Read in the stub file header, which is a DOS MZ executable. */ - if (bfd_bread (&filehdr_dos, DOS_HDR_SIZE, abfd) != DOS_HDR_SIZE) + if (bfd_read (&filehdr_dos, DOS_HDR_SIZE, abfd) != DOS_HDR_SIZE) goto fail; /* Make sure that this is an MZ executable. */ @@ -303,7 +303,7 @@ go32exe_check_format (bfd *abfd) go32exe_temp_stub = bfd_malloc (stubsize); if (go32exe_temp_stub == NULL) goto fail; - if (bfd_bread (go32exe_temp_stub, stubsize, abfd) != stubsize) + if (bfd_read (go32exe_temp_stub, stubsize, abfd) != stubsize) goto fail; go32exe_temp_stub_size = stubsize; @@ -351,7 +351,7 @@ go32exe_write_object_contents (bfd *abfd) abfd->origin = 0; if (bfd_seek (abfd, 0, SEEK_SET) != 0) return false; - if (bfd_bwrite (coff_data (abfd)->stub, stubsize, abfd) != stubsize) + if (bfd_write (coff_data (abfd)->stub, stubsize, abfd) != stubsize) return false; /* Seek back to where we were. */ diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index d76c99a..8a7647a 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1829,8 +1829,7 @@ xcoff64_slurp_armap (bfd *abfd) return false; /* The symbol table starts with a normal archive header. */ - if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd) - != SIZEOF_AR_HDR_BIG) + if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG) return false; /* Skip the name (normally empty). */ @@ -1907,7 +1906,7 @@ xcoff64_archive_p (bfd *abfd) struct xcoff_ar_file_hdr_big hdr; size_t amt = SXCOFFARMAG; - if (bfd_bread (magic, amt, abfd) != amt) + if (bfd_read (magic, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1925,7 +1924,7 @@ xcoff64_archive_p (bfd *abfd) /* Now read the rest of the file header. */ amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG; - if (bfd_bread (&hdr.memoff, amt, abfd) != amt) + if (bfd_read (&hdr.memoff, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2384,15 +2383,15 @@ xcoff64_generate_rtinit (bfd *abfd, const char *init, const char *fini, filehdr.f_symptr = data_scnhdr.s_relptr + data_scnhdr.s_nreloc * RELSZ; bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext); - bfd_bwrite (filehdr_ext, FILHSZ, abfd); + bfd_write (filehdr_ext, FILHSZ, abfd); bfd_coff_swap_scnhdr_out (abfd, &text_scnhdr, &scnhdr_ext[SCNHSZ * 0]); bfd_coff_swap_scnhdr_out (abfd, &data_scnhdr, &scnhdr_ext[SCNHSZ * 1]); bfd_coff_swap_scnhdr_out (abfd, &bss_scnhdr, &scnhdr_ext[SCNHSZ * 2]); - bfd_bwrite (scnhdr_ext, 3 * SCNHSZ, abfd); - bfd_bwrite (data_buffer, data_buffer_size, abfd); - bfd_bwrite (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd); - bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd); - bfd_bwrite (string_table, string_table_size, abfd); + bfd_write (scnhdr_ext, 3 * SCNHSZ, abfd); + bfd_write (data_buffer, data_buffer_size, abfd); + bfd_write (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd); + bfd_write (syment_ext, filehdr.f_nsyms * SYMESZ, abfd); + bfd_write (string_table, string_table_size, abfd); free (data_buffer); data_buffer = NULL; diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 6c8080c..99d9a56 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1888,9 +1888,9 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED, file_ptr oldpos = bfd_tell (abfd); bfd_size_type relsz = bfd_coff_relsz (abfd); - if (bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0) != 0) + if (bfd_seek (abfd, hdr->s_relptr, 0) != 0) return; - if (bfd_bread (& dst, relsz, abfd) != relsz) + if (bfd_read (& dst, relsz, abfd) != relsz) return; bfd_coff_swap_reloc_in (abfd, &dst, &n); @@ -1959,9 +1959,9 @@ coff_set_alignment_hook (bfd * abfd, asection * section, void * scnhdr) const file_ptr oldpos = bfd_tell (abfd); const bfd_size_type relsz = bfd_coff_relsz (abfd); - if (bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0) != 0) + if (bfd_seek (abfd, hdr->s_relptr, 0) != 0) return; - if (bfd_bread (& dst, relsz, abfd) != relsz) + if (bfd_read (& dst, relsz, abfd) != relsz) return; bfd_coff_swap_reloc_in (abfd, &dst, &n); @@ -2557,8 +2557,8 @@ coff_write_relocs (bfd * abfd, int first_undef) /* Add one to count *this* reloc (grr). */ n.r_vaddr = s->reloc_count + 1; coff_swap_reloc_out (abfd, &n, &dst); - if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd), - abfd) != bfd_coff_relsz (abfd)) + if (bfd_write (&dst, bfd_coff_relsz (abfd), abfd) + != bfd_coff_relsz (abfd)) return false; } #endif @@ -2650,8 +2650,8 @@ coff_write_relocs (bfd * abfd, int first_undef) #endif coff_swap_reloc_out (abfd, &n, &dst); - if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd), - abfd) != bfd_coff_relsz (abfd)) + if (bfd_write (&dst, bfd_coff_relsz (abfd), abfd) + != bfd_coff_relsz (abfd)) return false; } @@ -3271,7 +3271,7 @@ coff_compute_section_file_positions (bfd * abfd) b = 0; if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0 - || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) + || bfd_write (&b, 1, abfd) != 1) return false; } @@ -3295,7 +3295,7 @@ coff_read_word (bfd *abfd, unsigned int *value, unsigned int *pelength) unsigned char b[2]; int status; - status = bfd_bread (b, (bfd_size_type) 2, abfd); + status = bfd_read (b, 2, abfd); if (status < 1) { *value = 0; @@ -3371,7 +3371,7 @@ coff_compute_checksum (bfd *abfd, unsigned int *pelength) if (bfd_seek (abfd, filepos, SEEK_SET) != 0) return 0; - buf_size = bfd_bread (buf, COFF_CHECKSUM_BUFFER_SIZE, abfd); + buf_size = bfd_read (buf, COFF_CHECKSUM_BUFFER_SIZE, abfd); cur_buf_size = buf_size; cur_buf = buf; @@ -3411,7 +3411,7 @@ coff_apply_checksum (bfd *abfd) return false; checksum = 0; - bfd_bwrite (&checksum, (bfd_size_type) 4, abfd); + bfd_write (&checksum, 4, abfd); if (bfd_seek (abfd, peheader, SEEK_SET) != 0) return false; @@ -3423,7 +3423,7 @@ coff_apply_checksum (bfd *abfd) if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0) return false; - bfd_bwrite (&checksum, (bfd_size_type) 4, abfd); + bfd_write (&checksum, 4, abfd); return true; } @@ -3750,7 +3750,7 @@ coff_write_object_contents (bfd * abfd) bfd_size_type amt = bfd_coff_scnhsz (abfd); if (bfd_coff_swap_scnhdr_out (abfd, §ion, &buff) == 0 - || bfd_bwrite (& buff, amt, abfd) != amt) + || bfd_write (& buff, amt, abfd) != amt) return false; } @@ -3876,7 +3876,7 @@ coff_write_object_contents (bfd * abfd) scnhdr.s_flags = STYP_OVRFLO; amt = bfd_coff_scnhsz (abfd); if (bfd_coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0 - || bfd_bwrite (& buff, amt, abfd) != amt) + || bfd_write (& buff, amt, abfd) != amt) return false; } } @@ -3893,7 +3893,7 @@ coff_write_object_contents (bfd * abfd) bfd_byte *b = bfd_zmalloc (fill_size); if (b) { - bfd_bwrite (b, fill_size, abfd); + bfd_write (b, fill_size, abfd); free (b); } } @@ -4232,7 +4232,7 @@ coff_write_object_contents (bfd * abfd) #endif /* Now write header. */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) return false; { @@ -4244,7 +4244,7 @@ coff_write_object_contents (bfd * abfd) return false; bfd_coff_swap_filehdr_out (abfd, & internal_f, buff); - amount = bfd_bwrite (buff, amount, abfd); + amount = bfd_write (buff, amount, abfd); free (buff); @@ -4264,7 +4264,7 @@ coff_write_object_contents (bfd * abfd) return false; coff_swap_aouthdr_out (abfd, & internal_a, buff); - amount = bfd_bwrite (buff, amount, abfd); + amount = bfd_write (buff, amount, abfd); free (buff); @@ -4289,7 +4289,7 @@ coff_write_object_contents (bfd * abfd) size = bfd_coff_aoutsz (abfd); else size = SMALL_AOUTSZ; - if (bfd_bwrite (& buff, (bfd_size_type) size, abfd) != size) + if (bfd_write (&buff, size, abfd) != size) return false; } #endif @@ -4362,7 +4362,7 @@ coff_set_section_contents (bfd * abfd, if (count == 0) return true; - return bfd_bwrite (location, count, abfd) == count; + return bfd_write (location, count, abfd) == count; } static void * diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 9d45253..1ec9a51 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -414,7 +414,7 @@ coff_object_p (bfd *abfd) aoutsz) in executables. The bfd_coff_swap_aouthdr_in function expects this header to be aoutsz bytes in length, so we use that value in the call to bfd_alloc below. But we must be careful to - only read in f_opthdr bytes in the call to bfd_bread. We should + only read in f_opthdr bytes in the call to bfd_read. We should also attempt to catch corrupt or non-COFF binaries with a strange value for f_opthdr. */ if (! bfd_coff_bad_format_hook (abfd, &internal_f) @@ -638,7 +638,7 @@ _bfd_coff_read_internal_relocs (bfd *abfd, } if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || bfd_bread (external_relocs, amt, abfd) != amt) + || bfd_read (external_relocs, amt, abfd) != amt) goto error_return; if (internal_relocs == NULL) @@ -1152,7 +1152,7 @@ coff_write_symbol (bfd *abfd, if (!buf) return false; bfd_coff_swap_sym_out (abfd, &native->u.syment, buf); - if (bfd_bwrite (buf, symesz, abfd) != symesz) + if (bfd_write (buf, symesz, abfd) != symesz) return false; bfd_release (abfd, buf); @@ -1182,7 +1182,7 @@ coff_write_symbol (bfd *abfd, type, n_sclass, (int) j, native->u.syment.n_numaux, buf); - if (bfd_bwrite (buf, auxesz, abfd) != auxesz) + if (bfd_write (buf, auxesz, abfd) != auxesz) return false; } bfd_release (abfd, buf); @@ -1475,8 +1475,7 @@ coff_write_symbols (bfd *abfd) #else #error Change H_PUT_32 #endif - if (bfd_bwrite ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd) - != sizeof (buffer)) + if (bfd_write (buffer, sizeof (buffer), abfd) != sizeof (buffer)) return false; if (! _bfd_stringtab_emit (abfd, strtab)) @@ -1535,8 +1534,7 @@ coff_write_linenumbers (bfd *abfd) out.l_lnno = 0; out.l_addr.l_symndx = l->u.offset; bfd_coff_swap_lineno_out (abfd, &out, buff); - if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd) - != linesz) + if (bfd_write (buff, linesz, abfd) != linesz) return false; l++; while (l->line_number) @@ -1544,8 +1542,7 @@ coff_write_linenumbers (bfd *abfd) out.l_lnno = l->line_number; out.l_addr.l_symndx = l->u.offset; bfd_coff_swap_lineno_out (abfd, &out, buff); - if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd) - != linesz) + if (bfd_write (buff, linesz, abfd) != linesz) return false; l++; } @@ -1759,8 +1756,7 @@ _bfd_coff_read_string_table (bfd *abfd) if (bfd_seek (abfd, pos + size, SEEK_SET) != 0) return NULL; - if (bfd_bread (extstrsize, (bfd_size_type) sizeof extstrsize, abfd) - != sizeof extstrsize) + if (bfd_read (extstrsize, sizeof extstrsize, abfd) != sizeof extstrsize) { if (bfd_get_error () != bfd_error_file_truncated) return NULL; @@ -1798,7 +1794,7 @@ _bfd_coff_read_string_table (bfd *abfd) they are zero. */ memset (strings, 0, STRING_SIZE_SIZE); - if (bfd_bread (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd) + if (bfd_read (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd) != strsize - STRING_SIZE_SIZE) { free (strings); diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 24c4a2b..aea5c4c 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -978,7 +978,7 @@ _bfd_coff_final_link (bfd *abfd, if (rewrite && (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flaginfo.outsyms, symesz, abfd) != symesz)) + || bfd_write (flaginfo.outsyms, symesz, abfd) != symesz)) goto error_return; obj_raw_syment_count (abfd) += written; @@ -1023,7 +1023,7 @@ _bfd_coff_final_link (bfd *abfd, pos = obj_sym_filepos (abfd) + flaginfo.last_file_index * symesz; if (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flaginfo.outsyms, symesz, abfd) != symesz) + || bfd_write (flaginfo.outsyms, symesz, abfd) != symesz) return false; } @@ -1096,13 +1096,13 @@ _bfd_coff_final_link (bfd *abfd, memset (&incount, 0, sizeof (incount)); incount.r_vaddr = o->reloc_count + 1; bfd_coff_swap_reloc_out (abfd, &incount, excount); - if (bfd_bwrite (excount, relsz, abfd) != relsz) + if (bfd_write (excount, relsz, abfd) != relsz) /* We'll leak, but it's an error anyway. */ goto error_return; free (excount); } - if (bfd_bwrite (external_relocs, - (bfd_size_type) relsz * o->reloc_count, abfd) + if (bfd_write (external_relocs, + (bfd_size_type) relsz * o->reloc_count, abfd) != (bfd_size_type) relsz * o->reloc_count) goto error_return; } @@ -1149,8 +1149,7 @@ _bfd_coff_final_link (bfd *abfd, #error Change H_PUT_32 above #endif - if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd) - != STRING_SIZE_SIZE) + if (bfd_write (strbuf, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE) return false; if (! _bfd_stringtab_emit (abfd, flaginfo.strtab)) @@ -1877,7 +1876,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) pos = obj_sym_filepos (output_bfd); pos += flaginfo->last_file_index * osymesz; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (outsym, osymesz, output_bfd) != osymesz) + || bfd_write (outsym, osymesz, output_bfd) != osymesz) return false; } } @@ -2119,7 +2118,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) pos = obj_sym_filepos (output_bfd); pos += flaginfo->last_bf_index * osymesz; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || (bfd_bwrite (outsym, osymesz, output_bfd) + || (bfd_write (outsym, osymesz, output_bfd) != osymesz)) return false; } @@ -2185,7 +2184,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) continue; if (bfd_seek (input_bfd, o->line_filepos, SEEK_SET) != 0 - || bfd_bread (flaginfo->linenos, linesz * o->lineno_count, + || bfd_read (flaginfo->linenos, linesz * o->lineno_count, input_bfd) != linesz * o->lineno_count) return false; @@ -2275,7 +2274,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) pos += o->output_section->lineno_count * linesz; amt = oeline - flaginfo->linenos; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flaginfo->linenos, amt, output_bfd) != amt) + || bfd_write (flaginfo->linenos, amt, output_bfd) != amt) return false; o->output_section->lineno_count += amt / linesz; @@ -2305,7 +2304,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd) pos = obj_sym_filepos (output_bfd) + syment_base * osymesz; amt = outsym - flaginfo->outsyms; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flaginfo->outsyms, amt, output_bfd) != amt) + || bfd_write (flaginfo->outsyms, amt, output_bfd) != amt) return false; BFD_ASSERT ((obj_raw_syment_count (output_bfd) @@ -2670,7 +2669,7 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data) pos = obj_sym_filepos (output_bfd); pos += obj_raw_syment_count (output_bfd) * symesz; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flaginfo->outsyms, symesz, output_bfd) != symesz) + || bfd_write (flaginfo->outsyms, symesz, output_bfd) != symesz) { flaginfo->failed = true; return false; @@ -2735,7 +2734,7 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data) bfd_coff_swap_aux_out (output_bfd, auxp, isym.n_type, isym.n_sclass, (int) i, isym.n_numaux, flaginfo->outsyms); - if (bfd_bwrite (flaginfo->outsyms, symesz, output_bfd) != symesz) + if (bfd_write (flaginfo->outsyms, symesz, output_bfd) != symesz) { flaginfo->failed = true; return false; diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi index 8cf0857..50913ef 100644 --- a/bfd/doc/bfdint.texi +++ b/bfd/doc/bfdint.texi @@ -523,7 +523,7 @@ corresponds to an actual section in an actual BFD. Get the contents of a section. This is called from @samp{bfd_get_section_contents}. Most targets set this to @samp{_bfd_generic_get_section_contents}, which does a @samp{bfd_seek} -based on the section's @samp{filepos} field and a @samp{bfd_bread}. The +based on the section's @samp{filepos} field and a @samp{bfd_read}. The corresponding field in the target vector is named @samp{_bfd_get_section_contents}. @@ -656,7 +656,7 @@ always uses extended name tables anyhow. The corresponding field in the target vector is named @samp{_bfd_truncate_arname}. @item _write_armap -Write out the archive symbol table using calls to @samp{bfd_bwrite}. +Write out the archive symbol table using calls to @samp{bfd_write}. This is normally called from the archive @samp{write_contents} routine. The corresponding field in the target vector is named @samp{write_armap} (no leading underscore). diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 522a442..844f1a5 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -2267,7 +2267,7 @@ _bfd_ecoff_set_section_contents (bfd *abfd, pos = section->filepos + offset; if (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bwrite (location, count, abfd) != count) + || bfd_write (location, count, abfd) != count) return false; return true; @@ -2472,7 +2472,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) } internal_f.f_nscns = 0; - if (bfd_seek (abfd, (file_ptr) (filhsz + aoutsz), SEEK_SET) != 0) + if (bfd_seek (abfd, filhsz + aoutsz, SEEK_SET) != 0) goto error_return; for (current = abfd->sections; @@ -2527,7 +2527,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) current->flags); if (bfd_coff_swap_scnhdr_out (abfd, (void *) §ion, buff) == 0 - || bfd_bwrite (buff, scnhsz, abfd) != scnhsz) + || bfd_write (buff, scnhsz, abfd) != scnhsz) goto error_return; if ((section.s_flags & STYP_TEXT) != 0 @@ -2672,15 +2672,15 @@ _bfd_ecoff_write_object_contents (bfd *abfd) } /* Write out the file header and the optional header. */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) goto error_return; bfd_coff_swap_filehdr_out (abfd, (void *) &internal_f, buff); - if (bfd_bwrite (buff, filhsz, abfd) != filhsz) + if (bfd_write (buff, filhsz, abfd) != filhsz) goto error_return; bfd_coff_swap_aouthdr_out (abfd, (void *) &internal_a, buff); - if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz) + if (bfd_write (buff, aoutsz, abfd) != aoutsz) goto error_return; /* Build the external symbol information. This must be done before @@ -2796,7 +2796,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0) goto error_return; amt = current->reloc_count * external_reloc_size; - if (bfd_bwrite (reloc_buff, amt, abfd) != amt) + if (bfd_write (reloc_buff, amt, abfd) != amt) goto error_return; bfd_release (abfd, reloc_buff); reloc_buff = NULL; @@ -2822,15 +2822,13 @@ _bfd_ecoff_write_object_contents (bfd *abfd) { char c; - if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1, - SEEK_SET) != 0) + if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos - 1, SEEK_SET) != 0) goto error_return; - if (bfd_bread (&c, (bfd_size_type) 1, abfd) == 0) + if (bfd_read (&c, 1, abfd) == 0) c = 0; - if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1, - SEEK_SET) != 0) + if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos - 1, SEEK_SET) != 0) goto error_return; - if (bfd_bwrite (&c, (bfd_size_type) 1, abfd) != 1) + if (bfd_write (&c, 1, abfd) != 1) goto error_return; } @@ -2930,13 +2928,13 @@ _bfd_ecoff_slurp_armap (bfd *abfd) bfd_size_type amt; /* Get the name of the first element. */ - i = bfd_bread ((void *) nextname, (bfd_size_type) 16, abfd); + i = bfd_read (nextname, 16, abfd); if (i == 0) return true; if (i != 16) return false; - if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) + if (bfd_seek (abfd, -16, SEEK_CUR) != 0) return false; /* Irix 4.0.5F apparently can use either an ECOFF armap or a @@ -3166,12 +3164,11 @@ _bfd_ecoff_write_armap (bfd *abfd, if (((char *) (&hdr))[i] == '\0') (((char *) (&hdr))[i]) = ' '; - if (bfd_bwrite ((void *) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd) - != sizeof (struct ar_hdr)) + if (bfd_write (&hdr, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr)) return false; H_PUT_32 (abfd, hashsize, temp); - if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4) + if (bfd_write (temp, 4, abfd) != 4) return false; hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize); @@ -3220,21 +3217,21 @@ _bfd_ecoff_write_armap (bfd *abfd, H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4)); } - if (bfd_bwrite ((void *) hashtable, symdefsize, abfd) != symdefsize) + if (bfd_write (hashtable, symdefsize, abfd) != symdefsize) return false; bfd_release (abfd, hashtable); /* Now write the strings. */ H_PUT_32 (abfd, stringsize, temp); - if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4) + if (bfd_write (temp, 4, abfd) != 4) return false; for (i = 0; i < orl_count; i++) { bfd_size_type len; len = strlen (*map[i].name) + 1; - if (bfd_bwrite ((void *) (*map[i].name), len, abfd) != len) + if (bfd_write (*map[i].name, len, abfd) != len) return false; } @@ -3242,7 +3239,7 @@ _bfd_ecoff_write_armap (bfd *abfd, bug-compatible for DECstation ar we use a null. */ if (padit) { - if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1) + if (bfd_write ("", 1, abfd) != 1) return false; } @@ -3908,7 +3905,7 @@ ecoff_indirect_link_order (bfd *output_bfd, file_ptr pos = (output_section->rel_filepos + output_section->reloc_count * external_reloc_size); if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd) + || (bfd_write (external_relocs, external_relocs_size, output_bfd) != external_relocs_size)) goto error_return; output_section->reloc_count += input_section->reloc_count; @@ -4115,7 +4112,7 @@ ecoff_reloc_link_order (bfd *output_bfd, pos = (output_section->rel_filepos + output_section->reloc_count * external_reloc_size); ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0 - && (bfd_bwrite ((void *) rbuf, external_reloc_size, output_bfd) + && (bfd_write (rbuf, external_reloc_size, output_bfd) == external_reloc_size)); if (ok) diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 5b7acd5..a5803f4 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -1460,7 +1460,7 @@ ecoff_write_symhdr (bfd *abfd, goto error_return; (*swap->swap_hdr_out) (abfd, symhdr, buff); - if (bfd_bwrite (buff, swap->external_hdr_size, abfd) + if (bfd_write (buff, swap->external_hdr_size, abfd) != swap->external_hdr_size) goto error_return; @@ -1492,9 +1492,8 @@ bfd_ecoff_write_debug (bfd *abfd, BFD_ASSERT (symhdr->offset == 0 \ || (bfd_vma) bfd_tell (abfd) == symhdr->offset); \ if (symhdr->count != 0 \ - && bfd_bwrite (debug->ptr, \ - (bfd_size_type) size * symhdr->count, \ - abfd) != size * symhdr->count) \ + && bfd_write (debug->ptr, size * symhdr->count, \ + abfd) != size * symhdr->count) \ return false; WRITE (line, cbLine, sizeof (unsigned char), cbLineOffset); @@ -1502,8 +1501,7 @@ bfd_ecoff_write_debug (bfd *abfd, WRITE (external_pdr, ipdMax, swap->external_pdr_size, cbPdOffset); WRITE (external_sym, isymMax, swap->external_sym_size, cbSymOffset); WRITE (external_opt, ioptMax, swap->external_opt_size, cbOptOffset); - WRITE (external_aux, iauxMax, (bfd_size_type) sizeof (union aux_ext), - cbAuxOffset); + WRITE (external_aux, iauxMax, sizeof (union aux_ext), cbAuxOffset); WRITE (ss, issMax, sizeof (char), cbSsOffset); WRITE (ssext, issExtMax, sizeof (char), cbSsExtOffset); WRITE (external_fdr, ifdMax, swap->external_fdr_size, cbFdOffset); @@ -1524,23 +1522,21 @@ ecoff_write_shuffle (bfd *abfd, void * space) { struct shuffle *l; - unsigned long total; + size_t total; total = 0; - for (l = shuffle; l != (struct shuffle *) NULL; l = l->next) + for (l = shuffle; l != NULL; l = l->next) { if (! l->filep) { - if (bfd_bwrite (l->u.memory, (bfd_size_type) l->size, abfd) - != l->size) + if (bfd_write (l->u.memory, l->size, abfd) != l->size) return false; } else { if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0 - || bfd_bread (space, (bfd_size_type) l->size, - l->u.file.input_bfd) != l->size - || bfd_bwrite (space, (bfd_size_type) l->size, abfd) != l->size) + || bfd_read (space, l->size, l->u.file.input_bfd) != l->size + || bfd_write (space, l->size, abfd) != l->size) return false; } total += l->size; @@ -1548,15 +1544,15 @@ ecoff_write_shuffle (bfd *abfd, if ((total & (swap->debug_align - 1)) != 0) { - unsigned int i; + size_t i; bfd_byte *s; i = swap->debug_align - (total & (swap->debug_align - 1)); - s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i); + s = bfd_zmalloc (i); if (s == NULL && i != 0) return false; - if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i) + if (bfd_write (s, i, abfd) != i) { free (s); return false; @@ -1611,36 +1607,34 @@ bfd_ecoff_write_accumulated_debug (void * handle, bfd_byte null; struct string_hash_entry *sh; - BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL); + BFD_ASSERT (ainfo->ss == NULL); null = 0; - if (bfd_bwrite (&null, (bfd_size_type) 1, abfd) != 1) + if (bfd_write (&null, 1, abfd) != 1) goto error_return; total = 1; BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1); - for (sh = ainfo->ss_hash; - sh != (struct string_hash_entry *) NULL; - sh = sh->next) + for (sh = ainfo->ss_hash; sh != NULL; sh = sh->next) { size_t len; len = strlen (sh->root.string); amt = len + 1; - if (bfd_bwrite (sh->root.string, amt, abfd) != amt) + if (bfd_write (sh->root.string, amt, abfd) != amt) goto error_return; total += len + 1; } if ((total & (swap->debug_align - 1)) != 0) { - unsigned int i; + size_t i; bfd_byte *s; i = swap->debug_align - (total & (swap->debug_align - 1)); - s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i); + s = bfd_zmalloc (i); if (s == NULL && i != 0) goto error_return; - if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i) + if (bfd_write (s, i, abfd) != i) { free (s); goto error_return; @@ -1652,20 +1646,20 @@ bfd_ecoff_write_accumulated_debug (void * handle, /* The external strings and symbol are not converted over to using shuffles. FIXME: They probably should be. */ amt = debug->symbolic_header.issExtMax; - if (amt != 0 && bfd_bwrite (debug->ssext, amt, abfd) != amt) + if (amt != 0 && bfd_write (debug->ssext, amt, abfd) != amt) goto error_return; if ((debug->symbolic_header.issExtMax & (swap->debug_align - 1)) != 0) { - unsigned int i; + size_t i; bfd_byte *s; i = (swap->debug_align - (debug->symbolic_header.issExtMax & (swap->debug_align - 1))); - s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i); + s = bfd_zmalloc (i); if (s == NULL && i != 0) goto error_return; - if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i) + if (bfd_write (s, i, abfd) != i) { free (s); goto error_return; @@ -1682,7 +1676,7 @@ bfd_ecoff_write_accumulated_debug (void * handle, == (bfd_vma) bfd_tell (abfd))); amt = debug->symbolic_header.iextMax * swap->external_ext_size; - if (amt != 0 && bfd_bwrite (debug->external_ext, amt, abfd) != amt) + if (amt != 0 && bfd_write (debug->external_ext, amt, abfd) != amt) goto error_return; free (space); @@ -2520,8 +2514,7 @@ ecoff_collect_shuffle (struct shuffle *l, bfd_byte *buff) else { if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0 - || (bfd_bread (buff, (bfd_size_type) l->size, l->u.file.input_bfd) - != l->size)) + || bfd_read (buff, l->size, l->u.file.input_bfd) != l->size) return false; } buff += l->size; diff --git a/bfd/elf-nacl.c b/bfd/elf-nacl.c index b021bba..f701af6 100644 --- a/bfd/elf-nacl.c +++ b/bfd/elf-nacl.c @@ -348,7 +348,7 @@ nacl_final_write_processing (bfd *abfd) if (fill == NULL || bfd_seek (abfd, sec->filepos, SEEK_SET) != 0 - || bfd_bwrite (fill, sec->size, abfd) != sec->size) + || bfd_write (fill, sec->size, abfd) != sec->size) { /* We don't have a proper way to report an error here. So instead fudge things so that elf_write_shdrs_and_ehdr will diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c index 6925bc9..5de5af7 100644 --- a/bfd/elf-strtab.c +++ b/bfd/elf-strtab.c @@ -315,7 +315,7 @@ _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab) bfd_size_type off = 1; size_t i; - if (bfd_bwrite ("", 1, abfd) != 1) + if (bfd_write ("", 1, abfd) != 1) return false; for (i = 1; i < tab->size; ++i) @@ -329,7 +329,7 @@ _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab) continue; str = tab->array[i]->root.string; - if (bfd_bwrite (str, len, abfd) != len) + if (bfd_write (str, len, abfd) != len) return false; off += len; @@ -460,7 +460,7 @@ bfd_elf_get_elf_syms (bfd *ibfd, } if (extsym_buf == NULL || bfd_seek (ibfd, pos, SEEK_SET) != 0 - || bfd_bread (extsym_buf, amt, ibfd) != amt) + || bfd_read (extsym_buf, amt, ibfd) != amt) { intsym_buf = NULL; goto out; @@ -484,7 +484,7 @@ bfd_elf_get_elf_syms (bfd *ibfd, } if (extshndx_buf == NULL || bfd_seek (ibfd, pos, SEEK_SET) != 0 - || bfd_bread (extshndx_buf, amt, ibfd) != amt) + || bfd_read (extshndx_buf, amt, ibfd) != amt) { intsym_buf = NULL; goto out; @@ -2133,8 +2133,7 @@ _bfd_elf_get_dynamic_symbols (bfd *abfd, Elf_Internal_Phdr *phdr, NULL); if (filepos == (file_ptr) -1 || bfd_seek (abfd, filepos, SEEK_SET) != 0 - || (bfd_bread (nb, 2 * hash_ent_size, abfd) - != (2 * hash_ent_size))) + || bfd_read (nb, 2 * hash_ent_size, abfd) != 2 * hash_ent_size) goto error_return; /* The number of dynamic symbol table entries equals the number @@ -2163,7 +2162,7 @@ _bfd_elf_get_dynamic_symbols (bfd *abfd, Elf_Internal_Phdr *phdr, sizeof (nb), NULL); if (filepos == (file_ptr) -1 || bfd_seek (abfd, filepos, SEEK_SET) != 0 - || bfd_bread (nb, sizeof (nb), abfd) != sizeof (nb)) + || bfd_read (nb, sizeof (nb), abfd) != sizeof (nb)) goto error_return; ngnubuckets = bfd_get_32 (abfd, nb); @@ -2210,7 +2209,7 @@ _bfd_elf_get_dynamic_symbols (bfd *abfd, Elf_Internal_Phdr *phdr, do { - if (bfd_bread (nb, 4, abfd) != 4) + if (bfd_read (nb, 4, abfd) != 4) goto error_return; ++maxchain; if (maxchain == 0) @@ -7302,7 +7301,7 @@ _bfd_elf_write_object_contents (bfd *abfd) bfd_size_type amt = i_shdrp[count]->sh_size; if (bfd_seek (abfd, i_shdrp[count]->sh_offset, SEEK_SET) != 0 - || bfd_bwrite (i_shdrp[count]->contents, amt, abfd) != amt) + || bfd_write (i_shdrp[count]->contents, amt, abfd) != amt) return false; } } @@ -13819,8 +13818,7 @@ _bfd_elf_slurp_secondary_reloc_section (bfd * abfd, } if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 - || (bfd_bread (native_relocs, hdr->sh_size, abfd) - != hdr->sh_size)) + || bfd_read (native_relocs, hdr->sh_size, abfd) != hdr->sh_size) { free (native_relocs); /* The internal_relocs will be freed when diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index ccee076..5622aaa 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1641,7 +1641,7 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info) } if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0 - || (bfd_bread (buffer, length, ibfd) != length)) + || (bfd_read (buffer, length, ibfd) != length)) { /* xgettext:c-format */ error_message = _("unable to read in %s section from %pB"); diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 8e1abb3..c181523 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -2720,7 +2720,7 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int sec_index, if (bfd_seek (abfd, hdr->p_offset, SEEK_SET) != 0) return false; - if (bfd_bread (&sig, 4, abfd) != 4) + if (bfd_read (&sig, 4, abfd) != 4) return false; elf_tdata (abfd)->core->signal = sig; diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index a260c7e..28d3069 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -4703,7 +4703,7 @@ elf64_vms_write_shdrs_and_ehdr (bfd *abfd) bfd_putl64 (elf_ia64_vms_tdata (abfd)->needed_count, needed_count); if (bfd_seek (abfd, sizeof (Elf64_External_Ehdr), SEEK_SET) != 0 - || bfd_bwrite (needed_count, 8, abfd) != 8) + || bfd_write (needed_count, 8, abfd) != 8) return false; return true; @@ -4724,7 +4724,7 @@ elf64_vms_close_and_cleanup (bfd *abfd) uint64_t pad = 0; bfd_seek (abfd, isize, SEEK_SET); - bfd_bwrite (&pad, ishort, abfd); + bfd_write (&pad, ishort, abfd); } } diff --git a/bfd/elfcode.h b/bfd/elfcode.h index b227792..92e727b 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -529,7 +529,7 @@ elf_object_p (bfd *abfd) /* Read in the ELF header in external format. */ - if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr)) + if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr)) { if (bfd_get_error () != bfd_error_system_call) goto got_wrong_format_error; @@ -642,7 +642,7 @@ elf_object_p (bfd *abfd) /* Read the first section header at index 0, and convert to internal form. */ - if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) + if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) goto got_no_match; elf_swap_shdr_in (abfd, &x_shdr, &i_shdr); @@ -688,7 +688,7 @@ elf_object_p (bfd *abfd) if (bfd_seek (abfd, where, SEEK_SET) != 0) goto got_no_match; - if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) + if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) goto got_no_match; /* Back to where we were. */ @@ -730,7 +730,7 @@ elf_object_p (bfd *abfd) to internal form. */ for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++) { - if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) + if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) goto got_no_match; elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex); @@ -817,7 +817,7 @@ elf_object_p (bfd *abfd) = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt); if (elf_tdata (abfd)->phdr == NULL) goto got_no_match; - if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0) + if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0) goto got_no_match; bool eu_strip_broken_phdrs = false; i_phdr = elf_tdata (abfd)->phdr; @@ -825,7 +825,7 @@ elf_object_p (bfd *abfd) { Elf_External_Phdr x_phdr; - if (bfd_bread (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr) + if (bfd_read (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr) goto got_no_match; elf_swap_phdr_in (abfd, &x_phdr, i_phdr); /* Too much code in BFD relies on alignment being a power of @@ -1082,7 +1082,7 @@ elf_write_out_phdrs (bfd *abfd, Elf_External_Phdr extphdr; elf_swap_phdr_out (abfd, phdr, &extphdr); - if (bfd_bwrite (&extphdr, sizeof (Elf_External_Phdr), abfd) + if (bfd_write (&extphdr, sizeof (Elf_External_Phdr), abfd) != sizeof (Elf_External_Phdr)) return -1; phdr++; @@ -1112,8 +1112,8 @@ elf_write_shdrs_and_ehdr (bfd *abfd) #endif elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr); amt = sizeof (x_ehdr); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bwrite (&x_ehdr, amt, abfd) != amt) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || bfd_write (&x_ehdr, amt, abfd) != amt) return false; if ((abfd->flags & BFD_NO_SECTION_HEADER) != 0) @@ -1146,8 +1146,8 @@ elf_write_shdrs_and_ehdr (bfd *abfd) elf_swap_shdr_out (abfd, *i_shdrp, x_shdrp + count); } amt = (bfd_size_type) i_ehdrp->e_shnum * sizeof (*x_shdrp); - if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0 - || bfd_bwrite (x_shdrp, amt, abfd) != amt) + if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) != 0 + || bfd_write (x_shdrp, amt, abfd) != amt) return false; /* need to dump the string table too... */ diff --git a/bfd/elfcore.h b/bfd/elfcore.h index 77c240c..543f40b 100644 --- a/bfd/elfcore.h +++ b/bfd/elfcore.h @@ -95,7 +95,7 @@ elf_core_file_p (bfd *abfd) ufile_ptr filesize; /* Read in the ELF header in external format. */ - if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr)) + if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr)) { if (bfd_get_error () != bfd_error_system_call) goto wrong; @@ -185,7 +185,7 @@ elf_core_file_p (bfd *abfd) /* Read the first section header at index 0, and convert to internal form. */ - if (bfd_bread (&x_shdr, sizeof (x_shdr), abfd) != sizeof (x_shdr)) + if (bfd_read (&x_shdr, sizeof (x_shdr), abfd) != sizeof (x_shdr)) goto fail; elf_swap_shdr_in (abfd, &x_shdr, &i_shdr); @@ -217,12 +217,12 @@ elf_core_file_p (bfd *abfd) if (bfd_seek (abfd, where, SEEK_SET) != 0) goto fail; - if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) + if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) goto fail; } /* Move to the start of the program headers. */ - if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0) + if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0) goto wrong; /* Allocate space for the program headers. */ @@ -238,7 +238,7 @@ elf_core_file_p (bfd *abfd) { Elf_External_Phdr x_phdr; - if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) + if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) goto fail; elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex); @@ -315,7 +315,7 @@ NAME(_bfd_elf, core_find_build_id) goto fail; /* Read in the ELF header in external format. */ - if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr)) + if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr)) { if (bfd_get_error () != bfd_error_system_call) goto wrong; @@ -367,7 +367,7 @@ NAME(_bfd_elf, core_find_build_id) if (i_phdr == NULL) goto fail; - if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff), SEEK_SET) != 0) + if (bfd_seek (abfd, offset + i_ehdr.e_phoff, SEEK_SET) != 0) goto fail; /* Read in program headers and parse notes. */ @@ -375,7 +375,7 @@ NAME(_bfd_elf, core_find_build_id) { Elf_External_Phdr x_phdr; - if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) + if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) goto fail; elf_swap_phdr_in (abfd, &x_phdr, i_phdr); @@ -385,8 +385,8 @@ NAME(_bfd_elf, core_find_build_id) i_phdr->p_filesz, i_phdr->p_align); /* Make sure ABFD returns to processing the program headers. */ - if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff - + (i + 1) * sizeof (x_phdr)), + if (bfd_seek (abfd, + offset + i_ehdr.e_phoff + (i + 1) * sizeof (x_phdr), SEEK_SET) != 0) goto fail; diff --git a/bfd/elflink.c b/bfd/elflink.c index 7217c2f..c4f286e 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2651,7 +2651,7 @@ elf_link_read_relocs_from_section (bfd *abfd, return false; /* Read the relocations. */ - if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size) + if (bfd_read (external_relocs, shdr->sh_size, abfd) != shdr->sh_size) return false; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -10188,7 +10188,7 @@ elf_link_swap_symbols_out (struct elf_final_link_info *flinfo) pos = hdr->sh_offset + hdr->sh_size; amt = bed->s->sizeof_sym * flinfo->output_bfd->symcount; if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) == 0 - && bfd_bwrite (symbuf, amt, flinfo->output_bfd) == amt) + && bfd_write (symbuf, amt, flinfo->output_bfd) == amt) { hdr->sh_size += amt; ret = true; @@ -13071,7 +13071,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) off, true); if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_bwrite (flinfo.symshndxbuf, amt, abfd) != amt)) + || (bfd_write (flinfo.symshndxbuf, amt, abfd) != amt)) { ret = false; goto return_local_hash_table; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 1e9851c..92dd4c2 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -7355,7 +7355,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr) SEEK_SET) != 0) return false; H_PUT_32 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, 4, abfd) != 4) + if (bfd_write (buf, 4, abfd) != 4) return false; } @@ -7403,7 +7403,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr) SEEK_SET) != 0) return false; H_PUT_64 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, 8, abfd) != 8) + if (bfd_write (buf, 8, abfd) != 8) return false; } else if (intopt.kind == ODK_REGINFO) @@ -7418,7 +7418,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr) SEEK_SET) != 0) return false; H_PUT_32 (abfd, elf_gp (abfd), buf); - if (bfd_bwrite (buf, 4, abfd) != 4) + if (bfd_write (buf, 4, abfd) != 4) return false; } l += intopt.size; diff --git a/bfd/format.c b/bfd/format.c index c790f86..66dc2e7 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -359,7 +359,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) /* If the target type was explicitly specified, just check that target. */ if (!abfd->target_defaulted) { - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */ + if (bfd_seek (abfd, 0, SEEK_SET) != 0) /* rewind! */ goto err_ret; cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); @@ -425,7 +425,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) /* Change BFD's target temporarily. */ abfd->xvec = *target; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) goto err_ret; cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); @@ -573,7 +573,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) { bfd_reinit (abfd, initial_section_id, &preserve, cleanup); bfd_release (abfd, preserve.marker); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) goto err_ret; cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); BFD_ASSERT (cleanup != NULL); @@ -1119,8 +1119,8 @@ _bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab) bfd_byte buf[4]; /* The output length includes the null byte. */ - bfd_put_32 (abfd, (bfd_vma) len, buf); - if (bfd_bwrite ((void *) buf, (bfd_size_type) 4, abfd) != 4) + bfd_put_32 (abfd, len, buf); + if (bfd_write (buf, 4, abfd) != 4) return false; } else if (tab->length_field_size == 2) @@ -1128,12 +1128,12 @@ _bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab) bfd_byte buf[2]; /* The output length includes the null byte. */ - bfd_put_16 (abfd, (bfd_vma) len, buf); - if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2) + bfd_put_16 (abfd, len, buf); + if (bfd_write (buf, 2, abfd) != 2) return false; } - if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len) + if (bfd_write (str, len, abfd) != len) return false; } diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c index b9abc1a..4410db7 100644 --- a/bfd/hppabsd-core.c +++ b/bfd/hppabsd-core.c @@ -100,7 +100,7 @@ hppabsd_core_core_file_p (bfd *abfd) /* Try to read in the u-area. We will need information from this to know how to grok the rest of the core structures. */ - val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd); + val = bfd_read (&u, sizeof u, abfd); if (val != sizeof u) { if (bfd_get_error () != bfd_error_system_call) diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c index a165da4..f9603f5 100644 --- a/bfd/hpux-core.c +++ b/bfd/hpux-core.c @@ -161,8 +161,7 @@ hpux_core_core_file_p (bfd *abfd) int val; struct corehead core_header; - val = bfd_bread ((void *) &core_header, - (bfd_size_type) sizeof core_header, abfd); + val = bfd_read (&core_header, sizeof core_header, abfd); if (val <= 0) break; switch (core_header.type) @@ -170,14 +169,13 @@ hpux_core_core_file_p (bfd *abfd) case CORE_KERNEL: case CORE_FORMAT: /* Just skip this. */ - bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR); + bfd_seek (abfd, core_header.len, SEEK_CUR); good_sections++; break; case CORE_EXEC: { struct proc_exec proc_exec; - if (bfd_bread ((void *) &proc_exec, (bfd_size_type) core_header.len, - abfd) != core_header.len) + if (bfd_read (&proc_exec, core_header.len, abfd) != core_header.len) break; strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1); good_sections++; @@ -191,13 +189,12 @@ hpux_core_core_file_p (bfd *abfd) /* We need to read this section, 'cause we need to determine whether the core-dumped app was threaded before we create any .reg sections. */ - if (bfd_bread (&proc_info, (bfd_size_type) core_header.len, abfd) - != core_header.len) + if (bfd_read (&proc_info, core_header.len, abfd) != core_header.len) break; /* However, we also want to create those sections with the file positioned at the start of the record, it seems. */ - if (bfd_seek (abfd, -((file_ptr) core_header.len), SEEK_CUR) != 0) + if (bfd_seek (abfd, -(file_ptr) core_header.len, SEEK_CUR) != 0) break; #if defined(PROC_INFO_HAS_THREAD_ID) diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c index 1df85bd..c2eded8 100644 --- a/bfd/i386lynx.c +++ b/bfd/i386lynx.c @@ -34,48 +34,46 @@ #include "libbfd.h" #ifndef WRITE_HEADERS -#define WRITE_HEADERS(abfd, execp) \ - { \ - if (adata(abfd).magic == undecided_magic) \ - NAME(aout,adjust_sizes_and_vmas) (abfd); \ - \ - execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ - execp->a_entry = bfd_get_start_address (abfd); \ - \ - execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \ - obj_reloc_entry_size (abfd)); \ - execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \ - obj_reloc_entry_size (abfd)); \ - NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ - \ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ - || bfd_bwrite (&exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \ - abfd) != EXEC_BYTES_SIZE) \ - return false; \ - /* Now write out reloc info, followed by syms and strings */ \ - \ - if (bfd_get_symcount (abfd) != 0) \ - { \ - if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) \ - != 0) \ - return false; \ - \ - if (! NAME(aout,write_syms) (abfd)) return false; \ - \ - if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) \ - != 0) \ - return false; \ - \ - if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ - return false; \ - if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) \ - != 0) \ - return 0; \ - \ - if (!NAME(lynx,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ - return false; \ - } \ - } +#define WRITE_HEADERS(abfd, execp) \ + { \ + if (adata(abfd).magic == undecided_magic) \ + NAME (aout, adjust_sizes_and_vmas) (abfd); \ + \ + execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ + execp->a_entry = bfd_get_start_address (abfd); \ + \ + execp->a_trsize = ((obj_textsec (abfd)->reloc_count) \ + * obj_reloc_entry_size (abfd)); \ + execp->a_drsize = ((obj_datasec (abfd)->reloc_count) \ + * obj_reloc_entry_size (abfd)); \ + NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); \ + \ + if (bfd_seek (abfd, 0, SEEK_SET) != 0 \ + || bfd_write (&exec_bytes, EXEC_BYTES_SIZE, \ + abfd) != EXEC_BYTES_SIZE) \ + return false; \ + /* Now write out reloc info, followed by syms and strings. */ \ + \ + if (bfd_get_outsymbols (abfd) != NULL \ + && bfd_get_symcount (abfd) != 0) \ + { \ + if (bfd_seek (abfd, N_SYMOFF (execp), SEEK_SET) != 0) \ + return false; \ + \ + if (! NAME (aout, write_syms) (abfd)) \ + return false; \ + } \ + \ + if (bfd_seek (abfd, N_TRELOFF (execp), SEEK_SET) != 0) \ + return false; \ + if (!NAME (lynx, squirt_out_relocs) (abfd, obj_textsec (abfd))) \ + return false; \ + \ + if (bfd_seek (abfd, N_DRELOFF (execp), SEEK_SET) != 0) \ + return false; \ + if (!NAME (lynx, squirt_out_relocs) (abfd, obj_datasec (abfd))) \ + return false; \ + } #endif #include "libaout.h" @@ -494,7 +492,7 @@ NAME(lynx,squirt_out_relocs) (bfd *abfd, asection *section) NAME(lynx,swap_std_reloc_out) (abfd, *generic, (struct reloc_std_external *) natptr); } - if (bfd_bwrite (native, natsize, abfd) != natsize) + if (bfd_write (native, natsize, abfd) != natsize) { bfd_release (abfd, native); return false; diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 49e566d..5d8788f 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -49,8 +49,8 @@ msdos_object_p (bfd *abfd) asection *section; bfd_size_type size; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || (size = bfd_bread (&hdr, sizeof (hdr), abfd)) + 1 < DOS_HDR_SIZE + 1) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || (size = bfd_read (&hdr, sizeof (hdr), abfd)) + 1 < DOS_HDR_SIZE + 1) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -71,7 +71,7 @@ msdos_object_p (bfd *abfd) || H_GET_16 (abfd, hdr.e_cparhdr) < 4) ; else if (bfd_seek (abfd, H_GET_32 (abfd, hdr.e_lfanew), SEEK_SET) != 0 - || bfd_bread (buffer, (bfd_size_type) 2, abfd) != 2) + || bfd_read (buffer, 2, abfd) != 2) { if (bfd_get_error () == bfd_error_system_call) return NULL; @@ -179,8 +179,8 @@ msdos_write_object_contents (bfd *abfd) The program's crt0 code must relocate it to a real stack. */ H_PUT_16 (abfd, high_vma, &hdr[16]); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bwrite (hdr, (bfd_size_type) sizeof(hdr), abfd) != sizeof(hdr)) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || bfd_write (hdr, sizeof (hdr), abfd) != sizeof (hdr)) return false; return true; @@ -202,7 +202,7 @@ msdos_set_section_contents (bfd *abfd, if (bfd_section_flags (section) & SEC_LOAD) { if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_bwrite (location, count, abfd) != count) + || bfd_write (location, count, abfd) != count) return false; } @@ -194,14 +194,14 @@ ihex_get_byte (bfd *abfd, bool *errorptr) { bfd_byte c; - if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1) + if (bfd_read (&c, 1, abfd) != 1) { if (bfd_get_error () != bfd_error_file_truncated) *errorptr = true; return EOF; } - return (int) (c & 0xff); + return c & 0xff; } /* Report a problem in an Intel Hex file. */ @@ -248,7 +248,7 @@ ihex_scan (bfd *abfd) size_t bufsize; int c; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) goto error_return; abfd->start_address = 0; @@ -289,7 +289,7 @@ ihex_scan (bfd *abfd) pos = bfd_tell (abfd) - 1; /* Read the header bytes. */ - if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8) + if (bfd_read (hdr, 8, abfd) != 8) goto error_return; for (i = 0; i < 8; i++) @@ -309,13 +309,13 @@ ihex_scan (bfd *abfd) chars = len * 2 + 2; if (chars >= bufsize) { - buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars); + buf = bfd_realloc (buf, chars); if (buf == NULL) goto error_return; bufsize = chars; } - if (bfd_bread (buf, (bfd_size_type) chars, abfd) != chars) + if (bfd_read (buf, chars, abfd) != chars) goto error_return; for (i = 0; i < chars; i++) @@ -493,9 +493,9 @@ ihex_object_p (bfd *abfd) ihex_init (); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) return NULL; - if (bfd_bread (b, (bfd_size_type) 9, abfd) != 9) + if (bfd_read (b, 9, abfd) != 9) { if (bfd_get_error () == bfd_error_file_truncated) bfd_set_error (bfd_error_wrong_format); @@ -568,7 +568,7 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) know the exact format. */ BFD_ASSERT (c == ':'); - if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8) + if (bfd_read (hdr, 8, abfd) != 8) goto error_return; len = HEX2 (hdr); @@ -585,13 +585,13 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) if (len * 2 > bufsize) { - buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2); + buf = bfd_realloc (buf, len * 2); if (buf == NULL) goto error_return; bufsize = len * 2; } - if (bfd_bread (buf, (bfd_size_type) len * 2, abfd) != len * 2) + if (bfd_read (buf, len * 2, abfd) != len * 2) goto error_return; for (i = 0; i < len; i++) @@ -604,7 +604,7 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) } /* Skip the checksum. */ - if (bfd_bread (buf, (bfd_size_type) 2, abfd) != 2) + if (bfd_read (buf, 2, abfd) != 2) goto error_return; } @@ -745,7 +745,7 @@ ihex_write_record (bfd *abfd, p[3] = '\n'; total = 9 + count * 2 + 4; - if (bfd_bwrite (buf, (bfd_size_type) total, abfd) != total) + if (bfd_write (buf, total, abfd) != total) return false; return true; diff --git a/bfd/irix-core.c b/bfd/irix-core.c index f32ebea..fe564e4 100644 --- a/bfd/irix-core.c +++ b/bfd/irix-core.c @@ -61,7 +61,7 @@ do_sections64 (bfd *abfd, struct coreout *coreout) for (i = 0; i < coreout->c_nvmap; i++) { - val = bfd_bread (&vmap, (bfd_size_type) sizeof vmap, abfd); + val = bfd_read (&vmap, sizeof vmap, abfd); if (val != sizeof vmap) break; @@ -109,7 +109,7 @@ do_sections (bfd *abfd, struct coreout *coreout) for (i = 0; i < coreout->c_nvmap; i++) { - val = bfd_bread (&vmap, (bfd_size_type) sizeof vmap, abfd); + val = bfd_read (&vmap, sizeof vmap, abfd); if (val != sizeof vmap) break; @@ -174,7 +174,7 @@ irix_core_core_file_p (bfd *abfd) struct idesc *idg, *idf, *ids; size_t amt; - val = bfd_bread (&coreout, (bfd_size_type) sizeof coreout, abfd); + val = bfd_read (&coreout, sizeof coreout, abfd); if (val != sizeof coreout) { if (bfd_get_error () != bfd_error_system_call) diff --git a/bfd/libaout.h b/bfd/libaout.h index 20487af..5491d9b 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -619,46 +619,46 @@ extern bool NAME (aout, bfd_free_cached_info) #endif #ifndef WRITE_HEADERS -#define WRITE_HEADERS(abfd, execp) \ - { \ - if (adata(abfd).magic == undecided_magic) \ - NAME (aout, adjust_sizes_and_vmas) (abfd); \ - \ - execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ - execp->a_entry = bfd_get_start_address (abfd); \ - \ - execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \ - obj_reloc_entry_size (abfd)); \ - execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \ - obj_reloc_entry_size (abfd)); \ - NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes); \ - \ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ - || bfd_bwrite (& exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \ - abfd) != EXEC_BYTES_SIZE) \ - return false; \ - /* Now write out reloc info, followed by syms and strings. */ \ - \ - if (bfd_get_outsymbols (abfd) != NULL \ - && bfd_get_symcount (abfd) != 0) \ - { \ - if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0)\ - return false; \ - \ - if (! NAME (aout, write_syms) (abfd)) \ - return false; \ - } \ - \ - if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0) \ - return false; \ - if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \ - return false; \ - \ - if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0) \ - return false; \ - if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \ - return false; \ - } +#define WRITE_HEADERS(abfd, execp) \ + { \ + if (adata(abfd).magic == undecided_magic) \ + NAME (aout, adjust_sizes_and_vmas) (abfd); \ + \ + execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ + execp->a_entry = bfd_get_start_address (abfd); \ + \ + execp->a_trsize = ((obj_textsec (abfd)->reloc_count) \ + * obj_reloc_entry_size (abfd)); \ + execp->a_drsize = ((obj_datasec (abfd)->reloc_count) \ + * obj_reloc_entry_size (abfd)); \ + NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); \ + \ + if (bfd_seek (abfd, 0, SEEK_SET) != 0 \ + || bfd_write (&exec_bytes, EXEC_BYTES_SIZE, \ + abfd) != EXEC_BYTES_SIZE) \ + return false; \ + /* Now write out reloc info, followed by syms and strings. */ \ + \ + if (bfd_get_outsymbols (abfd) != NULL \ + && bfd_get_symcount (abfd) != 0) \ + { \ + if (bfd_seek (abfd, N_SYMOFF (execp), SEEK_SET) != 0) \ + return false; \ + \ + if (! NAME (aout, write_syms) (abfd)) \ + return false; \ + } \ + \ + if (bfd_seek (abfd, N_TRELOFF (execp), SEEK_SET) != 0) \ + return false; \ + if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \ + return false; \ + \ + if (bfd_seek (abfd, N_DRELOFF (execp), SEEK_SET) != 0) \ + return false; \ + if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \ + return false; \ + } #endif /* Test if a read-only section can be merged with .text. This is diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 03ae099..fc4b7bc 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -884,7 +884,7 @@ _bfd_alloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize) mem = bfd_alloc (abfd, asize); if (mem != NULL) { - if (bfd_bread (mem, rsize, abfd) == rsize) + if (bfd_read (mem, rsize, abfd) == rsize) return mem; bfd_release (abfd, mem); } @@ -907,7 +907,7 @@ _bfd_malloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize) mem = bfd_malloc (asize); if (mem != NULL) { - if (bfd_bread (mem, rsize, abfd) == rsize) + if (bfd_read (mem, rsize, abfd) == rsize) return mem; free (mem); } diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 7c75047..fafdf49 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -515,8 +515,8 @@ bool bfd_write_bigendian_4byte_int (bfd *abfd, unsigned int i) { bfd_byte buffer[4]; - bfd_putb32 ((bfd_vma) i, buffer); - return bfd_bwrite (buffer, (bfd_size_type) 4, abfd) == 4; + bfd_putb32 (i, buffer); + return bfd_write (buffer, 4, abfd) == 4; } @@ -1067,7 +1067,7 @@ _bfd_generic_get_section_contents (bfd *abfd, } if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_bread (location, count, abfd) != count) + || bfd_read (location, count, abfd) != count) return false; return true; @@ -1145,7 +1145,7 @@ _bfd_generic_set_section_contents (bfd *abfd, return true; if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_bwrite (location, count, abfd) != count) + || bfd_write (location, count, abfd) != count) return false; return true; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 1fc88a8..a84febd 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -890,7 +890,7 @@ _bfd_alloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize) mem = bfd_alloc (abfd, asize); if (mem != NULL) { - if (bfd_bread (mem, rsize, abfd) == rsize) + if (bfd_read (mem, rsize, abfd) == rsize) return mem; bfd_release (abfd, mem); } @@ -913,7 +913,7 @@ _bfd_malloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize) mem = bfd_malloc (asize); if (mem != NULL) { - if (bfd_bread (mem, rsize, abfd) == rsize) + if (bfd_read (mem, rsize, abfd) == rsize) return mem; free (mem); } diff --git a/bfd/lynx-core.c b/bfd/lynx-core.c index d9d88d2..90b8e26 100644 --- a/bfd/lynx-core.c +++ b/bfd/lynx-core.c @@ -102,11 +102,11 @@ lynx_core_file_p (bfd *abfd) /* Get the pss entry from the core file */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) return NULL; amt = sizeof pss; - if (bfd_bread ((void *) &pss, amt, abfd) != amt) + if (bfd_read (&pss, amt, abfd) != amt) { /* Too small to be a core file */ if (bfd_get_error () != bfd_error_system_call) diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 4d414fd..ec75876 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -1208,7 +1208,7 @@ bfd_mach_o_pad4 (bfd *abfd, size_t len) char pad[4] = {0,0,0,0}; unsigned int padlen = 4 - (len % 4); - if (bfd_bwrite (pad, padlen, abfd) != padlen) + if (bfd_write (pad, padlen, abfd) != padlen) return -1; return padlen; @@ -1229,7 +1229,7 @@ bfd_mach_o_pad_command (bfd *abfd, size_t len) char pad[8] = {0}; size_t padlen = align - (len % align); - if (bfd_bwrite (pad, padlen, abfd) != padlen) + if (bfd_write (pad, padlen, abfd) != padlen) return -1; return padlen; @@ -1259,7 +1259,7 @@ bfd_mach_o_write_header (bfd *abfd, bfd_mach_o_header *header) bfd_h_put_32 (abfd, header->reserved, raw.reserved); if (bfd_seek (abfd, 0, SEEK_SET) != 0 - || bfd_bwrite (&raw, size, abfd) != size) + || bfd_write (&raw, size, abfd) != size) return false; return true; @@ -1287,7 +1287,7 @@ bfd_mach_o_write_thread (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, (cmd->flavours[i].size / 4), raw.count); if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; offset += cmd->flavours[i].size + sizeof (raw); @@ -1306,11 +1306,11 @@ bfd_mach_o_write_dylinker (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, cmd->name_offset, raw.str); if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; namelen = strlen (cmd->name_str) + 1; - if (bfd_bwrite (cmd->name_str, namelen, abfd) != namelen) + if (bfd_write (cmd->name_str, namelen, abfd) != namelen) return false; if (bfd_mach_o_pad_command (abfd, namelen) < 0) @@ -1332,11 +1332,11 @@ bfd_mach_o_write_dylib (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, cmd->compatibility_version, raw.compatibility_version); if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; namelen = strlen (cmd->name_str) + 1; - if (bfd_bwrite (cmd->name_str, namelen, abfd) != namelen) + if (bfd_write (cmd->name_str, namelen, abfd) != namelen) return false; if (bfd_mach_o_pad_command (abfd, namelen) < 0) @@ -1355,7 +1355,7 @@ bfd_mach_o_write_main (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_64 (abfd, cmd->stacksize, raw.stacksize); if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; return true; @@ -1379,36 +1379,36 @@ bfd_mach_o_write_dyld_info (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, cmd->export_size, raw.export_size); if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; if (cmd->rebase_size != 0) if (bfd_seek (abfd, cmd->rebase_off, SEEK_SET) != 0 - || (bfd_bwrite (cmd->rebase_content, cmd->rebase_size, abfd) != + || (bfd_write (cmd->rebase_content, cmd->rebase_size, abfd) != cmd->rebase_size)) return false; if (cmd->bind_size != 0) if (bfd_seek (abfd, cmd->bind_off, SEEK_SET) != 0 - || (bfd_bwrite (cmd->bind_content, cmd->bind_size, abfd) != + || (bfd_write (cmd->bind_content, cmd->bind_size, abfd) != cmd->bind_size)) return false; if (cmd->weak_bind_size != 0) if (bfd_seek (abfd, cmd->weak_bind_off, SEEK_SET) != 0 - || (bfd_bwrite (cmd->weak_bind_content, cmd->weak_bind_size, abfd) != + || (bfd_write (cmd->weak_bind_content, cmd->weak_bind_size, abfd) != cmd->weak_bind_size)) return false; if (cmd->lazy_bind_size != 0) if (bfd_seek (abfd, cmd->lazy_bind_off, SEEK_SET) != 0 - || (bfd_bwrite (cmd->lazy_bind_content, cmd->lazy_bind_size, abfd) != + || (bfd_write (cmd->lazy_bind_content, cmd->lazy_bind_size, abfd) != cmd->lazy_bind_size)) return false; if (cmd->export_size != 0) if (bfd_seek (abfd, cmd->export_off, SEEK_SET) != 0 - || (bfd_bwrite (cmd->export_content, cmd->export_size, abfd) != + || (bfd_write (cmd->export_content, cmd->export_size, abfd) != cmd->export_size)) return false; @@ -1870,7 +1870,7 @@ bfd_mach_o_write_relocs (bfd *abfd, bfd_mach_o_section *section) pinfo); } - if (bfd_bwrite (&raw, BFD_MACH_O_RELENT_SIZE, abfd) + if (bfd_write (&raw, BFD_MACH_O_RELENT_SIZE, abfd) != BFD_MACH_O_RELENT_SIZE) return false; } @@ -1894,7 +1894,7 @@ bfd_mach_o_write_section_32 (bfd *abfd, bfd_mach_o_section *section) bfd_h_put_32 (abfd, section->reserved1, raw.reserved1); bfd_h_put_32 (abfd, section->reserved2, raw.reserved2); - if (bfd_bwrite (&raw, BFD_MACH_O_SECTION_SIZE, abfd) + if (bfd_write (&raw, BFD_MACH_O_SECTION_SIZE, abfd) != BFD_MACH_O_SECTION_SIZE) return false; @@ -1919,7 +1919,7 @@ bfd_mach_o_write_section_64 (bfd *abfd, bfd_mach_o_section *section) bfd_h_put_32 (abfd, section->reserved2, raw.reserved2); bfd_h_put_32 (abfd, section->reserved3, raw.reserved3); - if (bfd_bwrite (&raw, BFD_MACH_O_SECTION_64_SIZE, abfd) + if (bfd_write (&raw, BFD_MACH_O_SECTION_64_SIZE, abfd) != BFD_MACH_O_SECTION_64_SIZE) return false; @@ -1950,7 +1950,7 @@ bfd_mach_o_write_segment_32 (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, seg->flags, raw.flags); if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; for (sec = seg->sect_head; sec != NULL; sec = sec->next) @@ -1984,7 +1984,7 @@ bfd_mach_o_write_segment_64 (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, seg->flags, raw.flags); if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; for (sec = seg->sect_head; sec != NULL; sec = sec->next) @@ -2045,7 +2045,7 @@ bfd_mach_o_write_symtab_content (bfd *abfd, bfd_mach_o_symtab_command *sym) bfd_h_put_64 (abfd, s->symbol.section->vma + s->symbol.value, raw.n_value); - if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) goto err; } else @@ -2059,7 +2059,7 @@ bfd_mach_o_write_symtab_content (bfd *abfd, bfd_mach_o_symtab_command *sym) bfd_h_put_32 (abfd, s->symbol.section->vma + s->symbol.value, raw.n_value); - if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) goto err; } } @@ -2105,7 +2105,7 @@ bfd_mach_o_write_symtab (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, sym->strsize, raw.strsize); if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0 - || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; return true; @@ -2301,7 +2301,7 @@ bfd_mach_o_write_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, module->objc_module_info_size, &w.objc_module_info_size); - if (bfd_bwrite ((void *) &w, sizeof (w), abfd) != sizeof (w)) + if (bfd_write (&w, sizeof (w), abfd) != sizeof (w)) return false; } else @@ -2324,7 +2324,7 @@ bfd_mach_o_write_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, module->objc_module_info_size, &n.objc_module_info_size); - if (bfd_bwrite ((void *) &n, sizeof (n), abfd) != sizeof (n)) + if (bfd_write (&n, sizeof (n), abfd) != sizeof (n)) return false; } } @@ -2345,7 +2345,7 @@ bfd_mach_o_write_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, toc->symbol_index, &raw.symbol_index); bfd_h_put_32 (abfd, toc->module_index, &raw.module_index); - if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; } } @@ -2362,7 +2362,7 @@ bfd_mach_o_write_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) unsigned char raw[4]; bfd_h_put_32 (abfd, cmd->indirect_syms[i], &raw); - if (bfd_bwrite (raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_write (raw, sizeof (raw), abfd) != sizeof (raw)) return false; } } @@ -2395,7 +2395,7 @@ bfd_mach_o_write_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) } bfd_h_put_32 (abfd, v, raw); - if (bfd_bwrite (raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_write (raw, sizeof (raw), abfd) != sizeof (raw)) return false; } } @@ -2426,7 +2426,7 @@ bfd_mach_o_write_dysymtab (bfd *abfd, bfd_mach_o_load_command *command) bfd_h_put_32 (abfd, cmd->locreloff, &raw.locreloff); bfd_h_put_32 (abfd, cmd->nlocrel, &raw.nlocrel); - if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; } @@ -2753,7 +2753,7 @@ bfd_mach_o_write_contents (bfd *abfd) bfd_h_put_32 (abfd, cmd->len, raw.cmdsize); if (bfd_seek (abfd, cmd->offset, SEEK_SET) != 0 - || bfd_bwrite (&raw, BFD_MACH_O_LC_SIZE, abfd) != 8) + || bfd_write (&raw, BFD_MACH_O_LC_SIZE, abfd) != 8) return false; switch (cmd->type) @@ -3419,7 +3419,7 @@ bfd_mach_o_set_section_contents (bfd *abfd, pos = section->filepos + offset; if (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bwrite (location, count, abfd) != count) + || bfd_write (location, count, abfd) != count) return false; return true; @@ -3457,7 +3457,7 @@ bfd_mach_o_read_header (bfd *abfd, file_ptr hdr_off, bfd_mach_o_header *header) /* Just read the magic number. */ if (bfd_seek (abfd, hdr_off, SEEK_SET) != 0 - || bfd_bread (raw.magic, sizeof (raw.magic), abfd) != 4) + || bfd_read (raw.magic, sizeof (raw.magic), abfd) != 4) return false; if (bfd_getb32 (raw.magic) == BFD_MACH_O_MH_MAGIC) @@ -3499,7 +3499,7 @@ bfd_mach_o_read_header (bfd *abfd, file_ptr hdr_off, bfd_mach_o_header *header) BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE; if (bfd_seek (abfd, hdr_off, SEEK_SET) != 0 - || bfd_bread (&raw, size, abfd) != size) + || bfd_read (&raw, size, abfd) != size) return false; header->cputype = (*get32) (raw.cputype); @@ -3637,7 +3637,7 @@ bfd_mach_o_read_section_32 (bfd *abfd, unsigned long prot) asection *sec; bfd_mach_o_section *section; - if (bfd_bread (&raw, BFD_MACH_O_SECTION_SIZE, abfd) + if (bfd_read (&raw, BFD_MACH_O_SECTION_SIZE, abfd) != BFD_MACH_O_SECTION_SIZE) return NULL; @@ -3681,7 +3681,7 @@ bfd_mach_o_read_section_64 (bfd *abfd, unsigned long prot) asection *sec; bfd_mach_o_section *section; - if (bfd_bread (&raw, BFD_MACH_O_SECTION_64_SIZE, abfd) + if (bfd_read (&raw, BFD_MACH_O_SECTION_64_SIZE, abfd) != BFD_MACH_O_SECTION_64_SIZE) return NULL; @@ -3748,7 +3748,7 @@ bfd_mach_o_read_symtab_symbol (bfd *abfd, BFD_ASSERT (sym->strtab != NULL); if (bfd_seek (abfd, symoff, SEEK_SET) != 0 - || bfd_bread (&raw, symwidth, abfd) != symwidth) + || bfd_read (&raw, symwidth, abfd) != symwidth) { _bfd_error_handler /* xgettext:c-format */ @@ -4041,7 +4041,7 @@ bfd_mach_o_read_dylinker (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; nameoff = bfd_h_get_32 (abfd, raw.str); @@ -4082,7 +4082,7 @@ bfd_mach_o_read_dylib (bfd *abfd, bfd_mach_o_load_command *command) return false; } - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; nameoff = bfd_h_get_32 (abfd, raw.name); @@ -4112,7 +4112,7 @@ bfd_mach_o_read_prebound_dylib (bfd *abfd, if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; nameoff = bfd_h_get_32 (abfd, raw.name); @@ -4143,7 +4143,7 @@ bfd_mach_o_read_prebind_cksum (bfd *abfd, if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->cksum = bfd_get_32 (abfd, raw.cksum); @@ -4159,7 +4159,7 @@ bfd_mach_o_read_twolevel_hints (bfd *abfd, if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->offset = bfd_get_32 (abfd, raw.offset); @@ -4177,7 +4177,7 @@ bfd_mach_o_read_fvmlib (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; nameoff = bfd_h_get_32 (abfd, raw.name); @@ -4215,7 +4215,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command) unsigned int count; if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 - || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; count = bfd_h_get_32 (abfd, raw.count); @@ -4244,7 +4244,7 @@ bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command) while (offset != command->len) { if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0 - || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + || bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->flavours[nflavours].flavour = bfd_h_get_32 (abfd, raw.flavour); @@ -4321,7 +4321,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command, if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->ilocalsym = bfd_h_get_32 (abfd, raw.ilocalsym); @@ -4376,7 +4376,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command, unsigned long v; unsigned char buf[56]; - if (bfd_bread ((void *) buf, module_len, abfd) != module_len) + if (bfd_read (buf, module_len, abfd) != module_len) return false; module->module_name_idx = bfd_h_get_32 (abfd, buf + 0); @@ -4436,7 +4436,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command, { bfd_mach_o_dylib_table_of_content *toc = &cmd->dylib_toc[i]; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; toc->symbol_index = bfd_h_get_32 (abfd, raw.symbol_index); @@ -4472,7 +4472,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command, unsigned char raw[4]; unsigned int *is = &cmd->indirect_syms[i]; - if (bfd_bread (raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (raw, sizeof (raw), abfd) != sizeof (raw)) return false; *is = bfd_h_get_32 (abfd, raw); @@ -4509,7 +4509,7 @@ bfd_mach_o_read_dysymtab (bfd *abfd, bfd_mach_o_load_command *command, unsigned char raw[4]; bfd_mach_o_dylib_reference *ref = &cmd->ext_refs[i]; - if (bfd_bread (raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (raw, sizeof (raw), abfd) != sizeof (raw)) return false; /* Fields isym and flags are written as bit-fields, thus we need @@ -4547,7 +4547,7 @@ bfd_mach_o_read_symtab (bfd *abfd, bfd_mach_o_load_command *command, if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; symtab->symoff = bfd_h_get_32 (abfd, raw.symoff); @@ -4584,7 +4584,7 @@ bfd_mach_o_read_uuid (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < 16 + 8) return false; - if (bfd_bread (cmd->uuid, 16, abfd) != 16) + if (bfd_read (cmd->uuid, 16, abfd) != 16) return false; return true; @@ -4598,7 +4598,7 @@ bfd_mach_o_read_linkedit (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->dataoff = bfd_get_32 (abfd, raw.dataoff); @@ -4615,7 +4615,7 @@ bfd_mach_o_read_str (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; off = bfd_get_32 (abfd, raw.str); @@ -4693,7 +4693,7 @@ bfd_mach_o_read_dyld_info (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->rebase_off = bfd_get_32 (abfd, raw.rebase_off); @@ -4722,7 +4722,7 @@ bfd_mach_o_read_version_min (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->version = bfd_get_32 (abfd, raw.version); @@ -4738,7 +4738,7 @@ bfd_mach_o_read_encryption_info (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->cryptoff = bfd_get_32 (abfd, raw.cryptoff); @@ -4755,7 +4755,7 @@ bfd_mach_o_read_encryption_info_64 (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->cryptoff = bfd_get_32 (abfd, raw.cryptoff); @@ -4772,7 +4772,7 @@ bfd_mach_o_read_main (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->entryoff = bfd_get_64 (abfd, raw.entryoff); @@ -4789,7 +4789,7 @@ bfd_mach_o_read_source_version (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; ver = bfd_get_64 (abfd, raw.version); @@ -4816,7 +4816,7 @@ bfd_mach_o_read_note (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; memcpy (cmd->data_owner, raw.data_owner, 16); @@ -4833,7 +4833,7 @@ bfd_mach_o_read_build_version (bfd *abfd, bfd_mach_o_load_command *command) if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; cmd->platform = bfd_get_32 (abfd, raw.platform); @@ -4859,7 +4859,7 @@ bfd_mach_o_read_segment (bfd *abfd, if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; memcpy (seg->segname, raw.segname, 16); @@ -4882,7 +4882,7 @@ bfd_mach_o_read_segment (bfd *abfd, if (command->len < sizeof (raw) + 8) return false; - if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw)) + if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw)) return false; memcpy (seg->segname, raw.segname, 16); @@ -4937,7 +4937,7 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command, /* Read command type and length. */ if (bfd_seek (abfd, mdata->hdr_offset + command->offset, SEEK_SET) != 0 - || bfd_bread (&raw, BFD_MACH_O_LC_SIZE, abfd) != BFD_MACH_O_LC_SIZE) + || bfd_read (&raw, BFD_MACH_O_LC_SIZE, abfd) != BFD_MACH_O_LC_SIZE) return false; cmd = bfd_h_get_32 (abfd, raw.cmd); @@ -5173,7 +5173,7 @@ bfd_mach_o_scan_start_address (bfd *abfd) unsigned char buf[4]; if (bfd_seek (abfd, thr->flavours[i].offset + 40, SEEK_SET) != 0 - || bfd_bread (buf, 4, abfd) != 4) + || bfd_read (buf, 4, abfd) != 4) return false; abfd->start_address = bfd_h_get_32 (abfd, buf); @@ -5184,7 +5184,7 @@ bfd_mach_o_scan_start_address (bfd *abfd) unsigned char buf[4]; if (bfd_seek (abfd, thr->flavours[i].offset + 0, SEEK_SET) != 0 - || bfd_bread (buf, 4, abfd) != 4) + || bfd_read (buf, 4, abfd) != 4) return false; abfd->start_address = bfd_h_get_32 (abfd, buf); @@ -5195,7 +5195,7 @@ bfd_mach_o_scan_start_address (bfd *abfd) unsigned char buf[8]; if (bfd_seek (abfd, thr->flavours[i].offset + 0, SEEK_SET) != 0 - || bfd_bread (buf, 8, abfd) != 8) + || bfd_read (buf, 8, abfd) != 8) return false; abfd->start_address = bfd_h_get_64 (abfd, buf); @@ -5206,7 +5206,7 @@ bfd_mach_o_scan_start_address (bfd *abfd) unsigned char buf[8]; if (bfd_seek (abfd, thr->flavours[i].offset + (16 * 8), SEEK_SET) != 0 - || bfd_bread (buf, 8, abfd) != 8) + || bfd_read (buf, 8, abfd) != 8) return false; abfd->start_address = bfd_h_get_64 (abfd, buf); @@ -5540,7 +5540,7 @@ bfd_mach_o_fat_archive_p (bfd *abfd) ufile_ptr filesize; if (bfd_seek (abfd, 0, SEEK_SET) != 0 - || bfd_bread (&hdr, sizeof (hdr), abfd) != sizeof (hdr)) + || bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr)) goto error; adata = bfd_alloc (abfd, sizeof (mach_o_fat_data_struct)); @@ -5571,7 +5571,7 @@ bfd_mach_o_fat_archive_p (bfd *abfd) for (i = 0; i < adata->nfat_arch; i++) { struct mach_o_fat_arch_external arch; - if (bfd_bread (&arch, sizeof (arch), abfd) != sizeof (arch)) + if (bfd_read (&arch, sizeof (arch), abfd) != sizeof (arch)) goto error; adata->archentries[i].cputype = bfd_getb32 (arch.cputype); adata->archentries[i].cpusubtype = bfd_getb32 (arch.cpusubtype); @@ -5961,7 +5961,7 @@ bfd_mach_o_core_fetch_environment (bfd *abfd, return -1; } - nread = bfd_bread (buf, size, abfd); + nread = bfd_read (buf, size, abfd); if (nread != size) { diff --git a/bfd/merge.c b/bfd/merge.c index 327bd66..722e665 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -545,7 +545,7 @@ sec_merge_emit (bfd *abfd, struct sec_merge_sec_info *secinfo, memcpy (contents + offset, pad, len); offset += len; } - else if (bfd_bwrite (pad, len, abfd) != len) + else if (bfd_write (pad, len, abfd) != len) goto err; off += len; } @@ -558,7 +558,7 @@ sec_merge_emit (bfd *abfd, struct sec_merge_sec_info *secinfo, memcpy (contents + offset, str, len); offset += len; } - else if (bfd_bwrite (str, len, abfd) != len) + else if (bfd_write (str, len, abfd) != len) goto err; off += len; @@ -572,7 +572,7 @@ sec_merge_emit (bfd *abfd, struct sec_merge_sec_info *secinfo, BFD_ASSERT (off <= pad_len); if (contents) memcpy (contents + offset, pad, off); - else if (bfd_bwrite (pad, off, abfd) != off) + else if (bfd_write (pad, off, abfd) != off) goto err; } @@ -503,8 +503,8 @@ mmo_object_p (bfd *abfd) mmo_init (); if (bfd_stat (abfd, &statbuf) < 0 - || bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bread (b, 4, abfd) != 4) + || bfd_seek (abfd, 0, SEEK_SET) != 0 + || bfd_read (b, 4, abfd) != 4) goto bad_final; /* All mmo files are a multiple of four bytes long. @@ -514,8 +514,8 @@ mmo_object_p (bfd *abfd) goto bad_format; /* Get the last 32-bit word. */ - if (bfd_seek (abfd, (file_ptr) statbuf.st_size - 4, SEEK_SET) != 0 - || bfd_bread (b, 4, abfd) != 4) + if (bfd_seek (abfd, statbuf.st_size - 4, SEEK_SET) != 0 + || bfd_read (b, 4, abfd) != 4) goto bad_final; /* Check if the file ends in a lop_end lopcode. */ @@ -789,7 +789,7 @@ mmo_write_tetra_raw (bfd *abfd, unsigned int value) bfd_put_32 (abfd, value, buf); - if (bfd_bwrite (buf, 4, abfd) != 4) + if (bfd_write (buf, 4, abfd) != 4) abfd->tdata.mmo_data->have_error = true; } @@ -854,7 +854,7 @@ mmo_write_chunk (bfd *abfd, const bfd_byte *loc, unsigned int len) retval = (retval && ! mmop->have_error - && 4 == bfd_bwrite (loc, 4, abfd)); + && 4 == bfd_write (loc, 4, abfd)); loc += 4; len -= 4; @@ -1032,7 +1032,7 @@ mmo_get_spec_section (bfd *abfd, int spec_data_number) orig_pos = bfd_tell (abfd); /* Read the length (in 32-bit words). */ - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) goto format_error; if (buf[0] == LOP) @@ -1040,7 +1040,7 @@ mmo_get_spec_section (bfd *abfd, int spec_data_number) if (buf[1] != LOP_QUOTE) goto format_error; - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) goto format_error; } @@ -1058,7 +1058,7 @@ mmo_get_spec_section (bfd *abfd, int spec_data_number) for (i = 0; i < secname_length / 4; i++) { - if (bfd_bread (secname + i * 4, 4, abfd) != 4) + if (bfd_read (secname + i * 4, 4, abfd) != 4) goto format_error_free; if (secname[i * 4] == (char) LOP) @@ -1066,7 +1066,7 @@ mmo_get_spec_section (bfd *abfd, int spec_data_number) /* A bit of overkill, but we handle char 0x98 in a section name, and recognize misparsing. */ if (secname[i * 4 + 1] != LOP_QUOTE - || bfd_bread (secname + i * 4, 4, abfd) != 4) + || bfd_read (secname + i * 4, 4, abfd) != 4) /* Whoops. We thought this was a name, and now we found a non-lop_quote lopcode before we parsed the whole length of the name. Signal end-of-file in the same manner. */ @@ -1075,26 +1075,26 @@ mmo_get_spec_section (bfd *abfd, int spec_data_number) } /* Get the section flags. */ - if (bfd_bread (buf, 4, abfd) != 4 + if (bfd_read (buf, 4, abfd) != 4 || (buf[0] == LOP - && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4))) goto format_error_free; flags = bfd_get_32 (abfd, buf); /* Get the section length. */ - if (bfd_bread (buf, 4, abfd) != 4 + if (bfd_read (buf, 4, abfd) != 4 || (buf[0] == LOP - && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4))) goto format_error_free; section_length = (bfd_vma) bfd_get_32 (abfd, buf) << 32; /* That's the first, high-part. Now get the low part. */ - if (bfd_bread (buf, 4, abfd) != 4 + if (bfd_read (buf, 4, abfd) != 4 || (buf[0] == LOP - && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4))) goto format_error_free; section_length |= (bfd_vma) bfd_get_32 (abfd, buf); @@ -1104,17 +1104,17 @@ mmo_get_spec_section (bfd *abfd, int spec_data_number) goto format_error_free; /* Get the section VMA. */ - if (bfd_bread (buf, 4, abfd) != 4 + if (bfd_read (buf, 4, abfd) != 4 || (buf[0] == LOP - && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4))) goto format_error_free; section_vma = (bfd_vma) bfd_get_32 (abfd, buf) << 32; /* That's the first, high-part. Now get the low part. */ - if (bfd_bread (buf, 4, abfd) != 4 + if (bfd_read (buf, 4, abfd) != 4 || (buf[0] == LOP - && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4))) goto format_error_free; section_vma |= (bfd_vma) bfd_get_32 (abfd, buf); @@ -1179,7 +1179,7 @@ mmo_get_byte (bfd *abfd) if (abfd->tdata.mmo_data->byte_no == 0) { if (!abfd->tdata.mmo_data->have_error - && bfd_bread (abfd->tdata.mmo_data->buf, 4, abfd) != 4) + && bfd_read (abfd->tdata.mmo_data->buf, 4, abfd) != 4) abfd->tdata.mmo_data->have_error = true; /* A value somewhat safe against tripping on some inconsistency @@ -1203,7 +1203,7 @@ mmo_write_byte (bfd *abfd, bfd_byte value) if ((abfd->tdata.mmo_data->byte_no % 4) == 0) { if (! abfd->tdata.mmo_data->have_error - && bfd_bwrite (abfd->tdata.mmo_data->buf, 4, abfd) != 4) + && bfd_write (abfd->tdata.mmo_data->buf, 4, abfd) != 4) abfd->tdata.mmo_data->have_error = true; } } @@ -1615,10 +1615,10 @@ mmo_scan (bfd *abfd) abfd->symcount = 0; memset (file_names, 0, sizeof (file_names)); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) goto error_return; - while ((nbytes_read = bfd_bread (buf, 4, abfd)) == 4) + while ((nbytes_read = bfd_read (buf, 4, abfd)) == 4) { if (buf[0] == LOP) { @@ -1657,7 +1657,7 @@ mmo_scan (bfd *abfd) bfd_set_error (bfd_error_bad_value); goto error_return; } - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) goto error_return; vma &= ~3; @@ -1678,7 +1678,7 @@ mmo_scan (bfd *abfd) if (z == 1) { /* Get a 32-bit value. */ - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) goto error_return; vma += bfd_get_32 (abfd, buf); @@ -1686,7 +1686,7 @@ mmo_scan (bfd *abfd) else if (z == 2) { /* Get a 64-bit value. */ - if (bfd_bread (buf, 8, abfd) != 8) + if (bfd_read (buf, 8, abfd) != 8) goto error_return; vma += bfd_get_64 (abfd, buf); @@ -1729,7 +1729,7 @@ mmo_scan (bfd *abfd) if (z == 1) { /* Get a 32-bit value. */ - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) goto error_return; p += bfd_get_32 (abfd, buf); @@ -1737,7 +1737,7 @@ mmo_scan (bfd *abfd) else if (z == 2) { /* Get a 64-bit value. */ - if (bfd_bread (buf, 8, abfd) != 8) + if (bfd_read (buf, 8, abfd) != 8) goto error_return; p += bfd_get_64 (abfd, buf); @@ -1814,7 +1814,7 @@ mmo_scan (bfd *abfd) } /* Get the next 32-bit value. */ - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) goto error_return; delta = bfd_get_32 (abfd, buf); @@ -1871,7 +1871,7 @@ mmo_scan (bfd *abfd) for (i = 0; i < z; i++) { - if (bfd_bread (fname + i * 4, 4, abfd) != 4) + if (bfd_read (fname + i * 4, 4, abfd) != 4) { free (fname); goto error_return; @@ -1933,12 +1933,12 @@ mmo_scan (bfd *abfd) creation time from the first 32-bit word with the time in seconds since era. */ if (z >= 1 - && bfd_bread (abfd->tdata.mmo_data->created, 4, + && bfd_read (abfd->tdata.mmo_data->created, 4, abfd) != 4) goto error_return; for (i = 1; i < z; i++) - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) goto error_return; } break; @@ -1955,7 +1955,7 @@ mmo_scan (bfd *abfd) /* Read first octaword outside loop to simplify logic when excluding the Z == 255, octa == 0 case. */ - if (bfd_bread (buf, 8, abfd) != 8) + if (bfd_read (buf, 8, abfd) != 8) goto error_return; first_octa = bfd_get_64 (abfd, buf); @@ -1979,13 +1979,13 @@ mmo_scan (bfd *abfd) for (i = z + 1; i < 255; i++) { - if (bfd_bread (loc + (i - z) * 8, 8, abfd) != 8) + if (bfd_read (loc + (i - z) * 8, 8, abfd) != 8) goto error_return; } /* Read out the last octabyte, and use it to set the start address. */ - if (bfd_bread (buf, 8, abfd) != 8) + if (bfd_read (buf, 8, abfd) != 8) goto error_return; startaddr_octa = bfd_get_64 (abfd, buf); @@ -2368,11 +2368,11 @@ mmo_internal_write_header (bfd *abfd) { const char lop_pre_bfd[] = { LOP, LOP_PRE, 1, 1}; - if (bfd_bwrite (lop_pre_bfd, 4, abfd) != 4) + if (bfd_write (lop_pre_bfd, 4, abfd) != 4) return false; /* Copy creation time of original file. */ - if (bfd_bwrite (abfd->tdata.mmo_data->created, 4, abfd) != 4) + if (bfd_write (abfd->tdata.mmo_data->created, 4, abfd) != 4) return false; return true; @@ -2394,7 +2394,7 @@ mmo_internal_write_post (bfd *abfd, int z, asection *sec) { bfd_byte *data = mmo_get_loc (sec, i * 8, 8); - if (bfd_bwrite (data, 8, abfd) != 8) + if (bfd_write (data, 8, abfd) != 8) return false; } @@ -2403,7 +2403,7 @@ mmo_internal_write_post (bfd *abfd, int z, asection *sec) Z == 255, don't assume DATA is valid. */ bfd_put_64 (abfd, bfd_get_start_address (abfd), buf); - return ! abfd->tdata.mmo_data->have_error && bfd_bwrite (buf, 8, abfd) == 8; + return ! abfd->tdata.mmo_data->have_error && bfd_write (buf, 8, abfd) == 8; } /* Translate to and from BFD flags. This is to make sure that we don't @@ -3144,7 +3144,7 @@ mmo_write_symbols_and_terminator (bfd *abfd) /* Put out the lop_stab mark. */ bfd_put_32 (abfd, (LOP << 24) | (LOP_STAB << 16), buf); - if (bfd_bwrite (buf, 4, abfd) != 4) + if (bfd_write (buf, 4, abfd) != 4) return false; /* Dump out symbols. */ @@ -3174,12 +3174,12 @@ mmo_write_symbols_and_terminator (bfd *abfd) 0, 4 - (abfd->tdata.mmo_data->byte_no % 4)); if (abfd->tdata.mmo_data->have_error - || bfd_bwrite (abfd->tdata.mmo_data->buf, 4, abfd) != 4) + || bfd_write (abfd->tdata.mmo_data->buf, 4, abfd) != 4) return false; } bfd_put_32 (abfd, (LOP << 24) | (LOP_END << 16) | trie_len, buf); - return bfd_bwrite (buf, 4, abfd) == 4; + return bfd_write (buf, 4, abfd) == 4; } /* Write section unless it is the register contents section. For that, we diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c index aba4d5a..8cafba0 100644 --- a/bfd/netbsd-core.c +++ b/bfd/netbsd-core.c @@ -62,7 +62,7 @@ netbsd_core_file_p (bfd *abfd) struct coreseg coreseg; size_t amt = sizeof core; - val = bfd_bread (&core, amt, abfd); + val = bfd_read (&core, amt, abfd); if (val != sizeof core) { /* Too small to be a core file. */ @@ -93,7 +93,7 @@ netbsd_core_file_p (bfd *abfd) if (bfd_seek (abfd, offset, SEEK_SET) != 0) goto punt; - val = bfd_bread (&coreseg, sizeof coreseg, abfd); + val = bfd_read (&coreseg, sizeof coreseg, abfd); if (val != sizeof coreseg) { bfd_set_error (bfd_error_file_truncated); diff --git a/bfd/opncls.c b/bfd/opncls.c index ee34a12..56a9004 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -1005,7 +1005,7 @@ bfd_make_writable (bfd *abfd) if (bim == NULL) return false; /* bfd_error already set. */ abfd->iostream = bim; - /* bfd_bwrite will grow these as needed. */ + /* bfd_write will grow these as needed. */ bim->size = 0; bim->buffer = 0; diff --git a/bfd/osf-core.c b/bfd/osf-core.c index d76ea24..6a0e19a 100644 --- a/bfd/osf-core.c +++ b/bfd/osf-core.c @@ -80,7 +80,7 @@ osf_core_core_file_p (bfd *abfd) size_t amt; amt = sizeof core_header; - val = bfd_bread (& core_header, amt, abfd); + val = bfd_read (& core_header, amt, abfd); if (val != sizeof core_header) return NULL; @@ -101,7 +101,7 @@ osf_core_core_file_p (bfd *abfd) flagword flags; amt = sizeof core_scnhdr; - val = bfd_bread (& core_scnhdr, amt, abfd); + val = bfd_read (& core_scnhdr, amt, abfd); if (val != sizeof core_scnhdr) break; @@ -41,7 +41,7 @@ pdb_archive_p (bfd *abfd) int ret; char magic[sizeof (pdb_magic)]; - ret = bfd_bread (magic, sizeof (magic), abfd); + ret = bfd_read (magic, sizeof (magic), abfd); if (ret != sizeof (magic)) { bfd_set_error (bfd_error_wrong_format); @@ -77,7 +77,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) if (bfd_seek (abfd, sizeof (pdb_magic), SEEK_SET)) return NULL; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -97,7 +97,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) if (bfd_seek (abfd, 4 * sizeof (uint32_t), SEEK_CUR)) return NULL; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -110,7 +110,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) if (bfd_seek (abfd, block_map_addr * block_size, SEEK_SET)) return NULL; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -121,7 +121,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) if (bfd_seek (abfd, first_dir_block * block_size, SEEK_SET)) return NULL; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -149,7 +149,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) SEEK_SET)) return NULL; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -166,7 +166,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) SEEK_SET)) return NULL; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -232,7 +232,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) SEEK_SET)) goto fail; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); @@ -245,7 +245,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) goto fail; } - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); @@ -278,7 +278,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) SEEK_SET)) goto fail; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); goto fail; @@ -312,7 +312,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) SEEK_SET)) goto fail2; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); @@ -326,7 +326,7 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) SEEK_SET)) goto fail2; - if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { bfd_set_error (bfd_error_malformed_archive); goto fail2; @@ -339,13 +339,13 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index) to_read = left > block_size ? block_size : left; - if (bfd_bread (buf, to_read, abfd) != to_read) + if (bfd_read (buf, to_read, abfd) != to_read) { bfd_set_error (bfd_error_malformed_archive); goto fail2; } - if (bfd_bwrite (buf, to_read, file) != to_read) + if (bfd_write (buf, to_read, file) != to_read) goto fail2; if (left > block_size) @@ -431,7 +431,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, bfd_putl32 (block, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; block_map_off = sizeof (uint32_t); @@ -443,7 +443,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, bfd_putl32 (num_files, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; left -= sizeof (uint32_t); @@ -470,7 +470,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, bfd_putl32 (block, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; block_map_off += sizeof (uint32_t); @@ -481,7 +481,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, bfd_putl32 (bfd_get_size (arelt), tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; left -= sizeof (uint32_t); @@ -533,7 +533,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, bfd_putl32 (block, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { free (buf); @@ -555,7 +555,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, bfd_putl32 (file_block, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) { free (buf); return false; @@ -567,7 +567,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, to_read = size > block_size ? block_size : size; - if (bfd_bread (buf, to_read, arelt) != to_read) + if (bfd_read (buf, to_read, arelt) != to_read) { free (buf); return false; @@ -586,7 +586,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, /* Write file contents into allocated block. */ - if (bfd_bwrite (buf, block_size, abfd) != block_size) + if (bfd_write (buf, block_size, abfd) != block_size) { free (buf); return false; @@ -605,7 +605,7 @@ pdb_write_directory (bfd *abfd, uint32_t block_size, uint32_t num_files, memset (buf, 0, left); - if (bfd_bwrite (buf, left, abfd) != left) + if (bfd_write (buf, left, abfd) != left) { free (buf); return false; @@ -663,7 +663,7 @@ pdb_write_bitmap (bfd *abfd, uint32_t block_size, uint32_t num_blocks) else num_blocks -= block_size * 8; - if (bfd_bwrite (buf, block_size, abfd) != block_size) + if (bfd_write (buf, block_size, abfd) != block_size) return false; } @@ -683,17 +683,17 @@ pdb_write_contents (bfd *abfd) uint32_t num_directory_bytes = sizeof (uint32_t); bfd *arelt; - if (bfd_bwrite (pdb_magic, sizeof (pdb_magic), abfd) != sizeof (pdb_magic)) + if (bfd_write (pdb_magic, sizeof (pdb_magic), abfd) != sizeof (pdb_magic)) return false; bfd_putl32 (block_size, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; bfd_putl32 (1, tmp); /* Free block map block (always either 1 or 2). */ - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; arelt = abfd->archive_head; @@ -720,7 +720,7 @@ pdb_write_contents (bfd *abfd) bfd_putl32 (num_directory_bytes, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; /* Skip unknown uint32_t (always 0?). */ @@ -731,7 +731,7 @@ pdb_write_contents (bfd *abfd) bfd_putl32 (block_map_addr, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; if (!pdb_write_directory @@ -750,7 +750,7 @@ pdb_write_contents (bfd *abfd) bfd_putl32 (num_blocks, tmp); - if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) + if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t)) return false; return true; diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 68809e5..7acf946 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -367,18 +367,17 @@ pdp11_aout_write_headers (bfd *abfd, struct internal_exec *execp) NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) return false; - if (bfd_bwrite ((void *) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) - != EXEC_BYTES_SIZE) + if (bfd_write (&exec_bytes, EXEC_BYTES_SIZE, abfd) != EXEC_BYTES_SIZE) return false; /* Now write out reloc info, followed by syms and strings. */ if (bfd_get_outsymbols (abfd) != NULL && bfd_get_symcount (abfd) != 0) { - if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0) + if (bfd_seek (abfd, N_SYMOFF (execp), SEEK_SET) != 0) return false; if (! NAME (aout, write_syms) (abfd)) @@ -388,9 +387,9 @@ pdp11_aout_write_headers (bfd *abfd, struct internal_exec *execp) if (obj_textsec (abfd)->reloc_count > 0 || obj_datasec (abfd)->reloc_count > 0) { - if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0 + if (bfd_seek (abfd, N_TRELOFF (execp), SEEK_SET) != 0 || !NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd)) - || bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0 + || bfd_seek (abfd, N_DRELOFF (execp), SEEK_SET) != 0 || !NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) return false; } @@ -1244,7 +1243,7 @@ NAME (aout, set_section_contents) (bfd *abfd, if (count != 0) { if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_bwrite (location, count, abfd) != count) + || bfd_write (location, count, abfd) != count) return false; } @@ -1304,7 +1303,7 @@ aout_get_external_symbols (bfd *abfd) /* Get the size of the strings. */ if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 - || bfd_bread ((void *) string_chars, amt, abfd) != amt) + || bfd_read (string_chars, amt, abfd) != amt) return false; stringsize = H_GET_32 (abfd, string_chars); if (stringsize == 0) @@ -1334,7 +1333,7 @@ aout_get_external_symbols (bfd *abfd) if (stringsize >= BYTES_IN_LONG) { amt = stringsize - BYTES_IN_LONG; - if (bfd_bread (strings + BYTES_IN_LONG, amt, abfd) != amt) + if (bfd_read (strings + BYTES_IN_LONG, amt, abfd) != amt) { free (strings); return false; @@ -1721,8 +1720,7 @@ emit_stringtab (bfd *abfd, struct bfd_strtab_hash *tab) /* The string table starts with the size. */ H_PUT_32 (abfd, _bfd_stringtab_size (tab) + BYTES_IN_LONG, buffer); - if (bfd_bwrite ((void *) buffer, (bfd_size_type) BYTES_IN_LONG, abfd) - != BYTES_IN_LONG) + if (bfd_write (buffer, BYTES_IN_LONG, abfd) != BYTES_IN_LONG) return false; return _bfd_stringtab_emit (abfd, tab); @@ -1766,8 +1764,7 @@ NAME (aout, write_syms) (bfd *abfd) if (! translate_to_native_sym_flags (abfd, g, &nsp)) goto error_return; - if (bfd_bwrite ((void *)&nsp, (bfd_size_type) EXTERNAL_NLIST_SIZE, abfd) - != EXTERNAL_NLIST_SIZE) + if (bfd_write (&nsp, EXTERNAL_NLIST_SIZE, abfd) != EXTERNAL_NLIST_SIZE) goto error_return; /* NB: `KEEPIT' currently overlays `udata.p', so set this only @@ -2071,7 +2068,7 @@ NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section) } } - if (bfd_bwrite ((void *) native, natsize, abfd) != natsize) + if (bfd_write (native, natsize, abfd) != natsize) { bfd_release (abfd, native); return false; @@ -3163,7 +3160,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data) amt = EXTERNAL_NLIST_SIZE; if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0 - || bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt) + || bfd_write (&outsym, amt, output_bfd) != amt) /* FIXME: No way to handle errors. */ abort (); @@ -3345,7 +3342,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo, rel_size = obj_reloc_entry_size (flaginfo->output_bfd); if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 - || bfd_bwrite (rel_ptr, rel_size, flaginfo->output_bfd) != rel_size) + || bfd_write (rel_ptr, rel_size, flaginfo->output_bfd) != rel_size) return false; *reloff_ptr += rel_size; @@ -3702,7 +3699,7 @@ aout_link_input_section (struct aout_final_link_info *flaginfo, if (rel_size > 0) { if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || bfd_bread (relocs, rel_size, input_bfd) != rel_size) + || bfd_read (relocs, rel_size, input_bfd) != rel_size) return false; } } @@ -3727,7 +3724,7 @@ aout_link_input_section (struct aout_final_link_info *flaginfo, { if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) return false; - if (bfd_bwrite (relocs, rel_size, flaginfo->output_bfd) != rel_size) + if (bfd_write (relocs, rel_size, flaginfo->output_bfd) != rel_size) return false; *reloff_ptr += rel_size; @@ -4117,7 +4114,7 @@ NAME (aout, final_link) (bfd *abfd, bfd_byte b = 0; if (bfd_seek (abfd, pos - 1, SEEK_SET) != 0 - || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) + || bfd_write (&b, 1, abfd) != 1) goto error_return; } } @@ -4630,7 +4627,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd) return false; size = outsym - flaginfo->output_syms; size *= EXTERNAL_NLIST_SIZE; - if (bfd_bwrite ((void *) flaginfo->output_syms, size, output_bfd) != size) + if (bfd_write (flaginfo->output_syms, size, output_bfd) != size) return false; flaginfo->symoff += size; } diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index cdd89f8..3243393 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -1138,7 +1138,7 @@ _bfd_XXi_slurp_codeview_record (bfd * abfd, file_ptr where, unsigned long length return NULL; if (length > 256) length = 256; - nread = bfd_bread (buffer, length, abfd); + nread = bfd_read (buffer, length, abfd); if (length != nread) return NULL; @@ -1223,7 +1223,7 @@ _bfd_XXi_write_codeview_record (bfd * abfd, file_ptr where, CODEVIEW_INFO *cvinf else memcpy (cvinfo70->PdbFileName, pdb, pdb_len + 1); - written = bfd_bwrite (buffer, size, abfd); + written = bfd_write (buffer, size, abfd); free (buffer); @@ -387,7 +387,7 @@ bfd_pef_scan_section (bfd *abfd, bfd_pef_section *section) unsigned char buf[28]; bfd_seek (abfd, section->header_offset, SEEK_SET); - if (bfd_bread ((void *) buf, 28, abfd) != 28) + if (bfd_read (buf, 28, abfd) != 28) return -1; section->name_offset = bfd_h_get_32 (abfd, buf); @@ -570,7 +570,7 @@ bfd_pef_read_header (bfd *abfd, bfd_pef_header *header) bfd_seek (abfd, 0, SEEK_SET); - if (bfd_bread ((void *) buf, 40, abfd) != 40) + if (bfd_read (buf, 40, abfd) != 40) return -1; header->tag1 = bfd_getb32 (buf); @@ -1074,7 +1074,7 @@ bfd_pef_xlib_read_header (bfd *abfd, bfd_pef_xlib_header *header) bfd_seek (abfd, 0, SEEK_SET); - if (bfd_bread ((void *) buf, sizeof buf, abfd) != sizeof buf) + if (bfd_read (buf, sizeof buf, abfd) != sizeof buf) return -1; header->tag1 = bfd_getb32 (buf); diff --git a/bfd/peicode.h b/bfd/peicode.h index e2e2be6..2cd020e 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -1187,7 +1187,7 @@ pe_ILF_object_p (bfd * abfd) /* Upon entry the first six bytes of the ILF header have already been read. Now read the rest of the header. */ - if (bfd_bread (buffer, (bfd_size_type) 14, abfd) != 14) + if (bfd_read (buffer, 14, abfd) != 14) return NULL; ptr = buffer; @@ -1449,8 +1449,8 @@ pe_bfd_object_p (bfd * abfd) /* Detect if this a Microsoft Import Library Format element. */ /* First read the beginning of the header. */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bread (buffer, (bfd_size_type) 6, abfd) != 6) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || bfd_read (buffer, 6, abfd) != 6) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1462,9 +1462,8 @@ pe_bfd_object_p (bfd * abfd) && H_GET_16 (abfd, buffer + 4) == 0) return pe_ILF_object_p (abfd); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd) - != sizeof (dos_hdr)) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || bfd_read (&dos_hdr, sizeof (dos_hdr), abfd) != sizeof (dos_hdr)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -1489,8 +1488,7 @@ pe_bfd_object_p (bfd * abfd) offset = H_GET_32 (abfd, dos_hdr.e_lfanew); if (bfd_seek (abfd, offset, SEEK_SET) != 0 - || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd) - != sizeof (image_hdr))) + || bfd_read (&image_hdr, sizeof (image_hdr), abfd) != sizeof (image_hdr)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index 69c815a..50ac2d3 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -161,8 +161,7 @@ ppcboot_object_p (bfd *abfd) return NULL; } - if (bfd_bread (&hdr, (bfd_size_type) sizeof (hdr), abfd) - != sizeof (hdr)) + if (bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -224,8 +223,8 @@ ppcboot_get_section_contents (bfd *abfd, file_ptr offset, bfd_size_type count) { - if (bfd_seek (abfd, offset + (file_ptr) sizeof (ppcboot_hdr_t), SEEK_SET) != 0 - || bfd_bread (location, count, abfd) != count) + if (bfd_seek (abfd, offset + sizeof (ppcboot_hdr_t), SEEK_SET) != 0 + || bfd_read (location, count, abfd) != count) return false; return true; } diff --git a/bfd/ptrace-core.c b/bfd/ptrace-core.c index 1c49721..f41de5e 100644 --- a/bfd/ptrace-core.c +++ b/bfd/ptrace-core.c @@ -64,7 +64,7 @@ ptrace_unix_core_file_p (bfd *abfd) size_t amt; flagword flags; - val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd); + val = bfd_read (&u, sizeof u, abfd); if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC || u.pt_rev != _BCS_PTRACE_REV) { diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c index e8efeef..7c8f79b 100644 --- a/bfd/rs6000-core.c +++ b/bfd/rs6000-core.c @@ -290,13 +290,13 @@ read_hdr (bfd *abfd, CoreHdr *core) { bfd_size_type size; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) return false; /* Read the leading portion that old and new core dump structures have in common. */ size = CORE_COMMONSZ; - if (bfd_bread (core, size, abfd) != size) + if (bfd_read (core, size, abfd) != size) return false; /* Read the trailing portion of the structure. */ @@ -307,7 +307,7 @@ read_hdr (bfd *abfd, CoreHdr *core) size = sizeof (core->old); #endif size -= CORE_COMMONSZ; - return bfd_bread ((char *) core + CORE_COMMONSZ, size, abfd) == size; + return bfd_read ((char *) core + CORE_COMMONSZ, size, abfd) == size; } static asection * @@ -621,7 +621,7 @@ rs6000coff_core_p (bfd *abfd) { if (bfd_seek (abfd, c_loader, SEEK_SET) != 0) goto fail; - if (bfd_bread (&ldinfo, size, abfd) != size) + if (bfd_read (&ldinfo, size, abfd) != size) goto fail; if (proc64) @@ -670,7 +670,7 @@ rs6000coff_core_p (bfd *abfd) #else size = sizeof (vminfo.new_dump); #endif - if (bfd_bread (&vminfo, size, abfd) != size) + if (bfd_read (&vminfo, size, abfd) != size) goto fail; if (CORE_NEW (core)) @@ -747,7 +747,7 @@ rs6000coff_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) while (1) { - if (bfd_bread (s, (bfd_size_type) 1, core_bfd) != 1) + if (bfd_read (s, 1, core_bfd) != 1) { free (path); return false; @@ -2117,7 +2117,7 @@ setup_sections (bfd *abfd, SEEK_SET) != 0) goto error_return; amt = sizeof ext_space; - if (bfd_bread (&ext_space, amt, abfd) != amt) + if (bfd_read (&ext_space, amt, abfd) != amt) goto error_return; som_swap_space_dictionary_in (&ext_space, &space); @@ -2159,7 +2159,7 @@ setup_sections (bfd *abfd, SEEK_SET) != 0) goto error_return; amt = sizeof ext_subspace; - if (bfd_bread (&ext_subspace, amt, abfd) != amt) + if (bfd_read (&ext_subspace, amt, abfd) != amt) goto error_return; /* Seek back to the start of the subspaces for loop below. */ if (bfd_seek (abfd, @@ -2191,7 +2191,7 @@ setup_sections (bfd *abfd, /* Read in the next subspace. */ amt = sizeof ext_subspace; - if (bfd_bread (&ext_subspace, amt, abfd) != amt) + if (bfd_read (&ext_subspace, amt, abfd) != amt) goto error_return; som_swap_subspace_dictionary_in (&ext_subspace, &subspace); @@ -2396,7 +2396,7 @@ som_object_p (bfd *abfd) #define ENTRY_SIZE sizeof (struct som_external_som_entry) amt = sizeof (struct som_external_header); - if (bfd_bread (&ext_file_hdr, amt, abfd) != amt) + if (bfd_read (&ext_file_hdr, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2427,7 +2427,7 @@ som_object_p (bfd *abfd) case EXECLIBMAGIC: /* Read the lst header and determine where the SOM directory begins. */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2435,7 +2435,7 @@ som_object_p (bfd *abfd) } amt = sizeof (struct som_external_lst_header); - if (bfd_bread (&ext_lst_header, amt, abfd) != amt) + if (bfd_read (&ext_lst_header, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2452,7 +2452,7 @@ som_object_p (bfd *abfd) } amt = ENTRY_SIZE; - if (bfd_bread (&ext_som_entry, amt, abfd) != amt) + if (bfd_read (&ext_som_entry, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2470,7 +2470,7 @@ som_object_p (bfd *abfd) /* And finally, re-read the som header. */ amt = sizeof (struct som_external_header); - if (bfd_bread (&ext_file_hdr, amt, abfd) != amt) + if (bfd_read (&ext_file_hdr, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -2505,7 +2505,7 @@ som_object_p (bfd *abfd) if (aux_hdr_ptr == NULL) return NULL; amt = sizeof (struct som_external_exec_auxhdr); - if (bfd_bread (&ext_exec_auxhdr, amt, abfd) != amt) + if (bfd_read (&ext_exec_auxhdr, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -3039,7 +3039,7 @@ som_write_fixups (bfd *abfd, if (p - tmp_space + 512 > SOM_TMP_BUFSIZE) { amt = p - tmp_space; - if (bfd_bwrite ((void *) tmp_space, amt, abfd) != amt) + if (bfd_write (tmp_space, amt, abfd) != amt) return false; p = tmp_space; @@ -3290,7 +3290,7 @@ som_write_fixups (bfd *abfd, /* Scribble out the relocations. */ amt = p - tmp_space; - if (bfd_bwrite ((void *) tmp_space, amt, abfd) != amt) + if (bfd_write (tmp_space, amt, abfd) != amt) return false; p = tmp_space; @@ -3326,7 +3326,7 @@ som_write_space_strings (bfd *abfd, /* Seek to the start of the space strings in preparation for writing them out. */ - if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) + if (bfd_seek (abfd, current_offset, SEEK_SET) != 0) return false; /* Walk through all the spaces and subspaces (order is not important) @@ -3351,7 +3351,7 @@ som_write_space_strings (bfd *abfd, { /* Flush buffer before refilling or reallocating. */ amt = p - tmp_space; - if (bfd_bwrite ((void *) &tmp_space[0], amt, abfd) != amt) + if (bfd_write (&tmp_space[0], amt, abfd) != amt) return false; /* Reallocate if now empty buffer still too small. */ @@ -3405,7 +3405,7 @@ som_write_space_strings (bfd *abfd, /* Done with the space/subspace strings. Write out any information contained in a partial block. */ amt = p - tmp_space; - res = bfd_bwrite ((void *) &tmp_space[0], amt, abfd); + res = bfd_write (&tmp_space[0], amt, abfd); free (tmp_space); if (res != amt) return false; @@ -3445,7 +3445,7 @@ som_write_symbol_strings (bfd *abfd, /* Seek to the start of the space strings in preparation for writing them out. */ - if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) + if (bfd_seek (abfd, current_offset, SEEK_SET) != 0) return false; if (compilation_unit) @@ -3482,7 +3482,7 @@ som_write_symbol_strings (bfd *abfd, { /* Flush buffer before refilling or reallocating. */ amt = p - tmp_space; - if (bfd_bwrite ((void *) &tmp_space[0], amt, abfd) != amt) + if (bfd_write (tmp_space, amt, abfd) != amt) return false; /* Reallocate if now empty buffer still too small. */ @@ -3537,7 +3537,7 @@ som_write_symbol_strings (bfd *abfd, { /* Flush buffer before refilling or reallocating. */ amt = p - tmp_space; - if (bfd_bwrite ((void *) &tmp_space[0], amt, abfd) != amt) + if (bfd_write (tmp_space, amt, abfd) != amt) return false; /* Reallocate if now empty buffer still too small. */ @@ -3581,7 +3581,7 @@ som_write_symbol_strings (bfd *abfd, /* Scribble out any partial block. */ amt = p - tmp_space; - res = bfd_bwrite ((void *) &tmp_space[0], amt, abfd); + res = bfd_write (tmp_space, amt, abfd); free (tmp_space); if (res != amt) return false; @@ -3639,7 +3639,7 @@ som_begin_writing (bfd *abfd) struct som_external_string_auxhdr ext_string_auxhdr; bfd_size_type len; - if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) + if (bfd_seek (abfd, current_offset, SEEK_SET) != 0) return false; /* Write the aux_id structure and the string length. */ @@ -3648,15 +3648,14 @@ som_begin_writing (bfd *abfd) current_offset += len; som_swap_string_auxhdr_out (obj_som_version_hdr (abfd), &ext_string_auxhdr); - if (bfd_bwrite (&ext_string_auxhdr, len, abfd) != len) + if (bfd_write (&ext_string_auxhdr, len, abfd) != len) return false; /* Write the version string. */ len = obj_som_version_hdr (abfd)->header_id.length - 4; obj_som_file_hdr (abfd)->aux_header_size += len; current_offset += len; - if (bfd_bwrite ((void *) obj_som_version_hdr (abfd)->string, len, abfd) - != len) + if (bfd_write (obj_som_version_hdr (abfd)->string, len, abfd) != len) return false; } @@ -3665,7 +3664,7 @@ som_begin_writing (bfd *abfd) struct som_external_string_auxhdr ext_string_auxhdr; bfd_size_type len; - if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) + if (bfd_seek (abfd, current_offset, SEEK_SET) != 0) return false; /* Write the aux_id structure and the string length. */ @@ -3674,15 +3673,14 @@ som_begin_writing (bfd *abfd) current_offset += len; som_swap_string_auxhdr_out (obj_som_copyright_hdr (abfd), &ext_string_auxhdr); - if (bfd_bwrite (&ext_string_auxhdr, len, abfd) != len) + if (bfd_write (&ext_string_auxhdr, len, abfd) != len) return false; /* Write the copyright string. */ len = obj_som_copyright_hdr (abfd)->header_id.length - 4; obj_som_file_hdr (abfd)->aux_header_size += len; current_offset += len; - if (bfd_bwrite ((void *) obj_som_copyright_hdr (abfd)->string, len, abfd) - != len) + if (bfd_write (obj_som_copyright_hdr (abfd)->string, len, abfd) != len) return false; } @@ -3929,9 +3927,9 @@ som_begin_writing (bfd *abfd) zeros are filled in. Ugh. */ if (abfd->flags & (EXEC_P | DYNAMIC)) current_offset = SOM_ALIGN (current_offset, PA_PAGESIZE); - if (bfd_seek (abfd, (file_ptr) current_offset - 1, SEEK_SET) != 0) + if (bfd_seek (abfd, current_offset - 1, SEEK_SET) != 0) return false; - if (bfd_bwrite ((void *) "", (bfd_size_type) 1, abfd) != 1) + if (bfd_write ("", 1, abfd) != 1) return false; obj_som_file_hdr (abfd)->unloadable_sp_size @@ -4098,7 +4096,7 @@ som_finish_writing (bfd *abfd) som_swap_subspace_dictionary_record_out (som_section_data (subsection)->subspace_dict, &ext_subspace_dict); amt = sizeof (struct som_subspace_dictionary_record); - if (bfd_bwrite (&ext_subspace_dict, amt, abfd) != amt) + if (bfd_write (&ext_subspace_dict, amt, abfd) != amt) return false; } /* Goto the next section. */ @@ -4156,7 +4154,7 @@ som_finish_writing (bfd *abfd) som_swap_subspace_dictionary_record_out (som_section_data (subsection)->subspace_dict, &ext_subspace_dict); amt = sizeof (struct som_subspace_dictionary_record); - if (bfd_bwrite (&ext_subspace_dict, amt, abfd) != amt) + if (bfd_write (&ext_subspace_dict, amt, abfd) != amt) return false; } /* Goto the next section. */ @@ -4185,7 +4183,7 @@ som_finish_writing (bfd *abfd) som_swap_space_dictionary_out (som_section_data (section)->space_dict, &ext_space_dict); amt = sizeof (struct som_external_space_dictionary_record); - if (bfd_bwrite (&ext_space_dict, amt, abfd) != amt) + if (bfd_write (&ext_space_dict, amt, abfd) != amt) return false; /* Goto the next section. */ @@ -4205,7 +4203,7 @@ som_finish_writing (bfd *abfd) (obj_som_compilation_unit (abfd), &ext_comp_unit); amt = sizeof (struct som_external_compilation_unit); - if (bfd_bwrite (&ext_comp_unit, amt, abfd) != amt) + if (bfd_write (&ext_comp_unit, amt, abfd) != amt) return false; } @@ -4227,10 +4225,10 @@ som_finish_writing (bfd *abfd) /* Only thing left to do is write out the file header. It is always at location zero. Seek there and write it. */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) return false; amt = sizeof (struct som_external_header); - if (bfd_bwrite (&ext_header, amt, abfd) != amt) + if (bfd_write (&ext_header, amt, abfd) != amt) return false; /* Now write the exec header. */ @@ -4272,7 +4270,7 @@ som_finish_writing (bfd *abfd) return false; amt = sizeof (ext_exec_header); - if (bfd_bwrite (&ext_exec_header, amt, abfd) != amt) + if (bfd_write (&ext_exec_header, amt, abfd) != amt) return false; } return true; @@ -4518,7 +4516,7 @@ som_build_and_write_symbol_table (bfd *abfd) symtab_size = num_syms; symtab_size *= sizeof (struct som_external_symbol_dictionary_record); - if (bfd_bwrite ((void *) som_symtab, symtab_size, abfd) != symtab_size) + if (bfd_write (som_symtab, symtab_size, abfd) != symtab_size) goto error_return; free (som_symtab); @@ -5727,9 +5725,9 @@ som_get_section_contents (bfd *abfd, { if (count == 0 || ((section->flags & SEC_HAS_CONTENTS) == 0)) return true; - if ((bfd_size_type) (offset+count) > section->size - || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 - || bfd_bread (location, count, abfd) != count) + if ((bfd_size_type) (offset + count) > section->size + || bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 + || bfd_read (location, count, abfd) != count) return false; /* On error. */ return true; } @@ -5764,7 +5762,7 @@ som_set_section_contents (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) != 0) return false; - if (bfd_bwrite (location, count, abfd) != count) + if (bfd_write (location, count, abfd) != count) return false; return true; } @@ -5973,7 +5971,7 @@ som_bfd_count_ar_symbols (bfd *abfd, /* Read in this symbol and update the counter. */ amt = sizeof (ext_lst_symbol); - if (bfd_bread ((void *) &ext_lst_symbol, amt, abfd) != amt) + if (bfd_read (&ext_lst_symbol, amt, abfd) != amt) goto error_return; (*count)++; @@ -6001,7 +5999,7 @@ som_bfd_count_ar_symbols (bfd *abfd, /* Read the symbol in and update the counter. */ amt = sizeof (ext_lst_symbol); - if (bfd_bread ((void *) &ext_lst_symbol, amt, abfd) != amt) + if (bfd_read (&ext_lst_symbol, amt, abfd) != amt) goto error_return; (*count)++; @@ -6082,7 +6080,7 @@ som_bfd_fill_in_ar_symbols (bfd *abfd, goto error_return; amt = sizeof (lst_symbol); - if (bfd_bread ((void *) &lst_symbol, amt, abfd) != amt) + if (bfd_read (&lst_symbol, amt, abfd) != amt) goto error_return; /* Get the name of the symbol, first get the length which is stored @@ -6096,7 +6094,7 @@ som_bfd_fill_in_ar_symbols (bfd *abfd, + bfd_getb32 (lst_symbol.name) - 4), SEEK_SET) != 0) goto error_return; - if (bfd_bread (&ext_len, (bfd_size_type) 4, abfd) != 4) + if (bfd_read (&ext_len, 4, abfd) != 4) goto error_return; len = bfd_getb32 (ext_len); @@ -6139,7 +6137,7 @@ som_bfd_fill_in_ar_symbols (bfd *abfd, goto error_return; amt = sizeof (lst_symbol); - if (bfd_bread ((void *) &lst_symbol, amt, abfd) != amt) + if (bfd_read (&lst_symbol, amt, abfd) != amt) goto error_return; /* Seek to the name length & string and read them in. */ @@ -6147,7 +6145,7 @@ som_bfd_fill_in_ar_symbols (bfd *abfd, + bfd_getb32 (lst_symbol.name) - 4, SEEK_SET) != 0) goto error_return; - if (bfd_bread (&ext_len, (bfd_size_type) 4, abfd) != 4) + if (bfd_read (&ext_len, 4, abfd) != 4) goto error_return; len = bfd_getb32 (ext_len); @@ -6202,7 +6200,7 @@ som_slurp_armap (bfd *abfd) struct artdata *ardata = bfd_ardata (abfd); char nextname[17]; size_t amt = 16; - int i = bfd_bread ((void *) nextname, amt, abfd); + int i = bfd_read (nextname, amt, abfd); /* Special cases. */ if (i == 0) @@ -6210,7 +6208,7 @@ som_slurp_armap (bfd *abfd) if (i != 16) return false; - if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) + if (bfd_seek (abfd, -16, SEEK_CUR) != 0) return false; /* For archives without .o files there is no symbol table. */ @@ -6222,7 +6220,7 @@ som_slurp_armap (bfd *abfd) /* Read in and sanity check the archive header. */ amt = sizeof (struct ar_hdr); - if (bfd_bread ((void *) &ar_header, amt, abfd) != amt) + if (bfd_read (&ar_header, amt, abfd) != amt) return false; if (strncmp (ar_header.ar_fmag, ARFMAG, 2)) @@ -6246,7 +6244,7 @@ som_slurp_armap (bfd *abfd) /* Read in the library symbol table. We'll make heavy use of this in just a minute. */ amt = sizeof (struct som_external_lst_header); - if (bfd_bread ((void *) &ext_lst_header, amt, abfd) != amt) + if (bfd_read (&ext_lst_header, amt, abfd) != amt) return false; som_swap_lst_header_in (&ext_lst_header, &lst_header); @@ -6617,22 +6615,22 @@ som_bfd_ar_write_symbol_stuff (bfd *abfd, /* Now scribble out the hash table. */ amt = (size_t) hash_size * 4; - if (bfd_bwrite ((void *) hash_table, amt, abfd) != amt) + if (bfd_write (hash_table, amt, abfd) != amt) goto error_return; /* Then the SOM dictionary. */ amt = (size_t) module_count * sizeof (struct som_external_som_entry); - if (bfd_bwrite ((void *) som_dict, amt, abfd) != amt) + if (bfd_write (som_dict, amt, abfd) != amt) goto error_return; /* The library symbols. */ amt = (size_t) nsyms * sizeof (struct som_external_lst_symbol_record); - if (bfd_bwrite ((void *) lst_syms, amt, abfd) != amt) + if (bfd_write (lst_syms, amt, abfd) != amt) goto error_return; /* And finally the strings. */ amt = string_size; - if (bfd_bwrite ((void *) strings, amt, abfd) != amt) + if (bfd_write (strings, amt, abfd) != amt) goto error_return; free (hash_table); @@ -6773,12 +6771,12 @@ som_write_armap (bfd *abfd, /* Scribble out the ar header. */ amt = sizeof (struct ar_hdr); - if (bfd_bwrite ((void *) &hdr, amt, abfd) != amt) + if (bfd_write (&hdr, amt, abfd) != amt) return false; /* Now scribble out the lst header. */ amt = sizeof (struct som_external_lst_header); - if (bfd_bwrite ((void *) &lst, amt, abfd) != amt) + if (bfd_write (&lst, amt, abfd) != amt) return false; /* Build and write the armap. */ @@ -219,7 +219,7 @@ srec_get_byte (bfd *abfd, bool *errorptr) { bfd_byte c; - if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1) + if (bfd_read (&c, 1, abfd) != 1) { if (bfd_get_error () != bfd_error_file_truncated) *errorptr = true; @@ -303,7 +303,7 @@ srec_scan (bfd *abfd) asection *sec = NULL; char *symbuf = NULL; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) goto error_return; while ((c = srec_get_byte (abfd, &error)) != EOF) @@ -463,7 +463,7 @@ srec_scan (bfd *abfd) pos = bfd_tell (abfd) - 1; - if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3) + if (bfd_read (hdr, 3, abfd) != 3) goto error_return; if (! ISHEX (hdr[1]) || ! ISHEX (hdr[2])) @@ -494,13 +494,13 @@ srec_scan (bfd *abfd) if (bytes * 2 > bufsize) { free (buf); - buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2); + buf = bfd_malloc (bytes * 2); if (buf == NULL) goto error_return; bufsize = bytes * 2; } - if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2) + if (bfd_read (buf, bytes * 2, abfd) != bytes * 2) goto error_return; /* Ignore the checksum byte. */ @@ -647,8 +647,8 @@ srec_object_p (bfd *abfd) srec_init (); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bread (b, (bfd_size_type) 4, abfd) != 4) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || bfd_read (b, 4, abfd) != 4) return NULL; if (b[0] != 'S' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) @@ -682,8 +682,8 @@ symbolsrec_object_p (bfd *abfd) srec_init (); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bread (b, (bfd_size_type) 2, abfd) != 2) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || bfd_read (b, 2, abfd) != 2) return NULL; if (b[0] != '$' || b[1] != '$') @@ -736,7 +736,7 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents) if (c != 'S') goto error_return; - if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3) + if (bfd_read (hdr, 3, abfd) != 3) goto error_return; BFD_ASSERT (ISHEX (hdr[1]) && ISHEX (hdr[2])); @@ -746,13 +746,13 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents) if (bytes * 2 > bufsize) { free (buf); - buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2); + buf = bfd_malloc (bytes * 2); if (buf == NULL) goto error_return; bufsize = bytes * 2; } - if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2) + if (bfd_read (buf, bytes * 2, abfd) != bytes * 2) goto error_return; address = 0; @@ -1000,7 +1000,7 @@ srec_write_record (bfd *abfd, *dst++ = '\n'; wrlen = dst - buffer; - return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen; + return bfd_write (buffer, wrlen, abfd) == wrlen; } static bool @@ -1081,9 +1081,9 @@ srec_write_symbols (bfd *abfd) asymbol **table = bfd_get_outsymbols (abfd); len = strlen (bfd_get_filename (abfd)); - if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3 - || bfd_bwrite (bfd_get_filename (abfd), len, abfd) != len - || bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2) + if (bfd_write ("$$ ", 3, abfd) != 3 + || bfd_write (bfd_get_filename (abfd), len, abfd) != len + || bfd_write ("\r\n", 2, abfd) != 2) return false; for (i = 0; i < count; i++) @@ -1099,8 +1099,8 @@ srec_write_symbols (bfd *abfd) char buf[43]; len = strlen (s->name); - if (bfd_bwrite (" ", (bfd_size_type) 2, abfd) != 2 - || bfd_bwrite (s->name, len, abfd) != len) + if (bfd_write (" ", 2, abfd) != 2 + || bfd_write (s->name, len, abfd) != len) return false; sprintf (buf, " $%" PRIx64 "\r\n", @@ -1108,11 +1108,11 @@ srec_write_symbols (bfd *abfd) + s->section->output_section->lma + s->section->output_offset)); len = strlen (buf); - if (bfd_bwrite (buf, len, abfd) != len) + if (bfd_write (buf, len, abfd) != len) return false; } } - if (bfd_bwrite ("$$ \r\n", (bfd_size_type) 5, abfd) != 5) + if (bfd_write ("$$ \r\n", 5, abfd) != 5) return false; } diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 5a87b78..5c55990 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -515,7 +515,7 @@ pass_over (bfd *abfd, bool (*func) (bfd *, int, char *, char *)) bool is_eof = false; /* To the front of the file. */ - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) return false; while (! is_eof) @@ -524,15 +524,15 @@ pass_over (bfd *abfd, bool (*func) (bfd *, int, char *, char *)) char type; /* Find first '%'. */ - is_eof = (bool) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1); + is_eof = bfd_read (src, 1, abfd) != 1; while (!is_eof && *src != '%') - is_eof = (bool) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1); + is_eof = bfd_read (src, 1, abfd) != 1; if (is_eof) break; /* Fetch the type and the length and the checksum. */ - if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5) + if (bfd_read (src, 5, abfd) != 5) return false; type = src[2]; @@ -546,7 +546,7 @@ pass_over (bfd *abfd, bool (*func) (bfd *, int, char *, char *)) if (chars_on_line >= MAXCHUNK) return false; - if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line) + if (bfd_read (src, chars_on_line, abfd) != chars_on_line) return false; /* Put a null at the end. */ @@ -607,8 +607,8 @@ tekhex_object_p (bfd *abfd) tekhex_init (); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bread (b, (bfd_size_type) 4, abfd) != 4) + if (bfd_seek (abfd, 0, SEEK_SET) != 0 + || bfd_read (b, 4, abfd) != 4) return NULL; if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) @@ -788,11 +788,11 @@ out (bfd *abfd, int type, char *start, char *end) sum += sum_block[(unsigned char) front[2]]; sum += sum_block[(unsigned char) front[3]]; /* Type. */ TOHEX (front + 4, sum); - if (bfd_bwrite (front, (bfd_size_type) 6, abfd) != 6) + if (bfd_write (front, 6, abfd) != 6) abort (); end[0] = '\n'; wrlen = end - start + 1; - if (bfd_bwrite (start, wrlen, abfd) != wrlen) + if (bfd_write (start, wrlen, abfd) != wrlen) abort (); } @@ -897,7 +897,7 @@ tekhex_write_object_contents (bfd *abfd) } /* And the terminator. */ - if (bfd_bwrite ("%0781010\n", (bfd_size_type) 9, abfd) != 9) + if (bfd_write ("%0781010\n", 9, abfd) != 9) abort (); return true; } diff --git a/bfd/trad-core.c b/bfd/trad-core.c index 70a478c..0d6321a 100644 --- a/bfd/trad-core.c +++ b/bfd/trad-core.c @@ -70,11 +70,11 @@ trad_unix_core_file_p (bfd *abfd) #ifdef TRAD_CORE_USER_OFFSET /* If defined, this macro is the file position of the user struct. */ - if (bfd_seek (abfd, (file_ptr) TRAD_CORE_USER_OFFSET, SEEK_SET) != 0) + if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) != 0) return 0; #endif - val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd); + val = bfd_read (&u, sizeof u, abfd); if (val != sizeof u) { /* Too small to be a core file */ diff --git a/bfd/verilog.c b/bfd/verilog.c index ef37091..71a6fd6 100644 --- a/bfd/verilog.c +++ b/bfd/verilog.c @@ -200,7 +200,7 @@ verilog_write_address (bfd *abfd, bfd_vma address) *dst++ = '\n'; wrlen = dst - buffer; - return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen; + return bfd_write (buffer, wrlen, abfd) == wrlen; } /* Write a record of type, of the supplied number of bytes. The @@ -288,7 +288,7 @@ verilog_write_record (bfd *abfd, *dst++ = '\n'; wrlen = dst - buffer; - return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen; + return bfd_write (buffer, wrlen, abfd) == wrlen; } static bool diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index 704dc63..7fc73c6 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -802,7 +802,7 @@ _bfd_vms_get_object_record (bfd *abfd) /* Skip alignment byte if the current position is odd. */ if (PRIV (recrd.file_format) == FF_FOREIGN && (bfd_tell (abfd) & 1)) { - if (bfd_bread (PRIV (recrd.buf), 1, abfd) != 1) + if (bfd_read (PRIV (recrd.buf), 1, abfd) != 1) { bfd_set_error (bfd_error_file_truncated); return -1; @@ -810,7 +810,7 @@ _bfd_vms_get_object_record (bfd *abfd) } /* Read the record header */ - if (bfd_bread (PRIV (recrd.buf), test_len, abfd) != test_len) + if (bfd_read (PRIV (recrd.buf), test_len, abfd) != test_len) { bfd_set_error (bfd_error_file_truncated); return -1; @@ -880,7 +880,7 @@ vms_get_remaining_object_record (bfd *abfd, unsigned int read_so_far) vms_debug2 ((8, "vms_get_remaining_obj_record: to_read %d\n", to_read)); - if (bfd_bread (PRIV (recrd.buf) + read_so_far, to_read, abfd) != to_read) + if (bfd_read (PRIV (recrd.buf) + read_so_far, to_read, abfd) != to_read) { bfd_set_error (bfd_error_file_truncated); return 0; @@ -2803,7 +2803,7 @@ alpha_vms_object_p (bfd *abfd) return NULL; } - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET)) + if (bfd_seek (abfd, 0, SEEK_SET)) goto error_ret; /* The first challenge with VMS is to discover the kind of the file. @@ -2848,7 +2848,7 @@ alpha_vms_object_p (bfd *abfd) if (PRIV (recrd.rec_size) < sizeof (struct vms_eihd)) goto err_wrong_format; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET)) + if (bfd_seek (abfd, 0, SEEK_SET)) goto error_ret; free (PRIV (recrd.buf)); @@ -3426,7 +3426,7 @@ alpha_vms_write_exec (bfd *abfd) /* Write first block. */ bfd_putl32 (lnkflags, eihd.lnkflags); - if (bfd_bwrite (&eihd, sizeof (eihd), abfd) != sizeof (eihd)) + if (bfd_write (&eihd, sizeof (eihd), abfd) != sizeof (eihd)) return false; /* Write remaining eisd. */ @@ -3447,7 +3447,7 @@ alpha_vms_write_exec (bfd *abfd) || (next_eisd->file_pos / VMS_BLOCK_SIZE != eisd->file_pos / VMS_BLOCK_SIZE)) { - if (bfd_bwrite (blk, sizeof (blk), abfd) != sizeof (blk)) + if (bfd_write (blk, sizeof (blk), abfd) != sizeof (blk)) return false; memset (blk, 0xff, sizeof (blk)); @@ -3465,7 +3465,7 @@ alpha_vms_write_exec (bfd *abfd) if (sec->size == 0 || !(sec->flags & SEC_HAS_CONTENTS) || sec->contents == NULL) continue; - if (bfd_bwrite (sec->contents, sec->size, abfd) != sec->size) + if (bfd_write (sec->contents, sec->size, abfd) != sec->size) return false; /* Pad. */ @@ -3473,7 +3473,7 @@ alpha_vms_write_exec (bfd *abfd) if (len != VMS_BLOCK_SIZE) { memset (blk, 0, len); - if (bfd_bwrite (blk, len, abfd) != len) + if (bfd_write (blk, len, abfd) != len) return false; } } @@ -6885,7 +6885,7 @@ evax_bfd_print_eobj (struct bfd *abfd, FILE *file) unsigned char buf[6]; hdr_size = has_records ? 6 : 4; - if (bfd_bread (buf, hdr_size, abfd) != hdr_size) + if (bfd_read (buf, hdr_size, abfd) != hdr_size) { fprintf (file, _("cannot read GST record header\n")); return; @@ -6944,7 +6944,7 @@ evax_bfd_print_eobj (struct bfd *abfd, FILE *file) memcpy (rec, buf + (has_records ? 2 : 0), hdr_size); - if (bfd_bread (rec + hdr_size, pad_len - hdr_size, abfd) + if (bfd_read (rec + hdr_size, pad_len - hdr_size, abfd) != pad_len - hdr_size) { fprintf (file, _("cannot read GST record\n")); @@ -7471,7 +7471,7 @@ evax_bfd_print_dst (struct bfd *abfd, unsigned int dst_size, FILE *file) unsigned int type; unsigned char *buf; - if (bfd_bread (&dsth, sizeof (dsth), abfd) != sizeof (dsth)) + if (bfd_read (&dsth, sizeof (dsth), abfd) != sizeof (dsth)) { fprintf (file, _("cannot read DST header\n")); return; @@ -8033,8 +8033,8 @@ evax_bfd_print_image (bfd *abfd, FILE *file) unsigned int eiaf_size = 0; unsigned int eihvn_off; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) - || bfd_bread (&eihd, sizeof (eihd), abfd) != sizeof (eihd)) + if (bfd_seek (abfd, 0, SEEK_SET) + || bfd_read (&eihd, sizeof (eihd), abfd) != sizeof (eihd)) { fprintf (file, _("cannot read EIHD\n")); return; @@ -8161,8 +8161,8 @@ evax_bfd_print_image (bfd *abfd, FILE *file) unsigned int j; fprintf (file, _("system version array information:\n")); - if (bfd_seek (abfd, (file_ptr) eihvn_off, SEEK_SET) - || bfd_bread (&eihvn, sizeof (eihvn), abfd) != sizeof (eihvn)) + if (bfd_seek (abfd, eihvn_off, SEEK_SET) + || bfd_read (&eihvn, sizeof (eihvn), abfd) != sizeof (eihvn)) { fprintf (file, _("cannot read EIHVN header\n")); return; @@ -8172,7 +8172,7 @@ evax_bfd_print_image (bfd *abfd, FILE *file) if (mask & (1u << j)) { struct vms_eihvn_subversion ver; - if (bfd_bread (&ver, sizeof (ver), abfd) != sizeof (ver)) + if (bfd_read (&ver, sizeof (ver), abfd) != sizeof (ver)) { fprintf (file, _("cannot read EIHVN version\n")); return; @@ -8254,8 +8254,8 @@ evax_bfd_print_image (bfd *abfd, FILE *file) { struct vms_eiha eiha; - if (bfd_seek (abfd, (file_ptr) eiha_off, SEEK_SET) - || bfd_bread (&eiha, sizeof (eiha), abfd) != sizeof (eiha)) + if (bfd_seek (abfd, eiha_off, SEEK_SET) + || bfd_read (&eiha, sizeof (eiha), abfd) != sizeof (eiha)) { fprintf (file, _("cannot read EIHA\n")); return; @@ -8287,8 +8287,8 @@ evax_bfd_print_image (bfd *abfd, FILE *file) { struct vms_eihi eihi; - if (bfd_seek (abfd, (file_ptr) eihi_off, SEEK_SET) - || bfd_bread (&eihi, sizeof (eihi), abfd) != sizeof (eihi)) + if (bfd_seek (abfd, eihi_off, SEEK_SET) + || bfd_read (&eihi, sizeof (eihi), abfd) != sizeof (eihi)) { fprintf (file, _("cannot read EIHI\n")); return; @@ -8312,8 +8312,8 @@ evax_bfd_print_image (bfd *abfd, FILE *file) { struct vms_eihs eihs; - if (bfd_seek (abfd, (file_ptr) eihs_off, SEEK_SET) - || bfd_bread (&eihs, sizeof (eihs), abfd) != sizeof (eihs)) + if (bfd_seek (abfd, eihs_off, SEEK_SET) + || bfd_read (&eihs, sizeof (eihs), abfd) != sizeof (eihs)) { fprintf (file, _("cannot read EIHS\n")); return; @@ -8345,8 +8345,8 @@ evax_bfd_print_image (bfd *abfd, FILE *file) while (1) { - if (bfd_seek (abfd, (file_ptr) eisd_off, SEEK_SET) - || bfd_bread (&eisd, sizeof (eisd), abfd) != sizeof (eisd)) + if (bfd_seek (abfd, eisd_off, SEEK_SET) + || bfd_read (&eisd, sizeof (eisd), abfd) != sizeof (eisd)) { fprintf (file, _("cannot read EISD\n")); return; @@ -8461,7 +8461,7 @@ evax_bfd_print_image (bfd *abfd, FILE *file) struct vms_dmt_header dmth; unsigned int count; - if (bfd_bread (&dmth, sizeof (dmth), abfd) != sizeof (dmth)) + if (bfd_read (&dmth, sizeof (dmth), abfd) != sizeof (dmth)) { fprintf (file, _("cannot read DMT header\n")); return; @@ -8477,7 +8477,7 @@ evax_bfd_print_image (bfd *abfd, FILE *file) { struct vms_dmt_psect dmtp; - if (bfd_bread (&dmtp, sizeof (dmtp), abfd) != sizeof (dmtp)) + if (bfd_read (&dmtp, sizeof (dmtp), abfd) != sizeof (dmtp)) { fprintf (file, _("cannot read DMT psect\n")); return; diff --git a/bfd/vms-lib.c b/bfd/vms-lib.c index 298e959..2734557 100644 --- a/bfd/vms-lib.c +++ b/bfd/vms-lib.c @@ -196,7 +196,7 @@ vms_add_indexes_from_list (bfd *abfd, struct carsym_mem *cs, char *name, /* Read the LHS. */ off = (vbn - 1) * VMS_BLOCK_SIZE + bfd_getl16 (rfa->offset); if (bfd_seek (abfd, off, SEEK_SET) != 0 - || bfd_bread (&lns, sizeof (lns), abfd) != sizeof (lns)) + || bfd_read (&lns, sizeof (lns), abfd) != sizeof (lns)) return false; if (!vms_add_index (cs, name, @@ -217,7 +217,7 @@ vms_read_block (bfd *abfd, unsigned int vbn, void *blk) off = (vbn - 1) * VMS_BLOCK_SIZE; if (bfd_seek (abfd, off, SEEK_SET) != 0 - || bfd_bread (blk, VMS_BLOCK_SIZE, abfd) != VMS_BLOCK_SIZE) + || bfd_read (blk, VMS_BLOCK_SIZE, abfd) != VMS_BLOCK_SIZE) return false; return true; @@ -232,7 +232,7 @@ vms_write_block (bfd *abfd, unsigned int vbn, void *blk) off = (vbn - 1) * VMS_BLOCK_SIZE; if (bfd_seek (abfd, off, SEEK_SET) != 0 - || bfd_bwrite (blk, VMS_BLOCK_SIZE, abfd) != VMS_BLOCK_SIZE) + || bfd_write (blk, VMS_BLOCK_SIZE, abfd) != VMS_BLOCK_SIZE) return false; return true; @@ -391,7 +391,7 @@ vms_traverse_index (bfd *abfd, unsigned int vbn, struct carsym_mem *cs, /* Read the LHS. */ off = (idx_vbn - 1) * VMS_BLOCK_SIZE + idx_off; if (bfd_seek (abfd, off, SEEK_SET) != 0 - || bfd_bread (&lhs, sizeof (lhs), abfd) != sizeof (lhs)) + || bfd_read (&lhs, sizeof (lhs), abfd) != sizeof (lhs)) return false; /* These extra entries may cause reallocation of CS. */ @@ -430,7 +430,7 @@ vms_lib_read_index (bfd *abfd, int idx, unsigned int *nbrel) /* Read index desription. */ if (bfd_seek (abfd, LHD_IDXDESC + idx * IDD_LENGTH, SEEK_SET) != 0 - || bfd_bread (&idd, sizeof (idd), abfd) != sizeof (idd)) + || bfd_read (&idd, sizeof (idd), abfd) != sizeof (idd)) return NULL; /* Sanity checks. */ @@ -506,7 +506,7 @@ _bfd_vms_lib_archive_p (bfd *abfd, enum vms_lib_kind kind) unsigned int nbr_ent; /* Read header. */ - if (bfd_bread (&lhd, sizeof (lhd), abfd) != sizeof (lhd)) + if (bfd_read (&lhd, sizeof (lhd), abfd) != sizeof (lhd)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -609,7 +609,7 @@ _bfd_vms_lib_archive_p (bfd *abfd, enum vms_lib_kind kind) unsigned int i; if (bfd_seek (abfd, (dcxvbn - 1) * VMS_BLOCK_SIZE, SEEK_SET) != 0 - || bfd_bread (buf_reclen, sizeof (buf_reclen), abfd) + || bfd_read (buf_reclen, sizeof (buf_reclen), abfd) != sizeof (buf_reclen)) goto err; reclen = bfd_getl32 (buf_reclen); @@ -824,7 +824,7 @@ struct vms_lib_iovec /* Length of the module, when known. */ ufile_ptr file_len; - /* Current position in the record from bfd_bread point of view (ie, after + /* Current position in the record from bfd_read point of view (ie, after decompression). 0 means that no data byte have been read, -2 and -1 are reserved for the length word. */ int rec_pos; @@ -893,7 +893,7 @@ vms_lib_read_block (struct bfd *abfd) /* Read next block. */ if (bfd_seek (abfd->my_archive, vec->next_block, SEEK_SET) != 0) return false; - if (bfd_bread (hdr, sizeof (hdr), abfd->my_archive) != sizeof (hdr)) + if (bfd_read (hdr, sizeof (hdr), abfd->my_archive) != sizeof (hdr)) return false; vec->next_block = (bfd_getl32 (hdr + 2) - 1) * VMS_BLOCK_SIZE; vec->blk_off = sizeof (hdr); @@ -929,7 +929,7 @@ vms_lib_bread_raw (struct bfd *abfd, unsigned char *buf, file_ptr nbytes) if (buf != NULL) { /* Really read into BUF. */ - if (bfd_bread (buf, l, abfd->my_archive) != l) + if (bfd_read (buf, l, abfd->my_archive) != l) return -1; } else @@ -1405,7 +1405,7 @@ _bfd_vms_lib_get_module (bfd *abfd, unsigned int modidx) /* Read the MHD now. */ if (bfd_seek (abfd, file_off, SEEK_SET) != 0) return NULL; - if (bfd_bread (buf, tdata->mhd_size, abfd) != tdata->mhd_size) + if (bfd_read (buf, tdata->mhd_size, abfd) != tdata->mhd_size) return NULL; mhd = (struct vms_mhd *) buf; @@ -2010,7 +2010,7 @@ vms_write_data_block (bfd *arch, struct vms_datadef *data, file_ptr *off, data->fill_1 = 0; bfd_putl32 ((*off / VMS_BLOCK_SIZE) + 2, data->link); - if (bfd_bwrite (data, sizeof (*data), arch) != sizeof (*data)) + if (bfd_write (data, sizeof (*data), arch) != sizeof (*data)) return false; *off += DATA__LENGTH - doff; @@ -2242,7 +2242,7 @@ _bfd_vms_lib_write_archive_contents (bfd *arch) file_ptr off_hdr = off; /* Read to complete the first block. */ - amt = bfd_bread (blk + sz, VMS_BLOCK_SIZE - sz, current); + amt = bfd_read (blk + sz, VMS_BLOCK_SIZE - sz, current); if (amt == (bfd_size_type)-1) goto input_err; modsize = amt; @@ -2254,7 +2254,7 @@ _bfd_vms_lib_write_archive_contents (bfd *arch) bfd_putl32 (modsize, mhd->modsize); /* Write the first block (which contains an mhd). */ - if (bfd_bwrite (blk, VMS_BLOCK_SIZE, arch) != VMS_BLOCK_SIZE) + if (bfd_write (blk, VMS_BLOCK_SIZE, arch) != VMS_BLOCK_SIZE) goto input_err; off += VMS_BLOCK_SIZE; @@ -2265,7 +2265,7 @@ _bfd_vms_lib_write_archive_contents (bfd *arch) while (1) { - amt = bfd_bread (buffer, sizeof (buffer), current); + amt = bfd_read (buffer, sizeof (buffer), current); if (amt == (bfd_size_type)-1) goto input_err; if (amt == 0) @@ -2277,7 +2277,7 @@ _bfd_vms_lib_write_archive_contents (bfd *arch) memset (buffer + amt, 0, sizeof (buffer) - amt); amt = (amt + VMS_BLOCK_SIZE) & ~(VMS_BLOCK_SIZE - 1); } - if (bfd_bwrite (buffer, amt, arch) != amt) + if (bfd_write (buffer, amt, arch) != amt) goto input_err; off += amt; } @@ -2285,7 +2285,7 @@ _bfd_vms_lib_write_archive_contents (bfd *arch) /* Now that the size is known, write the first block (again). */ bfd_putl32 (modsize, mhd->modsize); if (bfd_seek (arch, off_hdr, SEEK_SET) != 0 - || bfd_bwrite (blk, VMS_BLOCK_SIZE, arch) != VMS_BLOCK_SIZE) + || bfd_write (blk, VMS_BLOCK_SIZE, arch) != VMS_BLOCK_SIZE) goto input_err; if (bfd_seek (arch, off, SEEK_SET) != 0) goto input_err; @@ -2300,7 +2300,7 @@ _bfd_vms_lib_write_archive_contents (bfd *arch) /* Write the member. */ while (1) { - sz = bfd_bread (blk, sizeof (blk), current); + sz = bfd_read (blk, sizeof (blk), current); if (sz == 0) break; if (!vms_write_data_block (arch, &data, &off, blk, sz, 0)) diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c index da8d66e..833e5a3 100644 --- a/bfd/vms-misc.c +++ b/bfd/vms-misc.c @@ -289,14 +289,14 @@ _bfd_vms_output_end (bfd *abfd, struct vms_rec_wr *recwr) converted to variable length (VAR) format. VAR format has a length word first which must be explicitly output in UDF format. */ /* So, first the length word. */ - bfd_bwrite (recwr->buf + 2, 2, abfd); + bfd_write (recwr->buf + 2, 2, abfd); /* Align. */ if (recwr->size & 1) recwr->buf[recwr->size++] = 0; /* Then the record. */ - bfd_bwrite (recwr->buf, (size_t) recwr->size, abfd); + bfd_write (recwr->buf, (size_t) recwr->size, abfd); recwr->size = 0; } diff --git a/bfd/wasm-module.c b/bfd/wasm-module.c index 40cc573..d887f44 100644 --- a/bfd/wasm-module.c +++ b/bfd/wasm-module.c @@ -117,7 +117,7 @@ wasm_read_leb128 (bfd *abfd, unsigned char lost, mask; int status = 1; - while (bfd_bread (&byte, 1, abfd) == 1) + while (bfd_read (&byte, 1, abfd) == 1) { num_read++; @@ -169,7 +169,7 @@ wasm_write_uleb128 (bfd *abfd, bfd_vma v) if (v) c |= 0x80; - if (bfd_bwrite (&c, 1, abfd) != 1) + if (bfd_write (&c, 1, abfd) != 1) return false; } while (v); @@ -197,7 +197,7 @@ wasm_read_magic (bfd *abfd, bool *errorptr) bfd_byte magic_const[SIZEOF_WASM_MAGIC] = WASM_MAGIC; bfd_byte magic[SIZEOF_WASM_MAGIC]; - if (bfd_bread (magic, sizeof (magic), abfd) == sizeof (magic) + if (bfd_read (magic, sizeof (magic), abfd) == sizeof (magic) && memcmp (magic, magic_const, sizeof (magic)) == 0) return true; @@ -214,7 +214,7 @@ wasm_read_version (bfd *abfd, bool *errorptr) bfd_byte vers_const[SIZEOF_WASM_VERSION] = WASM_VERSION; bfd_byte vers[SIZEOF_WASM_VERSION]; - if (bfd_bread (vers, sizeof (vers), abfd) == sizeof (vers) + if (bfd_read (vers, sizeof (vers), abfd) == sizeof (vers) /* Don't attempt to parse newer versions, which are likely to require code changes. */ && memcmp (vers, vers_const, sizeof (vers)) == 0) @@ -371,7 +371,7 @@ wasm_read_byte (bfd *abfd, bool *errorptr) { bfd_byte byte; - if (bfd_bread (&byte, (bfd_size_type) 1, abfd) != 1) + if (bfd_read (&byte, 1, abfd) != 1) { if (bfd_get_error () != bfd_error_file_truncated) *errorptr = true; @@ -395,7 +395,7 @@ wasm_scan (bfd *abfd) unsigned int bytes_read; asection *bfdsec; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) goto error_return; if (!wasm_read_header (abfd, &error)) @@ -446,7 +446,7 @@ wasm_scan (bfd *abfd) if (!name) goto error_return; memcpy (name, prefix, prefixlen); - if (bfd_bread (name + prefixlen, namelen, abfd) != namelen) + if (bfd_read (name + prefixlen, namelen, abfd) != namelen) goto error_return; name[prefixlen + namelen] = 0; @@ -552,7 +552,7 @@ wasm_compute_custom_section_file_position (bfd *abfd, if (! wasm_write_uleb128 (abfd, 0) || ! wasm_write_uleb128 (abfd, payload_len) || ! wasm_write_uleb128 (abfd, name_len) - || bfd_bwrite (name, name_len, abfd) != name_len) + || bfd_write (name, name_len, abfd) != name_len) goto error_return; fs->pos = asect->filepos = bfd_tell (abfd); } @@ -588,8 +588,8 @@ wasm_compute_section_file_positions (bfd *abfd) bfd_seek (abfd, (bfd_vma) 0, SEEK_SET); - if (bfd_bwrite (magic, sizeof (magic), abfd) != (sizeof magic) - || bfd_bwrite (vers, sizeof (vers), abfd) != sizeof (vers)) + if (bfd_write (magic, sizeof (magic), abfd) != (sizeof magic) + || bfd_write (vers, sizeof (vers), abfd) != sizeof (vers)) return false; for (i = 0; i < WASM_NUMBERED_SECTIONS; i++) @@ -642,7 +642,7 @@ wasm_set_section_contents (bfd *abfd, return false; if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 - || bfd_bwrite (location, count, abfd) != count) + || bfd_write (location, count, abfd) != count) return false; return true; @@ -657,8 +657,8 @@ wasm_write_object_contents (bfd* abfd) if (bfd_seek (abfd, 0, SEEK_SET) != 0) return false; - if (bfd_bwrite (magic, sizeof (magic), abfd) != sizeof (magic) - || bfd_bwrite (vers, sizeof (vers), abfd) != sizeof (vers)) + if (bfd_write (magic, sizeof (magic), abfd) != sizeof (magic) + || bfd_write (vers, sizeof (vers), abfd) != sizeof (vers)) return false; return true; @@ -749,7 +749,7 @@ wasm_object_p (bfd *abfd) bool error; asection *s; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (abfd, 0, SEEK_SET) != 0) return NULL; if (!wasm_read_header (abfd, &error)) diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index a277213..bb502c2 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -5441,7 +5441,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, pos = obj_sym_filepos (output_bfd); pos += flinfo->last_file_index * osymesz; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || (bfd_bwrite (outsym, osymesz, output_bfd) + || (bfd_write (outsym, osymesz, output_bfd) != osymesz)) return false; } @@ -5648,7 +5648,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, pos = enclosing->line_filepos; amt = linesz * enc_count; if (bfd_seek (input_bfd, pos, SEEK_SET) != 0 - || (bfd_bread (flinfo->linenos, amt, input_bfd) + || (bfd_read (flinfo->linenos, amt, input_bfd) != amt)) return false; oline = enclosing; @@ -5680,8 +5680,8 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, + o->output_section->lineno_count * linesz); amt = linesz * *lineno_counts; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flinfo->linenos + linoff, - amt, output_bfd) != amt) + || bfd_write (flinfo->linenos + linoff, amt, + output_bfd) != amt) return false; o->output_section->lineno_count += *lineno_counts; @@ -5771,7 +5771,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo, file_ptr pos = obj_sym_filepos (output_bfd) + syment_base * osymesz; bfd_size_type amt = outsym - flinfo->outsyms; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flinfo->outsyms, amt, output_bfd) != amt) + || bfd_write (flinfo->outsyms, amt, output_bfd) != amt) return false; BFD_ASSERT ((obj_raw_syment_count (output_bfd) @@ -6216,7 +6216,7 @@ xcoff_find_tc0 (bfd *output_bfd, struct xcoff_final_link_info *flinfo) pos += obj_raw_syment_count (output_bfd) * bfd_coff_symesz (output_bfd); size = 2 * bfd_coff_symesz (output_bfd); if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flinfo->outsyms, size, output_bfd) != size) + || bfd_write (flinfo->outsyms, size, output_bfd) != size) return false; obj_raw_syment_count (output_bfd) += 2; @@ -6520,7 +6520,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) * bfd_coff_symesz (output_bfd)); amt = outsym - flinfo->outsyms; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flinfo->outsyms, amt, output_bfd) != amt) + || bfd_write (flinfo->outsyms, amt, output_bfd) != amt) return false; obj_raw_syment_count (output_bfd) += (outsym - flinfo->outsyms) / bfd_coff_symesz (output_bfd); @@ -6780,7 +6780,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) pos += obj_raw_syment_count (output_bfd) * bfd_coff_symesz (output_bfd); amt = outsym - flinfo->outsyms; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flinfo->outsyms, amt, output_bfd) != amt) + || bfd_write (flinfo->outsyms, amt, output_bfd) != amt) return false; obj_raw_syment_count (output_bfd) += (outsym - flinfo->outsyms) / bfd_coff_symesz (output_bfd); @@ -7338,7 +7338,7 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) (void *) flinfo.outsyms); pos = obj_sym_filepos (abfd) + flinfo.last_file_index * symesz; if (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bwrite (flinfo.outsyms, symesz, abfd) != symesz) + || bfd_write (flinfo.outsyms, symesz, abfd) != symesz) goto error_return; } @@ -7431,7 +7431,7 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) rel_size = relsz * o->reloc_count; if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 - || bfd_bwrite ((void *) external_relocs, rel_size, abfd) != rel_size) + || bfd_write (external_relocs, rel_size, abfd) != rel_size) goto error_return; } @@ -7513,7 +7513,7 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) _bfd_stringtab_size (flinfo.strtab) + STRING_SIZE_SIZE, strbuf); amt = STRING_SIZE_SIZE; - if (bfd_bwrite (strbuf, amt, abfd) != amt) + if (bfd_write (strbuf, amt, abfd) != amt) goto error_return; if (! _bfd_stringtab_emit (abfd, flinfo.strtab)) goto error_return; @@ -195,7 +195,7 @@ bfd_sym_read_header_v32 (bfd *abfd, bfd_sym_header_block *header) unsigned char buf[154]; long ret; - ret = bfd_bread (buf, 154, abfd); + ret = bfd_read (buf, 154, abfd); if (ret != 154) return -1; @@ -236,7 +236,7 @@ bfd_sym_read_version (bfd *abfd, bfd_sym_version *version) char version_string[32]; long ret; - ret = bfd_bread (version_string, sizeof (version_string), abfd); + ret = bfd_read (version_string, sizeof (version_string), abfd); if (ret != sizeof (version_string)) return -1; @@ -565,7 +565,7 @@ bfd_sym_fetch_resources_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -616,7 +616,7 @@ bfd_sym_fetch_modules_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -666,7 +666,7 @@ bfd_sym_fetch_file_references_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -716,7 +716,7 @@ bfd_sym_fetch_contained_modules_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -766,7 +766,7 @@ bfd_sym_fetch_contained_variables_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -816,7 +816,7 @@ bfd_sym_fetch_contained_statements_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -866,7 +866,7 @@ bfd_sym_fetch_contained_labels_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -916,7 +916,7 @@ bfd_sym_fetch_contained_types_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -966,7 +966,7 @@ bfd_sym_fetch_file_references_index_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -1016,7 +1016,7 @@ bfd_sym_fetch_constant_pool_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -1063,7 +1063,7 @@ bfd_sym_fetch_type_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, entry_size, abfd) != entry_size) + if (bfd_read (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); @@ -1086,17 +1086,17 @@ bfd_sym_fetch_type_information_table_entry (bfd *abfd, if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) return -1; entry->nte_index = bfd_getb32 (buf); - if (bfd_bread (buf, 2, abfd) != 2) + if (bfd_read (buf, 2, abfd) != 2) return -1; entry->physical_size = bfd_getb16 (buf); if (entry->physical_size & 0x8000) { - if (bfd_bread (buf, 4, abfd) != 4) + if (bfd_read (buf, 4, abfd) != 4) return -1; entry->physical_size &= 0x7fff; entry->logical_size = bfd_getb32 (buf); @@ -1104,7 +1104,7 @@ bfd_sym_fetch_type_information_table_entry (bfd *abfd, } else { - if (bfd_bread (buf, 2, abfd) != 2) + if (bfd_read (buf, 2, abfd) != 2) return -1; entry->physical_size &= 0x7fff; entry->logical_size = bfd_getb16 (buf); diff --git a/binutils/ar.c b/binutils/ar.c index 0c6ccf9..97bf34b 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -855,7 +855,7 @@ main (int argc, char **argv) /* Create a bfd to contain the dependencies. It inherits its type from arch, but we must set the type to - "binary" otherwise bfd_bwrite() will fail. After writing, we + "binary" otherwise bfd_write() will fail. After writing, we must set the type back to default otherwise adding it to the archive will fail. */ libdeps_bfd = bfd_create (LIBDEPS, arch); @@ -871,7 +871,7 @@ main (int argc, char **argv) if (! bfd_make_writable (libdeps_bfd)) fatal (_("Cannot make libdeps object writable.")); - if (bfd_bwrite (libdeps, reclen, libdeps_bfd) != reclen) + if (bfd_write (libdeps, reclen, libdeps_bfd) != reclen) fatal (_("Cannot write libdeps record.")); if (! bfd_make_readable (libdeps_bfd)) @@ -1078,7 +1078,7 @@ print_contents (bfd *abfd) if (verbose) printf ("\n<%s>\n\n", bfd_get_filename (abfd)); - bfd_seek (abfd, (file_ptr) 0, SEEK_SET); + bfd_seek (abfd, 0, SEEK_SET); size = buf.st_size; while (ncopied < size) @@ -1089,7 +1089,7 @@ print_contents (bfd *abfd) if (tocopy > BUFSIZE) tocopy = BUFSIZE; - nread = bfd_bread (cbuf, tocopy, abfd); + nread = bfd_read (cbuf, tocopy, abfd); if (nread != tocopy) /* xgettext:c-format */ fatal (_("%s is not a valid archive"), @@ -1176,7 +1176,7 @@ extract_file (bfd *abfd) fatal (_("internal stat error on %s"), bfd_get_filename (abfd)); size = buf.st_size; - bfd_seek (abfd, (file_ptr) 0, SEEK_SET); + bfd_seek (abfd, 0, SEEK_SET); output_file = NULL; if (size == 0) @@ -1196,7 +1196,7 @@ extract_file (bfd *abfd) if (tocopy > BUFSIZE) tocopy = BUFSIZE; - nread = bfd_bread (cbuf, tocopy, abfd); + nread = bfd_read (cbuf, tocopy, abfd); if (nread != tocopy) /* xgettext:c-format */ fatal (_("%s is not a valid archive"), diff --git a/binutils/objcopy.c b/binutils/objcopy.c index b2b7ab6..2ce1b07 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1961,7 +1961,7 @@ copy_unknown_object (bfd *ibfd, bfd *obfd) return false; } - if (bfd_seek (ibfd, (file_ptr) 0, SEEK_SET) != 0) + if (bfd_seek (ibfd, 0, SEEK_SET) != 0) { bfd_nonfatal (bfd_get_archive_filename (ibfd)); return false; @@ -1979,14 +1979,14 @@ copy_unknown_object (bfd *ibfd, bfd *obfd) else tocopy = size; - if (bfd_bread (cbuf, tocopy, ibfd) != tocopy) + if (bfd_read (cbuf, tocopy, ibfd) != tocopy) { bfd_nonfatal_message (NULL, ibfd, NULL, NULL); free (cbuf); return false; } - if (bfd_bwrite (cbuf, tocopy, obfd) != tocopy) + if (bfd_write (cbuf, tocopy, obfd) != tocopy) { bfd_nonfatal_message (NULL, obfd, NULL, NULL); free (cbuf); diff --git a/binutils/od-macho.c b/binutils/od-macho.c index c2bd7d3..326120f 100644 --- a/binutils/od-macho.c +++ b/binutils/od-macho.c @@ -661,7 +661,7 @@ load_and_dump (bfd *abfd, ufile_ptr off, unsigned int len, buf = xmalloc (len); if (bfd_seek (abfd, off, SEEK_SET) == 0 - && bfd_bread (buf, len, abfd) == len) + && bfd_read (buf, len, abfd) == len) dump (abfd, buf, len, off); else return false; @@ -1045,7 +1045,7 @@ dump_thread (bfd *abfd, bfd_mach_o_load_command *cmd) char *buf = xmalloc (flavour->size); if (bfd_seek (abfd, flavour->offset, SEEK_SET) == 0 - && bfd_bread (buf, flavour->size, abfd) == flavour->size) + && bfd_read (buf, flavour->size, abfd) == flavour->size) (*bed->_bfd_mach_o_print_thread)(abfd, flavour, stdout, buf); free (buf); @@ -1248,7 +1248,7 @@ dump_code_signature (bfd *abfd, bfd_mach_o_linkedit_command *cmd) unsigned int off; if (bfd_seek (abfd, cmd->dataoff, SEEK_SET) != 0 - || bfd_bread (buf, cmd->datasize, abfd) != cmd->datasize) + || bfd_read (buf, cmd->datasize, abfd) != cmd->datasize) { non_fatal (_("cannot read code signature data")); free (buf); @@ -1276,7 +1276,7 @@ dump_segment_split_info (bfd *abfd, bfd_mach_o_linkedit_command *cmd) bfd_vma addr = 0; if (bfd_seek (abfd, cmd->dataoff, SEEK_SET) != 0 - || bfd_bread (buf, cmd->datasize, abfd) != cmd->datasize) + || bfd_read (buf, cmd->datasize, abfd) != cmd->datasize) { non_fatal (_("cannot read segment split info")); free (buf); @@ -1323,7 +1323,7 @@ dump_function_starts (bfd *abfd, bfd_mach_o_linkedit_command *cmd) bfd_vma addr; if (bfd_seek (abfd, cmd->dataoff, SEEK_SET) != 0 - || bfd_bread (buf, cmd->datasize, abfd) != cmd->datasize) + || bfd_read (buf, cmd->datasize, abfd) != cmd->datasize) { non_fatal (_("cannot read function starts")); free (buf); @@ -1387,7 +1387,7 @@ dump_data_in_code (bfd *abfd, bfd_mach_o_linkedit_command *cmd) buf = xmalloc (cmd->datasize); if (bfd_seek (abfd, cmd->dataoff, SEEK_SET) != 0 - || bfd_bread (buf, cmd->datasize, abfd) != cmd->datasize) + || bfd_read (buf, cmd->datasize, abfd) != cmd->datasize) { non_fatal (_("cannot read data_in_code")); free (buf); @@ -1425,7 +1425,7 @@ dump_twolevel_hints (bfd *abfd, bfd_mach_o_twolevel_hints_command *cmd) buf = xmalloc (sz); if (bfd_seek (abfd, cmd->offset, SEEK_SET) != 0 - || bfd_bread (buf, sz, abfd) != sz) + || bfd_read (buf, sz, abfd) != sz) { non_fatal (_("cannot read twolevel hints")); free (buf); @@ -1493,7 +1493,7 @@ dump_build_version (bfd *abfd, bfd_mach_o_load_command *cmd) tools = xmalloc (tools_len); if (bfd_seek (abfd, tools_offset, SEEK_SET) != 0 - || bfd_bread (tools, tools_len, abfd) != tools_len) + || bfd_read (tools, tools_len, abfd) != tools_len) { non_fatal (_("cannot read build tools")); free (tools); diff --git a/binutils/od-pe.c b/binutils/od-pe.c index be9d4eb..a5f2780 100644 --- a/binutils/od-pe.c +++ b/binutils/od-pe.c @@ -192,7 +192,8 @@ const struct target_specific_info targ_info[] = { 0x0b00, "MCore", AOUTHDRSZ } }; -static const struct target_specific_info unknown_info = { 0, "unknown", AOUTHDRSZ }; +static const struct target_specific_info unknown_info = + { 0, "unknown", AOUTHDRSZ }; static const struct target_specific_info * get_target_specific_info (unsigned int machine) @@ -203,7 +204,7 @@ get_target_specific_info (unsigned int machine) if (targ_info[i].machine_number == machine) return targ_info + i; - return & unknown_info; + return &unknown_info; } /* Display help. */ @@ -389,7 +390,7 @@ dump_pe_file_header (bfd * abfd, { /* Not correct on all platforms, but works on unix. */ time_t t = timedat; - fputs (ctime (& t), stdout); + fputs (ctime (&t), stdout); } printf (_("Symbol table offset:\t\t%#08lx\n"), @@ -415,7 +416,7 @@ dump_pe_file_header (bfd * abfd, // Fortunately, it appears that the size and layout of the // PEPAOUTHDR header is consistent across all architectures. if (bfd_seek (abfd, ihdr_off + sizeof (* ihdr), SEEK_SET) != 0 - || bfd_bread (& xhdr, sizeof (xhdr), abfd) != sizeof (xhdr)) + || bfd_read (&xhdr, sizeof (xhdr), abfd) != sizeof (xhdr)) printf (_("error: unable to read AOUT and PE+ headers\n")); else { @@ -500,7 +501,7 @@ dump_pe_file_header (bfd * abfd, off, aout_hdr_size); if (bfd_seek (abfd, off, SEEK_SET) != 0 - || bfd_bread (& xhdr.standard, size, abfd) != size) + || bfd_read (&xhdr.standard, size, abfd) != size) printf (_("error: unable to seek to/read AOUT header\n")); else { @@ -533,7 +534,7 @@ dump_pe_file_header (bfd * abfd, /* FIXME: Sanitizers might complain about reading more bytes than fit into the ImageBase field. Find a way to solve this. */ if (bfd_seek (abfd, off, SEEK_SET) != 0 - || bfd_bread (& xhdr.ImageBase, size, abfd) != size) + || bfd_read (&xhdr.ImageBase, size, abfd) != size) printf (_("error: unable to seek to/read PE header\n")); else { @@ -632,7 +633,7 @@ dump_pe_sections_header (bfd * abfd, struct external_scnhdr scn; unsigned int flags; - if (bfd_bread (& scn, sizeof (scn), abfd) != sizeof (scn)) + if (bfd_read (&scn, sizeof (scn), abfd) != sizeof (scn)) { non_fatal (_("cannot read section header")); return; @@ -689,7 +690,7 @@ pe_dump_obj (bfd *abfd) /* Read file header. */ if (bfd_seek (abfd, 0, SEEK_SET) != 0 - || bfd_bread (& fhdr, sizeof (fhdr), abfd) != sizeof (fhdr)) + || bfd_read (&fhdr, sizeof (fhdr), abfd) != sizeof (fhdr)) { non_fatal (_("cannot seek to/read file header")); return; @@ -709,7 +710,7 @@ pe_dump_obj (bfd *abfd) struct external_PEI_IMAGE_hdr ihdr; if (bfd_seek (abfd, ihdr_offset, SEEK_SET) != 0 - || bfd_bread (& ihdr, sizeof (ihdr), abfd) != sizeof (ihdr)) + || bfd_read (&ihdr, sizeof (ihdr), abfd) != sizeof (ihdr)) { non_fatal (_("cannot seek to/read image header at offset %#x"), ihdr_offset); @@ -724,7 +725,7 @@ pe_dump_obj (bfd *abfd) return; } - dump_pe (abfd, & fhdr, & ihdr); + dump_pe (abfd, &fhdr, &ihdr); } /* See if we recognise this particular PE object file. */ else if (get_target_specific_info (magic)->machine_number) @@ -732,15 +733,15 @@ pe_dump_obj (bfd *abfd) struct external_filehdr ehdr; if (bfd_seek (abfd, 0, SEEK_SET) != 0 - || bfd_bread (& ehdr, sizeof (ehdr), abfd) != sizeof (ehdr)) + || bfd_read (&ehdr, sizeof (ehdr), abfd) != sizeof (ehdr)) { non_fatal (_("cannot seek to/read image header")); return; } struct external_PEI_IMAGE_hdr ihdr; - memcpy (& ihdr.f_magic, & ehdr, sizeof (ehdr)); - dump_pe (abfd, NULL, & ihdr); + memcpy (&ihdr.f_magic, &ehdr, sizeof (ehdr)); + dump_pe (abfd, NULL, &ihdr); } else { diff --git a/binutils/od-xcoff.c b/binutils/od-xcoff.c index e6b2f08..8f3026d 100644 --- a/binutils/od-xcoff.c +++ b/binutils/od-xcoff.c @@ -455,7 +455,7 @@ dump_xcoff32_aout_header (bfd *abfd, struct xcoff_dump *data) (int)sizeof (auxhdr)); sz = sizeof (auxhdr); } - if (bfd_bread (&auxhdr, sz, abfd) != sz) + if (bfd_read (&auxhdr, sz, abfd) != sz) { non_fatal (_("cannot read auxhdr")); return; @@ -542,7 +542,7 @@ dump_xcoff32_sections_header (bfd *abfd, struct xcoff_dump *data) struct external_scnhdr scn; unsigned int flags; - if (bfd_bread (&scn, sizeof (scn), abfd) != sizeof (scn)) + if (bfd_read (&scn, sizeof (scn), abfd) != sizeof (scn)) { non_fatal (_("cannot read section header")); return; @@ -597,7 +597,7 @@ xcoff32_read_sections (bfd *abfd, struct xcoff_dump *data) struct external_scnhdr scn; struct xcoff32_section *s = &data->sects[i]; - if (bfd_bread (&scn, sizeof (scn), abfd) != sizeof (scn)) + if (bfd_read (&scn, sizeof (scn), abfd) != sizeof (scn)) { non_fatal (_("cannot read section header")); free (data->sects); @@ -644,7 +644,7 @@ xcoff32_read_symbols (bfd *abfd, struct xcoff_dump *data) /* Read string table. */ if (bfd_seek (abfd, stptr, SEEK_SET) != 0 - || bfd_bread (&stsz_arr, sizeof (stsz_arr), abfd) != sizeof (stsz_arr)) + || bfd_read (&stsz_arr, sizeof (stsz_arr), abfd) != sizeof (stsz_arr)) { non_fatal (_("cannot read strings table length")); data->strings_size = 0; @@ -659,7 +659,7 @@ xcoff32_read_symbols (bfd *abfd, struct xcoff_dump *data) data->strings = xmalloc (data->strings_size); memcpy (data->strings, stsz_arr, sizeof (stsz_arr)); - if (bfd_bread (data->strings + sizeof (stsz_arr), remsz, abfd) + if (bfd_read (data->strings + sizeof (stsz_arr), remsz, abfd) != remsz) { non_fatal (_("cannot read strings table")); @@ -683,7 +683,7 @@ xcoff32_read_symbols (bfd *abfd, struct xcoff_dump *data) int j; union xcoff32_symbol *s = &data->syms[i]; - if (bfd_bread (&sym, sizeof (sym), abfd) != sizeof (sym)) + if (bfd_read (&sym, sizeof (sym), abfd) != sizeof (sym)) { non_fatal (_("cannot read symbol entry")); goto clean; @@ -716,7 +716,7 @@ xcoff32_read_symbols (bfd *abfd, struct xcoff_dump *data) for (j = 0; j < s->sym.numaux; j++, i++) { - if (bfd_bread (&s[j + 1].aux, + if (bfd_read (&s[j + 1].aux, sizeof (union external_auxent), abfd) != sizeof (union external_auxent)) { @@ -948,7 +948,7 @@ dump_xcoff32_relocs (bfd *abfd, struct xcoff_dump *data) unsigned char rsize; unsigned int symndx; - if (bfd_bread (&rel, sizeof (rel), abfd) != sizeof (rel)) + if (bfd_read (&rel, sizeof (rel), abfd) != sizeof (rel)) { non_fatal (_("cannot read relocation entry")); return; @@ -1003,7 +1003,7 @@ dump_xcoff32_lineno (bfd *abfd, struct xcoff_dump *data) struct external_lineno ln; unsigned int no; - if (bfd_bread (&ln, sizeof (ln), abfd) != sizeof (ln)) + if (bfd_read (&ln, sizeof (ln), abfd) != sizeof (ln)) { non_fatal (_("cannot read line number entry")); return; @@ -1638,7 +1638,7 @@ xcoff_dump_obj (bfd *abfd) /* Read file header. */ if (bfd_seek (abfd, 0, SEEK_SET) != 0 - || bfd_bread (&fhdr, sizeof (fhdr), abfd) != sizeof (fhdr)) + || bfd_read (&fhdr, sizeof (fhdr), abfd) != sizeof (fhdr)) { non_fatal (_("cannot read header")); return; @@ -1735,7 +1735,7 @@ dump_dumpx_core (bfd *abfd, struct external_core_dumpx *hdr) ldr = xmalloc (len); if (bfd_seek (abfd, off, SEEK_SET) != 0 - || bfd_bread (ldr, len, abfd) != len) + || bfd_read (ldr, len, abfd) != len) non_fatal (_("cannot read loader info table")); else { @@ -1784,7 +1784,7 @@ xcoff_dump_core (bfd *abfd) /* Read file header. */ if (bfd_seek (abfd, 0, SEEK_SET) != 0 - || bfd_bread (&hdr, sizeof (hdr), abfd) != sizeof (hdr)) + || bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr)) { non_fatal (_("cannot core read header")); return; diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index 14eb9f9..b602db2 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -144,7 +144,7 @@ obj_aout_frob_file_before_fix (void) file_ptr pos = sec->filepos + *sizep; gas_assert (bfd_seek (stdoutput, pos - 1, SEEK_SET) == 0 - && bfd_bwrite (&b, 1, stdoutput) == 1); + && bfd_write (&b, 1, stdoutput) == 1); } } } diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index 4dc1dbf..dd4c0bd 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -2374,7 +2374,7 @@ tic54x_mlib (int ignore ATTRIBUTE_UNUSED) FILE *ftmp; /* We're not sure how big it is, but it will be smaller than "size". */ - size = bfd_bread (buf, size, mbfd); + size = bfd_read (buf, size, mbfd); /* Write to a temporary file, then use s_include to include it a bit of a hack. */ diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index a6401c4..b82b43c 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -259,7 +259,7 @@ pe_get16 (bfd *abfd, int where) unsigned char b[2]; bfd_seek (abfd, (file_ptr) where, SEEK_SET); - bfd_bread (b, (bfd_size_type) 2, abfd); + bfd_read (b, (bfd_size_type) 2, abfd); return b[0] + (b[1] << 8); } @@ -269,7 +269,7 @@ pe_get32 (bfd *abfd, int where) unsigned char b[4]; bfd_seek (abfd, (file_ptr) where, SEEK_SET); - bfd_bread (b, (bfd_size_type) 4, abfd); + bfd_read (b, (bfd_size_type) 4, abfd); return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24); } @@ -379,7 +379,7 @@ read_pe_exported_syms (minimal_symbol_reader &reader, unsigned long fptr = pe_get32 (dll, secptr1 + 20); bfd_seek (dll, (file_ptr) secptr1, SEEK_SET); - bfd_bread (sname, (bfd_size_type) sizeof (sname), dll); + bfd_read (sname, (bfd_size_type) sizeof (sname), dll); if ((strcmp (sname, ".edata") == 0) || (vaddr <= export_opthdrrva && export_opthdrrva < vaddr + vsize)) @@ -429,7 +429,7 @@ read_pe_exported_syms (minimal_symbol_reader &reader, asection *section; bfd_seek (dll, (file_ptr) secptr1 + 0, SEEK_SET); - bfd_bread (sec_name, (bfd_size_type) SCNNMLEN, dll); + bfd_read (sec_name, (bfd_size_type) SCNNMLEN, dll); sec_name[SCNNMLEN] = '\0'; sectix = read_pe_section_index (sec_name); @@ -469,7 +469,7 @@ read_pe_exported_syms (minimal_symbol_reader &reader, expdata = expdata_storage.data (); bfd_seek (dll, (file_ptr) expptr, SEEK_SET); - bfd_bread (expdata, (bfd_size_type) export_size, dll); + bfd_read (expdata, (bfd_size_type) export_size, dll); erva = expdata - export_rva; nexp = pe_as32 (expdata + 24); @@ -639,7 +639,7 @@ pe_text_section_offset (struct bfd *abfd) unsigned long vaddr = pe_get32 (abfd, secptr1 + 12); bfd_seek (abfd, (file_ptr) secptr1, SEEK_SET); - bfd_bread (sname, (bfd_size_type) SCNNMLEN, abfd); + bfd_read (sname, (bfd_size_type) SCNNMLEN, abfd); sname[SCNNMLEN] = '\0'; if (strcmp (sname, ".text") == 0) return vaddr; diff --git a/gdb/coffread.c b/gdb/coffread.c index 6ec341c..583db6b 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1224,14 +1224,14 @@ read_one_sym (struct coff_symbol *cs, bfd_size_type bytes; cs->c_symnum = symnum; - bytes = bfd_bread (temp_sym, local_symesz, nlist_bfd_global); + bytes = bfd_read (temp_sym, local_symesz, nlist_bfd_global); if (bytes != local_symesz) error (_("%s: error reading symbols"), objfile_name (coffread_objfile)); bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *) sym); cs->c_naux = sym->n_numaux & 0xff; if (cs->c_naux >= 1) { - bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global); + bytes = bfd_read (temp_aux, local_auxesz, nlist_bfd_global); if (bytes != local_auxesz) error (_("%s: error reading symbols"), objfile_name (coffread_objfile)); bfd_coff_swap_aux_in (symfile_bfd, temp_aux, @@ -1241,7 +1241,7 @@ read_one_sym (struct coff_symbol *cs, is important). */ for (i = 1; i < cs->c_naux; i++) { - bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global); + bytes = bfd_read (temp_aux, local_auxesz, nlist_bfd_global); if (bytes != local_auxesz) error (_("%s: error reading symbols"), objfile_name (coffread_objfile)); @@ -1308,7 +1308,7 @@ init_stringtab (bfd *abfd, file_ptr offset, gdb::unique_xmalloc_ptr<char> *stora if (bfd_seek (abfd, offset, 0) < 0) return -1; - val = bfd_bread ((char *) lengthbuf, sizeof lengthbuf, abfd); + val = bfd_read ((char *) lengthbuf, sizeof lengthbuf, abfd); length = bfd_h_get_32 (symfile_bfd, lengthbuf); /* If no string table is needed, then the file may end immediately @@ -1324,8 +1324,8 @@ init_stringtab (bfd *abfd, file_ptr offset, gdb::unique_xmalloc_ptr<char> *stora if (length == sizeof length) /* Empty table -- just the count. */ return 0; - val = bfd_bread (stringtab + sizeof lengthbuf, - length - sizeof lengthbuf, abfd); + val = bfd_read (stringtab + sizeof lengthbuf, + length - sizeof lengthbuf, abfd); if (val != length - sizeof lengthbuf || stringtab[length - 1] != '\0') return -1; @@ -1409,7 +1409,7 @@ init_lineno (bfd *abfd, file_ptr offset, file_ptr size, storage->reset ((char *) xmalloc (size + local_linesz)); linetab = storage->get (); - val = bfd_bread (storage->get (), size, abfd); + val = bfd_read (storage->get (), size, abfd); if (val != size) return -1; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index a0a08b1..75bbd51 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -640,7 +640,7 @@ dbx_symfile_init (struct objfile *objfile) perror_with_name (name); memset (size_temp, 0, sizeof (size_temp)); - val = bfd_bread (size_temp, sizeof (size_temp), sym_bfd); + val = bfd_read (size_temp, sizeof (size_temp), sym_bfd); if (val < 0) { perror_with_name (name); @@ -679,9 +679,9 @@ dbx_symfile_init (struct objfile *objfile) val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, SEEK_SET); if (val < 0) perror_with_name (name); - val = bfd_bread (DBX_STRINGTAB (objfile), - DBX_STRINGTAB_SIZE (objfile), - sym_bfd); + val = bfd_read (DBX_STRINGTAB (objfile), + DBX_STRINGTAB_SIZE (objfile), + sym_bfd); if (val != DBX_STRINGTAB_SIZE (objfile)) perror_with_name (name); } @@ -769,7 +769,7 @@ fill_symbuf (bfd *sym_bfd) else if (symbuf_sections == NULL) { count = sizeof (symbuf); - nbytes = bfd_bread (symbuf, count, sym_bfd); + nbytes = bfd_read (symbuf, count, sym_bfd); } else { @@ -787,7 +787,7 @@ fill_symbuf (bfd *sym_bfd) count = symbuf_left; if (count > sizeof (symbuf)) count = sizeof (symbuf); - nbytes = bfd_bread (symbuf, count, sym_bfd); + nbytes = bfd_read (symbuf, count, sym_bfd); } if (nbytes < 0) @@ -3015,7 +3015,7 @@ coffstab_build_psymtabs (struct objfile *objfile, val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET); if (val < 0) perror_with_name (name); - val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd); + val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd); if (val != stabstrsize) perror_with_name (name); @@ -3108,7 +3108,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect, val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET); if (val < 0) perror_with_name (name); - val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd); + val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd); if (val != stabstrsize) perror_with_name (name); diff --git a/gdb/dwarf2/section.c b/gdb/dwarf2/section.c index c9ef418..1235f29 100644 --- a/gdb/dwarf2/section.c +++ b/gdb/dwarf2/section.c @@ -182,7 +182,7 @@ dwarf2_section_info::read (struct objfile *objfile) gdb_assert (abfd != NULL); if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 - || bfd_bread (buf, size, abfd) != size) + || bfd_read (buf, size, abfd) != size) { error (_("Dwarf Error: Can't read DWARF data" " in section %s [in module %s]"), diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 9227a6c..3765561 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -838,7 +838,7 @@ get_file_crc (bfd *abfd, unsigned long *file_crc_return) gdb_byte buffer[8 * 1024]; bfd_size_type count; - count = bfd_bread (buffer, sizeof (buffer), abfd); + count = bfd_read (buffer, sizeof (buffer), abfd); if (count == (bfd_size_type) -1) { warning (_("Problem reading \"%s\" for CRC: %s"), diff --git a/gdb/minidebug.c b/gdb/minidebug.c index 53d34d3..a3ab0e3 100644 --- a/gdb/minidebug.c +++ b/gdb/minidebug.c @@ -95,7 +95,7 @@ lzma_open (struct bfd *nbfd, void *open_closure) offset = section->filepos + size - LZMA_STREAM_HEADER_SIZE; if (size < LZMA_STREAM_HEADER_SIZE || bfd_seek (section->owner, offset, SEEK_SET) != 0 - || bfd_bread (footer, LZMA_STREAM_HEADER_SIZE, section->owner) + || bfd_read (footer, LZMA_STREAM_HEADER_SIZE, section->owner) != LZMA_STREAM_HEADER_SIZE || lzma_stream_footer_decode (&options, footer) != LZMA_OK || offset < options.backward_size) @@ -109,7 +109,7 @@ lzma_open (struct bfd *nbfd, void *open_closure) index = NULL; pos = 0; if (bfd_seek (section->owner, offset, SEEK_SET) != 0 - || bfd_bread (indexdata, options.backward_size, section->owner) + || bfd_read (indexdata, options.backward_size, section->owner) != options.backward_size || lzma_index_buffer_decode (&index, &memlimit, &gdb_lzma_allocator, indexdata, &pos, options.backward_size) @@ -162,7 +162,7 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes, compressed = (gdb_byte *) xmalloc (iter.block.total_size); block_offset = section->filepos + iter.block.compressed_file_offset; if (bfd_seek (section->owner, block_offset, SEEK_SET) != 0 - || bfd_bread (compressed, iter.block.total_size, section->owner) + || bfd_read (compressed, iter.block.total_size, section->owner) != iter.block.total_size) { xfree (compressed); diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index f1fa437..f5fdbc7 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -2634,7 +2634,7 @@ read_program_headers_from_bfd (bfd *abfd) gdb::byte_vector buf (phdrs_size); if (bfd_seek (abfd, ehdr->e_phoff, SEEK_SET) != 0 - || bfd_bread (buf.data (), phdrs_size, abfd) != phdrs_size) + || bfd_read (buf.data (), phdrs_size, abfd) != phdrs_size) return {}; return buf; diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 8930cf1..8ce4b28 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -780,7 +780,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, while (curoffset <= limit_offset) { bfd_seek (abfd, curoffset, SEEK_SET); - bfd_bread (ext_lnno, linesz, abfd); + bfd_read (ext_lnno, linesz, abfd); bfd_coff_swap_lineno_in (abfd, ext_lnno, &int_lnno); /* Find the address this line represents. */ @@ -1827,7 +1827,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile) error (_("cannot seek to string table in %s: %s"), bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); - val = bfd_bread ((char *) lengthbuf, sizeof lengthbuf, abfd); + val = bfd_read ((char *) lengthbuf, sizeof lengthbuf, abfd); length = bfd_h_get_32 (abfd, lengthbuf); /* If no string table is needed, then the file may end immediately @@ -1848,7 +1848,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile) if (length == sizeof lengthbuf) return; - val = bfd_bread (strtbl + sizeof lengthbuf, length - sizeof lengthbuf, abfd); + val = bfd_read (strtbl + sizeof lengthbuf, length - sizeof lengthbuf, abfd); if (val != length - sizeof lengthbuf) error (_("cannot read string table from %s: %s"), @@ -2848,7 +2848,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) info->symtbl = (char *) obstack_alloc (&objfile->objfile_obstack, size); info->symtbl_num_syms = num_symbols; - val = bfd_bread (info->symtbl, size, abfd); + val = bfd_read (info->symtbl, size, abfd); if (val != size) perror_with_name (_("reading symbol table")); diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index a583b02..36f60d5 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1355,7 +1355,7 @@ pecoff_checksum_contents (bfd *abfd, if (bfd_seek (abfd, filepos, SEEK_SET) != 0) return 0; - status = bfd_bread (&b, (bfd_size_type) 1, abfd); + status = bfd_read (&b, 1, abfd); if (status < 1) { break; @@ -1446,7 +1446,7 @@ write_build_id (bfd *abfd) if (bfd_seek (abfd, asec->filepos + link_order->offset, SEEK_SET) != 0) return 0; - if (bfd_bwrite (contents, sizeof (*ext), abfd) != sizeof (*ext)) + if (bfd_write (contents, sizeof (*ext), abfd) != sizeof (*ext)) return 0; #ifdef PDB_H diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index 516d2af..1df959a 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -1353,7 +1353,7 @@ pecoff_checksum_contents (bfd *abfd, if (bfd_seek (abfd, filepos, SEEK_SET) != 0) return 0; - status = bfd_bread (&b, (bfd_size_type) 1, abfd); + status = bfd_read (&b, 1, abfd); if (status < 1) { break; @@ -1444,7 +1444,7 @@ write_build_id (bfd *abfd) if (bfd_seek (abfd, asec->filepos + link_order->offset, SEEK_SET) != 0) return 0; - if (bfd_bwrite (contents, sizeof (*ext), abfd) != sizeof (*ext)) + if (bfd_write (contents, sizeof (*ext), abfd) != sizeof (*ext)) return 0; #ifdef PDB_H @@ -1482,7 +1482,7 @@ write_build_id (bfd *abfd) position = i_shdr->sh_offset + asec->output_offset; size = asec->size; return (bfd_seek (abfd, position, SEEK_SET) == 0 - && bfd_bwrite (contents, size, abfd) == size); + && bfd_write (contents, size, abfd) == size); } /* Make .note.gnu.build-id section, and set up elf_tdata->build_id. */ @@ -1570,7 +1570,7 @@ write_package_metadata (bfd *abfd) position = i_shdr->sh_offset + asec->output_offset; size = asec->size; return (bfd_seek (abfd, position, SEEK_SET) == 0 - && bfd_bwrite (contents, size, abfd) == size); + && bfd_write (contents, size, abfd) == size); } /* Make .note.package section. @@ -220,7 +220,7 @@ create_old_directory_stream (bfd *pdb) bfd_putl32 (0, buf); - return bfd_bwrite (buf, sizeof (uint32_t), stream) == sizeof (uint32_t); + return bfd_write (buf, sizeof (uint32_t), stream) == sizeof (uint32_t); } /* Calculate the hash of a given string. */ @@ -288,7 +288,7 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) bfd_putl16 (bfd_getb16 (&guid[6]), &h.guid[6]); memcpy (&h.guid[8], &guid[8], 8); - if (bfd_bwrite (&h, sizeof (h), info_stream) != sizeof (h)) + if (bfd_write (&h, sizeof (h), info_stream) != sizeof (h)) return false; /* Write hash list of named streams. This is a "rollover" hash, i.e. @@ -344,7 +344,7 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) bfd_putl32 (names_length, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; @@ -355,7 +355,7 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) size_t len = strlen (b->filename) + 1; - if (bfd_bwrite (b->filename, len, info_stream) != len) + if (bfd_write (b->filename, len, info_stream) != len) goto end; } @@ -363,13 +363,13 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) bfd_putl32 (num_entries, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; bfd_putl32 (num_buckets, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; @@ -377,7 +377,7 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) bfd_putl32 ((num_buckets + 31) / 32, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; @@ -396,7 +396,7 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) bfd_putl32 (v, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; } @@ -405,7 +405,7 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) bfd_putl32 (0, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; @@ -417,13 +417,13 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) { bfd_putl32 (buckets[i]->offset, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; bfd_putl32 (buckets[i]->value, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; } @@ -431,13 +431,13 @@ populate_info_stream (bfd *pdb, bfd *info_stream, const unsigned char *guid) bfd_putl32 (0, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; bfd_putl32 (PDB_STREAM_VERSION_VC140, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) != + if (bfd_write (int_buf, sizeof (uint32_t), info_stream) != sizeof (uint32_t)) goto end; @@ -529,7 +529,7 @@ populate_type_stream (bfd *pdb, bfd *stream, struct types *types) &h.hash_adj_buffer_offset); bfd_putl32 (0, &h.hash_adj_buffer_length); - if (bfd_bwrite (&h, sizeof (h), stream) != sizeof (h)) + if (bfd_write (&h, sizeof (h), stream) != sizeof (h)) return false; /* Write the type definitions into the main stream, and the hashes @@ -545,13 +545,13 @@ populate_type_stream (bfd *pdb, bfd *stream, struct types *types) size = bfd_getl16 (e->data); - if (bfd_bwrite (e->data, size + sizeof (uint16_t), stream) + if (bfd_write (e->data, size + sizeof (uint16_t), stream) != size + sizeof (uint16_t)) return false; bfd_putl32 (e->cv_hash % NUM_TPI_HASH_BUCKETS, buf); - if (bfd_bwrite (buf, sizeof (uint32_t), hash_stream) + if (bfd_write (buf, sizeof (uint32_t), hash_stream) != sizeof (uint32_t)) return false; @@ -577,13 +577,13 @@ populate_type_stream (bfd *pdb, bfd *stream, struct types *types) bfd_putl32 (TPI_FIRST_INDEX + e->index, buf); - if (bfd_bwrite (buf, sizeof (uint32_t), hash_stream) + if (bfd_write (buf, sizeof (uint32_t), hash_stream) != sizeof (uint32_t)) return false; bfd_putl32 (old_off, buf); - if (bfd_bwrite (buf, sizeof (uint32_t), hash_stream) + if (bfd_write (buf, sizeof (uint32_t), hash_stream) != sizeof (uint32_t)) return false; } @@ -891,7 +891,7 @@ add_globals_ref (struct globals *glob, bfd *sym_rec_stream, const char *name, glob->last = g; - return bfd_bwrite (data, len, sym_rec_stream) == len; + return bfd_write (data, len, sym_rec_stream) == len; } /* Find the end of the current scope within symbols data. */ @@ -3870,7 +3870,7 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size, bfd_putl32 (CV_SIGNATURE_C13, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) { free (c13_info); free (syms); @@ -3879,7 +3879,7 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size, if (syms) { - if (bfd_bwrite (syms, *sym_byte_size, stream) != *sym_byte_size) + if (bfd_write (syms, *sym_byte_size, stream) != *sym_byte_size) { free (c13_info); free (syms); @@ -3891,7 +3891,7 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size, if (c13_info) { - if (bfd_bwrite (c13_info, *c13_info_size, stream) != *c13_info_size) + if (bfd_write (c13_info, *c13_info_size, stream) != *c13_info_size) { free (c13_info); return false; @@ -3904,7 +3904,7 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size, bfd_putl32 (0, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) return false; return true; @@ -4187,7 +4187,7 @@ create_section_contrib_substream (bfd *abfd, void **data, uint32_t *size) { bfd_seek (abfd, offset, SEEK_SET); - if (bfd_bread (sect_flags + (i * sizeof (uint32_t)), sizeof (uint32_t), + if (bfd_read (sect_flags + (i * sizeof (uint32_t)), sizeof (uint32_t), abfd) != sizeof (uint32_t)) { free (*data); @@ -4435,7 +4435,7 @@ create_globals_stream (bfd *pdb, struct globals *glob, uint16_t *stream_num) &h.entries_size); bfd_putl32 (buckets_size, &h.buckets_size); - if (bfd_bwrite (&h, sizeof (h), stream) != sizeof (h)) + if (bfd_write (&h, sizeof (h), stream) != sizeof (h)) return false; /* Write hash entries, sorted by hash. */ @@ -4447,7 +4447,7 @@ create_globals_stream (bfd *pdb, struct globals *glob, uint16_t *stream_num) bfd_putl32 (sorted[i]->offset + 1, &hr.offset); bfd_putl32 (sorted[i]->refcount, &hr.reference); - if (bfd_bwrite (&hr, sizeof (hr), stream) != sizeof (hr)) + if (bfd_write (&hr, sizeof (hr), stream) != sizeof (hr)) goto end; } @@ -4463,7 +4463,7 @@ create_globals_stream (bfd *pdb, struct globals *glob, uint16_t *stream_num) v |= 1 << j; } - if (bfd_bwrite (&v, sizeof (v), stream) != sizeof (v)) + if (bfd_write (&v, sizeof (v), stream) != sizeof (v)) goto end; } @@ -4471,7 +4471,7 @@ create_globals_stream (bfd *pdb, struct globals *glob, uint16_t *stream_num) bfd_putl32 (0, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) goto end; /* Write the bucket offsets. */ @@ -4484,7 +4484,7 @@ create_globals_stream (bfd *pdb, struct globals *glob, uint16_t *stream_num) Microsoft's parser. */ bfd_putl32 (buckets[i]->index * 0xc, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) goto end; } @@ -4618,7 +4618,7 @@ populate_dbi_stream (bfd *stream, bfd *abfd, bfd *pdb, bfd_putl16 (get_arch_number (abfd), &h.machine); bfd_putl32 (0, &h.padding); - if (bfd_bwrite (&h, sizeof (h), stream) != sizeof (h)) + if (bfd_write (&h, sizeof (h), stream) != sizeof (h)) { free (source_info); free (sc); @@ -4626,7 +4626,7 @@ populate_dbi_stream (bfd *stream, bfd *abfd, bfd *pdb, return false; } - if (bfd_bwrite (mod_info, mod_info_size, stream) != mod_info_size) + if (bfd_write (mod_info, mod_info_size, stream) != mod_info_size) { free (source_info); free (sc); @@ -4636,7 +4636,7 @@ populate_dbi_stream (bfd *stream, bfd *abfd, bfd *pdb, free (mod_info); - if (bfd_bwrite (sc, sc_size, stream) != sc_size) + if (bfd_write (sc, sc_size, stream) != sc_size) { free (source_info); free (sc); @@ -4645,7 +4645,7 @@ populate_dbi_stream (bfd *stream, bfd *abfd, bfd *pdb, free (sc); - if (bfd_bwrite (source_info, source_info_size, stream) != source_info_size) + if (bfd_write (source_info, source_info_size, stream) != source_info_size) { free (source_info); return false; @@ -4665,7 +4665,7 @@ populate_dbi_stream (bfd *stream, bfd *abfd, bfd *pdb, bfd_putl16 (0xffff, &opt.new_fpo_stream); bfd_putl16 (0xffff, &opt.orig_section_header_stream); - if (bfd_bwrite (&opt, sizeof (opt), stream) != sizeof (opt)) + if (bfd_write (&opt, sizeof (opt), stream) != sizeof (opt)) return false; return true; @@ -4781,11 +4781,11 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) bfd_putl32 (p->address, &ps.offset); bfd_putl16 (p->section, &ps.section); - if (bfd_bwrite (&ps, sizeof (struct pubsym), sym_rec_stream) != + if (bfd_write (&ps, sizeof (struct pubsym), sym_rec_stream) != sizeof (struct pubsym)) goto end; - if (bfd_bwrite (name, name_len + 1, sym_rec_stream) != + if (bfd_write (name, name_len + 1, sym_rec_stream) != name_len + 1) goto end; @@ -4793,7 +4793,7 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) { uint8_t b = 0; - if (bfd_bwrite (&b, sizeof (uint8_t), sym_rec_stream) != + if (bfd_write (&b, sizeof (uint8_t), sym_rec_stream) != sizeof (uint8_t)) goto end; } @@ -4858,7 +4858,7 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) bfd_putl32 (0, &header.thunk_table_offset); bfd_putl32 (0, &header.num_sects); - if (bfd_bwrite (&header, sizeof (header), stream) != sizeof (header)) + if (bfd_write (&header, sizeof (header), stream) != sizeof (header)) goto end; /* Output the global hash header. */ @@ -4869,7 +4869,7 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) &hash_header.entries_size); bfd_putl32 (buckets_size, &hash_header.buckets_size); - if (bfd_bwrite (&hash_header, sizeof (hash_header), stream) != + if (bfd_write (&hash_header, sizeof (hash_header), stream) != sizeof (hash_header)) goto end; @@ -4882,7 +4882,7 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) bfd_putl32 (sorted[i]->offset + 1, &hr.offset); bfd_putl32 (1, &hr.reference); - if (bfd_bwrite (&hr, sizeof (hr), stream) != sizeof (hr)) + if (bfd_write (&hr, sizeof (hr), stream) != sizeof (hr)) goto end; } @@ -4898,7 +4898,7 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) v |= 1 << j; } - if (bfd_bwrite (&v, sizeof (v), stream) != sizeof (v)) + if (bfd_write (&v, sizeof (v), stream) != sizeof (v)) goto end; } @@ -4906,7 +4906,7 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) bfd_putl32 (0, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) goto end; /* Write the bucket offsets. */ @@ -4919,7 +4919,7 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) Microsoft's parser. */ bfd_putl32 (buckets[i]->index * 0xc, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) goto end; } @@ -4937,7 +4937,7 @@ populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream) { bfd_putl32 (sorted[i]->offset, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) goto end; } @@ -4998,13 +4998,13 @@ create_section_header_stream (bfd *pdb, bfd *abfd, uint16_t *num) len = section_count * sizeof (struct external_scnhdr); buf = xmalloc (len); - if (bfd_bread (buf, len, abfd) != len) + if (bfd_read (buf, len, abfd) != len) { free (buf); return false; } - if (bfd_bwrite (buf, len, stream) != len) + if (bfd_write (buf, len, stream) != len) { free (buf); return false; @@ -5027,25 +5027,25 @@ populate_names_stream (bfd *stream, struct string_table *strings) bfd_putl32 (STRING_TABLE_SIGNATURE, &h.signature); bfd_putl32 (STRING_TABLE_VERSION, &h.version); - if (bfd_bwrite (&h, sizeof (h), stream) != sizeof (h)) + if (bfd_write (&h, sizeof (h), stream) != sizeof (h)) return false; bfd_putl32 (strings->strings_len, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) return false; int_buf[0] = 0; - if (bfd_bwrite (int_buf, 1, stream) != 1) + if (bfd_write (int_buf, 1, stream) != 1) return false; for (struct string *s = strings->strings_head; s; s = s->next) { - if (bfd_bwrite (s->s, s->len, stream) != s->len) + if (bfd_write (s->s, s->len, stream) != s->len) return false; - if (bfd_bwrite (int_buf, 1, stream) != 1) + if (bfd_write (int_buf, 1, stream) != 1) return false; num_strings++; @@ -5073,7 +5073,7 @@ populate_names_stream (bfd *stream, struct string_table *strings) bfd_putl32 (num_buckets, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) { free (buckets); return false; @@ -5086,7 +5086,7 @@ populate_names_stream (bfd *stream, struct string_table *strings) else bfd_putl32 (0, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) { free (buckets); @@ -5098,7 +5098,7 @@ populate_names_stream (bfd *stream, struct string_table *strings) bfd_putl32 (num_strings, int_buf); - if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) + if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t)) return false; return true; diff --git a/ld/pe-dll.c b/ld/pe-dll.c index b45c530..65bb50b 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -3423,8 +3423,8 @@ pe_get16 (bfd *abfd, int where) { unsigned char b[2]; - bfd_seek (abfd, (file_ptr) where, SEEK_SET); - bfd_bread (b, (bfd_size_type) 2, abfd); + bfd_seek (abfd, where, SEEK_SET); + bfd_read (b, 2, abfd); return b[0] + (b[1] << 8); } @@ -3433,8 +3433,8 @@ pe_get32 (bfd *abfd, int where) { unsigned char b[4]; - bfd_seek (abfd, (file_ptr) where, SEEK_SET); - bfd_bread (b, (bfd_size_type) 4, abfd); + bfd_seek (abfd, where, SEEK_SET); + bfd_read (b, 4, abfd); return b[0] + (b[1] << 8) + (b[2] << 16) + ((unsigned) b[3] << 24); } @@ -3524,8 +3524,8 @@ pe_implied_import_dll (const char *filename) bfd_vma vsize = pe_get32 (dll, secptr1 + 16); bfd_vma fptr = pe_get32 (dll, secptr1 + 20); - bfd_seek (dll, (file_ptr) secptr1, SEEK_SET); - bfd_bread (sname, (bfd_size_type) 8, dll); + bfd_seek (dll, secptr1, SEEK_SET); + bfd_read (sname, 8, dll); if (vaddr <= export_rva && vaddr + vsize > export_rva) { @@ -3547,8 +3547,8 @@ pe_implied_import_dll (const char *filename) char sec_name[9]; sec_name[8] = '\0'; - bfd_seek (dll, (file_ptr) secptr1 + 0, SEEK_SET); - bfd_bread (sec_name, (bfd_size_type) 8, dll); + bfd_seek (dll, secptr1 + 0, SEEK_SET); + bfd_read (sec_name, 8, dll); if (strcmp(sec_name,".data") == 0) { @@ -3583,8 +3583,8 @@ pe_implied_import_dll (const char *filename) } expdata = xmalloc (export_size); - bfd_seek (dll, (file_ptr) expptr, SEEK_SET); - bfd_bread (expdata, (bfd_size_type) export_size, dll); + bfd_seek (dll, expptr, SEEK_SET); + bfd_read (expdata, export_size, dll); erva = (char *) expdata - export_rva; if (pe_def_file == 0) diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c index 02920de..8ad6769 100644 --- a/sim/bfin/interp.c +++ b/sim/bfin/interp.c @@ -771,7 +771,7 @@ bfin_fdpic_load (SIM_DESC sd, SIM_CPU *cpu, struct bfd *abfd, bu32 *sp, goto skip_fdpic_init; if (bfd_seek (abfd, 0, SEEK_SET) != 0) goto skip_fdpic_init; - if (bfd_bread (&ehdr, sizeof (ehdr), abfd) != sizeof (ehdr)) + if (bfd_read (&ehdr, sizeof (ehdr), abfd) != sizeof (ehdr)) goto skip_fdpic_init; iehdr = elf_elfheader (abfd); if (!(iehdr->e_flags & EF_BFIN_FDPIC)) @@ -810,7 +810,7 @@ bfin_fdpic_load (SIM_DESC sd, SIM_CPU *cpu, struct bfd *abfd, bu32 *sp, if (bfd_seek (abfd, iehdr->e_phoff, SEEK_SET) != 0) goto skip_fdpic_init; data = xmalloc (phdr_size); - if (bfd_bread (data, phdr_size, abfd) != phdr_size) + if (bfd_read (data, phdr_size, abfd) != phdr_size) goto skip_fdpic_init; *sp -= phdr_size; elf_addrs[1] = *sp; @@ -844,7 +844,7 @@ bfin_fdpic_load (SIM_DESC sd, SIM_CPU *cpu, struct bfd *abfd, bu32 *sp, memset (data + filesz, 0, memsz - filesz); if (bfd_seek (abfd, p->p_offset, SEEK_SET) == 0 - && bfd_bread (data, filesz, abfd) == filesz) + && bfd_read (data, filesz, abfd) == filesz) sim_write (sd, paddr, data, memsz); free (data); @@ -870,7 +870,7 @@ bfin_fdpic_load (SIM_DESC sd, SIM_CPU *cpu, struct bfd *abfd, bu32 *sp, *ldso_path = xmalloc (len); if (bfd_seek (abfd, off, SEEK_SET) != 0 - || bfd_bread (*ldso_path, len, abfd) != len) + || bfd_read (*ldso_path, len, abfd) != len) { free (*ldso_path); *ldso_path = NULL; diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 5c220ff..cad7169 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -262,7 +262,7 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) (uint64_t) lma, (uint64_t) phdr[i].p_filesz); if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0 - || (bfd_bread (buf, phdr[i].p_filesz, abfd) != phdr[i].p_filesz)) + || (bfd_read (buf, phdr[i].p_filesz, abfd) != phdr[i].p_filesz)) { sim_io_eprintf (sd, "%s: could not read segment at 0x%" PRIx64 ", " @@ -530,7 +530,7 @@ cris_handle_interpreter (SIM_DESC sd, struct bfd *abfd) /* Read in the name. */ if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0 - || (bfd_bread (interp + strlen (simulator_sysroot), interplen, abfd) + || (bfd_read (interp + strlen (simulator_sysroot), interplen, abfd) != interplen)) goto interpname_failed; diff --git a/sim/rl78/load.c b/sim/rl78/load.c index 85d0fcf..86211d6 100644 --- a/sim/rl78/load.c +++ b/sim/rl78/load.c @@ -149,7 +149,7 @@ rl78_load (bfd *prog, host_callback *callbacks, const char * const simname) continue; } - if (bfd_bread (buf, size, prog) != size) + if (bfd_read (buf, size, prog) != size) { fprintf (stderr, "%s: Failed to read %" PRIx64 " bytes\n", simname, (uint64_t) size); diff --git a/sim/rx/load.c b/sim/rx/load.c index 2378094..ffb262f 100644 --- a/sim/rx/load.c +++ b/sim/rx/load.c @@ -153,7 +153,7 @@ rx_load (bfd *prog, host_callback *callback) fprintf (stderr, "Failed to seek to offset %lx\n", (long) offset); continue; } - if (bfd_bread (buf, size, prog) != size) + if (bfd_read (buf, size, prog) != size) { fprintf (stderr, "Failed to read %" PRIx64 " bytes\n", (uint64_t) size); |