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

Disallow to call ESMWriter::writeT with pointer type

This will make ESMWriter to use a pointer to this pointer to access the data
that is unlikely an intent. For example:
68ef96410c.
This commit is contained in:
elsid 2022-01-30 14:04:12 +01:00
parent 4554a075e7
commit b17c9a22ff
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40

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);
}