X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e9c4c02c19c11e6cd487e03e0a7b105d0281fd7e..fd85b0640ea48f66a27e5908930e9f004de698b6:/src/common/config.cpp?ds=sidebyside diff --git a/src/common/config.cpp b/src/common/config.cpp index be417c4243..1b614016b2 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -132,10 +132,9 @@ bool wxConfigBase::Read(const wxString& key, long *pl, long defVal) const bool wxConfigBase::Read(const wxString& key, double* val) const { wxString str; - if (Read(key, & str)) + if ( Read(key, &str) ) { - *val = wxAtof(str); - return TRUE; + return str.ToDouble(val); } return FALSE; @@ -190,28 +189,29 @@ bool wxConfigBase::Read(const wxString& key, int *pi, int defVal) const { long l; bool ret = Read(key, &l, (long) defVal); - *pi = (int) l; + if (ret) + *pi = (int) l; return ret; } bool wxConfigBase::Write(const wxString& key, double val) { wxString str; - str.Printf(wxT("%f"), val); + str.Printf(wxT("%g"), val); return Write(key, str); } bool wxConfigBase::Write(const wxString& key, bool value) { - long l = (value ? 1 : 0); - return Write(key, l); + return Write(key, value ? 1l : 0l); } -bool wxConfigBase::Write( const wxString &key, const wxChar *text ) +bool wxConfigBase::Write(const wxString& key, const wxChar *value) { - wxString str( text ) ; - return Write( key, str ) ; + // explicit cast needed, otherwise value would have been converted to bool + return Write(key, wxString(value)); } + wxString wxConfigBase::ExpandEnvVars(const wxString& str) const { wxString tmp; // Required for BC++