{
char* buffer = static_cast<char*>(buffer_);
- m_lastcount = 0;
+ size_t totalCount = 0;
for ( ;; )
{
if ( !lastCount )
break;
- m_lastcount += lastCount;
+ totalCount += lastCount;
// ... Or if an error occurred on the stream.
if ( !IsOk() )
// "==" test, but be safe and avoid overflowing size even in case of
// bugs in LastRead()).
if ( lastCount >= size )
- return true;
+ {
+ size = 0;
+ break;
+ }
// Advance the buffer before trying to read the rest of data.
size -= lastCount;
buffer += lastCount;
}
- return false;
+ m_lastcount = totalCount;
+
+ return size == 0;
}
wxFileOffset wxInputStream::SeekI(wxFileOffset pos, wxSeekMode mode)
// This exactly mirrors ReadAll(), see there for more comments.
const char* buffer = static_cast<const char*>(buffer_);
- m_lastcount = 0;
+ size_t totalCount = 0;
for ( ;; )
{
if ( !lastCount )
break;
- m_lastcount += lastCount;
+ totalCount += lastCount;
if ( !IsOk() )
break;
if ( lastCount >= size )
- return true;
+ {
+ size = 0;
+ break;
+ }
size -= lastCount;
buffer += lastCount;
}
- return false;
+ m_lastcount = totalCount;
+ return size == 0;
}
wxFileOffset wxOutputStream::TellO() const