1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

Merge branch 'use_min' into 'master'

Use existing min implementation

See merge request OpenMW/openmw!828
This commit is contained in:
Petr Mikheev 2021-05-09 13:05:39 +00:00
commit e65b285f06

View File

@ -1,6 +1,7 @@
#ifndef OPENMW_ESM_COMMON_H #ifndef OPENMW_ESM_COMMON_H
#define OPENMW_ESM_COMMON_H #define OPENMW_ESM_COMMON_H
#include <algorithm>
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <vector> #include <vector>
@ -110,8 +111,7 @@ struct FIXED_STRING<4> : public FIXED_STRING_BASE<FIXED_STRING, 4>
void assign(const std::string& value) void assign(const std::string& value)
{ {
intval = 0; intval = 0;
std::memcpy(data, value.data(), (value.size() < 4)? value.size(): 4); std::memcpy(data, value.data(), std::min(value.size(), sizeof(data)));
} }
char const* ro_data() const { return data; } char const* ro_data() const { return data; }