1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00

Initialize string_view with explicit size

Otherwise size is detected by null terminating character.
This commit is contained in:
elsid 2022-02-16 17:08:39 +01:00
parent d680870e8f
commit b96c41df07
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

View File

@ -57,13 +57,13 @@ namespace
switch (sourceEncoding)
{
case ToUTF8::WINDOWS_1252:
return ToUTF8::windows_1252;
return {ToUTF8::windows_1252, std::size(ToUTF8::windows_1252)};
case ToUTF8::WINDOWS_1250:
return ToUTF8::windows_1250;
return {ToUTF8::windows_1250, std::size(ToUTF8::windows_1250)};
case ToUTF8::WINDOWS_1251:
return ToUTF8::windows_1251;
return {ToUTF8::windows_1251, std::size(ToUTF8::windows_1251)};
case ToUTF8::CP437:
return ToUTF8::cp437;
return {ToUTF8::cp437, std::size(ToUTF8::cp437)};
}
throw std::logic_error("Invalid source encoding: " + std::to_string(sourceEncoding));
}