]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wfstream.cpp
fix for bug 1371386, with some minor mods and cleanup
[wxWidgets.git] / src / common / wfstream.cpp
index 9d15b4f9b65d501e7dd71a5bce998b04666b42fa..74bdde104059b597489e39340d30d03740f4979f 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "wfstream.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -37,6 +33,8 @@ wxFileInputStream::wxFileInputStream(const wxString& fileName)
 {
     m_file = new wxFile(fileName, wxFile::read);
     m_file_destroy = true;
 {
     m_file = new wxFile(fileName, wxFile::read);
     m_file_destroy = true;
+    if ( !m_file->IsOpened() )
+        m_lasterror = wxSTREAM_READ_ERROR;
 }
 
 wxFileInputStream::wxFileInputStream()
 }
 
 wxFileInputStream::wxFileInputStream()
@@ -115,14 +113,7 @@ wxFileOutputStream::wxFileOutputStream(const wxString& fileName)
     m_file_destroy = true;
 
     if (!m_file->IsOpened())
     m_file_destroy = true;
 
     if (!m_file->IsOpened())
-    {
         m_lasterror = wxSTREAM_WRITE_ERROR;
         m_lasterror = wxSTREAM_WRITE_ERROR;
-    }
-    else
-    {
-        if (m_file->Error())
-            m_lasterror = wxSTREAM_WRITE_ERROR;
-    }
 }
 
 wxFileOutputStream::wxFileOutputStream(wxFile& file)
 }
 
 wxFileOutputStream::wxFileOutputStream(wxFile& file)
@@ -234,6 +225,9 @@ wxFFileInputStream::wxFFileInputStream(const wxString& fileName,
 {
     m_file = new wxFFile(fileName, mode);
     m_file_destroy = true;
 {
     m_file = new wxFFile(fileName, mode);
     m_file_destroy = true;
+
+    if (!m_file->IsOpened())
+        m_lasterror = wxSTREAM_WRITE_ERROR;
 }
 
 wxFFileInputStream::wxFFileInputStream()
 }
 
 wxFFileInputStream::wxFFileInputStream()