diff options
author | George Hazan <ghazan@miranda.im> | 2021-04-25 15:35:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-04-25 15:35:39 +0300 |
commit | 68f68d7633596d9f39a0bd48f26732b24a2b5ee9 (patch) | |
tree | bd52f64f99547c84c98a413b7e2b6c2f07407ebd | |
parent | 9449b0587fa74976ff55828f5d850bc061e331b8 (diff) |
code cleaning
-rw-r--r-- | plugins/Dbx_sqlite/src/dbcrypt.cpp | 2 | ||||
-rw-r--r-- | protocols/Facebook/src/thrift.cpp | 4 | ||||
-rw-r--r-- | protocols/WhatsAppWeb/src/utils.cpp | 11 |
3 files changed, 9 insertions, 8 deletions
diff --git a/plugins/Dbx_sqlite/src/dbcrypt.cpp b/plugins/Dbx_sqlite/src/dbcrypt.cpp index 5eee3f3c70..a59846f387 100644 --- a/plugins/Dbx_sqlite/src/dbcrypt.cpp +++ b/plugins/Dbx_sqlite/src/dbcrypt.cpp @@ -26,7 +26,7 @@ STDMETHODIMP_(BOOL) CDbxSQLite::ReadCryptoKey(MBinBuffer &buf) return FALSE; } - buf.append((BYTE*)sqlite3_column_blob(stmt, 0), sqlite3_column_bytes(stmt, 0)); + buf.append(sqlite3_column_blob(stmt, 0), sqlite3_column_bytes(stmt, 0)); sqlite3_reset(stmt); return TRUE; } diff --git a/protocols/Facebook/src/thrift.cpp b/protocols/Facebook/src/thrift.cpp index ccd9b8c613..294796de6a 100644 --- a/protocols/Facebook/src/thrift.cpp +++ b/protocols/Facebook/src/thrift.cpp @@ -63,7 +63,7 @@ FbThrift& FbThrift::operator<<(const char *str) { size_t len = mir_strlen(str); writeIntV(len); - m_buf.append((void*)str, len); + m_buf.append(str, len); return *this; } @@ -75,7 +75,7 @@ void FbThrift::writeBool(bool bValue) void FbThrift::writeBuf(const void *pData, size_t cbLen) { - m_buf.append((void*)pData, cbLen); + m_buf.append(pData, cbLen); } void FbThrift::writeField(int iType) diff --git a/protocols/WhatsAppWeb/src/utils.cpp b/protocols/WhatsAppWeb/src/utils.cpp index 853c5ae383..4300256cf7 100644 --- a/protocols/WhatsAppWeb/src/utils.cpp +++ b/protocols/WhatsAppWeb/src/utils.cpp @@ -67,16 +67,17 @@ bool WhatsAppProto::decryptBinaryMessage(size_t cbSize, const void *buf, MBinBuf } // okay, let's decrypt this thing + auto *pBuf = (const unsigned char *)buf; { BYTE iv[16]; - memcpy(iv, (char*)buf + 32, sizeof(iv)); - res.assign((char*)buf + 48, cbSize - 48); - res.append((char*)mac_key.data(), 32); // reserve 32 more bytes for temp data + memcpy(iv, pBuf + 32, sizeof(iv)); + res.assign(pBuf + 48, cbSize - 48); + res.append(mac_key.data(), 32); // reserve 32 more bytes for temp data int dec_len = 0, final_len = 0; EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, (BYTE*)enc_key.data(), iv); - EVP_DecryptUpdate(ctx, (BYTE*)res.data(), &dec_len, (BYTE*)buf + 48, (int)cbSize - 48); + EVP_DecryptUpdate(ctx, (BYTE*)res.data(), &dec_len, pBuf + 48, (int)cbSize - 48); EVP_DecryptFinal_ex(ctx, (BYTE*)res.data() + dec_len, &final_len); EVP_CIPHER_CTX_free(ctx); } @@ -517,7 +518,7 @@ void WAWriter::writeString(const char *str, bool bRaw) else { int len = (int)strlen(str); writeLength(len); - body.append((void *)str, len); + body.append(str, len); } } |