]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Remove unnecessary locale/UTF-8 encoding conversions
authorJānis Rūcis <parasti@gmail.com>
Thu, 20 May 2010 16:13:48 +0000 (19:13 +0300)
committerJānis Rūcis <parasti@gmail.com>
Thu, 20 May 2010 16:45:59 +0000 (19:45 +0300)
contrib/prtview/LoadPortalFileDialog.cpp
libs/xml/xmlparser.h
libs/xml/xmlwriter.h
radiant/console.cpp
radiant/dialog.cpp
radiant/entityinspector.cpp
radiant/mru.cpp
radiant/qe3.cpp
radiant/watchbsp.cpp

index d9984a0b8a7b66f935feedc5f67247a643855f95..03d8439777e08e01c6282f91a5af79900d3a9f10 100644 (file)
@@ -176,7 +176,7 @@ int DoLoadPortalFileDialog ()
   }
 
   StringOutputStream value(256);
   }
 
   StringOutputStream value(256);
-  value << ConvertLocaleToUTF8(portals.fn);
+  value << portals.fn;
   gtk_entry_set_text (GTK_ENTRY (entry), value.c_str());
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check2d), portals.show_2d);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check3d), portals.show_3d);
   gtk_entry_set_text (GTK_ENTRY (entry), value.c_str());
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check2d), portals.show_2d);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check3d), portals.show_3d);
index 0b70c2f4224859d291ce0e3cf918ccec59c0adca..8fef04f56c720c2305e1fba24347bd5a077e6e2b 100644 (file)
@@ -138,7 +138,7 @@ class XMLSAXImporter
   static void characters(void *user_data, const xmlChar *ch, int len)
   {
     reinterpret_cast<XMLSAXImporter*>(user_data)->m_importer
   static void characters(void *user_data, const xmlChar *ch, int len)
   {
     reinterpret_cast<XMLSAXImporter*>(user_data)->m_importer
-      << ConvertUTF8ToLocale(StringRange(reinterpret_cast<const char*>(ch), reinterpret_cast<const char*>(ch + len)));
+      << StringRange(reinterpret_cast<const char*>(ch), reinterpret_cast<const char*>(ch + len));
   }
 
   static void warning(void *user_data, const char *msg, ...)
   }
 
   static void warning(void *user_data, const char *msg, ...)
index 85e49d45b34d2836cb37f5fc7f98d300a14cc407..ec5a4ade54ac2a2119ea693cb338a9683551ec1a 100644 (file)
@@ -113,7 +113,7 @@ class XMLStreamWriter : public XMLImporter, public XMLAttrVisitor
 
   void write_cdata(const char* buffer, std::size_t length)
   {
 
   void write_cdata(const char* buffer, std::size_t length)
   {
-    m_ostream << ConvertLocaleToUTF8(StringRange(buffer, buffer + length));
+    m_ostream << StringRange(buffer, buffer + length);
   }
   void write_string(const char* string)
   {
   }
   void write_string(const char* string)
   {
index 94a496f696bf61e69d24466bc8be9e3739becfaf..db7997e18be53d14319a47664486f41a0fa9a650 100644 (file)
@@ -216,7 +216,7 @@ std::size_t Sys_Print(int level, const char* buf, std::size_t length)
         if(!globalCharacterSet().isUTF8())
         {
           BufferedTextOutputStream<GtkTextBufferOutputStream> buffered(textBuffer);
         if(!globalCharacterSet().isUTF8())
         {
           BufferedTextOutputStream<GtkTextBufferOutputStream> buffered(textBuffer);
-          buffered << ConvertLocaleToUTF8(StringRange(buf, buf + length));
+          buffered << StringRange(buf, buf + length);
         }
         else
         {
         }
         else
         {
index 3f24bf84dc15398bff311da864ead0fc130dffce..d3e4dba131d57a78c4d2c36f3ba6d6c190667c9f 100644 (file)
@@ -170,31 +170,13 @@ void IntRadioExport(GtkRadioButton& widget, const IntImportCallback& importCallb
 }
 typedef ImportExport<GtkRadioButton, int, IntRadioImport, IntRadioExport> IntRadioImportExport;
 
 }
 typedef ImportExport<GtkRadioButton, int, IntRadioImport, IntRadioExport> IntRadioImportExport;
 
-template<typename Type, typename Formatter>
-class StringFromType
-{
-  StringOutputStream value;
-public:
-  StringFromType(const Type& type)
-  {
-    value << Formatter(type);
-  }
-  operator const char*() const
-  {
-    return value.c_str();
-  }
-};
-
-typedef StringFromType<const char*, ConvertLocaleToUTF8> LocaleToUTF8;
-typedef StringFromType<const char*, ConvertUTF8ToLocale> UTF8ToLocale;
-
 void TextEntryImport(GtkEntry& widget, const char* text)
 {
 void TextEntryImport(GtkEntry& widget, const char* text)
 {
-  gtk_entry_set_text(&widget, LocaleToUTF8(text));
+  gtk_entry_set_text(&widget, text);
 }
 void TextEntryExport(GtkEntry& widget, const StringImportCallback& importCallback)
 {
 }
 void TextEntryExport(GtkEntry& widget, const StringImportCallback& importCallback)
 {
-  importCallback(UTF8ToLocale(gtk_entry_get_text(&widget)));
+  importCallback(gtk_entry_get_text(&widget));
 }
 typedef ImportExport<GtkEntry, const char*, TextEntryImport, TextEntryExport> TextEntryImportExport;
 
 }
 typedef ImportExport<GtkEntry, const char*, TextEntryImport, TextEntryExport> TextEntryImportExport;
 
index e2f3c194938ef89dc676eda77e3cbff77761dbfa..ab9cabd7073c03281a3588a7ee0f5b7d661ed2d6 100644 (file)
@@ -216,7 +216,7 @@ public:
   void apply()
   {
     StringOutputStream value(64);
   void apply()
   {
     StringOutputStream value(64);
-    value << ConvertUTF8ToLocale(gtk_entry_get_text(m_entry));
+    value << gtk_entry_get_text(m_entry);
     Scene_EntitySetKeyValue_Selected_Undoable(m_key.c_str(), value.c_str());
   }
   typedef MemberCaller<StringAttribute, &StringAttribute::apply> ApplyCaller;
     Scene_EntitySetKeyValue_Selected_Undoable(m_key.c_str(), value.c_str());
   }
   typedef MemberCaller<StringAttribute, &StringAttribute::apply> ApplyCaller;
@@ -224,7 +224,7 @@ public:
   void update()
   {
     StringOutputStream value(64);
   void update()
   {
     StringOutputStream value(64);
-    value << ConvertLocaleToUTF8(SelectedEntity_getValueForKey(m_key.c_str()));
+    value << SelectedEntity_getValueForKey(m_key.c_str());
     gtk_entry_set_text(m_entry, value.c_str());
   }
   typedef MemberCaller<StringAttribute, &StringAttribute::update> UpdateCaller;
     gtk_entry_set_text(m_entry, value.c_str());
   }
   typedef MemberCaller<StringAttribute, &StringAttribute::update> UpdateCaller;
@@ -264,14 +264,14 @@ public:
   void apply()
   {
     StringOutputStream value(64);
   void apply()
   {
     StringOutputStream value(64);
-    value << ConvertUTF8ToLocale(gtk_entry_get_text(GTK_ENTRY(m_entry.m_entry.m_entry)));
+    value << gtk_entry_get_text(GTK_ENTRY(m_entry.m_entry.m_entry));
     Scene_EntitySetKeyValue_Selected_Undoable(m_key.c_str(), value.c_str());
   }
   typedef MemberCaller<ModelAttribute, &ModelAttribute::apply> ApplyCaller;
   void update()
   {
     StringOutputStream value(64);
     Scene_EntitySetKeyValue_Selected_Undoable(m_key.c_str(), value.c_str());
   }
   typedef MemberCaller<ModelAttribute, &ModelAttribute::apply> ApplyCaller;
   void update()
   {
     StringOutputStream value(64);
-    value << ConvertLocaleToUTF8(SelectedEntity_getValueForKey(m_key.c_str()));
+    value << SelectedEntity_getValueForKey(m_key.c_str());
     gtk_entry_set_text(GTK_ENTRY(m_entry.m_entry.m_entry), value.c_str());
   }
   typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
     gtk_entry_set_text(GTK_ENTRY(m_entry.m_entry.m_entry), value.c_str());
   }
   typedef MemberCaller<ModelAttribute, &ModelAttribute::update> UpdateCaller;
@@ -338,14 +338,14 @@ public:
   void apply()
   {
     StringOutputStream value(64);
   void apply()
   {
     StringOutputStream value(64);
-    value << ConvertUTF8ToLocale(gtk_entry_get_text(GTK_ENTRY(m_entry.m_entry.m_entry)));
+    value << gtk_entry_get_text(GTK_ENTRY(m_entry.m_entry.m_entry));
     Scene_EntitySetKeyValue_Selected_Undoable(m_key.c_str(), value.c_str());
   }
   typedef MemberCaller<SoundAttribute, &SoundAttribute::apply> ApplyCaller;
   void update()
   {
     StringOutputStream value(64);
     Scene_EntitySetKeyValue_Selected_Undoable(m_key.c_str(), value.c_str());
   }
   typedef MemberCaller<SoundAttribute, &SoundAttribute::apply> ApplyCaller;
   void update()
   {
     StringOutputStream value(64);
-    value << ConvertLocaleToUTF8(SelectedEntity_getValueForKey(m_key.c_str()));
+    value << SelectedEntity_getValueForKey(m_key.c_str());
     gtk_entry_set_text(GTK_ENTRY(m_entry.m_entry.m_entry), value.c_str());
   }
   typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
     gtk_entry_set_text(GTK_ENTRY(m_entry.m_entry.m_entry), value.c_str());
   }
   typedef MemberCaller<SoundAttribute, &SoundAttribute::update> UpdateCaller;
@@ -1170,9 +1170,9 @@ void EntityInspector_updateKeyValues()
     GtkTreeIter iter;
     gtk_list_store_append(store, &iter);
     StringOutputStream key(64);
     GtkTreeIter iter;
     gtk_list_store_append(store, &iter);
     StringOutputStream key(64);
-    key << ConvertLocaleToUTF8((*i).first.c_str());
+    key << (*i).first.c_str();
     StringOutputStream value(64);
     StringOutputStream value(64);
-    value << ConvertLocaleToUTF8((*i).second.c_str());
+    value << (*i).second.c_str();
     gtk_list_store_set(store, &iter, 0, key.c_str(), 1, value.c_str(), -1);
   }
 
     gtk_list_store_set(store, &iter, 0, key.c_str(), 1, value.c_str(), -1);
   }
 
@@ -1243,9 +1243,9 @@ void EntityInspector_applyKeyValue()
 {
   // Get current selection text
   StringOutputStream key(64);
 {
   // Get current selection text
   StringOutputStream key(64);
-  key << ConvertUTF8ToLocale(gtk_entry_get_text(g_entityKeyEntry));
+  key << gtk_entry_get_text(g_entityKeyEntry);
   StringOutputStream value(64);
   StringOutputStream value(64);
-  value << ConvertUTF8ToLocale(gtk_entry_get_text(g_entityValueEntry));
+  value << gtk_entry_get_text(g_entityValueEntry);
 
 
   // TTimo: if you change the classname to worldspawn you won't merge back in the structural brushes but create a parasite entity
 
 
   // TTimo: if you change the classname to worldspawn you won't merge back in the structural brushes but create a parasite entity
@@ -1280,7 +1280,7 @@ void EntityInspector_clearKeyValue()
 {
   // Get current selection text
   StringOutputStream key(64);
 {
   // Get current selection text
   StringOutputStream key(64);
-  key << ConvertUTF8ToLocale(gtk_entry_get_text(g_entityKeyEntry));
+  key << gtk_entry_get_text(g_entityKeyEntry);
 
   if(strcmp(key.c_str(), "classname") != 0)
   {
 
   if(strcmp(key.c_str(), "classname") != 0)
   {
index 7f3fbeebf4ced43eba311b44f683e541e70254d6..2dd0da72090c65cfdfb6a08741576baacaaa77ca 100644 (file)
@@ -90,7 +90,7 @@ inline EscapedMnemonic& operator<<(EscapedMnemonic& ostream, const T& t)
 void MRU_updateWidget(std::size_t index, const char *filename)
 {
   EscapedMnemonic mnemonic(64);
 void MRU_updateWidget(std::size_t index, const char *filename)
 {
   EscapedMnemonic mnemonic(64);
-  mnemonic << Unsigned(index + 1) << "- " << ConvertLocaleToUTF8(filename);
+  mnemonic << Unsigned(index + 1) << "- " << filename;
   gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[index]))), mnemonic.c_str());
 }
 
   gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[index]))), mnemonic.c_str());
 }
 
index 451489b531c83b765d21e661c3bf4f54244fec00..0291d2cfb9b2a12014a13cf4f9696ff66c4de4c2 100644 (file)
@@ -346,7 +346,7 @@ void RunBSP(const char* name)
 void Sys_SetTitle(const char *text, bool modified)
 {
   StringOutputStream title;
 void Sys_SetTitle(const char *text, bool modified)
 {
   StringOutputStream title;
-  title << ConvertLocaleToUTF8(text);
+  title << text;
 
   if(modified)
   {
 
   if(modified)
   {
index e2cc86c37d176e4cf70b81007230a29031ee652d..83fba9009a45258516115baf151f3d1b4cf0f57a 100644 (file)
@@ -431,7 +431,7 @@ inline MessageOutputStream& operator<<(MessageOutputStream& ostream, const T& t)
 static void saxCharacters(message_info_t *data, const xmlChar *ch, int len)
 {
   MessageOutputStream ostream(data);
 static void saxCharacters(message_info_t *data, const xmlChar *ch, int len)
 {
   MessageOutputStream ostream(data);
-  ostream << ConvertUTF8ToLocale(StringRange(reinterpret_cast<const char*>(ch), reinterpret_cast<const char*>(ch + len)));
+  ostream << StringRange(reinterpret_cast<const char*>(ch), reinterpret_cast<const char*>(ch + len));
 }
 
 static void saxComment(void *ctx, const xmlChar *msg)
 }
 
 static void saxComment(void *ctx, const xmlChar *msg)