+ m_currentPos = 0;
+}
+
+wxFileOffset wxCountingOutputStream::GetLength() const
+{
+ return m_lastcount;
+}
+
+size_t wxCountingOutputStream::OnSysWrite(const void *WXUNUSED(buffer),
+ size_t size)
+{
+ m_currentPos += size;
+ if (m_currentPos > m_lastcount)
+ m_lastcount = m_currentPos;
+
+ return m_currentPos;
+}
+
+wxFileOffset wxCountingOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
+{
+ ssize_t new_pos = (ssize_t)pos;
+
+ switch ( mode )
+ {
+ case wxFromStart:
+ wxCHECK_MSG( (wxFileOffset)new_pos == pos, wxInvalidOffset, wxT("huge position not supported") );
+ break;
+
+ case wxFromEnd:
+ new_pos = m_lastcount + new_pos;
+ wxCHECK_MSG( (wxFileOffset)new_pos == (wxFileOffset)(m_lastcount + pos), wxInvalidOffset, wxT("huge position not supported") );
+ break;
+
+ case wxFromCurrent:
+ new_pos = m_currentPos + new_pos;
+ wxCHECK_MSG( (wxFileOffset)new_pos == (wxFileOffset)(m_currentPos + pos), wxInvalidOffset, wxT("huge position not supported") );
+ break;
+
+ default:
+ wxFAIL_MSG( _T("invalid seek mode") );
+ return wxInvalidOffset;
+ }
+
+ m_currentPos = new_pos;
+
+ if (m_currentPos > m_lastcount)
+ m_lastcount = m_currentPos;
+
+ return m_currentPos;
+}
+
+wxFileOffset wxCountingOutputStream::OnSysTell() const
+{
+ return m_currentPos;