Address cppcheck complaints

This commit is contained in:
jpirnay
2026-05-23 20:44:34 +02:00
parent 7f61b99be2
commit d568563372
+9 -9
View File
@@ -2662,6 +2662,11 @@ bool EpubReaderActivity::drawCurrentPageToBuffer(const std::string& filePath, Gf
void EpubReaderActivity::openReaderMenu() { void EpubReaderActivity::openReaderMenu() {
const int currentPage = section ? section->currentPage + 1 : 0; const int currentPage = section ? section->currentPage + 1 : 0;
const int totalPages = section ? section->pageCount : 0; const int totalPages = section ? section->pageCount : 0;
if (!epub) {
return;
}
float bookProgress = 0.0f; float bookProgress = 0.0f;
if (epub->getBookSize() > 0 && section && section->pageCount > 0) { if (epub->getBookSize() > 0 && section && section->pageCount > 0) {
const float chapterProgress = static_cast<float>(section->currentPage) / static_cast<float>(section->pageCount); const float chapterProgress = static_cast<float>(section->currentPage) / static_cast<float>(section->pageCount);
@@ -2674,15 +2679,10 @@ void EpubReaderActivity::openReaderMenu() {
// Show the "Go to printed page" item only when this book has at least one integer-labelled // Show the "Go to printed page" item only when this book has at least one integer-labelled
// entry in pagelist.bin. Roman-only or empty page lists are excluded — the numeric input // entry in pagelist.bin. Roman-only or empty page lists are excluded — the numeric input
// dialog can't address them anyway. // dialog can't address them anyway.
bool hasPrintedPages = false; const auto printedPageList = epub->loadPrintedPageList();
if (epub) { const bool hasPrintedPages = std::any_of(printedPageList.begin(), printedPageList.end(), [](const auto& entry) {
for (const auto& entry : epub->loadPrintedPageList()) { return parsePrintedPageLabel(entry.label).has_value();
if (parsePrintedPageLabel(entry.label).has_value()) { });
hasPrintedPages = true;
break;
}
}
}
ReaderUtils::enforceExitFullRefresh(renderer); ReaderUtils::enforceExitFullRefresh(renderer);
startActivityForResult( startActivityForResult(