mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-27 09:41:16 +00:00
Merge branch 'fix_icu_from_utf8_debug_crash' into 'master'
Avoid constructing icu::StringPiece from std::string directly (#6782) Closes #6782 See merge request OpenMW/openmw!2073
This commit is contained in:
commit
bbcc12262f
@ -75,7 +75,7 @@ namespace l10n
|
||||
{
|
||||
const auto key = it.first.as<std::string>();
|
||||
const auto value = it.second.as<std::string>();
|
||||
icu::UnicodeString pattern = icu::UnicodeString::fromUTF8(value);
|
||||
icu::UnicodeString pattern = icu::UnicodeString::fromUTF8(icu::StringPiece(value.data(), value.size()));
|
||||
icu::ErrorCode status;
|
||||
UParseError parseError;
|
||||
icu::MessageFormat message(pattern, lang, parseError, status);
|
||||
@ -112,7 +112,7 @@ namespace l10n
|
||||
std::vector<icu::Formattable> argValues;
|
||||
for (auto& [k, v] : args)
|
||||
{
|
||||
argNames.push_back(icu::UnicodeString::fromUTF8(k));
|
||||
argNames.push_back(icu::UnicodeString::fromUTF8(icu::StringPiece(k.data(), k.size())));
|
||||
argValues.push_back(v);
|
||||
}
|
||||
return formatMessage(key, argNames, argValues);
|
||||
|
@ -68,7 +68,8 @@ namespace LuaUtil
|
||||
}
|
||||
|
||||
// Argument names
|
||||
argNames.push_back(icu::UnicodeString::fromUTF8(key.as<std::string>()));
|
||||
const auto str = key.as<std::string>();
|
||||
argNames.push_back(icu::UnicodeString::fromUTF8(icu::StringPiece(str.data(), str.size())));
|
||||
}
|
||||
return std::make_pair(args, argNames);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user