Decompile fn_18373 (?TransformFields@?A0x2a9fa6c1@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@ABV23@@Z)

Batch #11401 by SapitoSucio: 0 byte-identical, 1 confirmed by peer review.

- fn_18373 ?TransformFields@?A0x2a9fa6c1@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@ABV23@@Z: logic confirmed by peer review

Peer-reviewed-by: Yommy, dori, cremane
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-05 00:00:20 +00:00
commit 3364b49789

View file

@ -6,6 +6,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Text/Base64.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Text/StringUtil.h"
#include "Utility/Text/TextTokens.h"
#include <cstdio>
@ -4750,20 +4751,18 @@ namespace {
// OFFSET: 0x00B009D0
// FUNCTION: fn_18373
std::vector<std::string> TransformFields(const std::vector<std::string>& row) {
const char* escapes[] = {"\\r", "\\n", "\\t", "\\'", "\\\"", "\\\\"};
const char replacements[] = {'\r', '\n', '\t', '\'', '"', '\\'};
std::vector<std::string> result;
result.reserve(row.size());
for (std::string text : row) {
if (text.empty()) {
text = "NO MSG";
} else {
for (unsigned i = 0; i < 6; ++i) {
for (std::size_t pos = 0; (pos = text.find(escapes[i], pos)) != std::string::npos; ++pos) {
text.replace(pos, 2, 1, replacements[i]);
}
}
ReplaceAll(text, "\\r", "\r");
ReplaceAll(text, "\\n", "\n");
ReplaceAll(text, "\\t", "\t");
ReplaceAll(text, "\\'", "'");
ReplaceAll(text, "\\\"", "\"");
ReplaceAll(text, "\\\\", "\\");
}
result.push_back(std::move(text));
}