mirror of https://github.com/libAthena/athena.git
* Change default constructor for BinaryWriter to accept null buffers
This commit is contained in:
parent
f92811004f
commit
8b80f486ad
|
@ -41,7 +41,7 @@ public:
|
||||||
* \param data The existing buffer
|
* \param data The existing buffer
|
||||||
* \param length The length of the existing buffer
|
* \param length The length of the existing buffer
|
||||||
*/
|
*/
|
||||||
BinaryWriter(atUint8* data, atUint64 length);
|
explicit BinaryWriter(atUint8* data = nullptr, atUint64 length=0x10);
|
||||||
|
|
||||||
/*! \brief This constructor creates an instance from a file on disk.
|
/*! \brief This constructor creates an instance from a file on disk.
|
||||||
*
|
*
|
||||||
|
|
|
@ -41,7 +41,10 @@ BinaryWriter::BinaryWriter(atUint8* data, atUint64 length)
|
||||||
m_bitPosition(0),
|
m_bitPosition(0),
|
||||||
m_endian(Endian::LittleEndian),
|
m_endian(Endian::LittleEndian),
|
||||||
m_progressCallback(nullptr)
|
m_progressCallback(nullptr)
|
||||||
{}
|
{
|
||||||
|
if (!m_data)
|
||||||
|
m_data = new atUint8[m_length];
|
||||||
|
}
|
||||||
|
|
||||||
BinaryWriter::BinaryWriter(const std::string& filename, std::function<void(int)> progressFun)
|
BinaryWriter::BinaryWriter(const std::string& filename, std::function<void(int)> progressFun)
|
||||||
: m_length(0),
|
: m_length(0),
|
||||||
|
|
Loading…
Reference in New Issue