Skip to content

Commit

Permalink
Use iterator over wxString rather than GetChar, as GetChar is approxi…
Browse files Browse the repository at this point in the history
…mately

linear, making wx2ns quadratic.
  • Loading branch information
benpmorgan committed Nov 12, 2010
1 parent e1ad541 commit 62cc7a9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nsimpl.cpp 100644 → 100755
Expand Up @@ -438,9 +438,14 @@ wxString ns2wx(const PRUnichar* str)
void wx2ns(const wxString& wxstr, nsEmbedString& nsstr)
{
size_t i, len = wxstr.Length();
wxString::const_iterator p;
PRUnichar* buf = new PRUnichar[len+1];
for (i = 0; i < len; ++i)
buf[i] = wxstr.GetChar(i);
for (p=wxstr.begin(), i=0;
p<wxstr.end();
p++, i++)
{
buf[i] = *p;
}
nsstr.Assign(buf, len);
delete[] buf;
}
Expand Down Expand Up @@ -905,4 +910,4 @@ nsIWebProgressListener* CreateProgressListenerAdaptor(wxWebProgressBase* progres
p->AddRef();
return (nsIWebProgressListener*)p;
}
}
}

0 comments on commit 62cc7a9

Please sign in to comment.