use wxString argument and not wxChar* in wxHtmlParser::AddText(), for compatibility with STL build without implicit wxString conversions

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-06-11 12:11:15 +00:00
parent 01c0981e75
commit 5bce3e6feb
7 changed files with 34 additions and 23 deletions

View File

@@ -342,15 +342,13 @@ wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type,
return GetFS()->OpenFile(myurl, flags);
}
void wxHtmlWinParser::AddText(const wxChar* txt)
void wxHtmlWinParser::AddText(const wxString& txt)
{
size_t i = 0,
x,
lng = wxStrlen(txt);
register wxChar d;
int templen = 0;
wxChar nbsp = GetEntitiesParser()->GetCharForCode(160 /* nbsp */);
size_t lng = txt.length();
if (lng+1 > m_tmpStrBufSize)
{
delete[] m_tmpStrBuf;
@@ -359,24 +357,36 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
}
wxChar *temp = m_tmpStrBuf;
wxString::const_iterator i = txt.begin();
wxString::const_iterator end = txt.end();
if (m_tmpLastWasSpace)
{
while ((i < lng) &&
((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) || (txt[i] == wxT(' ')) ||
(txt[i] == wxT('\t')))) i++;
while ( (i < end) &&
(*i == wxT('\n') || *i == wxT('\r') || *i == wxT(' ') ||
*i == wxT('\t')) )
{
++i;
}
}
while (i < lng)
while (i < end)
{
x = 0;
d = temp[templen++] = txt[i];
size_t x = 0;
d = temp[templen++] = *i;
if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
{
i++, x++;
while ((i < lng) && ((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) ||
(txt[i] == wxT(' ')) || (txt[i] == wxT('\t')))) i++, x++;
++i, ++x;
while ( (i < end) &&
(*i == wxT('\n') || *i == wxT('\r') ||
*i == wxT(' ')) || *i == wxT('\t') )
{
++i;
++x;
}
}
else i++;
else
++i;
if (x)
{