aboutsummaryrefslogtreecommitdiff
path: root/bfd/pdb.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-08-07 14:40:35 +0930
committerAlan Modra <amodra@gmail.com>2023-08-09 08:48:09 +0930
commit226f9f4fadb087875ef98a0a55d614236c6241b3 (patch)
treee6c63b104143dd86acf739d5633649582668224e /bfd/pdb.c
parentfeddea4b466ce4f2bb2301fd2d4bef56e8d09ccc (diff)
downloadbinutils-226f9f4fadb087875ef98a0a55d614236c6241b3.zip
binutils-226f9f4fadb087875ef98a0a55d614236c6241b3.tar.gz
binutils-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).
Diffstat (limited to 'bfd/pdb.c')
-rw-r--r--bfd/pdb.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/bfd/pdb.c b/bfd/pdb.c
index 7fefd81..2e77c7b 100644
--- a/bfd/pdb.c
+++ b/bfd/pdb.c
@@ -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;