const buffer pointer for write[U]Bytes

This commit is contained in:
Jack Andersen 2015-06-30 17:01:04 -10:00
parent a76a3c584a
commit fa016115c2
5 changed files with 10 additions and 10 deletions

View File

@ -31,8 +31,8 @@ public:
void seekBit(int bit); void seekBit(int bit);
void writeUByte(atUint8 val); void writeUByte(atUint8 val);
void writeByte(atInt8 val); void writeByte(atInt8 val);
void writeUBytes(atUint8* data, atUint64 len); void writeUBytes(const atUint8* data, atUint64 len);
void writeBytes(atInt8* data, atUint64 len); void writeBytes(const atInt8* data, atUint64 len);
void writeUint16(atUint16 val); void writeUint16(atUint16 val);
void writeInt16(atInt16 val); void writeInt16(atInt16 val);
void writeUint32(atUint32 val); void writeUint32(atUint32 val);

View File

@ -25,8 +25,8 @@ public:
virtual void writeBit(bool) = 0; virtual void writeBit(bool) = 0;
virtual void writeUByte(atUint8) = 0; virtual void writeUByte(atUint8) = 0;
virtual void writeByte(atInt8) = 0; virtual void writeByte(atInt8) = 0;
virtual void writeUBytes(atUint8*, atUint64) = 0; virtual void writeUBytes(const atUint8*, atUint64) = 0;
virtual void writeBytes(atInt8*, atUint64) = 0; virtual void writeBytes(const atInt8*, atUint64) = 0;
virtual void writeUint16(atUint16) = 0; virtual void writeUint16(atUint16) = 0;
virtual void writeInt16(atInt16) = 0; virtual void writeInt16(atInt16) = 0;
virtual void writeUint32(atUint32) = 0; virtual void writeUint32(atUint32) = 0;

View File

@ -164,7 +164,7 @@ public:
* \param data The buffer to write * \param data The buffer to write
* \param length The amount to write * \param length The amount to write
*/ */
void writeUBytes(atUint8* data, atUint64 len); void writeUBytes(const atUint8* data, atUint64 len);
/*! \brief Writes the given buffer with the specified length, buffers can be bigger than the length /*! \brief Writes the given buffer with the specified length, buffers can be bigger than the length
* however it's undefined behavior to try and write a buffer which is smaller than the given length. * however it's undefined behavior to try and write a buffer which is smaller than the given length.
@ -172,7 +172,7 @@ public:
* \param data The buffer to write * \param data The buffer to write
* \param length The amount to write * \param length The amount to write
*/ */
void writeBytes(atInt8* data, atUint64 len); void writeBytes(const atInt8* data, atUint64 len);
/*! \brief Writes an Int16 to the buffer and advances the buffer. /*! \brief Writes an Int16 to the buffer and advances the buffer.
* It also swaps the bytes depending on the platform and Stream settings. * It also swaps the bytes depending on the platform and Stream settings.

View File

@ -155,7 +155,7 @@ void FileWriter::writeByte(atInt8 val)
writeUByte(val); writeUByte(val);
} }
void FileWriter::writeUBytes(atUint8* data, atUint64 len) void FileWriter::writeUBytes(const atUint8* data, atUint64 len)
{ {
if (!isOpen()) if (!isOpen())
THROW_INVALID_OPERATION_EXCEPTION("File not open for writing"); THROW_INVALID_OPERATION_EXCEPTION("File not open for writing");
@ -166,7 +166,7 @@ void FileWriter::writeUBytes(atUint8* data, atUint64 len)
THROW_IO_EXCEPTION("Unable to write to stream"); THROW_IO_EXCEPTION("Unable to write to stream");
} }
void FileWriter::writeBytes(atInt8* data, atUint64 len) void FileWriter::writeBytes(const atInt8* data, atUint64 len)
{ {
writeUBytes((atUint8*)data, len); writeUBytes((atUint8*)data, len);
} }

View File

@ -254,7 +254,7 @@ void MemoryWriter::writeByte(atInt8 val)
writeUByte(val); writeUByte(val);
} }
void MemoryWriter::writeUBytes(atUint8* data, atUint64 length) void MemoryWriter::writeUBytes(const atUint8* data, atUint64 length)
{ {
if (!isOpen()) if (!isOpen())
resize(sizeof(atUint8) * length); resize(sizeof(atUint8) * length);
@ -276,7 +276,7 @@ void MemoryWriter::writeUBytes(atUint8* data, atUint64 length)
m_position += length; m_position += length;
} }
void MemoryWriter::writeBytes(atInt8* data, atUint64 length) void MemoryWriter::writeBytes(const atInt8* data, atUint64 length)
{ {
writeUBytes((atUint8*)data, length); writeUBytes((atUint8*)data, length);
} }