X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/420ec58abbf042de49ccde2253abd96dbc85c8ff..1f1dee6b0dd1fe468011a64ec1af6eba720902fb:/src/html/htmlfilter.cpp diff --git a/src/html/htmlfilter.cpp b/src/html/htmlfilter.cpp index ba3f0a84e4..87a104c37d 100644 --- a/src/html/htmlfilter.cpp +++ b/src/html/htmlfilter.cpp @@ -8,24 +8,22 @@ #ifdef __GNUG__ -#pragma implementation +#pragma implementation "htmlfilter.h" #endif -#include +#include "wx/wxprec.h" -#include "wx/defs.h" -#if wxUSE_HTML - -#ifdef __BORDLANDC__ -#pragma hdrstop +#ifdef __BORLANDC__ + #pragma hdrstop #endif +#if wxUSE_HTML + #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(wxT("<"), wxT("<"), TRUE); + doc.Replace(wxT(">"), wxT(">"), TRUE); + doc2 = wxT("
\n") + doc + wxT("\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(wxT("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; }