From e70fd281d94638aa5652d8fbc8b88946ce9ff6a0 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Mon, 4 May 2026 17:27:21 +0200 Subject: [PATCH] Review changes --- lib/FsHelpers/FsHelpers.cpp | 1 + lib/ZipFile/ZipFile.cpp | 2 +- lib/ZipFile/ZipFile.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/FsHelpers/FsHelpers.cpp b/lib/FsHelpers/FsHelpers.cpp index 94bcde15..ba18cb2a 100644 --- a/lib/FsHelpers/FsHelpers.cpp +++ b/lib/FsHelpers/FsHelpers.cpp @@ -10,6 +10,7 @@ namespace FsHelpers { // both normalisePath overloads so the parsing rules stay in one place. static void appendOrPopComponent(std::string& out, const char* compData, size_t compLen) { if (compLen == 0) return; + if (compLen == 1 && compData[0] == '.') return; if (compLen == 2 && compData[0] == '.' && compData[1] == '.') { if (out.empty()) return; const auto lastSlash = out.find_last_of('/'); diff --git a/lib/ZipFile/ZipFile.cpp b/lib/ZipFile/ZipFile.cpp index 2bb19147..c91f2d4f 100644 --- a/lib/ZipFile/ZipFile.cpp +++ b/lib/ZipFile/ZipFile.cpp @@ -295,7 +295,7 @@ bool ZipFile::getInflatedFileSize(const char* filename, size_t* size) { return true; } -int ZipFile::fillUncompressedSizes(std::vector& targets, std::vector& sizes) { +int ZipFile::fillUncompressedSizes(const std::vector& targets, std::vector& sizes) { if (targets.empty()) { return 0; } diff --git a/lib/ZipFile/ZipFile.h b/lib/ZipFile/ZipFile.h index bc97559d..76d0af31 100644 --- a/lib/ZipFile/ZipFile.h +++ b/lib/ZipFile/ZipFile.h @@ -64,7 +64,7 @@ class ZipFile { // Batch lookup: scan ZIP central dir once and fill sizes for matching targets. // targets must be sorted by (hash, len). sizes[target.index] receives uncompressedSize. // Returns number of targets matched. - int fillUncompressedSizes(std::vector& targets, std::vector& sizes); + int fillUncompressedSizes(const std::vector& targets, std::vector& sizes); // Due to the memory required to run each of these, it is recommended to not preopen the zip file for multiple // These functions will open and close the zip as needed uint8_t* readFileToMemory(const char* filename, size_t* size = nullptr, bool trailingNullByte = false);