X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5bce3e6feb143c3ef8d6002a90f743e2d7782532..5aac6f3f9563d5a56470982cc11c35c81f555671:/src/html/helpdata.cpp?ds=sidebyside diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 0e8bc843df..506fc99d8f 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -127,7 +127,7 @@ public: protected: virtual void AddText(const wxString& WXUNUSED(txt)) {} - DECLARE_NO_COPY_CLASS(HP_Parser) + wxDECLARE_NO_COPY_CLASS(HP_Parser); }; @@ -170,7 +170,7 @@ class HP_TagHandler : public wxHtmlTagHandler m_parentItem = NULL; } - DECLARE_NO_COPY_CLASS(HP_TagHandler) + wxDECLARE_NO_COPY_CLASS(HP_TagHandler); }; @@ -284,7 +284,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, HP_TagHandler *handler = new HP_TagHandler(book); parser.AddTagHandler(handler); - f = ( contentsfile.empty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) ); + f = ( contentsfile.empty() ? NULL : fsys.OpenFile(contentsfile) ); if (f) { buf.clear(); @@ -298,7 +298,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str()); } - f = ( indexfile.empty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) ); + f = ( indexfile.empty() ? NULL : fsys.OpenFile(indexfile) ); if (f) { buf.clear(); @@ -701,15 +701,29 @@ bool wxHtmlHelpData::AddBook(const wxString& book) wxString wxHtmlHelpData::FindPageByName(const wxString& x) { - int cnt; int i; - wxFileSystem fsys; - wxFSFile *f; - // 1. try to open given file: - cnt = m_bookRecords.GetCount(); - for (i = 0; i < cnt; i++) + bool has_non_ascii = false; + wxString::const_iterator it; + for (it = x.begin(); it != x.end(); ++it) + { + wxUniChar ch = *it; + if (!ch.IsAscii()) + { + has_non_ascii = true; + break; + } + } + + int cnt = m_bookRecords.GetCount(); + + if (!has_non_ascii) { + wxFileSystem fsys; + wxFSFile *f; + // 1. try to open given file: + for (i = 0; i < cnt; i++) + { f = fsys.OpenFile(m_bookRecords[i].GetFullPath(x)); if (f) { @@ -717,6 +731,7 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x) delete f; return url; } + } }