Fix return value of wxCountingOutputStream::LastWrite().

Don't reuse m_lastcount in wxCountingOutputStream to store the stream length,
this doesn't make any sense and results in LastWrite() returning completely
wrong results as it expects m_lastcount to be the number of bytes written by
the last operation.

Add m_lastPos member to store the stream length instead.

Also correct wxCountingOutputStream documentation.

Closes #15215.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-05-20 13:15:26 +00:00
parent 0f5378d414
commit 9bc3af3e64
4 changed files with 20 additions and 15 deletions

View File

@@ -281,16 +281,17 @@ class WXDLLIMPEXP_BASE wxCountingOutputStream : public wxOutputStream
public:
wxCountingOutputStream();
wxFileOffset GetLength() const;
virtual wxFileOffset GetLength() const;
bool Ok() const { return IsOk(); }
bool IsOk() const { return true; }
virtual bool IsOk() const { return true; }
protected:
virtual size_t OnSysWrite(const void *buffer, size_t size);
virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
virtual wxFileOffset OnSysTell() const;
size_t m_currentPos;
size_t m_currentPos,
m_lastPos;
DECLARE_DYNAMIC_CLASS(wxCountingOutputStream)
wxDECLARE_NO_COPY_CLASS(wxCountingOutputStream);