From 9d62e31863057f847b56e82e3880c4c588c9cb0a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 24 Jun 2013 12:35:43 +0000 Subject: warning fix git-svn-id: http://svn.miranda-ng.org/main/trunk@5118 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/OpenSSL/md32_common.h | 4 ++-- protocols/WhatsApp/src/OpenSSL/p5_crpt2.c | 3 ++- protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp | 16 ++++++++-------- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'protocols/WhatsApp/src') diff --git a/protocols/WhatsApp/src/OpenSSL/md32_common.h b/protocols/WhatsApp/src/OpenSSL/md32_common.h index e0deb78015..f0ca0fe631 100644 --- a/protocols/WhatsApp/src/OpenSSL/md32_common.h +++ b/protocols/WhatsApp/src/OpenSSL/md32_common.h @@ -293,7 +293,7 @@ int HASH_UPDATE (HASH_CTX *c, const void *data_, size_t len) * Wei Dai for pointing it out. */ if (l < c->Nl) /* overflow */ c->Nh++; - c->Nh+=(len>>29); /* might cause compiler warning on 16-bit */ + c->Nh += (unsigned long)(len>>29); /* might cause compiler warning on 16-bit */ c->Nl=l; n = c->num; @@ -331,7 +331,7 @@ int HASH_UPDATE (HASH_CTX *c, const void *data_, size_t len) if (len != 0) { p = (unsigned char *)c->data; - c->num = len; + c->num = (unsigned)len; memcpy (p,data,len); } return 1; diff --git a/protocols/WhatsApp/src/OpenSSL/p5_crpt2.c b/protocols/WhatsApp/src/OpenSSL/p5_crpt2.c index cc3b012ac0..18b366d2c2 100644 --- a/protocols/WhatsApp/src/OpenSSL/p5_crpt2.c +++ b/protocols/WhatsApp/src/OpenSSL/p5_crpt2.c @@ -56,6 +56,7 @@ * */ #include +#include #include #include "evp.h" @@ -82,7 +83,7 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, p = out; tkeylen = keylen; if(!pass) passlen = 0; - else if(passlen == -1) passlen = strlen(pass); + else if(passlen == -1) passlen = (int)strlen(pass); while(tkeylen) { if(tkeylen > SHA_DIGEST_LENGTH) cplen = SHA_DIGEST_LENGTH; else cplen = tkeylen; diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp index d50a4a91e5..63428f7821 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp @@ -27,7 +27,7 @@ BinTreeNodeWriter::BinTreeNodeWriter(WAConnection* conn, ISocketConnection* conn void BinTreeNodeWriter::writeDummyHeader() { int num = 3; - this->dataBegin = this->out->getPosition(); + this->dataBegin = (int)this->out->getPosition(); int num2 = this->dataBegin + num; this->out->setLength(num2); this->out->setPosition(num2); @@ -40,12 +40,12 @@ void BinTreeNodeWriter::processBuffer() unsigned int num = 0u; if (flag) { - long num2 = this->out->getLength() + 4L; + long num2 = (long)this->out->getLength() + 4L; this->out->setLength(num2); this->out->setPosition(num2); num |= 1u; } - long num3 = this->out->getLength() - 3L - (long) this->dataBegin; + long num3 = (long)this->out->getLength() - 3L - (long) this->dataBegin; if (num3 >= 1048576L) { throw WAException("Buffer too large: " + num3, WAException::CORRUPT_STREAM_EX, 0); @@ -76,7 +76,7 @@ void BinTreeNodeWriter::streamStart(std::string domain, std::string resource) { attributes["to"] = domain; attributes["resource"] = resource; this->writeDummyHeader(); - this->writeListStart(attributes.size() * 2 + 1); + this->writeListStart((int)attributes.size() * 2 + 1); this->out->write(1); this->writeAttributes(&attributes); this->processBuffer(); @@ -135,7 +135,7 @@ void BinTreeNodeWriter::writeString(const std::string& tag) { else { size_t atIndex = tag.find('@'); if (atIndex == 0 || atIndex == string::npos) - writeBytes((unsigned char*) tag.data(), tag.length()); + writeBytes((unsigned char*) tag.data(), (int)tag.length()); else { std::string server = tag.substr(atIndex + 1); std::string user = tag.substr(0, atIndex); @@ -183,16 +183,16 @@ void BinTreeNodeWriter::writeInt24(int v) { void BinTreeNodeWriter::writeInternal(ProtocolTreeNode* node) { writeListStart( - 1 + (node->attributes == NULL ? 0 : node->attributes->size() * 2) + 1 + (node->attributes == NULL ? 0 : (int)node->attributes->size() * 2) + (node->children == NULL ? 0 : 1) + (node->data == NULL ? 0 : 1)); writeString(node->tag); writeAttributes(node->attributes); if (node->data != NULL) { - writeBytes((unsigned char*) node->data->data(), node->data->size()); + writeBytes((unsigned char*) node->data->data(), (int)node->data->size()); } if (node->children != NULL && !node->children->empty()) { - writeListStart(node->children->size()); + writeListStart((int)node->children->size()); for (size_t a = 0; a < node->children->size(); a++) { writeInternal((*node->children)[a]); } -- cgit v1.2.3