X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0efe5ba76e45711cad627222905a55c7e04adf9a..6627a4b0497f89221ea9f7848990f8830cf81b7e:/src/common/ffile.cpp diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index 4e1aea21ec..e1e5a2dbe1 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -56,7 +56,21 @@ bool wxFFile::Open(const wxChar *filename, const char *mode) { wxASSERT_MSG( !m_fp, _T("should close or detach the old file first") ); +#if wxUSE_UNICODE + char *tmp_fname; + size_t fname_len; + + fname_len = wxStrlen(filename)+1; + tmp_fname = new char[fname_len]; + wxWX2MB(tmp_fname, filename, fname_len); + + m_fp = fopen(tmp_fname, mode); + + delete tmp_fname; +#else m_fp = fopen(filename, mode); +#endif + if ( !m_fp ) { @@ -74,7 +88,7 @@ bool wxFFile::Close() { if ( IsOpened() ) { - if ( !fclose(m_fp) ) + if ( fclose(m_fp) != 0 ) { wxLogSysError(_("can't close file '%s'"), m_name.c_str()); @@ -153,7 +167,9 @@ bool wxFFile::Flush() { if ( IsOpened() ) { - if ( !fflush(m_fp) ) + // fflush returns non-zero on error + // + if ( fflush(m_fp) ) { wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());