X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/420ec58abbf042de49ccde2253abd96dbc85c8ff..babd4308f2704f4234e271d29a8e8c1e211b4af6:/src/html/htmlfilter.cpp diff --git a/src/html/htmlfilter.cpp b/src/html/htmlfilter.cpp index ba3f0a84e4..37215c5170 100644 --- a/src/html/htmlfilter.cpp +++ b/src/html/htmlfilter.cpp @@ -8,12 +8,11 @@ #ifdef __GNUG__ -#pragma implementation +#pragma implementation "htmlfilter.h" #endif -#include +#include "wx/wxprec.h" -#include "wx/defs.h" #if wxUSE_HTML #ifdef __BORDLANDC__ @@ -21,11 +20,11 @@ #endif #ifndef WXPRECOMP -#include +#include "wx/wx.h" #endif -#include -#include +#include "wx/html/htmlfilter.h" +#include "wx/html/htmlwin.h" /* @@ -125,7 +124,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterHTML, wxHtmlFilter) bool wxHtmlFilterHTML::CanRead(const wxFSFile& file) const { - return (file.GetMimeType() == "text/html"); +// return (file.GetMimeType() == "text/html"); +// This is true in most case but some page can return: +// "text/html; char-encoding=...." +// So we use Find instead + return (file.GetMimeType().Find(_T("text/html")) == 0); } @@ -137,11 +140,11 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const wxString doc; if (s == NULL) return wxEmptyString; - src = (char*) malloc(s -> GetSize() + 1); + src = new char[s -> GetSize() + 1]; src[s -> GetSize()] = 0; s -> Read(src, s -> GetSize()); doc = src; - free(src); + delete[] src; return doc; }