diff --git a/include/mio/mmap.hpp b/include/mio/mmap.hpp index ddb95b2..def559a 100644 --- a/include/mio/mmap.hpp +++ b/include/mio/mmap.hpp @@ -180,11 +180,11 @@ public: size_type length() const noexcept { return length_; } size_type mapped_length() const noexcept { return mapped_length_; } - /** - * Returns the offset, relative to the file's start, at which the mapping was - * requested to be created. - */ - size_type offset() const noexcept { return mapped_length_ - length_; } + /** Returns the offset relative to the start of the mapping. */ + size_type mapping_offset() const noexcept + { + return mapped_length_ - length_; + } /** * Returns a pointer to the first requested byte, or `nullptr` if no memory mapping @@ -362,12 +362,12 @@ private: typename = typename std::enable_if::type > pointer get_mapping_start() noexcept { - return !data() ? nullptr : data() - offset(); + return !data() ? nullptr : data() - mapping_offset(); } const_pointer get_mapping_start() const noexcept { - return !data() ? nullptr : data() - offset(); + return !data() ? nullptr : data() - mapping_offset(); } /** diff --git a/include/mio/shared_mmap.hpp b/include/mio/shared_mmap.hpp index b914c18..f125a59 100644 --- a/include/mio/shared_mmap.hpp +++ b/include/mio/shared_mmap.hpp @@ -162,12 +162,6 @@ public: return pimpl_ ? pimpl_->mapped_length() : 0; } - /** - * Returns the offset, relative to the file's start, at which the mapping was - * requested to be created. - */ - size_type offset() const noexcept { return pimpl_ ? pimpl_->offset() : 0; } - /** * Returns a pointer to the first requested byte, or `nullptr` if no memory mapping * exists.