Rewrite switch on wxTextBufferOpenMode to be exhaustive
Get rid of the default clause to allow the compiler to warn us if ever add new elements to this enum. No real changes.
This commit is contained in:
@@ -58,14 +58,10 @@ bool wxTextFile::OnExists() const
|
||||
|
||||
bool wxTextFile::OnOpen(const wxString &strBufferName, wxTextBufferOpenMode openMode)
|
||||
{
|
||||
wxFile::OpenMode fileOpenMode;
|
||||
wxFile::OpenMode fileOpenMode = wxFile::read_write;
|
||||
|
||||
switch ( openMode )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG( wxT("unknown open mode in wxTextFile::Open") );
|
||||
wxFALLTHROUGH;
|
||||
|
||||
case ReadAccess:
|
||||
fileOpenMode = wxFile::read;
|
||||
break;
|
||||
@@ -75,6 +71,13 @@ bool wxTextFile::OnOpen(const wxString &strBufferName, wxTextBufferOpenMode open
|
||||
break;
|
||||
}
|
||||
|
||||
if ( fileOpenMode == wxFile::read_write )
|
||||
{
|
||||
// This must mean it hasn't been initialized in the switch above.
|
||||
wxFAIL_MSG( wxT("unknown open mode in wxTextFile::Open") );
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_file.Open(strBufferName, fileOpenMode);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user