Fix offset method name to reflect actual intent

It was meant to return the mapping offset from the start of the file,
but in reality it returned the mapping offset from the start of the page
that is mapped. It is now renamed to reflect this.
This commit is contained in:
mandreyel 2019-05-27 18:38:27 +02:00
parent dc885d0984
commit 518b99b967
2 changed files with 7 additions and 13 deletions

View File

@ -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<A == access_mode::write>::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();
}
/**

View File

@ -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.