Fix utility::vsprintf

Fix operator>> (I'm a derp)
This commit is contained in:
Phillip Stephens 2015-10-16 17:25:36 -07:00
parent 1b67cce607
commit 8124d219d9
3 changed files with 10 additions and 9 deletions

View File

@ -1217,7 +1217,7 @@ protected:
template <typename T>
IStreamReader& operator>>(IStreamReader& lhs, T& rhs)
{
rhs = lhs.readVal<T>(rhs);
rhs = lhs.readVal<T>();
return lhs;
}
}

View File

@ -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);

View File

@ -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);