#include "wx/textfile.h"
#include "wx/utils.h"
#include "wx/utils.h"
+#include "wx/math.h"
#include <stdlib.h>
-#include <math.h>
#include <ctype.h>
#include <limits.h> // for INT_MAX
ms_pConfig =
#if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE
new wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName());
+ #elif defined(__WXPALMOS__) && wxUSE_CONFIG_NATIVE
+ new wxPrefConfig(wxTheApp->GetAppName());
#else // either we're under Unix or wish to use files even under Windows
new wxFileConfig(wxTheApp->GetAppName());
#endif
wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR);
// except in the special case of "/keyname" when there is nothing before "/"
- if ( strPath.IsEmpty() &&
- ((!strEntry.IsEmpty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR) )
+ if ( strPath.empty() &&
+ ((!strEntry.empty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR) )
{
strPath = wxCONFIG_PATH_SEPARATOR;
}
- if ( !strPath.IsEmpty() )
+ if ( !strPath.empty() )
{
if ( m_pContainer->GetPath() != strPath )
{
// do change the path
m_bChanged = true;
- m_strOldPath = m_pContainer->GetPath();
+
+ /* JACS: work around a memory bug that causes an assert
+ when using wxRegConfig, related to reference-counting.
+ Can be reproduced by removing (const wxChar*) below and
+ adding the following code to the config sample OnInit under
+ Windows:
+
+ pConfig->SetPath(wxT("MySettings"));
+ pConfig->SetPath(wxT(".."));
+ int value;
+ pConfig->Read(_T("MainWindowX"), & value);
+ */
+ m_strOldPath = (const wxChar*) m_pContainer->GetPath();
if ( *m_strOldPath.c_str() != wxCONFIG_PATH_SEPARATOR )
m_strOldPath += wxCONFIG_PATH_SEPARATOR;
m_pContainer->SetPath(strPath);
case '\\':
// backslash can be used to suppress special meaning of % and $
- if ( n != str.Len() && (str[n + 1] == wxT('%') || str[n + 1] == wxT('$')) ) {
+ if ( n != str.Len() - 1 &&
+ (str[n + 1] == wxT('%') || str[n + 1] == wxT('$')) ) {
strResult += str[++n];
break;
strCurrent.Empty();
}
- else if ( !strCurrent.IsEmpty() ) {
+ else if ( !strCurrent.empty() ) {
aParts.push_back(strCurrent);
strCurrent.Empty();
}