diff options
author | George Hazan <george.hazan@gmail.com> | 2015-01-25 22:07:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-01-25 22:07:28 +0000 |
commit | 97ba0b94c5da04f0d03945baa21c338c77c9dc20 (patch) | |
tree | 55d1b4c131a616b8c660128c70418df95de99b90 /protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp | |
parent | 4b9da6b7ea643ac4917440880583d507b697cf9a (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.cpp | 13 |
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;
|