X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/420ec58abbf042de49ccde2253abd96dbc85c8ff..3bdb628b5c73e17a705ae42737c58b8d1897f535:/src/html/htmlfilter.cpp diff --git a/src/html/htmlfilter.cpp b/src/html/htmlfilter.cpp index ba3f0a84e4..57508b1069 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,10 @@ #endif #ifndef WXPRECOMP -#include #endif -#include -#include +#include "wx/html/htmlfilter.h" +#include "wx/html/htmlwin.h" /* @@ -43,7 +41,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxHtmlFilter, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterPlainText, wxHtmlFilter) -bool wxHtmlFilterPlainText::CanRead(const wxFSFile& file) const +bool wxHtmlFilterPlainText::CanRead(const wxFSFile& WXUNUSED(file)) const { return TRUE; } @@ -63,9 +61,9 @@ wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file) const doc = src; delete [] src; - doc.Replace("<", "<", TRUE); - doc.Replace(">", ">", TRUE); - doc2 = "
\n" + doc + "\n
"; + doc.Replace(_T("<"), _T("<"), TRUE); + doc.Replace(_T(">"), _T(">"), TRUE); + doc2 = _T("
\n") + doc + _T("\n
"); return doc2; } @@ -125,7 +123,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 +139,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; }