From 2a768fc6d8f566dddfe1e9305c81ded530d188b4 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 12:30:18 +0000 Subject: [PATCH] Decompile 2 functions in Source/Network/TextEncoding.cpp Batch #12147 by cremane: 0 byte-identical, 2 confirmed by peer review. - fn_18265 EncodeText: logic confirmed by peer review - fn_02795 FindSubstring: logic confirmed by peer review Peer-reviewed-by: Yommy, Tanke Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Network/TextEncoding.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Source/Network/TextEncoding.cpp b/Source/Network/TextEncoding.cpp index f0976e14..d76a1ad8 100644 --- a/Source/Network/TextEncoding.cpp +++ b/Source/Network/TextEncoding.cpp @@ -135,15 +135,15 @@ std::wstring DecodeText(UINT codePage, const std::string& text) { std::string EncodeText(UINT codePage, const std::wstring& text) { const int length = WideCharToMultiByte(codePage, 0, text.c_str(), -1, nullptr, 0, nullptr, nullptr); if (length == 0) { - return {}; + return ""; } char* converted = static_cast(std::malloc(length)); if (converted == nullptr) { - return {}; + return ""; } if (WideCharToMultiByte(codePage, 0, text.c_str(), -1, converted, length, nullptr, nullptr) == 0) { std::free(converted); - return {}; + return ""; } std::string result(converted, std::strlen(converted)); std::free(converted); @@ -161,9 +161,6 @@ std::wstring LowercaseWide(const std::string& text) { // OFFSET: 0x0058D6B0 // FUNCTION: fn_02795 int FindSubstring(const char* text, int codePage, const char* pattern) { - std::wstring wideText = LowercaseWide(text); - std::wstring widePattern = LowercaseWide(pattern); - size_t pos = wideText.find(widePattern); - return (pos == std::wstring::npos) ? -1 : static_cast(pos); + return static_cast(LowercaseWide(text).find(LowercaseWide(pattern))); }