aboutsummaryrefslogtreecommitdiff
path: root/bfd/ihex.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/ihex.c
parentfeddea4b466ce4f2bb2301fd2d4bef56e8d09ccc (diff)
downloadgdb-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).
Diffstat (limited to 'bfd/ihex.c')
-rw-r--r--bfd/ihex.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/bfd/ihex.c b/bfd/ihex.c
index d038b0a..f610dd1 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -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;