X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b19d5e569e72a4c91708bba85c0b2268b28fe935..4a64bee465c0dbf3d97fbf290cb2fef4ad41ca34:/src/html/helpdata.cpp diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index befee0b860..cb5eb0e862 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -93,7 +93,7 @@ class HP_TagHandler : public wxHtmlTagHandler wxHtmlBookRecord *m_Book; public: - HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler() {m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString; m_Level = 0; } + HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler() {m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString; m_Level = 0; m_ID = -1; } wxString GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); } bool HandleTag(const wxHtmlTag& tag); void WriteOut(wxHtmlContentsItem*& array, int& size); @@ -222,7 +222,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c HP_TagHandler *handler = new HP_TagHandler(book); parser.AddTagHandler(handler); - f = ( contentsfile.IsEmpty() ? NULL : fsys.OpenFile(contentsfile) ); + f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) ); if (f) { sz = f -> GetStream() -> GetSize(); buf = new char[sz + 1]; @@ -237,7 +237,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c else wxLogError(_("Cannot open contents file: %s"), contentsfile.mb_str()); - f = ( indexfile.IsEmpty() ? NULL : fsys.OpenFile(indexfile) ); + f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) ); if (f) { sz = f -> GetStream() -> GetSize(); buf = new char[sz + 1]; @@ -394,6 +394,17 @@ void wxHtmlHelpData::SetTempDir(const wxString& path) } + +static wxString SafeFileName(const wxString& s) +{ + wxString res(s); + res.Replace(wxT("#"), wxT("_")); + res.Replace(wxT(":"), wxT("_")); + res.Replace(wxT("\\"), wxT("_")); + res.Replace(wxT("/"), wxT("_")); + return res; +} + bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, wxFontEncoding encoding, const wxString& title, const wxString& contfile, @@ -446,7 +457,7 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, if (m_TempPath != wxEmptyString) { wxFileOutputStream *outs = new wxFileOutputStream(m_TempPath + - wxFileNameFromPath(bookfile.GetLocation()) + wxT(".cached")); + SafeFileName(wxFileNameFromPath(bookfile.GetLocation())) + wxT(".cached")); SaveCachedBook(bookr, outs); delete outs; }