X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..e83ecba968c94965523be449a56fffcf4c55010b:/src/common/wfstream.cpp diff --git a/src/common/wfstream.cpp b/src/common/wfstream.cpp index b28617d537..c7c06b57ba 100644 --- a/src/common/wfstream.cpp +++ b/src/common/wfstream.cpp @@ -87,7 +87,7 @@ size_t wxFileInputStream::OnSysRead(void *buffer, size_t size) off_t wxFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode) { - return m_file->Seek(pos, mode); + return m_file->Seek(pos, mode) ; } off_t wxFileInputStream::OnSysTell() const @@ -103,6 +103,16 @@ wxFileOutputStream::wxFileOutputStream(const wxString& fileName) { m_file = new wxFile(fileName, wxFile::write); m_file_destroy = TRUE; + + if (!m_file->IsOpened()) + { + m_lasterror = wxSTREAM_WRITE_ERROR; + } + else + { + if (m_file->Error()) + m_lasterror = wxSTREAM_WRITE_ERROR; + } } wxFileOutputStream::wxFileOutputStream(wxFile& file) @@ -234,7 +244,7 @@ size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size) off_t wxFFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode) { - return m_file->Seek(pos, mode); + return ( m_file->Seek(pos, mode) ? pos : wxInvalidOffset ); } off_t wxFFileInputStream::OnSysTell() const @@ -250,6 +260,16 @@ wxFFileOutputStream::wxFFileOutputStream(const wxString& fileName) { m_file = new wxFFile(fileName, "w+b"); m_file_destroy = TRUE; + + if (!m_file->IsOpened()) + { + m_lasterror = wxSTREAM_WRITE_ERROR; + } + else + { + if (m_file->Error()) + m_lasterror = wxSTREAM_WRITE_ERROR; + } } wxFFileOutputStream::wxFFileOutputStream(wxFFile& file) @@ -297,7 +317,7 @@ off_t wxFFileOutputStream::OnSysTell() const off_t wxFFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode) { - return m_file->Seek(pos, mode); + return ( m_file->Seek(pos, mode) ? pos : wxInvalidOffset ); } void wxFFileOutputStream::Sync()