From 5624b6fa344f446d542676000dfd5840fe352152 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 18:48:38 +0000 Subject: [PATCH] Decompile fn_06614 (LoadItemIntegerTable) Batch #16353 by youko: 0 byte-identical, 1 confirmed by peer review. - fn_06614 LoadItemIntegerTable: logic confirmed by peer review Peer-reviewed-by: eAthena, Yommy, Toshiro Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Items/ItemInfo.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Source/Contents/Items/ItemInfo.cpp b/Source/Contents/Items/ItemInfo.cpp index 979c388e7..a7ba56053 100644 --- a/Source/Contents/Items/ItemInfo.cpp +++ b/Source/Contents/Items/ItemInfo.cpp @@ -599,26 +599,23 @@ bool LoadItemIntegerTable(std::vector& values, const char* name) { const unsigned int size = file.GetSize(); char* buffer = new char[size + 1]; - if (values.capacity() < size) { - values.reserve(size); - } + values.reserve(size); file.Read(buffer, size); buffer[size] = '\0'; file.Close(); char* token = buffer; for (int index = 0; index < static_cast(size); ++index) { - char value = buffer[index]; - if (value == '/' && buffer[index + 1] == '/') { + if (buffer[index] == '/' && buffer[index + 1] == '/') { do { - if (value == '\r' || index >= static_cast(size)) { + if (buffer[index] == '\r' || index >= static_cast(size)) { break; } - value = buffer[++index]; - } while (value != '\n'); + ++index; + } while (buffer[index] != '\n'); token = buffer + index + 1; } - switch (value) { + switch (buffer[index]) { case '\t': case ' ': buffer[index] = '\0'; @@ -631,7 +628,9 @@ bool LoadItemIntegerTable(std::vector& values, const char* name) { break; } } - delete[] buffer; + if (buffer != nullptr) { + delete[] buffer; + } std::vector(values).swap(values); return true; }