Thread: SVN Commit by dpage: r4958 - branches/REL-1_4_0_PATCHES/pgadmin3/src/frm

SVN Commit by dpage: r4958 - branches/REL-1_4_0_PATCHES/pgadmin3/src/frm

From
svn@pgadmin.org
Date:
Author: dpage
Date: 2006-01-25 08:37:27 +0000 (Wed, 25 Jan 2006)
New Revision: 4958

Modified:
   branches/REL-1_4_0_PATCHES/pgadmin3/src/frm/frmConfig.cpp
Log:
Andreas' multibyte patch from trunk: read/write config files with wxUtfFile and wxFONTENCODING_SYSTEM

Modified: branches/REL-1_4_0_PATCHES/pgadmin3/src/frm/frmConfig.cpp
===================================================================
--- branches/REL-1_4_0_PATCHES/pgadmin3/src/frm/frmConfig.cpp    2006-01-24 19:00:17 UTC (rev 4957)
+++ branches/REL-1_4_0_PATCHES/pgadmin3/src/frm/frmConfig.cpp    2006-01-25 08:37:27 UTC (rev 4958)
@@ -301,20 +301,18 @@

 void frmConfig::OpenLastFile()
 {
-    wxFile file(lastPath, wxFile::read);
+    wxUtfFile file(lastPath, wxFile::read, wxFONTENCODING_SYSTEM);
     if (file.IsOpened())
     {
 #ifdef __WXMSW__
         _setmode(file.fd(), _O_BINARY);
 #endif
-        char *buffer=new char[file.Length()+1];
-        int cnt=file.Read(buffer,file.Length());
-        buffer[cnt] = 0;
+        wxString buffer;
+        file.Read(buffer);
         file.Close();

-        DisplayFile(wxString(buffer, wxConvLibc));
+        DisplayFile(buffer);

-        delete buffer;
         statusBar->SetStatusText(wxString::Format(_(" Configuration read from %s"), lastPath.c_str()));

         fileMenu->Enable(MNU_SAVE, false);
@@ -373,9 +371,12 @@
     }
     else
     {
-        wxFile file(lastPath, wxFile::write);
+        wxUtfFile file(lastPath, wxFile::write, wxFONTENCODING_SYSTEM);
         if (file.IsOpened())
         {
+#ifdef __WXMSW__
+            _setmode(file.fd(), _O_BINARY);
+#endif
             file.Write(str);
             file.Close();
             done=true;