]> git.saurik.com Git - wxWidgets.git/commitdiff
use iterator in wxTextBuffer::Translate() instead of c_str()
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 31 Dec 2007 08:58:05 +0000 (08:58 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 31 Dec 2007 08:58:05 +0000 (08:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50958 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/textbuf.cpp

index 17e00fac4194717050a0eb14e802d38714b28d07..b6e8362c852c0a3161daf1bd8eecf8de41c38c0c 100644 (file)
@@ -80,14 +80,14 @@ wxString wxTextBuffer::Translate(const wxString& text, wxTextFileType type)
     wxString eol = GetEOL(type), result;
 
     // optimization: we know that the length of the new string will be about
-    // the same as the length of the old one, so prealloc memory to aviod
+    // the same as the length of the old one, so prealloc memory to avoid
     // unnecessary relocations
     result.Alloc(text.Len());
 
     wxChar chLast = 0;
-    for ( const wxChar *pc = text.c_str(); *pc; pc++ )
+    for ( wxString::const_iterator i = text.begin(); i != text.end(); ++i )
     {
-        wxChar ch = *pc;
+        wxChar ch = *i;
         switch ( ch ) {
             case _T('\n'):
                 // Dos/Unix line termination