summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp10
-rw-r--r--protocols/WhatsApp/src/contacts.cpp11
2 files changed, 8 insertions, 13 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp
index 96ef32f415..6b2d02d4f9 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp
@@ -129,13 +129,13 @@ void BinTreeNodeWriter::writeAttributes(std::map<string, string>* attributes) {
void BinTreeNodeWriter::writeString(const std::string& tag) {
std::map<string, int>::iterator it = this->tokenMap.find(tag);
- if (it != this->tokenMap.end()) {
+ if (it != this->tokenMap.end())
writeToken(it->second);
- } else {
- unsigned int atIndex = tag.find('@');
- if (atIndex == 0 || atIndex == string::npos) {
+ else {
+ size_t atIndex = tag.find('@');
+ if (atIndex == 0 || atIndex == string::npos)
writeBytes((unsigned char*) tag.data(), tag.length());
- } else {
+ else {
std::string server = tag.substr(atIndex + 1);
std::string user = tag.substr(0, atIndex);
writeJid(&user, server);
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp
index 337e62cc9e..f412d6be56 100644
--- a/protocols/WhatsApp/src/contacts.cpp
+++ b/protocols/WhatsApp/src/contacts.cpp
@@ -125,11 +125,8 @@ HANDLE WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber)
// Cache
std::map<string, HANDLE>::iterator it = this->hContactByJid.find(phoneNumber);
if (it != this->hContactByJid.end())
- {
return it->second;
- }
- const char* id;
const char* idForContact = "ID";
const char* idForChat = "ChatRoomID";
@@ -140,7 +137,7 @@ HANDLE WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber)
if(!IsMyContact(hContact, true))
continue;
- id = db_get_b(hContact, m_szModuleName, "ChatRoom", 0) > 0 ? idForChat : idForContact;
+ const char* id = db_get_b(hContact, m_szModuleName, "ChatRoom", 0) > 0 ? idForChat : idForContact;
DBVARIANT dbv;
if( !db_get_s(hContact,m_szModuleName, id,&dbv, DBVT_ASCIIZ))
@@ -151,10 +148,8 @@ HANDLE WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber)
this->hContactByJid[phoneNumber] = hContact;
return hContact;
}
- else
- {
- db_free(&dbv);
- }
+
+ db_free(&dbv);
}
}