use iterator in wxTextBuffer::Translate() instead of c_str()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50958 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2007-12-31 08:58:05 +00:00
parent b35388de3e
commit 769dd0cee1

View 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