From 155f0c77acad3167c632d45f2d2a63705644eb7e Mon Sep 17 00:00:00 2001 From: jpirnay Date: Sat, 11 Apr 2026 20:29:57 +0200 Subject: [PATCH] Fix oversight --- lib/Epub/Epub/converters/JpegToFramebufferConverter.cpp | 3 ++- lib/Epub/Epub/converters/PngToFramebufferConverter.cpp | 3 ++- src/activities/boot_sleep/SleepActivity.cpp | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Epub/Epub/converters/JpegToFramebufferConverter.cpp b/lib/Epub/Epub/converters/JpegToFramebufferConverter.cpp index ca632eb8..fdf29129 100644 --- a/lib/Epub/Epub/converters/JpegToFramebufferConverter.cpp +++ b/lib/Epub/Epub/converters/JpegToFramebufferConverter.cpp @@ -129,7 +129,8 @@ uint8_t ditherGray(JpegContext& ctx, uint8_t gray, int localX, int outX, int out // File I/O callbacks use pFile->fHandle to access the FsFile*, // avoiding the need for global file state. void* jpegOpen(const char* filename, int32_t* size) { - FsFile* f = new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to JPEGDEC callbacks + FsFile* f = + new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to JPEGDEC callbacks if (!Storage.openFileForRead("JPG", std::string(filename), *f)) { delete f; // NOLINT(cppcoreguidelines-owning-memory) return nullptr; diff --git a/lib/Epub/Epub/converters/PngToFramebufferConverter.cpp b/lib/Epub/Epub/converters/PngToFramebufferConverter.cpp index 5f6dcc07..5bf2a364 100644 --- a/lib/Epub/Epub/converters/PngToFramebufferConverter.cpp +++ b/lib/Epub/Epub/converters/PngToFramebufferConverter.cpp @@ -133,7 +133,8 @@ uint8_t ditherGray(PngContext& ctx, uint8_t gray, int localX, int outX, int outY // File I/O callbacks use pFile->fHandle to access the FsFile*, // avoiding the need for global file state. void* pngOpenWithHandle(const char* filename, int32_t* size) { - FsFile* f = new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to PNGdec callbacks + FsFile* f = + new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to PNGdec callbacks if (!Storage.openFileForRead("PNG", std::string(filename), *f)) { delete f; // NOLINT(cppcoreguidelines-owning-memory) return nullptr; diff --git a/src/activities/boot_sleep/SleepActivity.cpp b/src/activities/boot_sleep/SleepActivity.cpp index 8c8dce03..4dffb5f4 100644 --- a/src/activities/boot_sleep/SleepActivity.cpp +++ b/src/activities/boot_sleep/SleepActivity.cpp @@ -48,7 +48,8 @@ struct PngOverlayCtx { // PNGdec file I/O callbacks — mirror the pattern in PngToFramebufferConverter.cpp. void* pngSleepOpen(const char* filename, int32_t* size) { - FsFile* f = new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to PNGdec callbacks + FsFile* f = + new FsFile(); // NOLINT(cppcoreguidelines-owning-memory) — ownership transferred via void* to PNGdec callbacks if (!Storage.openFileForRead("SLP", std::string(filename), *f)) { delete f; // NOLINT(cppcoreguidelines-owning-memory) return nullptr; @@ -901,7 +902,7 @@ void SleepActivity::renderOverlaySleepScreen() const { ctx.yScale = yScale; ctx.lastDstY = -1; ctx.transparentColor = -2; // will be resolved on first draw callback (after tRNS is parsed) - ctx.pngObj = png; + ctx.pngObj = png.get(); rc = png->decode(&ctx, 0); png->close();