diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-11 13:33:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-11 13:33:42 +0000 |
commit | 85bd008c039eb1d93894e94fba9d158a42a71a12 (patch) | |
tree | 2d72d10759f6928e9e4b960175d2de01b5cf7e12 /protocols/Xfire/src/recvstatusmessagepacket.cpp | |
parent | 222802c2986dcaf029fdfb828b7679bdabfa7bb2 (diff) |
massive code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14910 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Xfire/src/recvstatusmessagepacket.cpp')
-rw-r--r-- | protocols/Xfire/src/recvstatusmessagepacket.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/protocols/Xfire/src/recvstatusmessagepacket.cpp b/protocols/Xfire/src/recvstatusmessagepacket.cpp index 38387f424d..3bf45bbbdc 100644 --- a/protocols/Xfire/src/recvstatusmessagepacket.cpp +++ b/protocols/Xfire/src/recvstatusmessagepacket.cpp @@ -26,55 +26,55 @@ #include "variablevalue.h" #include "xdebug.h" -#include <vector> -#include <string> -namespace xfirelib { - RecvStatusMessagePacket::RecvStatusMessagePacket() { - centries=0; - } +namespace xfirelib +{ + RecvStatusMessagePacket::RecvStatusMessagePacket() + { + centries = 0; + } - void RecvStatusMessagePacket::parseContent(char *buf, int length, int numberOfAtts) { - int index = 0; - int numberOfIds = 0; - VariableValue val; - index += val.readName(buf,index); - index ++; // ignore 03 ?? - index ++; // jump to counter - numberOfIds = (unsigned char) buf[index]; - index ++; // Ignore 00 ?? - index ++; - sids = new std::vector<char *>; - for(int i = 0 ; i < numberOfIds ; i++) { - index += val.readValue(buf,index,16); - char *sid = new char[16]; - memcpy(sid,val.getValue(),16); - sids->push_back(sid); - } + void RecvStatusMessagePacket::parseContent(char *buf, int, int) + { + int index = 0; + int numberOfIds = 0; + VariableValue val; + index += val.readName(buf, index); + index++; // ignore 03 ?? + index++; // jump to counter + numberOfIds = (unsigned char)buf[index]; + index++; // Ignore 00 ?? + index++; + sids = new std::vector<char *>; + for (int i = 0; i < numberOfIds; i++) { + index += val.readValue(buf, index, 16); + char *sid = new char[16]; + memcpy(sid, val.getValue(), 16); + sids->push_back(sid); + } - index += val.readName(buf,index); - XDEBUG(( "valname %s\n", val.getName().c_str() )); - index ++; // Ignore 04 ?? - msgs = new std::vector<std::string>; - index = readStrings(msgs,buf,index); + index += val.readName(buf, index); + XDEBUG(("valname %s\n", val.getName().c_str())); + index++; // Ignore 04 ?? + msgs = new std::vector<std::string>; + index = readStrings(msgs, buf, index); + } - } - - -int RecvStatusMessagePacket::readStrings(std::vector<std::string> *strings, char *buf, int index) { - VariableValue friends; - index += friends.readValue(buf,index); - index ++; // Ignore 00 - int numberOfStrings = friends.getValueAsLong(); - XDEBUG3( "name: %s numberOfStrings: %d\n", friends.getName().c_str(), numberOfStrings ); - for(int i = 0 ; i < numberOfStrings ; i++) { - int length = (unsigned char)buf[index++]; - index++; - index += friends.readValue(buf,index,length); - std::string stringvalue = std::string(friends.getValue(),length); - strings->push_back(stringvalue); - XDEBUG3( "String length: %2d : %s\n", length, stringvalue.c_str() ); - } - return index; - } + int RecvStatusMessagePacket::readStrings(std::vector<std::string> *strings, char *buf, int index) + { + VariableValue friends; + index += friends.readValue(buf, index); + index++; // Ignore 00 + int numberOfStrings = friends.getValueAsLong(); + XDEBUG3("name: %s numberOfStrings: %d\n", friends.getName().c_str(), numberOfStrings); + for (int i = 0; i < numberOfStrings; i++) { + int length = (unsigned char)buf[index++]; + index++; + index += friends.readValue(buf, index, length); + std::string stringvalue = std::string(friends.getValue(), length); + strings->push_back(stringvalue); + XDEBUG3("String length: %2d : %s\n", length, stringvalue.c_str()); + } + return index; + } }; |