X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7c74e7fe1de14f32dcd6f3c9cdd727de540bbd0e..f5ba273ecd799f652736ce2bc830283787302a56:/src/common/fileconf.cpp diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 80b528c70e..d9ab373bdb 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -49,9 +49,6 @@ #if defined(__WXPM__) #define INCL_DOS #include - #define LINKAGEMODE _Optlink -#else - #define LINKAGEMODE #endif #include @@ -98,7 +95,9 @@ wxString wxFileConfig::GetGlobalDir() { wxString strDir; - #ifdef __UNIX__ + #ifdef __VMS__ // Note if __VMS is defined __UNIX is also defined + strDir = wxT("sys$manager:"); + #elif defined( __UNIX__ ) strDir = wxT("/etc/"); #elif defined(__WXPM__) ULONG aulSysInfo[QSV_MAX] = {0}; @@ -225,11 +224,13 @@ wxString wxFileConfig::GetLocalDir() #ifndef __WXMAC__ wxGetHomeDir(&strDir); -#ifdef __UNIX__ +#ifndef __VMS__ +# ifdef __UNIX__ if (strDir.Last() != wxT('/')) strDir << wxT('/'); #else if (strDir.Last() != wxT('\\')) strDir << wxT('\\'); #endif +#endif #else // no local dir concept on mac return GetGlobalDir() ; @@ -257,8 +258,14 @@ wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile) wxString wxFileConfig::GetLocalFileName(const wxChar *szFile) { - wxString str = GetLocalDir(); - +#ifdef __VMS__ // On VMS I saw the problem that the home directory was appended + // twice for the configuration file. Does that also happen for other + // platforms? + wxString str = wxT( ' ' ); +#else + wxString str = GetLocalDir(); +#endif + #ifdef __UNIX__ str << wxT('.'); #endif @@ -462,11 +469,15 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal) } else { // a key const wxChar *pEnd = pStart; - while ( *pEnd != wxT('=') && !wxIsspace(*pEnd) ) { + while ( *pEnd && *pEnd != wxT('=') && !wxIsspace(*pEnd) ) { if ( *pEnd == wxT('\\') ) { // next character may be space or not - still take it because it's - // quoted + // quoted (unless there is nothing) pEnd++; + if ( !*pEnd ) { + // the error message will be given below anyhow + break; + } } pEnd++; @@ -585,7 +596,7 @@ bool wxFileConfig::GetFirstGroup(wxString& str, long& lIndex) const bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const { if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) { - str = m_pCurrentGroup->Groups()[lIndex++]->Name(); + str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name(); return TRUE; } else @@ -601,7 +612,7 @@ bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const { if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) { - str = m_pCurrentGroup->Entries()[lIndex++]->Name(); + str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name(); return TRUE; } else @@ -754,7 +765,7 @@ bool wxFileConfig::Write(const wxString& key, long lValue) bool wxFileConfig::Flush(bool /* bCurrentOnly */) { - if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() ) + if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() || !m_strLocalFile ) return TRUE; wxTempFile file(m_strLocalFile);