Make some File_read methods const.
authorIan Lance Taylor <iant@google.com>
Fri, 14 Dec 2007 18:22:06 +0000 (18:22 +0000)
committerIan Lance Taylor <iant@google.com>
Fri, 14 Dec 2007 18:22:06 +0000 (18:22 +0000)
gold/fileread.cc
gold/fileread.h

index 9579f0f5dd42242da951c2314604c4a1c23af231..b9171095b7f97bf5f8ae9a060bb5a003ae5a0a6b 100644 (file)
@@ -170,10 +170,10 @@ File_read::is_locked()
 // SIZE bytes.  Return a pointer to the View if found, NULL if not.
 
 inline File_read::View*
-File_read::find_view(off_t start, off_t size)
+File_read::find_view(off_t start, off_t size) const
 {
   off_t page = File_read::page_offset(start);
-  Views::iterator p = this->views_.find(page);
+  Views::const_iterator p = this->views_.find(page);
   if (p == this->views_.end())
     return NULL;
   if (p->second->size() - (start - page) < size)
@@ -185,10 +185,8 @@ File_read::find_view(off_t start, off_t size)
 // the buffer at P.
 
 void
-File_read::do_read(off_t start, off_t size, void* p)
+File_read::do_read(off_t start, off_t size, void* p) const
 {
-  gold_assert(this->lock_count_ > 0);
-
   off_t bytes;
   if (this->contents_ != NULL)
     {
@@ -223,7 +221,7 @@ File_read::do_read(off_t start, off_t size, void* p)
 // Read data from the file.
 
 void
-File_read::read(off_t start, off_t size, void* p)
+File_read::read(off_t start, off_t size, void* p) const
 {
   gold_assert(this->lock_count_ > 0);
 
index c39f9de55b2293ddc6882fa39a15618892df6b3a..0e5bdbe33480e1bb331b1bed604156da70597660 100644 (file)
@@ -98,7 +98,7 @@ class File_read
   // Read data from the file into the buffer P starting at file offset
   // START for SIZE bytes.
   void
-  read(off_t start, off_t size, void* p);
+  read(off_t start, off_t size, void* p) const;
 
   // Return a lasting view into the file starting at file offset START
   // for SIZE bytes.  This is allocated with new, and the caller is
@@ -188,11 +188,11 @@ class File_read
 
   // Find a view into the file.
   View*
-  find_view(off_t start, off_t size);
+  find_view(off_t start, off_t size) const;
 
   // Read data from the file into a buffer.
   void
-  do_read(off_t start, off_t size, void* p);
+  do_read(off_t start, off_t size, void* p) const;
 
   // Find or make a view into the file.
   View*
This page took 0.033887 seconds and 4 git commands to generate.