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).
This commit is contained in:
parent
105dff439e
commit
22a5224c9c
1 changed files with 6 additions and 6 deletions
|
|
@ -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<std::size_t>(-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<std::size_t>(-1), "%s-%04d.txt", base, nextIndex);
|
||||
} else {
|
||||
if (nextIndex == 0) {
|
||||
StringFormat(candidate, sizeof(candidate), static_cast<std::size_t>(-1), "%s.txt", base);
|
||||
} else {
|
||||
StringFormat(candidate, sizeof(candidate), static_cast<std::size_t>(-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<std::size_t>(-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<std::size_t>(-1), "%s-%04d.txt", base, lastExisting);
|
||||
} else {
|
||||
if (lastExisting == 0) {
|
||||
StringFormat(filename, sizeof(filename), static_cast<std::size_t>(-1), "%s.txt", base);
|
||||
} else {
|
||||
StringFormat(filename, sizeof(filename), static_cast<std::size_t>(-1), "%s-%04d.txt", base, lastExisting);
|
||||
}
|
||||
FILE* file = nullptr;
|
||||
if (fopen_s(&file, filename, "r") == 0 && file != nullptr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue