summaryrefslogtreecommitdiff
path: root/dash
diff options
authorBrandon Schaefer <brandontschaefer@gmail.com>2013-10-15 19:39:48 -0700
committerBrandon Schaefer <brandontschaefer@gmail.com>2013-10-15 19:39:48 -0700
commitf53602c67380f4e6f98118afb571e5ce8e98a72b (patch)
tree14cd90342cf9f74d7b78e706fcc5f5331dc90189 /dash
parent95a042a543ac9e62a887c8dc469ab2af91568a53 (diff)
* Use *next_char
(bzr r3571.1.6)
Diffstat (limited to 'dash')
-rw-r--r--dash/ResultRendererTile.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/dash/ResultRendererTile.cpp b/dash/ResultRendererTile.cpp
index ff93f06e6..884bc6ac2 100644
--- a/dash/ResultRendererTile.cpp
+++ b/dash/ResultRendererTile.cpp
@@ -420,11 +420,13 @@ std::string ReplaceBlacklistedChars(std::string const& str)
gchar const* uni_s = str.c_str();
gunichar uni_c;
+ gchar utf8_buff[6];
- for (int i = 0; i < g_utf8_strlen(uni_s, -1); ++i)
+ int size = g_utf8_strlen(uni_s, -1);
+ for (int i = 0; i < size; ++i)
{
- gchar* s = g_utf8_substring(uni_s, i, i+1);
- uni_c = g_utf8_get_char(s);
+ uni_s = g_utf8_next_char(uni_s);
+ uni_c = g_utf8_get_char(uni_s);
if (IsBlacklistedChar(uni_c))
{
@@ -432,10 +434,11 @@ std::string ReplaceBlacklistedChars(std::string const& str)
}
else
{
- new_string += s;
- }
+ int end = g_unichar_to_utf8(uni_c, utf8_buff);
+ utf8_buff[end] = '\0';
- g_free(s);
+ new_string += utf8_buff;
+ }
}
return new_string;