glibmm r652 - in trunk: . glib/glibmm



Author: murrayc
Date: Sun Apr 13 11:52:16 2008
New Revision: 652
URL: http://svn.gnome.org/viewvc/glibmm?rev=652&view=rev

Log:
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).

Modified:
   trunk/ChangeLog
   trunk/glib/glibmm/ustring.cc

Modified: trunk/glib/glibmm/ustring.cc
==============================================================================
--- trunk/glib/glibmm/ustring.cc	(original)
+++ trunk/glib/glibmm/ustring.cc	Sun Apr 13 11:52:16 2008
@@ -683,7 +683,10 @@
 
 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)



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