summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-25 22:07:28 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-25 22:07:28 +0000
commit97ba0b94c5da04f0d03945baa21c338c77c9dc20 (patch)
tree55d1b4c131a616b8c660128c70418df95de99b90 /protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp
parent4b9da6b7ea643ac4917440880583d507b697cf9a (diff)
- 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
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp13
1 files changed, 6 insertions, 7 deletions
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;