From 593f30967059da6a06bb7a900837748a61d1c1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 8 Jan 2003 19:44:53 +0000 Subject: [PATCH] fixed ANSI/Unicode incompatibility of the cache (bug 663396) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18645 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/helpdata.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 1864c907e5..82c9ec07d0 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -337,7 +337,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 +361,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 +401,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++)