#pragma implementation
#endif
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
#include "wx/defs.h"
-#if wxUSE_HTML
+#if wxUSE_HTML && wxUSE_STREAMS
#ifdef __BORDLANDC__
#pragma hdrstop
#endif
#ifndef WXPRECOMP
-#include <wx/wx.h>
+#include "wx/wx.h"
#endif
#include "wx/tokenzr.h"
-#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;
i = begin_pos;
while (i < end_pos) {
- c = m_Source[i];
+ c = m_Source[(unsigned int) i];
// continue building word:
if (c != '<') {
temp[templen++] = c;
- if (templen == wxHTML_BUFLEN-1) {
- temp[templen] = 0;
- AddText(temp);
- templen = 0;
- }
i++;
}
temp[templen] = 0;
AddText(temp);
}
+ delete[] temp;
}
{
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);
}