Add const to Object::read and Object::sized_target.
This commit is contained in:
parent
c71c6f566c
commit
7004837e8d
3 changed files with 21 additions and 15 deletions
|
@ -161,7 +161,7 @@ File_read::unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
File_read::is_locked()
|
File_read::is_locked() const
|
||||||
{
|
{
|
||||||
return this->lock_count_ > 0;
|
return this->lock_count_ > 0;
|
||||||
}
|
}
|
||||||
|
@ -223,8 +223,6 @@ File_read::do_read(off_t start, off_t size, void* p) const
|
||||||
void
|
void
|
||||||
File_read::read(off_t start, off_t size, void* p) const
|
File_read::read(off_t start, off_t size, void* p) const
|
||||||
{
|
{
|
||||||
gold_assert(this->lock_count_ > 0);
|
|
||||||
|
|
||||||
File_read::View* pv = this->find_view(start, size);
|
File_read::View* pv = this->find_view(start, size);
|
||||||
if (pv != NULL)
|
if (pv != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ class File_read
|
||||||
|
|
||||||
// Test whether the object is locked.
|
// Test whether the object is locked.
|
||||||
bool
|
bool
|
||||||
is_locked();
|
is_locked() const;
|
||||||
|
|
||||||
// Return the size of the file.
|
// Return the size of the file.
|
||||||
off_t
|
off_t
|
||||||
|
@ -323,6 +323,10 @@ class Input_file
|
||||||
file()
|
file()
|
||||||
{ return this->file_; }
|
{ return this->file_; }
|
||||||
|
|
||||||
|
const File_read&
|
||||||
|
file() const
|
||||||
|
{ return this->file_; }
|
||||||
|
|
||||||
// Whether we found the file in a directory in the system root.
|
// Whether we found the file in a directory in the system root.
|
||||||
bool
|
bool
|
||||||
is_in_sysroot() const
|
is_in_sysroot() const
|
||||||
|
|
|
@ -166,24 +166,24 @@ class Object
|
||||||
// Lock the underlying file.
|
// Lock the underlying file.
|
||||||
void
|
void
|
||||||
lock()
|
lock()
|
||||||
{ this->input_file_->file().lock(); }
|
{ this->input_file()->file().lock(); }
|
||||||
|
|
||||||
// Unlock the underlying file.
|
// Unlock the underlying file.
|
||||||
void
|
void
|
||||||
unlock()
|
unlock()
|
||||||
{ this->input_file_->file().unlock(); }
|
{ this->input_file()->file().unlock(); }
|
||||||
|
|
||||||
// Return whether the underlying file is locked.
|
// Return whether the underlying file is locked.
|
||||||
bool
|
bool
|
||||||
is_locked() const
|
is_locked() const
|
||||||
{ return this->input_file_->file().is_locked(); }
|
{ return this->input_file()->file().is_locked(); }
|
||||||
|
|
||||||
// Return the sized target structure associated with this object.
|
// Return the sized target structure associated with this object.
|
||||||
// This is like the target method but it returns a pointer of
|
// This is like the target method but it returns a pointer of
|
||||||
// appropriate checked type.
|
// appropriate checked type.
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
Sized_target<size, big_endian>*
|
Sized_target<size, big_endian>*
|
||||||
sized_target(ACCEPT_SIZE_ENDIAN_ONLY);
|
sized_target(ACCEPT_SIZE_ENDIAN_ONLY) const;
|
||||||
|
|
||||||
// Get the number of sections.
|
// Get the number of sections.
|
||||||
unsigned int
|
unsigned int
|
||||||
|
@ -324,6 +324,10 @@ class Object
|
||||||
|
|
||||||
// Get the file.
|
// Get the file.
|
||||||
Input_file*
|
Input_file*
|
||||||
|
input_file()
|
||||||
|
{ return this->input_file_; }
|
||||||
|
|
||||||
|
const Input_file*
|
||||||
input_file() const
|
input_file() const
|
||||||
{ return this->input_file_; }
|
{ return this->input_file_; }
|
||||||
|
|
||||||
|
@ -331,22 +335,22 @@ class Object
|
||||||
const unsigned char*
|
const unsigned char*
|
||||||
get_view(off_t start, off_t size, bool cache)
|
get_view(off_t start, off_t size, bool cache)
|
||||||
{
|
{
|
||||||
return this->input_file_->file().get_view(start + this->offset_, size,
|
return this->input_file()->file().get_view(start + this->offset_, size,
|
||||||
cache);
|
cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a lasting view into the underlying file.
|
// Get a lasting view into the underlying file.
|
||||||
File_view*
|
File_view*
|
||||||
get_lasting_view(off_t start, off_t size, bool cache)
|
get_lasting_view(off_t start, off_t size, bool cache)
|
||||||
{
|
{
|
||||||
return this->input_file_->file().get_lasting_view(start + this->offset_,
|
return this->input_file()->file().get_lasting_view(start + this->offset_,
|
||||||
size, cache);
|
size, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read data from the underlying file.
|
// Read data from the underlying file.
|
||||||
void
|
void
|
||||||
read(off_t start, off_t size, void* p)
|
read(off_t start, off_t size, void* p) const
|
||||||
{ this->input_file_->file().read(start + this->offset_, size, p); }
|
{ this->input_file()->file().read(start + this->offset_, size, p); }
|
||||||
|
|
||||||
// Set the target.
|
// Set the target.
|
||||||
void
|
void
|
||||||
|
@ -398,7 +402,7 @@ class Object
|
||||||
|
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
inline Sized_target<size, big_endian>*
|
inline Sized_target<size, big_endian>*
|
||||||
Object::sized_target(ACCEPT_SIZE_ENDIAN_ONLY)
|
Object::sized_target(ACCEPT_SIZE_ENDIAN_ONLY) const
|
||||||
{
|
{
|
||||||
gold_assert(this->target_->get_size() == size);
|
gold_assert(this->target_->get_size() == size);
|
||||||
gold_assert(this->target_->is_big_endian() ? big_endian : !big_endian);
|
gold_assert(this->target_->is_big_endian() ? big_endian : !big_endian);
|
||||||
|
|
Loading…
Reference in a new issue