don't test for both stream.fail() and stream.bad() as the latter implies the former; also use operator!() instead of fail() to make it more clear what's going on
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -582,10 +582,10 @@ bool wxDocument::DoSaveDocument(const wxString& file)
|
|||||||
{
|
{
|
||||||
#if wxUSE_STD_IOSTREAM
|
#if wxUSE_STD_IOSTREAM
|
||||||
wxSTD ofstream store(file.mb_str(), wxSTD ios::binary);
|
wxSTD ofstream store(file.mb_str(), wxSTD ios::binary);
|
||||||
if (store.fail() || store.bad())
|
if ( !store )
|
||||||
#else
|
#else
|
||||||
wxFileOutputStream store(file);
|
wxFileOutputStream store(file);
|
||||||
if (store.GetLastError() != wxSTREAM_NO_ERROR)
|
if ( store.GetLastError() != wxSTREAM_NO_ERROR )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxLogError(_("File \"%s\" could not be opened for writing."), file);
|
wxLogError(_("File \"%s\" could not be opened for writing."), file);
|
||||||
@@ -605,7 +605,7 @@ bool wxDocument::DoOpenDocument(const wxString& file)
|
|||||||
{
|
{
|
||||||
#if wxUSE_STD_IOSTREAM
|
#if wxUSE_STD_IOSTREAM
|
||||||
wxSTD ifstream store(file.mb_str(), wxSTD ios::binary);
|
wxSTD ifstream store(file.mb_str(), wxSTD ios::binary);
|
||||||
if ( store.fail() || store.bad() )
|
if ( !store )
|
||||||
#else
|
#else
|
||||||
wxFileInputStream store(file);
|
wxFileInputStream store(file);
|
||||||
if (store.GetLastError() != wxSTREAM_NO_ERROR)
|
if (store.GetLastError() != wxSTREAM_NO_ERROR)
|
||||||
@@ -617,7 +617,7 @@ bool wxDocument::DoOpenDocument(const wxString& file)
|
|||||||
|
|
||||||
#if wxUSE_STD_IOSTREAM
|
#if wxUSE_STD_IOSTREAM
|
||||||
LoadObject(store);
|
LoadObject(store);
|
||||||
if ( store.fail() || store.bad() )
|
if ( !store )
|
||||||
#else
|
#else
|
||||||
int res = LoadObject(store).GetLastError();
|
int res = LoadObject(store).GetLastError();
|
||||||
if ( res != wxSTREAM_NO_ERROR && res != wxSTREAM_EOF )
|
if ( res != wxSTREAM_NO_ERROR && res != wxSTREAM_EOF )
|
||||||
|
Reference in New Issue
Block a user