X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2Finternal%2FILocalIODevice_p.cpp;h=8730a91505a02970887ed39ef050b30ba5528298;hb=9f1ce8c47aeadb6dc1320b52ee671c3341b97935;hp=9e9a2b314f6f8359bebde155f8a872f04a7c1cb3;hpb=c1fc1c5423ca73a1b5bcbe790650821d73e5959c;p=bamtools.git diff --git a/src/api/internal/ILocalIODevice_p.cpp b/src/api/internal/ILocalIODevice_p.cpp index 9e9a2b3..8730a91 100644 --- a/src/api/internal/ILocalIODevice_p.cpp +++ b/src/api/internal/ILocalIODevice_p.cpp @@ -2,12 +2,12 @@ // ILocalIODevice_p.cpp (c) 2011 Derek Barnett // Marth Lab, Department of Biology, Boston College // --------------------------------------------------------------------------- -// Last modified: 8 September 2011 (DB) +// Last modified: 10 October 2011 (DB) // --------------------------------------------------------------------------- // Provides shared behavior for files & pipes // *************************************************************************** -#include +#include "api/internal/ILocalIODevice_p.h" using namespace BamTools; using namespace BamTools::Internal; @@ -32,25 +32,25 @@ void ILocalIODevice::Close(void) { // flush & close FILE* fflush(m_stream); fclose(m_stream); + m_stream = 0; - // reset internals + // reset other device state m_mode = IBamIODevice::NotOpen; - m_stream = 0; } size_t ILocalIODevice::Read(char* data, const unsigned int numBytes) { - BT_ASSERT_X( m_stream, "ILocalIODevice::Read() - null stream" ); - BT_ASSERT_X( (m_mode == IBamIODevice::ReadOnly), "ILocalIODevice::Read() - device not in read-only mode"); + 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); } int64_t ILocalIODevice::Tell(void) const { - BT_ASSERT_X( m_stream, "ILocalIODevice::Tell() - null stream" ); + BT_ASSERT_X( m_stream, "ILocalIODevice::Tell: trying to get file position fromnull stream" ); return ftell64(m_stream); } size_t ILocalIODevice::Write(const char* data, const unsigned int numBytes) { - BT_ASSERT_X( m_stream, "ILocalIODevice::Write() - null stream" ); - BT_ASSERT_X( (m_mode == IBamIODevice::WriteOnly), "ILocalIODevice::Write() - device not in write-only mode" ); + 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); }