X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..f124ddf4502341eb60d41d27da7f24f4ae9fd25c:/src/html/helpdata.cpp diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 51d0f334d3..b08700cbaa 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -114,6 +114,8 @@ class HP_TagHandler : public wxHtmlTagHandler bool HandleTag(const wxHtmlTag& tag); void WriteOut(wxHtmlContentsItem*& array, int& size); void ReadIn(wxHtmlContentsItem* array, int size); + + DECLARE_NO_COPY_CLASS(HP_TagHandler) }; @@ -337,7 +339,12 @@ inline static wxChar* CacheReadString(wxInputStream *f) #endif } -#define CURRENT_CACHED_BOOK_VERSION 3 +#define CURRENT_CACHED_BOOK_VERSION 4 + +// Additional flags to detect incompatibilities of the runtime environment: +#define CACHED_BOOK_FORMAT_FLAGS \ + (wxUSE_UNICODE << 0) + bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f) { @@ -356,6 +363,9 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f) return FALSE; } + if (CacheReadInt32(f) != CACHED_BOOK_FORMAT_FLAGS) + return FALSE; + /* load contents : */ st = m_ContentsCnt; m_ContentsCnt += CacheReadInt32(f); @@ -393,6 +403,7 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f) /* save header - version info : */ CacheWriteInt32(f, CURRENT_CACHED_BOOK_VERSION); + CacheWriteInt32(f, CACHED_BOOK_FORMAT_FLAGS); /* save contents : */ for (cnt = 0, i = 0; i < m_ContentsCnt; i++) @@ -498,13 +509,17 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, fi = fsys.OpenFile(bookfile.GetLocation() + wxT(".cached")); if (fi == NULL || +#if wxUSE_DATETIME fi->GetModificationTime() < bookfile.GetModificationTime() || +#endif // wxUSE_DATETIME !LoadCachedBook(bookr, fi->GetStream())) { if (fi != NULL) delete fi; fi = fsys.OpenFile(m_TempPath + wxFileNameFromPath(bookfile.GetLocation()) + wxT(".cached")); if (m_TempPath == wxEmptyString || fi == NULL || +#if wxUSE_DATETIME fi->GetModificationTime() < bookfile.GetModificationTime() || +#endif // wxUSE_DATETIME !LoadCachedBook(bookr, fi->GetStream())) { LoadMSProject(bookr, fsys, indexfile, contfile); @@ -570,7 +585,6 @@ bool wxHtmlHelpData::AddBook(const wxString& book) { wxFSFile *fi; wxFileSystem fsys; - wxString bookFull; wxString title = _("noname"), safetitle, @@ -579,23 +593,13 @@ bool wxHtmlHelpData::AddBook(const wxString& book) index = wxEmptyString, charset = wxEmptyString; -#if defined(__WXMAC__) && !defined(__DARWIN__) - if (wxIsAbsolutePath(book)) bookFull = book; - else bookFull = wxGetCwd() + book; // no slash or dot - wxFileName fn( bookFull ); - bookFull = fn.GetFullPath( wxPATH_UNIX ); -#else - if (wxIsAbsolutePath(book)) bookFull = book; - else bookFull = wxGetCwd() + wxT("/") + book; -#endif - - fi = fsys.OpenFile(bookFull); + fi = fsys.OpenFile(book); if (fi == NULL) { - wxLogError(_("Cannot open HTML help book: %s"), bookFull.c_str()); + wxLogError(_("Cannot open HTML help book: %s"), book.c_str()); return FALSE; } - fsys.ChangePathTo(bookFull); + fsys.ChangePathTo(book); const wxChar *lineptr; wxChar linebuf[300];