Refactor to a more generic unobstrusive approach

This commit is contained in:
jpirnay
2026-03-27 17:06:30 +01:00
parent 3f8a87e907
commit a51fd3953d
3 changed files with 8 additions and 6 deletions
+4 -6
View File
@@ -7,13 +7,11 @@
#include <PngToBmpConverter.h>
#include <ZipFile.h>
#include "CrossPointSettings.h"
#include "Epub/parsers/ContainerParser.h"
#include "Epub/parsers/ContentOpfParser.h"
#include "Epub/parsers/TocNavParser.h"
#include "Epub/parsers/TocNcxParser.h"
bool Epub::findContentOpfFile(std::string* contentOpfFile) const {
const auto containerPath = "META-INF/container.xml";
size_t containerSize;
@@ -770,7 +768,7 @@ BookMetadataCache::TocEntry Epub::getTocItem(const int tocIndex) const {
return {};
}
if (SETTINGS.syntheticTocFallback && !hasReliableToc()) {
if (syntheticTocFallbackEnabled && !hasReliableToc()) {
const int spineCount = bookMetadataCache->getSpineCount();
if (tocIndex < 0 || tocIndex >= spineCount) {
LOG_DBG("EBP", "getTocItem synthetic index:%d is out of range", tocIndex);
@@ -795,7 +793,7 @@ int Epub::getTocItemsCount() const {
return 0;
}
if (SETTINGS.syntheticTocFallback && !hasReliableToc()) {
if (syntheticTocFallbackEnabled && !hasReliableToc()) {
return bookMetadataCache->getSpineCount();
}
@@ -809,7 +807,7 @@ int Epub::getSpineIndexForTocIndex(const int tocIndex) const {
return 0;
}
if (SETTINGS.syntheticTocFallback && !hasReliableToc()) {
if (syntheticTocFallbackEnabled && !hasReliableToc()) {
if (tocIndex < 0 || tocIndex >= bookMetadataCache->getSpineCount()) {
LOG_ERR("EBP", "getSpineIndexForTocIndex synthetic tocIndex %d out of range", tocIndex);
return 0;
@@ -885,7 +883,7 @@ int Epub::getTocIndexForSpineIndex(const int spineIndex) const {
return 0;
}
if (SETTINGS.syntheticTocFallback && !hasReliableToc()) {
if (syntheticTocFallbackEnabled && !hasReliableToc()) {
return spineIndex;
}