This commit is contained in:
Danny Robson 2015-01-07 16:00:12 +11:00
parent 2704002dbd
commit da3b709eca

View File

@ -35,12 +35,14 @@ mapped_file::mapped_file (const boost::filesystem::path &_path, access_t _access
{ load_fd (_access); } { load_fd (_access); }
//----------------------------------------------------------------------------
mapped_file::~mapped_file () { mapped_file::~mapped_file () {
CHECK (m_data != NULL); CHECK (m_data != NULL);
munmap (m_data, m_size); munmap (m_data, m_size);
} }
//----------------------------------------------------------------------------
int int
mapped_file::access_to_flags (access_t a) { mapped_file::access_to_flags (access_t a) {
int flags = 0; int flags = 0;
@ -55,6 +57,7 @@ mapped_file::access_to_flags (access_t a) {
} }
//----------------------------------------------------------------------------
void void
mapped_file::load_fd (access_t access) { mapped_file::load_fd (access_t access) {
struct stat meta; struct stat meta;
@ -68,6 +71,7 @@ mapped_file::load_fd (access_t access) {
} }
//----------------------------------------------------------------------------
size_t size_t
mapped_file::size (void) const { mapped_file::size (void) const {
CHECK (m_size > 0); CHECK (m_size > 0);
@ -77,6 +81,7 @@ mapped_file::size (void) const {
} }
//----------------------------------------------------------------------------
uint8_t* uint8_t*
mapped_file::data (void) { mapped_file::data (void) {
CHECK (m_size > 0); CHECK (m_size > 0);
@ -86,6 +91,7 @@ mapped_file::data (void) {
} }
//----------------------------------------------------------------------------
const uint8_t* const uint8_t*
mapped_file::data (void) const { mapped_file::data (void) const {
CHECK (m_size > 0); CHECK (m_size > 0);
@ -95,24 +101,28 @@ mapped_file::data (void) const {
} }
//----------------------------------------------------------------------------
uint8_t* uint8_t*
mapped_file::begin (void) { mapped_file::begin (void) {
return data (); return data ();
} }
//----------------------------------------------------------------------------
uint8_t* uint8_t*
mapped_file::end (void) { mapped_file::end (void) {
return data () + size (); return data () + size ();
} }
//----------------------------------------------------------------------------
const uint8_t* const uint8_t*
mapped_file::cbegin (void) const { mapped_file::cbegin (void) const {
return data (); return data ();
} }
//----------------------------------------------------------------------------
const uint8_t* const uint8_t*
mapped_file::cend (void) const { mapped_file::cend (void) const {
return data () + size (); return data () + size ();