From b806445a361214d604307baab4da2eea89515e3c Mon Sep 17 00:00:00 2001 From: elsid Date: Fri, 7 May 2021 18:14:44 +0200 Subject: [PATCH] Use existing min implementation --- components/esm/esmcommon.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esm/esmcommon.hpp b/components/esm/esmcommon.hpp index bb4069d26..749e9a85d 100644 --- a/components/esm/esmcommon.hpp +++ b/components/esm/esmcommon.hpp @@ -1,6 +1,7 @@ #ifndef OPENMW_ESM_COMMON_H #define OPENMW_ESM_COMMON_H +#include #include #include #include @@ -110,8 +111,7 @@ struct FIXED_STRING<4> : public FIXED_STRING_BASE void assign(const std::string& value) { 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; }