X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/01dba85a7fc9a1103f866c7c3a5cc72f21c0784e..80a24267cbc17d85e278e1f10cdfdaea12199639:/src/html/htmlpars.cpp diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 5c07054f58..65066aeddc 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -15,7 +15,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop @@ -69,11 +69,13 @@ void wxHtmlParser::DoneParser() -#define wxHTML_MAX_BUFLEN 1024 void wxHtmlParser::DoParsing(int begin_pos, int end_pos) { - char temp[wxHTML_BUFLEN], c; + if (end_pos <= begin_pos) return; + + char c; + char *temp = new char[end_pos - begin_pos + 1]; int i; int templen; @@ -86,11 +88,6 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos) // continue building word: if (c != '<') { temp[templen++] = c; - if (templen == wxHTML_BUFLEN-1) { - temp[templen] = 0; - AddText(temp); - templen = 0; - } i++; } @@ -112,6 +109,7 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos) temp[templen] = 0; AddText(temp); } + delete[] temp; } @@ -173,7 +171,12 @@ void wxHtmlParser::PopTagHandler() { wxNode *first; - if (m_HandlersStack == NULL || (first = m_HandlersStack -> GetFirst()) == NULL) return; + if (m_HandlersStack == NULL || + (first = m_HandlersStack -> GetFirst()) == NULL) + { + wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack.")); + return; + } m_HandlersHash = *((wxHashTable*) first -> GetData()); m_HandlersStack -> DeleteNode(first); }