X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0413cec5271566470f4c852608a35800b49056cd..dd107c50be43e8d4dbdba20df162faf119a3781c:/src/html/htmlfilt.cpp diff --git a/src/html/htmlfilt.cpp b/src/html/htmlfilt.cpp index 350037cea1..6f30086b60 100644 --- a/src/html/htmlfilt.cpp +++ b/src/html/htmlfilt.cpp @@ -15,7 +15,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop @@ -58,9 +58,9 @@ wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file) const wxString doc, doc2; if (s == NULL) return wxEmptyString; - src = new char[s -> GetSize()+1]; - src[s -> GetSize()] = 0; - s -> Read(src, s -> GetSize()); + src = new char[s->GetSize()+1]; + src[s->GetSize()] = 0; + s->Read(src, s->GetSize()); doc = src; delete [] src; @@ -141,13 +141,25 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const char *src; wxString doc; - if (s == NULL) return wxEmptyString; - src = new char[s -> GetSize() + 1]; - src[s -> GetSize()] = 0; - s -> Read(src, s -> GetSize()); + if (s == NULL) + { + wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().c_str()); + return wxEmptyString; + } + src = new char[s->GetSize() + 1]; + src[s->GetSize()] = 0; + s->Read(src, s->GetSize()); doc = src; delete[] src; + // add meta tag if we obtained this through http: + if (file.GetMimeType().Find(_T("; charset=")) == 0) + { + wxString s(_T(""); + return s; + } + return doc; }