Review comments

This commit is contained in:
jpirnay
2026-05-23 20:21:11 +02:00
parent 0dc3fc623c
commit 7f61b99be2
8 changed files with 26 additions and 11 deletions
+2 -1
View File
@@ -25,10 +25,11 @@ namespace {
// <nav epub:type="page-list"> share the same writer.
template <typename Entry>
void writePageListBin(const std::string& cachePath, const std::vector<Entry>& pageList) {
const auto pageListPath = cachePath + "/pagelist.bin";
if (pageList.empty()) {
Storage.remove(pageListPath.c_str());
return;
}
const auto pageListPath = cachePath + "/pagelist.bin";
FsFile pageListFile;
if (!Storage.openFileForWrite("EBP", pageListPath, pageListFile)) {
LOG_ERR("EBP", "Could not write pagelist.bin");
@@ -507,6 +507,7 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
self->recordPageBreakLabel(label);
if (!idAttr.empty()) {
self->anchorData.emplace_back(idAttr, static_cast<uint16_t>(self->completedPageCount));
self->pendingAnchorId = idAttr;
}
}
+7 -1
View File
@@ -68,7 +68,13 @@ void XMLCALL PageMapParser::startElement(void* userData, const XML_Char* name, c
// We only care about <page name="..." href="..."/> elements. The wrapping <page-map>
// root is ignored (no need for a state machine — every page element carries its data).
if (strcmp(name, "page") != 0) {
const char* localName = strrchr(name, ':');
if (localName) {
localName++;
} else {
localName = name;
}
if (strcmp(localName, "page") != 0) {
return;
}