mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-19 12:40:49 +00:00
Merge branch 'var_copy' into 'master'
Do not copy vector See merge request OpenMW/openmw!3401
This commit is contained in:
commit
58a3fcb972
@ -110,13 +110,14 @@ namespace LuaUtf8
|
|||||||
};
|
};
|
||||||
|
|
||||||
utf8["codes"] = [](std::string_view s) {
|
utf8["codes"] = [](std::string_view s) {
|
||||||
std::vector<int64_t> pos_byte{ 1 };
|
return sol::as_function(
|
||||||
return sol::as_function([s, pos_byte]() mutable -> sol::optional<std::pair<int64_t, int64_t>> {
|
[s, pos_byte = std::vector<int64_t>{ 1 }]() mutable -> sol::optional<std::pair<int64_t, int64_t>> {
|
||||||
if (pos_byte.back() <= static_cast<int64_t>(s.size()))
|
if (pos_byte.back() <= static_cast<int64_t>(s.size()))
|
||||||
{
|
{
|
||||||
const auto pair = decodeNextUTF8Character(s, pos_byte);
|
const auto pair = decodeNextUTF8Character(s, pos_byte);
|
||||||
if (pair.second == -1)
|
if (pair.second == -1)
|
||||||
throw std::runtime_error("Invalid UTF-8 code at position " + std::to_string(pos_byte.size()));
|
throw std::runtime_error(
|
||||||
|
"Invalid UTF-8 code at position " + std::to_string(pos_byte.size()));
|
||||||
|
|
||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user