From 22a5224c9cda0d04f00e275ccabddb43ab87aeb5 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 14:32:15 +0000 Subject: [PATCH] Decompile fn_07589 (NFileLog::Initialize) Batch #16025 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_07589 NFileLog::Initialize: logic confirmed by peer review Peer-reviewed-by: alisonrag, youko Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Utility/NFileLog.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Utility/NFileLog.cpp b/Source/Utility/NFileLog.cpp index 397734c8b..06e7006bd 100644 --- a/Source/Utility/NFileLog.cpp +++ b/Source/Utility/NFileLog.cpp @@ -45,10 +45,10 @@ bool NFileLog::Initialize(const char* directoryName, const char* filePrefix) { char candidate[1024]{}; char base[1024]{}; StringFormat(base, sizeof(base), static_cast(-1), "%s\\%s(%04d%02d%02d)", this->directory, this->prefix, this->year, this->month, this->day); - if (nextIndex != 0) { - StringFormat(candidate, sizeof(candidate), static_cast(-1), "%s-%04d.txt", base, nextIndex); - } else { + if (nextIndex == 0) { StringFormat(candidate, sizeof(candidate), static_cast(-1), "%s.txt", base); + } else { + StringFormat(candidate, sizeof(candidate), static_cast(-1), "%s-%04d.txt", base, nextIndex); } if (_access(candidate, 0) != 0) { break; @@ -61,10 +61,10 @@ bool NFileLog::Initialize(const char* directoryName, const char* filePrefix) { std::memset(filename, 0, sizeof(filename)); char base[1024]{}; StringFormat(base, sizeof(base), static_cast(-1), "%s\\%s(%04d%02d%02d)", this->directory, this->prefix, this->year, this->month, this->day); - if (lastExisting != 0) { - StringFormat(filename, sizeof(filename), static_cast(-1), "%s-%04d.txt", base, lastExisting); - } else { + if (lastExisting == 0) { StringFormat(filename, sizeof(filename), static_cast(-1), "%s.txt", base); + } else { + StringFormat(filename, sizeof(filename), static_cast(-1), "%s-%04d.txt", base, lastExisting); } FILE* file = nullptr; if (fopen_s(&file, filename, "r") == 0 && file != nullptr) {