Review implied changes
This commit is contained in:
@@ -520,6 +520,7 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
||||
// Create page for image - only break if image won't fit remaining space
|
||||
if (self->currentPage && !self->currentPage->elements.empty() &&
|
||||
(self->currentPageNextY + displayHeight > self->viewportHeight)) {
|
||||
self->paragraphIndexPerPage.push_back(self->xpathParagraphIndex);
|
||||
self->completePageFn(std::move(self->currentPage));
|
||||
self->completedPageCount++;
|
||||
self->currentPage.reset(new Page());
|
||||
|
||||
@@ -99,6 +99,13 @@ std::string makeSpineCacheKey(const std::shared_ptr<Epub>& epub, const int spine
|
||||
|
||||
size_t getTotalTextBytesCached(const std::shared_ptr<Epub>& epub, const int spineIndex, const std::string& tmpPath) {
|
||||
static std::unordered_map<std::string, size_t> sTotalBytesBySpine;
|
||||
static std::string sCachedBookPath;
|
||||
|
||||
const std::string currentBookPath = epub ? epub->getCachePath() : std::string();
|
||||
if (currentBookPath != sCachedBookPath) {
|
||||
sTotalBytesBySpine.clear();
|
||||
sCachedBookPath = currentBookPath;
|
||||
}
|
||||
|
||||
const std::string key = makeSpineCacheKey(epub, spineIndex);
|
||||
if (!key.empty()) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <HalStorage.h>
|
||||
#include <Logging.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@@ -10,9 +11,8 @@
|
||||
namespace ChapterXPathIndexerInternal {
|
||||
|
||||
std::string toLowerStr(std::string value) {
|
||||
for (char& c : value) {
|
||||
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
|
||||
}
|
||||
std::transform(value.begin(), value.end(), value.begin(),
|
||||
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ std::string decompressToTempFile(const std::shared_ptr<Epub>& epub, const int sp
|
||||
return "";
|
||||
}
|
||||
|
||||
const std::string tmpPath = epub->getCachePath() + "/.tmp_kox.html";
|
||||
const std::string tmpPath = epub->getCachePath() + "/.tmp_kox_" + std::to_string(spineIndex) + ".html";
|
||||
if (Storage.exists(tmpPath.c_str())) {
|
||||
Storage.remove(tmpPath.c_str());
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace ChapterXPathIndexerInternal {
|
||||
struct StackNode {
|
||||
std::string tag;
|
||||
int index = 1;
|
||||
// Reserved for future text-node heuristics; intentionally unused for now.
|
||||
bool hasText = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user