From 97ba0b94c5da04f0d03945baa21c338c77c9dc20 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 25 Jan 2015 22:07:28 +0000 Subject: - correct writing of tokens, especially extended - further code optimizations git-svn-id: http://svn.miranda-ng.org/main/trunk@11911 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp') diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp index 492dde1027..99c186f126 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp @@ -12,6 +12,8 @@ #include "ProtocolTreeNode.h" #include "utilities.h" +extern const char *dictionary[], *extended_dict[]; + BinTreeNodeReader::BinTreeNodeReader(WAConnection *conn, ISocketConnection *connection) : buf(BUFFER_SIZE) { @@ -145,15 +147,12 @@ ReadData* BinTreeNodeReader::readString(int token) int bSize; ReadData *ret = new ReadData(); - if (token > 2 && token <= WAConnection::DICTIONARY_LEN) { - if (token != WAConnection::DICTIONARY_LEN) - ret->data = new std::string(WAConnection::dictionary[token]); + if (token > 2 && token <= 236) { + if (token != 236) + ret->data = new std::string(dictionary[token]); else { token = readInt8(this->in); - if (token >= WAConnection::EXTDICTIONARY_LEN) - throw WAException("invalid token/length in getToken", WAException::CORRUPT_STREAM_EX, 0); - - ret->data = new std::string(WAConnection::extended_dict[token]); + ret->data = new std::string(extended_dict[token]); } ret->type = STRING; -- cgit v1.2.3