io: use intmax for size to match mmap output

This commit is contained in:
Danny Robson 2016-10-25 17:49:27 +11:00
parent 6781f7a361
commit 1b5ad41b5d
2 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ mapped_file::mapped_file (const ::util::posix::fd &src, int mflags)
if (fstat (src, &meta) < 0)
throw errno_error ();
m_size = (size_t)meta.st_size;
m_size = meta.st_size;
m_data = (uint8_t *)mmap (NULL, m_size, mflags, MAP_SHARED, src, 0);
if (m_data == MAP_FAILED)
throw errno_error ();
@ -54,7 +54,7 @@ mapped_file::~mapped_file ()
//----------------------------------------------------------------------------
size_t
intmax_t
mapped_file::size (void) const
{
return m_size;

View File

@ -40,7 +40,7 @@ namespace util {
~mapped_file ();
bool empty (void) const;
size_t size (void) const;
intmax_t size (void) const;
const uint8_t* data (void) const &;
uint8_t* data (void) &;
@ -64,7 +64,7 @@ namespace util {
private:
uint8_t *m_data;
size_t m_size;
intmax_t m_size;
};
} }