projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Wrong class used in _setCallbackInfo
[wxWidgets.git]
/
src
/
common
/
stream.cpp
diff --git
a/src/common/stream.cpp
b/src/common/stream.cpp
index 87748a4fe6a1deda292f3319849d28fe6aaf7f96..271f7490ae38c0a2c6538d5505eecb131eb41f40 100644
(file)
--- a/
src/common/stream.cpp
+++ b/
src/common/stream.cpp
@@
-551,11
+551,11
@@
size_t wxStreamBuffer::Write(wxStreamBuffer *sbuf)
return total;
}
return total;
}
-
off_t wxStreamBuffer::Seek(off_
t pos, wxSeekMode mode)
+
wxFileOffset wxStreamBuffer::Seek(wxFileOffse
t pos, wxSeekMode mode)
{
{
-
off_
t ret_off, diff;
+
wxFileOffse
t ret_off, diff;
-
off_
t last_access = GetLastAccess();
+
wxFileOffse
t last_access = GetLastAccess();
if ( !m_flushable )
{
if ( !m_flushable )
{
@@
-580,7
+580,9
@@
off_t wxStreamBuffer::Seek(off_t pos, wxSeekMode mode)
}
if (diff < 0 || diff > last_access)
return wxInvalidOffset;
}
if (diff < 0 || diff > last_access)
return wxInvalidOffset;
- SetIntPosition(diff);
+ size_t int_diff = (size_t)diff;
+ wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") );
+ SetIntPosition(int_diff);
return diff;
}
return diff;
}
@@
-605,7
+607,9
@@
off_t wxStreamBuffer::Seek(off_t pos, wxSeekMode mode)
}
else
{
}
else
{
- SetIntPosition(diff);
+ size_t int_diff = (size_t)diff;
+ wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") );
+ SetIntPosition(int_diff);
return pos;
}
return pos;
}
@@
-619,9
+623,9
@@
off_t wxStreamBuffer::Seek(off_t pos, wxSeekMode mode)
return wxInvalidOffset;
}
return wxInvalidOffset;
}
-
off_
t wxStreamBuffer::Tell() const
+
wxFileOffse
t wxStreamBuffer::Tell() const
{
{
-
off_
t pos;
+
wxFileOffse
t pos;
// ask the stream for position if we have a real one
if ( m_stream )
// ask the stream for position if we have a real one
if ( m_stream )
@@
-657,16
+661,36
@@
wxStreamBase::~wxStreamBase()
{
}
{
}
-off_t wxStreamBase::OnSysSeek(off_t WXUNUSED(seek), wxSeekMode WXUNUSED(mode))
+size_t wxStreamBase::GetSize() const
+{
+ wxFileOffset length = GetLength();
+ return length == wxInvalidOffset ? 0 : (size_t)length;
+}
+
+wxFileOffset wxStreamBase::OnSysSeek(wxFileOffset WXUNUSED(seek), wxSeekMode WXUNUSED(mode))
{
return wxInvalidOffset;
}
{
return wxInvalidOffset;
}
-
off_
t wxStreamBase::OnSysTell() const
+
wxFileOffse
t wxStreamBase::OnSysTell() const
{
return wxInvalidOffset;
}
{
return wxInvalidOffset;
}
+#if WXWIN_COMPATIBILITY_2_2
+
+wxStreamError wxStreamBase::LastError() const
+{
+ return m_lasterror;
+}
+
+size_t wxStreamBase::StreamSize() const
+{
+ return GetSize();
+}
+
+#endif // WXWIN_COMPATIBILITY_2_2
+
// ----------------------------------------------------------------------------
// wxInputStream
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxInputStream
// ----------------------------------------------------------------------------
@@
-853,7
+877,7
@@
wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
return *this;
}
return *this;
}
-
off_t wxInputStream::SeekI(off_
t pos, wxSeekMode mode)
+
wxFileOffset wxInputStream::SeekI(wxFileOffse
t pos, wxSeekMode mode)
{
// RR: This code is duplicated in wxBufferedInputStream. This is
// not really a good design, but buffered stream are different
{
// RR: This code is duplicated in wxBufferedInputStream. This is
// not really a good design, but buffered stream are different
@@
-887,9
+911,9
@@
off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
return OnSysSeek(pos, mode);
}
return OnSysSeek(pos, mode);
}
-
off_
t wxInputStream::TellI() const
+
wxFileOffse
t wxInputStream::TellI() const
{
{
-
off_
t pos = OnSysTell();
+
wxFileOffse
t pos = OnSysTell();
if (pos != wxInvalidOffset)
pos -= (m_wbacksize - m_wbackcur);
if (pos != wxInvalidOffset)
pos -= (m_wbacksize - m_wbackcur);
@@
-933,12
+957,12
@@
wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in)
return *this;
}
return *this;
}
-
off_
t wxOutputStream::TellO() const
+
wxFileOffse
t wxOutputStream::TellO() const
{
return OnSysTell();
}
{
return OnSysTell();
}
-
off_t wxOutputStream::SeekO(off_
t pos, wxSeekMode mode)
+
wxFileOffset wxOutputStream::SeekO(wxFileOffse
t pos, wxSeekMode mode)
{
return OnSysSeek(pos, mode);
}
{
return OnSysSeek(pos, mode);
}
@@
-957,7
+981,7
@@
wxCountingOutputStream::wxCountingOutputStream ()
m_currentPos = 0;
}
m_currentPos = 0;
}
-
size_t wxCountingOutputStream::GetSize
() const
+
wxFileOffset wxCountingOutputStream::GetLength
() const
{
return m_lastcount;
}
{
return m_lastcount;
}
@@
-972,20
+996,24
@@
size_t wxCountingOutputStream::OnSysWrite(const void *WXUNUSED(buffer),
return m_currentPos;
}
return m_currentPos;
}
-
off_t wxCountingOutputStream::OnSysSeek(off_
t pos, wxSeekMode mode)
+
wxFileOffset wxCountingOutputStream::OnSysSeek(wxFileOffse
t pos, wxSeekMode mode)
{
{
+ ssize_t new_pos = (ssize_t)pos;
+
switch ( mode )
{
case wxFromStart:
switch ( mode )
{
case wxFromStart:
-
m_currentPos = pos
;
+
wxCHECK_MSG( (wxFileOffset)new_pos == pos, wxInvalidOffset, wxT("huge position not supported") )
;
break;
case wxFromEnd:
break;
case wxFromEnd:
- m_currentPos = m_lastcount + pos;
+ new_pos = m_lastcount + new_pos;
+ wxCHECK_MSG( (wxFileOffset)new_pos == (wxFileOffset)(m_lastcount + pos), wxInvalidOffset, wxT("huge position not supported") );
break;
case wxFromCurrent:
break;
case wxFromCurrent:
- m_currentPos += pos;
+ new_pos = m_currentPos + new_pos;
+ wxCHECK_MSG( (wxFileOffset)new_pos == (wxFileOffset)(m_currentPos + pos), wxInvalidOffset, wxT("huge position not supported") );
break;
default:
break;
default:
@@
-993,13
+1021,15
@@
off_t wxCountingOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
return wxInvalidOffset;
}
return wxInvalidOffset;
}
+ m_currentPos = new_pos;
+
if (m_currentPos > m_lastcount)
m_lastcount = m_currentPos;
return m_currentPos;
}
if (m_currentPos > m_lastcount)
m_lastcount = m_currentPos;
return m_currentPos;
}
-
off_
t wxCountingOutputStream::OnSysTell() const
+
wxFileOffse
t wxCountingOutputStream::OnSysTell() const
{
return m_currentPos;
}
{
return m_currentPos;
}
@@
-1063,7
+1093,7
@@
wxBufferedInputStream::wxBufferedInputStream(wxInputStream& s,
wxBufferedInputStream::~wxBufferedInputStream()
{
wxBufferedInputStream::~wxBufferedInputStream()
{
- m_parent_i_stream->SeekI(-(
off_
t)m_i_streambuf->GetBytesLeft(),
+ m_parent_i_stream->SeekI(-(
wxFileOffse
t)m_i_streambuf->GetBytesLeft(),
wxFromCurrent);
delete m_i_streambuf;
wxFromCurrent);
delete m_i_streambuf;
@@
-1100,7
+1130,7
@@
wxInputStream& wxBufferedInputStream::Read(void *buf, size_t size)
return *this;
}
return *this;
}
-
off_t wxBufferedInputStream::SeekI(off_
t pos, wxSeekMode mode)
+
wxFileOffset wxBufferedInputStream::SeekI(wxFileOffse
t pos, wxSeekMode mode)
{
// RR: Look at wxInputStream for comments.
{
// RR: Look at wxInputStream for comments.
@@
-1120,9
+1150,9
@@
off_t wxBufferedInputStream::SeekI(off_t pos, wxSeekMode mode)
return m_i_streambuf->Seek(pos, mode);
}
return m_i_streambuf->Seek(pos, mode);
}
-
off_
t wxBufferedInputStream::TellI() const
+
wxFileOffse
t wxBufferedInputStream::TellI() const
{
{
-
off_
t pos = m_i_streambuf->Tell();
+
wxFileOffse
t pos = m_i_streambuf->Tell();
if (pos != wxInvalidOffset)
pos -= (m_wbacksize - m_wbackcur);
if (pos != wxInvalidOffset)
pos -= (m_wbacksize - m_wbackcur);
@@
-1135,12
+1165,12
@@
size_t wxBufferedInputStream::OnSysRead(void *buffer, size_t bufsize)
return m_parent_i_stream->Read(buffer, bufsize).LastRead();
}
return m_parent_i_stream->Read(buffer, bufsize).LastRead();
}
-
off_t wxBufferedInputStream::OnSysSeek(off_
t seek, wxSeekMode mode)
+
wxFileOffset wxBufferedInputStream::OnSysSeek(wxFileOffse
t seek, wxSeekMode mode)
{
return m_parent_i_stream->SeekI(seek, mode);
}
{
return m_parent_i_stream->SeekI(seek, mode);
}
-
off_
t wxBufferedInputStream::OnSysTell() const
+
wxFileOffse
t wxBufferedInputStream::OnSysTell() const
{
return m_parent_i_stream->TellI();
}
{
return m_parent_i_stream->TellI();
}
@@
-1179,6
+1209,13
@@
wxBufferedOutputStream::~wxBufferedOutputStream()
delete m_o_streambuf;
}
delete m_o_streambuf;
}
+bool wxBufferedOutputStream::Close()
+{
+ Sync();
+ return IsOk();
+}
+
+
wxOutputStream& wxBufferedOutputStream::Write(const void *buffer, size_t size)
{
m_lastcount = 0;
wxOutputStream& wxBufferedOutputStream::Write(const void *buffer, size_t size)
{
m_lastcount = 0;
@@
-1186,13
+1223,13
@@
wxOutputStream& wxBufferedOutputStream::Write(const void *buffer, size_t size)
return *this;
}
return *this;
}
-
off_t wxBufferedOutputStream::SeekO(off_
t pos, wxSeekMode mode)
+
wxFileOffset wxBufferedOutputStream::SeekO(wxFileOffse
t pos, wxSeekMode mode)
{
Sync();
return m_o_streambuf->Seek(pos, mode);
}
{
Sync();
return m_o_streambuf->Seek(pos, mode);
}
-
off_
t wxBufferedOutputStream::TellO() const
+
wxFileOffse
t wxBufferedOutputStream::TellO() const
{
return m_o_streambuf->Tell();
}
{
return m_o_streambuf->Tell();
}
@@
-1208,19
+1245,19
@@
size_t wxBufferedOutputStream::OnSysWrite(const void *buffer, size_t bufsize)
return m_parent_o_stream->Write(buffer, bufsize).LastWrite();
}
return m_parent_o_stream->Write(buffer, bufsize).LastWrite();
}
-
off_t wxBufferedOutputStream::OnSysSeek(off_
t seek, wxSeekMode mode)
+
wxFileOffset wxBufferedOutputStream::OnSysSeek(wxFileOffse
t seek, wxSeekMode mode)
{
return m_parent_o_stream->SeekO(seek, mode);
}
{
return m_parent_o_stream->SeekO(seek, mode);
}
-
off_
t wxBufferedOutputStream::OnSysTell() const
+
wxFileOffse
t wxBufferedOutputStream::OnSysTell() const
{
return m_parent_o_stream->TellO();
}
{
return m_parent_o_stream->TellO();
}
-
size_t wxBufferedOutputStream::GetSize
() const
+
wxFileOffset wxBufferedOutputStream::GetLength
() const
{
{
- return m_parent_o_stream->Get
Size
() + m_o_streambuf->GetIntPosition();
+ return m_parent_o_stream->Get
Length
() + m_o_streambuf->GetIntPosition();
}
void wxBufferedOutputStream::SetOutputStreamBuffer(wxStreamBuffer *buffer)
}
void wxBufferedOutputStream::SetOutputStreamBuffer(wxStreamBuffer *buffer)