fix(cppcheck): clang format

This commit is contained in:
Brackyt 2026-01-26 00:27:58 +01:00
parent 092fcafd19
commit fce43feea1
2 changed files with 16 additions and 18 deletions

View File

@ -232,8 +232,6 @@ bool HomeActivity::storeCoverBuffer() {
return true; return true;
} }
void HomeActivity::freeCoverBuffer() { void HomeActivity::freeCoverBuffer() {
if (coverBuffer) { if (coverBuffer) {
free(coverBuffer); free(coverBuffer);
@ -372,10 +370,10 @@ void HomeActivity::render() {
if (f.read(data, 4) == 4) { if (f.read(data, 4) == 4) {
int spineIndex = data[0] + (data[1] << 8); int spineIndex = data[0] + (data[1] << 8);
int spineCount = epub.getSpineItemsCount(); int spineCount = epub.getSpineItemsCount();
currentPageStr = std::to_string(spineIndex + 1); // Display 1-based currentPageStr = std::to_string(spineIndex + 1); // Display 1-based
totalPagesStr = std::to_string(spineCount); totalPagesStr = std::to_string(spineCount);
if (spineCount > 0) { if (spineCount > 0) {
progressPercent = (spineIndex * 100) / spineCount; progressPercent = (spineIndex * 100) / spineCount;
} }
@ -383,8 +381,8 @@ void HomeActivity::render() {
// Resolve Chapter Title // Resolve Chapter Title
auto spineEntry = epub.getSpineItem(spineIndex); auto spineEntry = epub.getSpineItem(spineIndex);
if (spineEntry.tocIndex != -1) { if (spineEntry.tocIndex != -1) {
auto tocEntry = epub.getTocItem(spineEntry.tocIndex); auto tocEntry = epub.getTocItem(spineEntry.tocIndex);
chapterTitle = tocEntry.title; chapterTitle = tocEntry.title;
} }
} }
f.close(); f.close();
@ -393,22 +391,22 @@ void HomeActivity::render() {
StringUtils::checkFileExtension(APP_STATE.openEpubPath, ".xtch")) { StringUtils::checkFileExtension(APP_STATE.openEpubPath, ".xtch")) {
Xtc xtc(APP_STATE.openEpubPath, "/.crosspoint"); Xtc xtc(APP_STATE.openEpubPath, "/.crosspoint");
if (xtc.load()) { if (xtc.load()) {
// Read progress // Read progress
FsFile f; FsFile f;
if (SdMan.openFileForRead("HOME", xtc.getCachePath() + "/progress.bin", f)) { if (SdMan.openFileForRead("HOME", xtc.getCachePath() + "/progress.bin", f)) {
uint8_t data[4]; uint8_t data[4];
if (f.read(data, 4) == 4) { if (f.read(data, 4) == 4) {
uint32_t currentPage = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); uint32_t currentPage = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
uint32_t totalPages = xtc.getPageCount(); uint32_t totalPages = xtc.getPageCount();
currentPageStr = std::to_string(currentPage + 1); // 1-based currentPageStr = std::to_string(currentPage + 1); // 1-based
totalPagesStr = std::to_string(totalPages); totalPagesStr = std::to_string(totalPages);
if (totalPages > 0) { if (totalPages > 0) {
progressPercent = (currentPage * 100) / totalPages; progressPercent = (currentPage * 100) / totalPages;
} }
chapterTitle = "Page " + currentPageStr; chapterTitle = "Page " + currentPageStr;
} }
f.close(); f.close();
} }

View File

@ -46,7 +46,7 @@ class HomeActivity final : public Activity {
[[noreturn]] void displayTaskLoop(); [[noreturn]] void displayTaskLoop();
void render(); void render();
int getMenuItemCount() const; int getMenuItemCount() const;
bool storeCoverBuffer(); // Store frame buffer for cover image bool storeCoverBuffer(); // Store frame buffer for cover image
void freeCoverBuffer(); // Free the stored cover buffer void freeCoverBuffer(); // Free the stored cover buffer
void loadRecentBooksData(); // Load and cache recent books data void loadRecentBooksData(); // Load and cache recent books data