From 25207d57cb5dc5d0b76c8a246edbcf504e697dd8 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Sat, 4 Apr 2026 09:43:15 +0200 Subject: [PATCH] Address cppcheck complaints --- src/activities/home/FileBrowserActivity.cpp | 2 +- src/activities/reader/EpubReaderActivity.cpp | 9 --------- src/activities/weather/WeatherActivity.cpp | 3 --- src/components/themes/BaseTheme.cpp | 2 +- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/activities/home/FileBrowserActivity.cpp b/src/activities/home/FileBrowserActivity.cpp index 06f46ed0..46a1b294 100644 --- a/src/activities/home/FileBrowserActivity.cpp +++ b/src/activities/home/FileBrowserActivity.cpp @@ -256,7 +256,7 @@ void FileBrowserActivity::loop() { std::string getFileName(std::string filename) { if (filename.back() == '/') { - filename = filename.substr(0, filename.length() - 1); + filename.pop_back(); if (!UITheme::getInstance().getTheme().showsFileIcons()) { return "[" + filename + "]"; } diff --git a/src/activities/reader/EpubReaderActivity.cpp b/src/activities/reader/EpubReaderActivity.cpp index 41e58456..df1b30c6 100644 --- a/src/activities/reader/EpubReaderActivity.cpp +++ b/src/activities/reader/EpubReaderActivity.cpp @@ -466,15 +466,6 @@ void EpubReaderActivity::onReaderMenuConfirm(EpubReaderMenuActivity::MenuAction if (KOREADER_STORE.hasCredentials()) { const int currentPage = section ? section->currentPage : 0; const int totalPages = section ? section->pageCount : 0; - // Look up paragraph index from section cache for accurate XPath generation on upload - uint16_t paragraphIdx = 0; - bool hasParagraphIdx = false; - if (section) { - if (const auto pIdx = section->getParagraphIndexForPage(currentPage)) { - paragraphIdx = *pIdx; - hasParagraphIdx = true; - } - } startActivityForResult(std::make_unique(renderer, mappedInput, epub, epub->getPath(), currentSpineIndex, currentPage, totalPages), [this](const ActivityResult& result) { handleSyncResult(result); }); diff --git a/src/activities/weather/WeatherActivity.cpp b/src/activities/weather/WeatherActivity.cpp index f9009cd5..dc382a83 100644 --- a/src/activities/weather/WeatherActivity.cpp +++ b/src/activities/weather/WeatherActivity.cpp @@ -41,7 +41,6 @@ void drawWeatherIconWithOrientation(const GfxRenderer& renderer, const uint8_t* } } - StrId getWeatherDescriptionStrId(const int wmoCode) { switch (wmoCode) { case 0: @@ -597,8 +596,6 @@ void WeatherActivity::renderDailyForecast(int x, int y, int w, int h) { const int extraPx = w % numDays; int cardX = x; - int debugMoonX = x + w - 18; - int debugMoonYBase = y + 10; for (int i = 0; i < numDays; i++) { const auto& day = weatherData.daily[i]; diff --git a/src/components/themes/BaseTheme.cpp b/src/components/themes/BaseTheme.cpp index d9332df6..be91e65e 100644 --- a/src/components/themes/BaseTheme.cpp +++ b/src/components/themes/BaseTheme.cpp @@ -276,7 +276,7 @@ void BaseTheme::drawList(const GfxRenderer& renderer, Rect rect, int itemCount, std::string subtitleText = rowSubtitle(i); const auto nl = subtitleText.find('\n'); if (nl != std::string::npos) { - subtitleText = subtitleText.substr(0, nl) + " \u2022 " + subtitleText.substr(nl + 1); + subtitleText.replace(nl, 1, " \u2022 "); } auto subtitle = renderer.truncatedText(UI_10_FONT_ID, subtitleText.c_str(), textWidth); renderer.drawText(UI_10_FONT_ID, rect.x + BaseMetrics::values.contentSidePadding, itemY + 30, subtitle.c_str(),