diff --git a/include/Athena/IStreamReader.hpp b/include/Athena/IStreamReader.hpp index b29801b..9886d20 100644 --- a/include/Athena/IStreamReader.hpp +++ b/include/Athena/IStreamReader.hpp @@ -1217,7 +1217,7 @@ protected: template IStreamReader& operator>>(IStreamReader& lhs, T& rhs) { - rhs = lhs.readVal(rhs); + rhs = lhs.readVal(); return lhs; } } diff --git a/include/Athena/MemoryReader.hpp b/include/Athena/MemoryReader.hpp index 6b87d18..cbe1ba3 100644 --- a/include/Athena/MemoryReader.hpp +++ b/include/Athena/MemoryReader.hpp @@ -20,6 +20,8 @@ namespace io */ class MemoryReader : public IStreamReader { +protected: + MemoryReader() = default; public: virtual ~MemoryReader(); @@ -83,10 +85,10 @@ public: atUint64 readUBytesToBuf(void* buf, atUint64 len); protected: - const atUint8* m_data; - atUint64 m_length; - atUint64 m_position; - bool m_owns; + const atUint8* m_data = nullptr; + atUint64 m_length = 0; + atUint64 m_position = 0; + bool m_owns = false; }; class MemoryCopyReader : public MemoryReader @@ -104,8 +106,7 @@ public: * \param filename The file to create the stream from */ MemoryCopyReader(const std::string& filename) - : MemoryReader(NULL, 0), - m_filepath(filename) + : m_filepath(filename) {loadData();} void setData(const atUint8* data, atUint64 length); diff --git a/src/Athena/Utility.cpp b/src/Athena/Utility.cpp index d9618d3..0ef8a72 100644 --- a/src/Athena/Utility.cpp +++ b/src/Athena/Utility.cpp @@ -84,7 +84,7 @@ std::string vsprintf(const char* fmt, va_list list) int size = 512; char* buffer = 0; buffer = new char[size]; - int nsize = ::vsnprintf(buffer, size, fmt, list); + int nsize = ::vsprintf(buffer, fmt, list); while (size <= nsize) { @@ -92,7 +92,7 @@ std::string vsprintf(const char* fmt, va_list list) delete[] buffer; buffer = 0; buffer = new char[nsize + 1]; //+1 for /0 - nsize = ::vsnprintf(buffer, size, fmt, list); + nsize = ::vsprintf(buffer, fmt, list); } std::string ret(buffer);