aboutsummaryrefslogtreecommitdiff
path: root/bfd/srec.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-11-30 08:39:46 +0000
committerAlan Modra <amodra@gmail.com>2002-11-30 08:39:46 +0000
commitb34976b65aea8f33690229600bbf4527ec3118e1 (patch)
tree6411348664ef81ca2aa2e3ff325116e6e6502edf /bfd/srec.c
parent583d52d728c60410c0d39bae68ee536a7b9e7a6c (diff)
downloadgdb-b34976b65aea8f33690229600bbf4527ec3118e1.zip
gdb-b34976b65aea8f33690229600bbf4527ec3118e1.tar.gz
gdb-b34976b65aea8f33690229600bbf4527ec3118e1.tar.bz2
s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. Simplify
comparisons of bfd_boolean vars with TRUE/FALSE. Formatting.
Diffstat (limited to 'bfd/srec.c')
-rw-r--r--bfd/srec.c168
1 files changed, 84 insertions, 84 deletions
diff --git a/bfd/srec.c b/bfd/srec.c
index 6c29fa1..f792d97 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -114,30 +114,29 @@ static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static void srec_print_symbol
PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
static void srec_init PARAMS ((void));
-static boolean srec_mkobject PARAMS ((bfd *));
-static int srec_get_byte PARAMS ((bfd *, boolean *));
-static void srec_bad_byte PARAMS ((bfd *, unsigned int, int, boolean));
-static boolean srec_scan PARAMS ((bfd *));
+static bfd_boolean srec_mkobject PARAMS ((bfd *));
+static int srec_get_byte PARAMS ((bfd *, bfd_boolean *));
+static void srec_bad_byte PARAMS ((bfd *, unsigned int, int, bfd_boolean));
+static bfd_boolean srec_scan PARAMS ((bfd *));
static const bfd_target *srec_object_p PARAMS ((bfd *));
static const bfd_target *symbolsrec_object_p PARAMS ((bfd *));
-static boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *));
-
-static boolean srec_write_record PARAMS ((bfd *, unsigned int, bfd_vma,
- const bfd_byte *,
- const bfd_byte *));
-static boolean srec_write_header PARAMS ((bfd *));
-static boolean srec_write_symbols PARAMS ((bfd *));
-static boolean srec_new_symbol PARAMS ((bfd *, const char *, bfd_vma));
-static boolean srec_get_section_contents
+static bfd_boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *));
+
+static bfd_boolean srec_write_record
+ PARAMS ((bfd *, unsigned int, bfd_vma, const bfd_byte *, const bfd_byte *));
+static bfd_boolean srec_write_header PARAMS ((bfd *));
+static bfd_boolean srec_write_symbols PARAMS ((bfd *));
+static bfd_boolean srec_new_symbol PARAMS ((bfd *, const char *, bfd_vma));
+static bfd_boolean srec_get_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static boolean srec_set_arch_mach
+static bfd_boolean srec_set_arch_mach
PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static boolean srec_set_section_contents
+static bfd_boolean srec_set_section_contents
PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
-static boolean internal_srec_write_object_contents PARAMS ((bfd *, int));
-static boolean srec_write_object_contents PARAMS ((bfd *));
-static boolean symbolsrec_write_object_contents PARAMS ((bfd *));
-static int srec_sizeof_headers PARAMS ((bfd *, boolean));
+static bfd_boolean internal_srec_write_object_contents PARAMS ((bfd *, int));
+static bfd_boolean srec_write_object_contents PARAMS ((bfd *));
+static bfd_boolean symbolsrec_write_object_contents PARAMS ((bfd *));
+static int srec_sizeof_headers PARAMS ((bfd *, bfd_boolean));
static long srec_get_symtab_upper_bound PARAMS ((bfd *));
static long srec_get_symtab PARAMS ((bfd *, asymbol **));
@@ -158,11 +157,11 @@ static const char digs[] = "0123456789ABCDEF";
static void
srec_init ()
{
- static boolean inited = false;
+ static bfd_boolean inited = FALSE;
if (! inited)
{
- inited = true;
+ inited = TRUE;
hex_init ();
}
}
@@ -181,7 +180,7 @@ unsigned int Chunk = DEFAULT_CHUNK;
/* The type of srec output (free or forced to S3).
This variable can be modified by objcopy's --srec-forceS3
parameter. */
-boolean S3Forced = false;
+bfd_boolean S3Forced = FALSE;
/* When writing an S-record file, the S-records can not be output as
they are seen. This structure is used to hold them in memory. */
@@ -220,13 +219,14 @@ typedef struct srec_data_struct
}
tdata_type;
-static boolean srec_write_section PARAMS ((bfd *, tdata_type *,
- srec_data_list_type *));
-static boolean srec_write_terminator PARAMS ((bfd *, tdata_type *));
+static bfd_boolean srec_write_section
+ PARAMS ((bfd *, tdata_type *, srec_data_list_type *));
+static bfd_boolean srec_write_terminator
+ PARAMS ((bfd *, tdata_type *));
/* Set up the S-record tdata information. */
-static boolean
+static bfd_boolean
srec_mkobject (abfd)
bfd *abfd;
{
@@ -238,8 +238,8 @@ srec_mkobject (abfd)
amt = sizeof (tdata_type);
tdata = (tdata_type *) bfd_alloc (abfd, amt);
if (tdata == NULL)
- return false;
-
+ return FALSE;
+
abfd->tdata.srec_data = tdata;
tdata->type = 1;
tdata->head = NULL;
@@ -248,7 +248,7 @@ srec_mkobject (abfd)
tdata->symtail = NULL;
tdata->csymbols = NULL;
- return true;
+ return TRUE;
}
/* Read a byte from an S record file. Set *ERRORPTR if an error
@@ -257,14 +257,14 @@ srec_mkobject (abfd)
static int
srec_get_byte (abfd, errorptr)
bfd *abfd;
- boolean *errorptr;
+ bfd_boolean *errorptr;
{
bfd_byte c;
if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
{
if (bfd_get_error () != bfd_error_file_truncated)
- *errorptr = true;
+ *errorptr = TRUE;
return EOF;
}
@@ -280,7 +280,7 @@ srec_bad_byte (abfd, lineno, c, error)
bfd *abfd;
unsigned int lineno;
int c;
- boolean error;
+ bfd_boolean error;
{
if (c == EOF)
{
@@ -307,7 +307,7 @@ srec_bad_byte (abfd, lineno, c, error)
/* Add a new symbol found in an S-record file. */
-static boolean
+static bfd_boolean
srec_new_symbol (abfd, name, val)
bfd *abfd;
const char *name;
@@ -318,7 +318,7 @@ srec_new_symbol (abfd, name, val)
n = (struct srec_symbol *) bfd_alloc (abfd, amt);
if (n == NULL)
- return false;
+ return FALSE;
n->name = name;
n->val = val;
@@ -332,19 +332,19 @@ srec_new_symbol (abfd, name, val)
++abfd->symcount;
- return true;
+ return TRUE;
}
/* Read the S record file and turn it into sections. We create a new
section for each contiguous set of bytes. */
-static boolean
+static bfd_boolean
srec_scan (abfd)
bfd *abfd;
{
int c;
unsigned int lineno = 1;
- boolean error = false;
+ bfd_boolean error = FALSE;
bfd_byte *buf = NULL;
size_t bufsize = 0;
asection *sec = NULL;
@@ -356,7 +356,7 @@ srec_scan (abfd)
while ((c = srec_get_byte (abfd, &error)) != EOF)
{
/* We only build sections from contiguous S-records, so if this
- is not an S-record, then stop building a section. */
+ is not an S-record, then stop building a section. */
if (c != 'S' && c != '\r' && c != '\n')
sec = NULL;
@@ -542,7 +542,7 @@ srec_scan (abfd)
case '0':
case '5':
/* Prologue--ignore the file name, but stop building a
- section at this point. */
+ section at this point. */
sec = NULL;
break;
@@ -567,7 +567,7 @@ srec_scan (abfd)
&& sec->vma + sec->_raw_size == address)
{
/* This data goes at the end of the section we are
- currently building. */
+ currently building. */
sec->_raw_size += bytes;
}
else
@@ -612,7 +612,7 @@ srec_scan (abfd)
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
}
}
break;
@@ -625,14 +625,14 @@ srec_scan (abfd)
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
error_return:
if (symbuf != NULL)
free (symbuf);
if (buf != NULL)
free (buf);
- return false;
+ return FALSE;
}
/* Check whether an existing file is an S-record file. */
@@ -709,7 +709,7 @@ symbolsrec_object_p (abfd)
/* Read in the contents of a section in an S-record file. */
-static boolean
+static bfd_boolean
srec_read_section (abfd, section, contents)
bfd *abfd;
asection *section;
@@ -717,7 +717,7 @@ srec_read_section (abfd, section, contents)
{
int c;
bfd_size_type sofar = 0;
- boolean error = false;
+ bfd_boolean error = FALSE;
bfd_byte *buf = NULL;
size_t bufsize = 0;
@@ -735,7 +735,7 @@ srec_read_section (abfd, section, contents)
continue;
/* This is called after srec_scan has already been called, so we
- ought to know the exact format. */
+ ought to know the exact format. */
BFD_ASSERT (c == 'S');
if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3)
@@ -766,7 +766,7 @@ srec_read_section (abfd, section, contents)
BFD_ASSERT (sofar == section->_raw_size);
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
case '3':
address = HEX (data);
@@ -791,7 +791,7 @@ srec_read_section (abfd, section, contents)
BFD_ASSERT (sofar == section->_raw_size);
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
}
/* Don't consider checksum. */
@@ -816,17 +816,17 @@ srec_read_section (abfd, section, contents)
if (buf != NULL)
free (buf);
- return true;
+ return TRUE;
error_return:
if (buf != NULL)
free (buf);
- return false;
+ return FALSE;
}
/* Get the contents of a section in an S-record file. */
-static boolean
+static bfd_boolean
srec_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
@@ -838,21 +838,21 @@ srec_get_section_contents (abfd, section, location, offset, count)
{
section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
if (section->used_by_bfd == NULL && section->_raw_size != 0)
- return false;
+ return FALSE;
if (! srec_read_section (abfd, section, section->used_by_bfd))
- return false;
+ return FALSE;
}
memcpy (location, (bfd_byte *) section->used_by_bfd + offset,
(size_t) count);
- return true;
+ return TRUE;
}
/* Set the architecture. We accept an unknown architecture here. */
-static boolean
+static bfd_boolean
srec_set_arch_mach (abfd, arch, mach)
bfd *abfd;
enum bfd_architecture arch;
@@ -861,14 +861,14 @@ srec_set_arch_mach (abfd, arch, mach)
if (arch == bfd_arch_unknown)
{
abfd->arch_info = &bfd_default_arch_struct;
- return true;
+ return TRUE;
}
return bfd_default_set_arch_mach (abfd, arch, mach);
}
/* We have to save up all the Srecords for a splurge before output. */
-static boolean
+static bfd_boolean
srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
bfd *abfd;
sec_ptr section;
@@ -882,7 +882,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
entry = ((srec_data_list_type *)
bfd_alloc (abfd, (bfd_size_type) sizeof (srec_data_list_type)));
if (entry == NULL)
- return false;
+ return FALSE;
if (bytes_to_do
&& (section->flags & SEC_ALLOC)
@@ -892,10 +892,10 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
if (data == NULL)
- return false;
+ return FALSE;
memcpy ((PTR) data, location, (size_t) bytes_to_do);
- /* Ff S3Forced is true then always select S3 records,
+ /* Ff S3Forced is TRUE then always select S3 records,
regardless of the siez of the addresses. */
if (S3Forced)
tdata->type = 3;
@@ -912,7 +912,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
entry->size = bytes_to_do;
/* Sort the records by address. Optimize for the common case of
- adding a record to the end of the list. */
+ adding a record to the end of the list. */
if (tdata->tail != NULL
&& entry->where >= tdata->tail->where)
{
@@ -934,14 +934,14 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
tdata->tail = entry;
}
}
- return true;
+ return TRUE;
}
/* Write a record of type, of the supplied number of bytes. The
supplied bytes and length don't have a checksum. That's worked out
here. */
-static boolean
+static bfd_boolean
srec_write_record (abfd, type, address, data, end)
bfd *abfd;
unsigned int type;
@@ -999,11 +999,11 @@ srec_write_record (abfd, type, address, data, end)
*dst++ = '\n';
wrlen = dst - buffer;
if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen)
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
-static boolean
+static bfd_boolean
srec_write_header (abfd)
bfd *abfd;
{
@@ -1017,7 +1017,7 @@ srec_write_header (abfd)
abfd->filename, abfd->filename + len);
}
-static boolean
+static bfd_boolean
srec_write_section (abfd, tdata, list)
bfd *abfd;
tdata_type *tdata;
@@ -1052,16 +1052,16 @@ srec_write_section (abfd, tdata, list)
address,
location,
location + octets_this_chunk))
- return false;
+ return FALSE;
octets_written += octets_this_chunk;
location += octets_this_chunk;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
srec_write_terminator (abfd, tdata)
bfd *abfd;
tdata_type *tdata;
@@ -1070,7 +1070,7 @@ srec_write_terminator (abfd, tdata)
abfd->start_address, NULL, NULL);
}
-static boolean
+static bfd_boolean
srec_write_symbols (abfd)
bfd *abfd;
{
@@ -1086,7 +1086,7 @@ srec_write_symbols (abfd)
if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3
|| bfd_bwrite (abfd->filename, len, abfd) != len
|| bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2)
- return false;
+ return FALSE;
for (i = 0; i < count; i++)
{
@@ -1100,7 +1100,7 @@ srec_write_symbols (abfd)
len = strlen (s->name);
if (bfd_bwrite (" ", (bfd_size_type) 2, abfd) != 2
|| bfd_bwrite (s->name, len, abfd) != len)
- return false;
+ return FALSE;
sprintf_vma (buf + 1, (s->value
+ s->section->output_section->lma
@@ -1114,17 +1114,17 @@ srec_write_symbols (abfd)
*--p = ' ';
len += 3;
if (bfd_bwrite (p, len, abfd) != len)
- return false;
+ return FALSE;
}
}
if (bfd_bwrite ("$$ \r\n", (bfd_size_type) 5, abfd) != 5)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
-static boolean
+static bfd_boolean
internal_srec_write_object_contents (abfd, symbols)
bfd *abfd;
int symbols;
@@ -1135,11 +1135,11 @@ internal_srec_write_object_contents (abfd, symbols)
if (symbols)
{
if (! srec_write_symbols (abfd))
- return false;
+ return FALSE;
}
if (! srec_write_header (abfd))
- return false;
+ return FALSE;
/* Now wander though all the sections provided and output them. */
list = tdata->head;
@@ -1147,20 +1147,20 @@ internal_srec_write_object_contents (abfd, symbols)
while (list != (srec_data_list_type *) NULL)
{
if (! srec_write_section (abfd, tdata, list))
- return false;
+ return FALSE;
list = list->next;
}
return srec_write_terminator (abfd, tdata);
}
-static boolean
+static bfd_boolean
srec_write_object_contents (abfd)
bfd *abfd;
{
return internal_srec_write_object_contents (abfd, 0);
}
-static boolean
+static bfd_boolean
symbolsrec_write_object_contents (abfd)
bfd *abfd;
{
@@ -1170,7 +1170,7 @@ symbolsrec_write_object_contents (abfd)
static int
srec_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
- boolean exec ATTRIBUTE_UNUSED;
+ bfd_boolean exec ATTRIBUTE_UNUSED;
{
return 0;
}
@@ -1203,7 +1203,7 @@ srec_get_symtab (abfd, alocation)
csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
if (csymbols == NULL && symcount != 0)
- return (long) false;
+ return (long) FALSE;
abfd->tdata.srec_data->csymbols = csymbols;
for (s = abfd->tdata.srec_data->symbols, c = csymbols;