From de6ea736a1f24f330095996934e9ee58e5bba55c Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 27 Apr 2016 17:06:09 +1000 Subject: [PATCH] io_posix: add mapped_file::empty implementation --- io_posix.cpp | 14 ++++++++++---- io_posix.hpp | 4 +++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/io_posix.cpp b/io_posix.cpp index f584b1c7..bea0b7b8 100644 --- a/io_posix.cpp +++ b/io_posix.cpp @@ -63,14 +63,20 @@ mapped_file::load_fd (int mflags) { //---------------------------------------------------------------------------- size_t -mapped_file::size (void) const { - CHECK (m_size > 0); - CHECK (m_data != NULL); - +mapped_file::size (void) const +{ return m_size; } +//----------------------------------------------------------------------------- +bool +mapped_file::empty (void) const +{ + return size () == 0; +} + + //---------------------------------------------------------------------------- uint8_t* mapped_file::data (void) { diff --git a/io_posix.hpp b/io_posix.hpp index 781b82d8..e62d6e0b 100644 --- a/io_posix.hpp +++ b/io_posix.hpp @@ -42,7 +42,9 @@ namespace util { const uint8_t* data (void) const; uint8_t* data (void); - size_t size (void) const; + + bool empty (void) const; + size_t size (void) const; uint8_t* begin (void); uint8_t* end (void);