mirror of
https://github.com/vimpunk/mio.git
synced 2025-12-06 16:57:01 +08:00
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:
parent
dc885d0984
commit
518b99b967
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user