From Craig Silverstein: avoid some signed/unsigned warnings from gcc 4.2.

This commit is contained in:
Ian Lance Taylor 2007-10-02 20:52:18 +00:00
parent e31dcd201e
commit f5c3f2256f
5 changed files with 7 additions and 7 deletions

View File

@ -334,7 +334,7 @@ Archive::include_all_members(Symbol_table* symtab, Layout* layout,
off_t filesize = this->input_file_->file().filesize();
while (true)
{
if (filesize - off < sizeof(Archive_header))
if (filesize - off < static_cast<off_t>(sizeof(Archive_header)))
{
if (filesize != off)
{
@ -381,7 +381,7 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
std::string n;
this->read_header(off, &n);
size_t memoff = off + sizeof(Archive_header);
const off_t memoff = off + static_cast<off_t>(sizeof(Archive_header));
// Read enough of the file to pick up the entire ELF header.
unsigned char ehdr_buf[elfcpp::Elf_sizes<64>::ehdr_size];

View File

@ -629,7 +629,7 @@ Sized_dynobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
const int sym_size = This::sym_size;
const size_t symcount = sd->symbols_size / sym_size;
if (symcount * sym_size != sd->symbols_size)
if (static_cast<off_t>(symcount * sym_size) != sd->symbols_size)
{
fprintf(stderr,
_("%s: %s: size of dynamic symbols is not "

View File

@ -891,7 +891,7 @@ Layout::create_symtab_sections(const Input_objects* input_objects,
off_t locsize = dyn_global_index * this->dynsym_section_->entsize();
dynoff = this->dynsym_section_->offset() + locsize;
dyncount = (this->dynsym_section_->data_size() - locsize) / symsize;
gold_assert(dyncount * symsize
gold_assert(static_cast<off_t>(dyncount * symsize)
== this->dynsym_section_->data_size() - locsize);
}

View File

@ -502,7 +502,7 @@ Sized_relobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
const int sym_size = This::sym_size;
size_t symcount = sd->symbols_size / sym_size;
if (symcount * sym_size != sd->symbols_size)
if (static_cast<off_t>(symcount * sym_size) != sd->symbols_size)
{
fprintf(stderr,
_("%s: %s: size of symbols is not multiple of symbol size\n"),

View File

@ -231,7 +231,7 @@ Sized_relobj<size, big_endian>::do_read_relocs(Read_relocs_data* rd)
}
size_t reloc_count = sh_size / reloc_size;
if (reloc_count * reloc_size != sh_size)
if (static_cast<off_t>(reloc_count * reloc_size) != sh_size)
{
fprintf(stderr, _("%s: %s: reloc section %u size %lu uneven"),
program_name, this->name().c_str(), i,
@ -478,7 +478,7 @@ Sized_relobj<size, big_endian>::relocate_sections(
}
size_t reloc_count = sh_size / reloc_size;
if (reloc_count * reloc_size != sh_size)
if (static_cast<off_t>(reloc_count * reloc_size) != sh_size)
{
fprintf(stderr, _("%s: %s: reloc section %u size %lu uneven"),
program_name, this->name().c_str(), i,