Review comments
This commit is contained in:
+2
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user