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:
parent
4554a075e7
commit
b17c9a22ff
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue