Fix for C++ std streams

This commit is contained in:
Hugues Delorme 2012-06-25 17:31:18 +02:00
parent 98176be41d
commit 5478c2c0a7

View File

@ -43,9 +43,14 @@ public:
Int64 read(char* data, Int64 maxSize) Int64 read(char* data, Int64 maxSize)
{ {
m_istr->read(data, maxSize); m_istr->read(data, maxSize);
if (!m_istr->eof() && (m_istr->fail())) if (!m_istr->eof() && m_istr->fail()) {
m_istr->clear();
return -1; return -1;
return m_istr->gcount(); }
const Int64 bytesCount = m_istr->gcount();
if (m_istr->fail()) // TODO preserve eof() flag
m_istr->clear();
return bytesCount;
} }
Int64 write(const char* /*data*/, Int64 /*maxSize*/) Int64 write(const char* /*data*/, Int64 /*maxSize*/)