X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4dcaf11a7b5189be78e52e1412febd7689a959f8..e333075415c35d2e869ea585fa41f01a2c938897:/src/html/htmlfilter.cpp diff --git a/src/html/htmlfilter.cpp b/src/html/htmlfilter.cpp index 1bdccd5b17..57508b1069 100644 --- a/src/html/htmlfilter.cpp +++ b/src/html/htmlfilter.cpp @@ -20,7 +20,6 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif #include "wx/html/htmlfilter.h" @@ -42,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; } @@ -62,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; } @@ -124,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); } @@ -136,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; }