]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wfstream.cpp
don't try to remove -g flag from CFLAGS, it is not necessary and doesn't work correct...
[wxWidgets.git] / src / common / wfstream.cpp
index b28617d537d666bf65146a5edea093b3c957626b..c7c06b57babe3cd3be0e8a96fc00aa38157375f0 100644 (file)
@@ -87,7 +87,7 @@ size_t wxFileInputStream::OnSysRead(void *buffer, size_t size)
 
 off_t wxFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
 {
 
 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
 }
 
 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;
 {
     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)
 }
 
 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)
 {
 
 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
 }
 
 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;
 {
     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)
 }
 
 wxFFileOutputStream::wxFFileOutputStream(wxFFile& file)
@@ -297,7 +317,7 @@ off_t wxFFileOutputStream::OnSysTell() const
 
 off_t wxFFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
 {
 
 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()
 }
 
 void wxFFileOutputStream::Sync()