diff options
author | Ian Lance Taylor <iant@google.com> | 2007-12-20 21:21:24 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-12-20 21:21:24 +0000 |
commit | fe8718a4637d92b3cd991a8f1a22d6d0a09bc6dd (patch) | |
tree | 1d8c345aa0b876471ab9e73e4f22c04d65aa61bf /gold/fileread.cc | |
parent | 1f7efbae406ff9f2e8967d508bfae665501dc8ae (diff) | |
download | gdb-fe8718a4637d92b3cd991a8f1a22d6d0a09bc6dd.zip gdb-fe8718a4637d92b3cd991a8f1a22d6d0a09bc6dd.tar.gz gdb-fe8718a4637d92b3cd991a8f1a22d6d0a09bc6dd.tar.bz2 |
Convert more instances of off_t to be 32-bit types.
Diffstat (limited to 'gold/fileread.cc')
-rw-r--r-- | gold/fileread.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gold/fileread.cc b/gold/fileread.cc index 3050154..31f48a4 100644 --- a/gold/fileread.cc +++ b/gold/fileread.cc @@ -206,9 +206,9 @@ File_read::find_view(off_t start, section_size_type size) const // the buffer at P. void -File_read::do_read(off_t start, off_t size, void* p) const +File_read::do_read(off_t start, section_size_type size, void* p) const { - off_t bytes; + section_size_type bytes; if (this->contents_ != NULL) { bytes = this->size_ - start; @@ -220,16 +220,16 @@ File_read::do_read(off_t start, off_t size, void* p) const } else { - bytes = ::pread(this->descriptor_, p, size, start); - if (bytes == size) - return; - - if (bytes < 0) + ssize_t got = ::pread(this->descriptor_, p, size, start); + if (got < 0) { gold_fatal(_("%s: pread failed: %s"), this->filename().c_str(), strerror(errno)); return; } + + if (static_cast<section_size_type>(got) == size) + return; } gold_fatal(_("%s: file too short: read only %lld of %lld bytes at %lld"), @@ -242,7 +242,7 @@ File_read::do_read(off_t start, off_t size, void* p) const // Read data from the file. void -File_read::read(off_t start, off_t size, void* p) const +File_read::read(off_t start, section_size_type size, void* p) const { File_read::View* pv = this->find_view(start, size); if (pv != NULL) @@ -286,12 +286,12 @@ File_read::find_or_make_view(off_t start, section_size_type size, bool cache) // We need to read data from the file. We read full pages for // greater efficiency on small files. - off_t psize = File_read::pages(size + (start - poff)); + section_size_type psize = File_read::pages(size + (start - poff)); if (poff + psize >= this->size_) { psize = this->size_ - poff; - gold_assert(psize >= static_cast<off_t>(size)); + gold_assert(psize >= size); } File_read::View* v; |