From 4248e14b7318d0f59590757dac11d82a26e204ab Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 29 May 2015 21:39:26 +0300 Subject: [PATCH] Added option to disable ZLFile::ourPlainStreamCache --- .../zlibrary/core/src/filesystem/ZLFile.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fbreader/fbreader/zlibrary/core/src/filesystem/ZLFile.cpp b/fbreader/fbreader/zlibrary/core/src/filesystem/ZLFile.cpp index b8b4bee..5bef70e 100644 --- a/fbreader/fbreader/zlibrary/core/src/filesystem/ZLFile.cpp +++ b/fbreader/fbreader/zlibrary/core/src/filesystem/ZLFile.cpp @@ -32,7 +32,13 @@ const ZLFile ZLFile::NO_FILE; +#ifndef FBREADER_DISABLE_ZLFILE_PLAIN_STREAM_CACHE +# define FBREADER_DISABLE_ZLFILE_PLAIN_STREAM_CACHE 0 +#endif + +#if !FBREADER_DISABLE_ZLFILE_PLAIN_STREAM_CACHE std::map > ZLFile::ourPlainStreamCache; +#endif ZLFile::ZLFile() : myMimeTypeIsUpToDate(true), myInfoIsFilled(true) { } @@ -102,16 +108,20 @@ shared_ptr ZLFile::inputStream() const { int index = ZLFSManager::Instance().findArchiveFileNameDelimiter(myPath); if (index == -1) { - stream = ourPlainStreamCache[myPath]; +#if !FBREADER_DISABLE_ZLFILE_PLAIN_STREAM_CACHE + stream = ourPlainStreamCache[myPath]; if (stream.isNull()) { +#endif if (isDirectory()) { return 0; } stream = ZLFSManager::Instance().createPlainInputStream(myPath); stream = envelopeCompressedStream(stream); - ourPlainStreamCache[myPath] = stream; +#if !FBREADER_DISABLE_ZLFILE_PLAIN_STREAM_CACHE + ourPlainStreamCache[myPath] = stream; } - } else { +#endif + } else { ZLFile baseFile(myPath.substr(0, index)); shared_ptr base = baseFile.inputStream(); if (!base.isNull()) {