From f3075002c19ccd74d566ecf3a063f46c5d35eca9 Mon Sep 17 00:00:00 2001 From: cottongin Date: Wed, 28 Jan 2026 10:22:01 -0500 Subject: [PATCH] style: reduce variable scope in EpubReaderActivity Move cachedRenderer, cachedMappedInput, and cachedSection declarations into the DICTIONARY action block where they're actually used, addressing cppcheck variableScope warnings. --- src/activities/reader/EpubReaderActivity.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/activities/reader/EpubReaderActivity.cpp b/src/activities/reader/EpubReaderActivity.cpp index 426a836..6cc7a89 100644 --- a/src/activities/reader/EpubReaderActivity.cpp +++ b/src/activities/reader/EpubReaderActivity.cpp @@ -386,15 +386,15 @@ void EpubReaderActivity::loop() { [this](QuickMenuAction action) { // Cache values before exitActivity EpubReaderActivity* self = this; - GfxRenderer& cachedRenderer = renderer; - MappedInputManager& cachedMappedInput = mappedInput; - const Section* cachedSection = section.get(); SemaphoreHandle_t cachedMutex = renderingMutex; exitActivity(); if (action == QuickMenuAction::DICTIONARY) { - // Open dictionary menu + // Open dictionary menu - cache renderer/input for this scope + GfxRenderer& cachedRenderer = self->renderer; + MappedInputManager& cachedMappedInput = self->mappedInput; + const Section* cachedSection = self->section.get(); self->enterNewActivity(new DictionaryMenuActivity( cachedRenderer, cachedMappedInput, [self](DictionaryMode mode) {