X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/981e62aa85597e36b40d89274bcf1203e5ae5f67..f0b22b4a039b5797b94ecde35e2b67f6716c9e84:/src/html/htmlfilt.cpp diff --git a/src/html/htmlfilt.cpp b/src/html/htmlfilt.cpp index 199b91c6c4..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; @@ -130,7 +130,7 @@ bool wxHtmlFilterHTML::CanRead(const wxFSFile& file) const // This is true in most case but some page can return: // "text/html; char-encoding=...." // So we use Find instead - return (file.GetMimeType().Find(_("text/html")) == 0); + return (file.GetMimeType().Find(wxT("text/html")) == 0); } @@ -141,10 +141,14 @@ 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; @@ -156,7 +160,7 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const return s; } - else return doc; + return doc; }