]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed 'patch' #422993 (Error in wxConfigBase::Write for doubles)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 27 May 2001 02:23:16 +0000 (02:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 27 May 2001 02:23:16 +0000 (02:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/config.cpp

index be417c42432ca4d1b22db32f62627db51e1b5997..5ec9090807dc12ae52ada0ad3369aae79552a542 100644 (file)
@@ -134,8 +134,7 @@ bool wxConfigBase::Read(const wxString& key, double* val) const
     wxString str;
     if (Read(key, & str))
     {
-        *val = wxAtof(str);
-        return TRUE;
+        return wxSscanf(str, _T("%g"), val) == 1;
     }
 
     return FALSE;
@@ -190,14 +189,15 @@ 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);
 }
 
@@ -209,8 +209,7 @@ bool wxConfigBase::Write(const wxString& key, bool value)
 
 bool wxConfigBase::Write( const wxString &key, const wxChar *text )
 {
-       wxString str( text ) ;
-       return Write( key, str ) ;
+    return Write(key, str) ;
 }
 wxString wxConfigBase::ExpandEnvVars(const wxString& str) const
 {