X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fapi%2Finternal%2Fio%2FILocalIODevice_p.cpp;h=d515728b5a618c4d10ccffef4814159c2fdd79c9;hb=e235c55e4a2c5d88d13c932206db90991fa093e0;hp=63a3beee68644497392ebcd9a76b4a561f98aaf5;hpb=90432a3736392f98803a5e8787f3db0dc5bb44ad;p=bamtools.git diff --git a/src/api/internal/io/ILocalIODevice_p.cpp b/src/api/internal/io/ILocalIODevice_p.cpp index 63a3bee..d515728 100644 --- a/src/api/internal/io/ILocalIODevice_p.cpp +++ b/src/api/internal/io/ILocalIODevice_p.cpp @@ -2,7 +2,7 @@ // ILocalIODevice_p.cpp (c) 2011 Derek Barnett // Marth Lab, Department of Biology, Boston College // --------------------------------------------------------------------------- -// Last modified: 25 October 2011 (DB) +// Last modified: 27 July 2012 (DB) // --------------------------------------------------------------------------- // Provides shared behavior for files & pipes // *************************************************************************** @@ -38,10 +38,10 @@ void ILocalIODevice::Close(void) { m_mode = IBamIODevice::NotOpen; } -size_t ILocalIODevice::Read(char* data, const unsigned int numBytes) { +int64_t ILocalIODevice::Read(char* data, const unsigned int numBytes) { BT_ASSERT_X( m_stream, "ILocalIODevice::Read: trying to read from null stream" ); - BT_ASSERT_X( (m_mode == IBamIODevice::ReadOnly), "ILocalIODevice::Read: device not in read-only mode"); - return fread(data, sizeof(char), numBytes, m_stream); + BT_ASSERT_X( (m_mode & IBamIODevice::ReadOnly), "ILocalIODevice::Read: device not in read-able mode"); + return static_cast( fread(data, sizeof(char), numBytes, m_stream) ); } int64_t ILocalIODevice::Tell(void) const { @@ -49,8 +49,8 @@ int64_t ILocalIODevice::Tell(void) const { return ftell64(m_stream); } -size_t ILocalIODevice::Write(const char* data, const unsigned int numBytes) { +int64_t ILocalIODevice::Write(const char* data, const unsigned int numBytes) { BT_ASSERT_X( m_stream, "ILocalIODevice::Write: tryint to write to null stream" ); - BT_ASSERT_X( (m_mode == IBamIODevice::WriteOnly), "ILocalIODevice::Write: device not in write-only mode" ); - return fwrite(data, sizeof(char), numBytes, m_stream); + BT_ASSERT_X( (m_mode & IBamIODevice::WriteOnly), "ILocalIODevice::Write: device not in write-able mode" ); + return static_cast( fwrite(data, sizeof(char), numBytes, m_stream) ); }