Make the size() method const
authorReid Spencer <rspencer@reidspencer.com>
Mon, 13 Dec 2004 02:58:51 +0000 (02:58 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 13 Dec 2004 02:58:51 +0000 (02:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18852 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/System/MappedFile.h
lib/System/Unix/MappedFile.cpp
lib/System/Unix/MappedFile.inc

index 526d11b4dac1e55d843143aff6b9aea4c9dae2cd..f73618aeb4095333a370c5221045f609f938d6eb 100644 (file)
@@ -94,7 +94,7 @@ namespace sys {
 
     /// This function returns the number of bytes in the file. 
     /// @throws std::string if an error occurs
 
     /// This function returns the number of bytes in the file. 
     /// @throws std::string if an error occurs
-    size_t size();
+    size_t size() const;
 
   /// @}
   /// @name Mutators
 
   /// @}
   /// @name Mutators
@@ -137,7 +137,7 @@ namespace sys {
     sys::Path path_;       ///< Path to the file.
     int options_;          ///< Options used to create the mapping
     void* base_;           ///< Pointer to the base memory address
     sys::Path path_;       ///< Path to the file.
     int options_;          ///< Options used to create the mapping
     void* base_;           ///< Pointer to the base memory address
-    MappedFileInfo* info_; ///< Platform specific info for the mapping
+    mutable MappedFileInfo* info_; ///< Platform specific info for the mapping
 
   /// @}
   /// @name Disabled
 
   /// @}
   /// @name Disabled
index 1c9622d36239250308f850dc5ac7435e77397887..36a17e0f2c4b9535fff18a04ee07d99916575f0b 100644 (file)
@@ -108,7 +108,7 @@ void* MappedFile::map() {
   return base_;
 }
 
   return base_;
 }
 
-size_t MappedFile::size() {
+size_t MappedFile::size() const {
   assert(info_ && "MappedFile not initialized");
   return info_->sbuf_.st_size;
 }
   assert(info_ && "MappedFile not initialized");
   return info_->sbuf_.st_size;
 }
index 1c9622d36239250308f850dc5ac7435e77397887..36a17e0f2c4b9535fff18a04ee07d99916575f0b 100644 (file)
@@ -108,7 +108,7 @@ void* MappedFile::map() {
   return base_;
 }
 
   return base_;
 }
 
-size_t MappedFile::size() {
+size_t MappedFile::size() const {
   assert(info_ && "MappedFile not initialized");
   return info_->sbuf_.st_size;
 }
   assert(info_ && "MappedFile not initialized");
   return info_->sbuf_.st_size;
 }