From fa016115c24ac7e4c3c14dc42aba225b075ebf24 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 30 Jun 2015 17:01:04 -1000 Subject: [PATCH] const buffer pointer for write[U]Bytes --- include/Athena/FileWriter.hpp | 4 ++-- include/Athena/IStreamWriter.hpp | 4 ++-- include/Athena/MemoryWriter.hpp | 4 ++-- src/Athena/FileWriter.cpp | 4 ++-- src/Athena/MemoryWriter.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/Athena/FileWriter.hpp b/include/Athena/FileWriter.hpp index b0c7ff9..3f65cf0 100644 --- a/include/Athena/FileWriter.hpp +++ b/include/Athena/FileWriter.hpp @@ -31,8 +31,8 @@ public: void seekBit(int bit); void writeUByte(atUint8 val); void writeByte(atInt8 val); - void writeUBytes(atUint8* data, atUint64 len); - void writeBytes(atInt8* data, atUint64 len); + void writeUBytes(const atUint8* data, atUint64 len); + void writeBytes(const atInt8* data, atUint64 len); void writeUint16(atUint16 val); void writeInt16(atInt16 val); void writeUint32(atUint32 val); diff --git a/include/Athena/IStreamWriter.hpp b/include/Athena/IStreamWriter.hpp index 3ef8514..6f7dc23 100644 --- a/include/Athena/IStreamWriter.hpp +++ b/include/Athena/IStreamWriter.hpp @@ -25,8 +25,8 @@ public: virtual void writeBit(bool) = 0; virtual void writeUByte(atUint8) = 0; virtual void writeByte(atInt8) = 0; - virtual void writeUBytes(atUint8*, atUint64) = 0; - virtual void writeBytes(atInt8*, atUint64) = 0; + virtual void writeUBytes(const atUint8*, atUint64) = 0; + virtual void writeBytes(const atInt8*, atUint64) = 0; virtual void writeUint16(atUint16) = 0; virtual void writeInt16(atInt16) = 0; virtual void writeUint32(atUint32) = 0; diff --git a/include/Athena/MemoryWriter.hpp b/include/Athena/MemoryWriter.hpp index f1862a8..5778aae 100644 --- a/include/Athena/MemoryWriter.hpp +++ b/include/Athena/MemoryWriter.hpp @@ -164,7 +164,7 @@ public: * \param data The buffer 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 * 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 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. * It also swaps the bytes depending on the platform and Stream settings. diff --git a/src/Athena/FileWriter.cpp b/src/Athena/FileWriter.cpp index b8a03af..cccce04 100644 --- a/src/Athena/FileWriter.cpp +++ b/src/Athena/FileWriter.cpp @@ -155,7 +155,7 @@ void FileWriter::writeByte(atInt8 val) writeUByte(val); } -void FileWriter::writeUBytes(atUint8* data, atUint64 len) +void FileWriter::writeUBytes(const atUint8* data, atUint64 len) { if (!isOpen()) 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"); } -void FileWriter::writeBytes(atInt8* data, atUint64 len) +void FileWriter::writeBytes(const atInt8* data, atUint64 len) { writeUBytes((atUint8*)data, len); } diff --git a/src/Athena/MemoryWriter.cpp b/src/Athena/MemoryWriter.cpp index d5c5ed6..cfb2c55 100644 --- a/src/Athena/MemoryWriter.cpp +++ b/src/Athena/MemoryWriter.cpp @@ -254,7 +254,7 @@ void MemoryWriter::writeByte(atInt8 val) writeUByte(val); } -void MemoryWriter::writeUBytes(atUint8* data, atUint64 length) +void MemoryWriter::writeUBytes(const atUint8* data, atUint64 length) { if (!isOpen()) resize(sizeof(atUint8) * length); @@ -276,7 +276,7 @@ void MemoryWriter::writeUBytes(atUint8* data, atUint64 length) m_position += length; } -void MemoryWriter::writeBytes(atInt8* data, atUint64 length) +void MemoryWriter::writeBytes(const atInt8* data, atUint64 length) { writeUBytes((atUint8*)data, length); }