[nemiver: 2/5] Don't automatically convert locale in UString constructor



commit d7b0e390a53fdf44ab9c1d41a5ab923cf85a2950
Author: Jonathon Jongsma <jonathon jongsma collabora co uk>
Date:   Sat Apr 11 21:56:20 2009 -0500

    Don't automatically convert locale in UString constructor
    
    	* src/common/nmv-ustring.cc: remove the automatic locale
    	conversion from the UString(std::string) constructor.  This can be handy,
    	but tends to introduce issues when you're not really careful.
    	* src/dbgengine/nmv-gdb-engine.cc:
    	* src/main.cc:
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc:
    	* src/persp/dbgperspective/nmv-memory-view.h: go through and make sure we're
    	not depending on the old constructor locale conversion behavior anywhere,
    	and fix a few other locale-related issues
---
 src/common/nmv-ustring.cc                       |    5 ++---
 src/dbgengine/nmv-gdb-engine.cc                 |    4 +++-
 src/main.cc                                     |    3 ++-
 src/persp/dbgperspective/nmv-dbg-perspective.cc |    2 +-
 src/persp/dbgperspective/nmv-memory-view.h      |    1 -
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/common/nmv-ustring.cc b/src/common/nmv-ustring.cc
index 71c9d90..3d6bf76 100644
--- a/src/common/nmv-ustring.cc
+++ b/src/common/nmv-ustring.cc
@@ -97,9 +97,8 @@ UString::UString (const Glib::ustring &an_other_string) :
 {}
 
 UString::UString (const string &an_other_string) :
-    Glib::ustring (Glib::locale_to_utf8 (an_other_string.c_str ()))
-{
-}
+    Glib::ustring (an_other_string)
+{}
 
 UString::~UString ()
 {}
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index e45b6c9..4de2b4f 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -524,7 +524,8 @@ public:
     {
         const char *tmp = g_getenv ("PATH");
         if (!tmp) {return false;}
-        vector<UString> path_dirs = UString (tmp).split (":");
+        vector<UString> path_dirs =
+            UString (Glib::filename_to_utf8 (tmp)).split (":");
         path_dirs.insert (path_dirs.begin (), ("."));
         vector<UString>::const_iterator it;
         string file_path;
@@ -3487,6 +3488,7 @@ fetch_variable:
     }
     LOG_DD ("globals: got variable name: " << var_name );
 
+    // TODO: What encoding is var_name?
     var.reset (new IDebugger::Variable (UString (var_name)));
     var_list.push_back (var);
 
diff --git a/src/main.cc b/src/main.cc
index b58d758..6242f93 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -419,7 +419,8 @@ process_gui_command_line (int& a_argc, char** a_argv, int &a_return)
                    NMV_DEFAULT_DOMAIN);
             map<UString, UString> env;
             if (gv_env_vars) {
-                vector<UString> env_vars = UString (gv_env_vars).split (" ");
+                vector<UString> env_vars =
+                    UString (Glib::locale_to_utf8 (gv_env_vars)).split (" ");
                 for (vector<UString>::const_iterator it = env_vars.begin ();
                      it != env_vars.end ();
                      ++it) {
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 1ecf20a..5fc2c35 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -980,7 +980,7 @@ struct DBGPerspective::Priv {
 
         UString buf_content;
         if (is_buffer_valid_utf8 (a_input.c_str (), a_input.size ())) {
-            a_output = UString(a_input.c_str ());
+            a_output = UString(a_input);
             return true;
         }
         UString utf8_content;
diff --git a/src/persp/dbgperspective/nmv-memory-view.h b/src/persp/dbgperspective/nmv-memory-view.h
index cc666e4..0d8d3fd 100644
--- a/src/persp/dbgperspective/nmv-memory-view.h
+++ b/src/persp/dbgperspective/nmv-memory-view.h
@@ -33,7 +33,6 @@
 #include "nmv-i-debugger.h"
 
 using nemiver::common::SafePtr;
-using nemiver::common::UString;
 
 namespace nemiver {
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]