mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 13:03:27 +02:00
Merge fallen changes
This commit is contained in:
@@ -57,6 +57,7 @@ public:
|
||||
std::string getBuildRevision() { return BUILD_REVISION; }
|
||||
std::string getBuildCommit() { return BUILD_COMMIT; }
|
||||
std::string getBuildType() { return BUILD_TYPE; }
|
||||
std::string getBuildArch() { return BUILD_ARCH; }
|
||||
std::string getStartupOptions() { return m_startupOptions; }
|
||||
|
||||
protected:
|
||||
|
@@ -60,7 +60,7 @@ void BinaryTree::seek(uint pos)
|
||||
|
||||
uint8 BinaryTree::getU8()
|
||||
{
|
||||
if(m_pos+1 > m_buffer.size())
|
||||
if (m_pos+1 > m_buffer.size())
|
||||
stdext::throw_exception("BinaryTree: getU8 failed");
|
||||
uint8 v = m_buffer[m_pos];
|
||||
m_pos += 1;
|
||||
@@ -69,7 +69,7 @@ uint8 BinaryTree::getU8()
|
||||
|
||||
uint16 BinaryTree::getU16()
|
||||
{
|
||||
if(m_pos+2 > m_buffer.size())
|
||||
if (m_pos+2 > m_buffer.size())
|
||||
stdext::throw_exception("BinaryTree: getU16 failed");
|
||||
uint16 v = stdext::readLE16(&m_buffer[m_pos]);
|
||||
m_pos += 2;
|
||||
@@ -78,7 +78,7 @@ uint16 BinaryTree::getU16()
|
||||
|
||||
uint32 BinaryTree::getU32()
|
||||
{
|
||||
if(m_pos+4 > m_buffer.size())
|
||||
if (m_pos+4 > m_buffer.size())
|
||||
stdext::throw_exception("BinaryTree: getU32 failed");
|
||||
uint32 v = stdext::readLE32(&m_buffer[m_pos]);
|
||||
m_pos += 4;
|
||||
@@ -87,8 +87,8 @@ uint32 BinaryTree::getU32()
|
||||
|
||||
uint64 BinaryTree::getU64()
|
||||
{
|
||||
if(m_pos+8 > m_buffer.size())
|
||||
stdext::throw_exception("BinaryTree: getu64 failed");
|
||||
if (m_pos+8 > m_buffer.size())
|
||||
stdext::throw_exception("BinaryTree: getU64 failed");
|
||||
uint64 v = stdext::readLE64(&m_buffer[m_pos]);
|
||||
m_pos += 8;
|
||||
return v;
|
||||
@@ -98,7 +98,10 @@ std::string BinaryTree::getString()
|
||||
{
|
||||
uint16 len = getU16();
|
||||
if (len == 0 || len > 8192)
|
||||
stdext::throw_exception("failed to get string from binary tree - invalid size read.");
|
||||
stdext::throw_exception("BinaryTree: getString failed: invalid or too large string length");
|
||||
|
||||
if (m_pos+len > m_buffer.size())
|
||||
stdext::throw_exception("BinaryTree: getString failed: string length exceeded buffer size.");
|
||||
|
||||
std::string ret((char *)&m_buffer[m_pos], len);
|
||||
m_pos += len;
|
||||
|
@@ -59,6 +59,8 @@ public:
|
||||
void addU32(uint32 v);
|
||||
void addU64(uint64 v);
|
||||
void addString(const std::string& v);
|
||||
void startNode(uint8 nodeType) { addU8(0xFE); addU8(nodeType); }
|
||||
void endNode() { addU8(0xFF); }
|
||||
|
||||
FileStreamPtr asFileStream() { return std::static_pointer_cast<FileStream>(shared_from_this()); }
|
||||
|
||||
|
Reference in New Issue
Block a user