Merge both getString functions in binarytree

This commit is contained in:
niczkx 2012-07-31 02:02:41 -06:00
parent 12e6602925
commit e316c0b5cd
1 changed files with 1 additions and 7 deletions

View File

@ -153,14 +153,8 @@ uint64 BinaryTree::getU64()
std::string BinaryTree::getString() std::string BinaryTree::getString()
{ {
unserialize();
uint16 len = getU16(); uint16 len = getU16();
if(m_pos+len > m_buffer.size()) return getString(len);
stdext::throw_exception("BinaryTree: getString failed: string length exceeded buffer size.");
std::string ret((char *)&m_buffer[m_pos], len);
m_pos += len;
return ret;
} }
std::string BinaryTree::getString(uint16 len) std::string BinaryTree::getString(uint16 len)