X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a3a584a7a6ade199990dd4463488e4bbf3545349..33754c4d83c59b7523a6da0c4fb21079cb60301c:/src/common/textfile.cpp diff --git a/src/common/textfile.cpp b/src/common/textfile.cpp index f0e08b4012..63f02f1a37 100644 --- a/src/common/textfile.cpp +++ b/src/common/textfile.cpp @@ -61,20 +61,22 @@ bool wxTextFile::OnExists() const bool wxTextFile::OnOpen(const wxString &strBufferName, wxTextBufferOpenMode OpenMode) { - wxFile::OpenMode FileOpenMode = wxFile::read; - - switch (OpenMode) - { + wxFile::OpenMode FileOpenMode; + + switch ( OpenMode ) + { + default: + wxFAIL_MSG( _T("unknown open mode in wxTextFile::Open") ); + // fall through + case ReadAccess : FileOpenMode = wxFile::read; break; + case WriteAccess : FileOpenMode = wxFile::write; break; - default : - wxASSERT(0); // Should not happen. - break; - } + } return m_file.Open(strBufferName.c_str(), FileOpenMode); } @@ -136,6 +138,7 @@ bool wxTextFile::OnRead(wxMBConv& conv) AddLine(str, wxTextFileType_Mac); chLast = ch; #if wxUSE_UNICODE + conv_mbBuf[0] = ch; if (conv.MB2WC(conv_wcBuf, conv_mbBuf, 2) == (size_t)-1) conv_wcBuf[0] = ch; str = conv_wcBuf[0]; @@ -146,6 +149,7 @@ bool wxTextFile::OnRead(wxMBConv& conv) else { // add to the current line #if wxUSE_UNICODE + conv_mbBuf[0] = ch; if (conv.MB2WC(conv_wcBuf, conv_mbBuf, 2) == (size_t)-1) conv_wcBuf[0] = ch; str += conv_wcBuf[0];