summaryrefslogtreecommitdiff
path: root/bfd/srec.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-01-13 22:10:36 +0000
committerNick Clifton <nickc@redhat.com>2000-01-13 22:10:36 +0000
commit9a968f43323ca8e2e800d0382bac9fbf9ad9b396 (patch)
treee849045af355b8a60a7a21fea3575bafcf380ec3 /bfd/srec.c
parentf45fbf876deab0568bd359788dbdaeabf4f22967 (diff)
Apply Tim walls octest vs bytes patch
Diffstat (limited to 'bfd/srec.c')
-rw-r--r--bfd/srec.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/bfd/srec.c b/bfd/srec.c
index aefdc64167..bce2efe330 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1000,31 +1000,28 @@ srec_write_section (abfd, tdata, list)
tdata_type *tdata;
srec_data_list_type *list;
{
- unsigned int bytes_written = 0;
+ unsigned int octets_written = 0;
bfd_byte *location = list->data;
- while (bytes_written < list->size)
+ while (octets_written < list->size)
{
bfd_vma address;
+ unsigned int octets_this_chunk = list->size - octets_written;
- unsigned int bytes_this_chunk = list->size - bytes_written;
+ if (octets_this_chunk > CHUNK)
+ octets_this_chunk = CHUNK;
- if (bytes_this_chunk > CHUNK)
- {
- bytes_this_chunk = CHUNK;
- }
-
- address = list->where + bytes_written;
+ address = list->where + octets_written / bfd_octets_per_byte (abfd);
if (! srec_write_record (abfd,
tdata->type,
address,
location,
- location + bytes_this_chunk))
+ location + octets_this_chunk))
return false;
- bytes_written += bytes_this_chunk;
- location += bytes_this_chunk;
+ octets_written += octets_this_chunk;
+ location += octets_this_chunk;
}
return true;