X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22f3361e1cf25c52a2da8fdfc5cb081809e18fb9..99e8cb505ad94704ec6596d20842ca8fa34e7d9e:/src/html/helpdata.cpp diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 8ebc82d3a5..b08700cbaa 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -339,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) { @@ -358,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); @@ -395,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++) @@ -500,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);