summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2008-04-13 10:52:16 +0000
committerMurray Cumming <murrayc@src.gnome.org>2008-04-13 10:52:16 +0000
commit9c843c1489fb31d50558f2528f9385399ff1a092 (patch)
treed4b5c8c2584b59effbae8f7a7ca1004607478510
parent144f74921e5f5c83d75b6481cfeb12d0e7eac16c (diff)
downloadglibmm-9c843c1489fb31d50558f2528f9385399ff1a092.tar.gz
Create an end iterator and use it, instead of just using the
2008-04-13 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/ustring.cc erase(): Create an end iterator and use it, instead of just using the std::string(iterator) erase implementation, because that only removes one byte, which can make the whole string invalid UTF-8. Bug #527687 (Jarro). svn path=/trunk/; revision=652
-rw-r--r--ChangeLog8
-rw-r--r--glib/glibmm/ustring.cc5
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e853e40..b4670cdd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-04-13 Murray Cumming <murrayc@murrayc.com>
+
+ * glib/glibmm/ustring.cc erase(): Create an end iterator and use it,
+ instead of just using the std::string(iterator) erase implementation,
+ because that only removes one byte, which can make the whole string
+ invalid UTF-8.
+ Bug #527687 (Jarro).
+
2008-04-11 Murray Cumming <murrayc@murrayc.com>
* glib/src/optionentry.ccg:
diff --git a/glib/glibmm/ustring.cc b/glib/glibmm/ustring.cc
index e936e4b4..2fa0f8c9 100644
--- a/glib/glibmm/ustring.cc
+++ b/glib/glibmm/ustring.cc
@@ -683,7 +683,10 @@ ustring& ustring::erase()
ustring::iterator ustring::erase(ustring::iterator p)
{
- return iterator(string_.erase(p.base()));
+ ustring::iterator iter_end = p;
+ ++iter_end;
+
+ return iterator(string_.erase(p.base(), iter_end.base()));
}
ustring::iterator ustring::erase(ustring::iterator pbegin, ustring::iterator pend)