1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:29:55 +00:00

Fix undefined behaviour

This commit is contained in:
AnyOldName3 2021-05-17 22:47:08 +01:00
parent aba735e615
commit d66cc3b7ae

View file

@ -48,7 +48,7 @@ class Base64 {
size_t out_len = 4 * ((in_len + 2) / 3); size_t out_len = 4 * ((in_len + 2) / 3);
std::string ret(out_len, '\0'); std::string ret(out_len, '\0');
size_t i; size_t i;
char *p = const_cast<char*>(ret.c_str()); char *p = ret.data();
for (i = 0; i < in_len - 2; i += 3) { for (i = 0; i < in_len - 2; i += 3) {
*p++ = sEncodingTable[(data[i] >> 2) & 0x3F]; *p++ = sEncodingTable[(data[i] >> 2) & 0x3F];