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

Merge branch 'prevent_wrong_use_of_write' into 'master'

Disallow to call ESMWriter::writeT with pointer type

See merge request OpenMW/openmw!1609
This commit is contained in:
psi29a 2022-01-30 16:34:45 +00:00
commit e18393d7d6

View File

@ -3,6 +3,7 @@
#include <iosfwd>
#include <list>
#include <type_traits>
#include "components/esm/esmcommon.hpp"
#include "loadtes3.hpp"
@ -111,6 +112,7 @@ class ESMWriter
template<typename T>
void writeT(const T& data)
{
static_assert(!std::is_pointer_v<T>);
write((char*)&data, sizeof(T));
}
@ -123,6 +125,7 @@ class ESMWriter
template<typename T>
void writeT(const T& data, size_t size)
{
static_assert(!std::is_pointer_v<T>);
write((char*)&data, size);
}