diff options
author | George Hazan <ghazan@miranda.im> | 2017-12-11 21:36:29 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-12-11 21:36:29 +0300 |
commit | 617831dfc953a5bba630163c01fbeda11445ee78 (patch) | |
tree | be3eb09d61f5652989dcc134f89bab6aab70955e /protocols | |
parent | e57cdb681cb10993f4bd08c594a27278af478b1a (diff) |
mir_base64_* => parameters type fix
Diffstat (limited to 'protocols')
24 files changed, 64 insertions, 67 deletions
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index 42b69e9f3d..98e6d1f853 100755 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -327,8 +327,7 @@ void CAimProto::aim_connection_clientlogin(void) }
if(COOKIE)
mir_free(COOKIE);
- COOKIE = (char*)mir_base64_decode(cookie, (unsigned int*)&COOKIE_LENGTH);
-
+ COOKIE = (char*)mir_base64_decode(cookie, &COOKIE_LENGTH);
m_hServerConn = aim_connect(bos_host, bos_port, (tls_cert_name[0] && encryption) ? true : false, bos_host);
if (!m_hServerConn) {
@@ -337,8 +336,6 @@ void CAimProto::aim_connection_clientlogin(void) return;
}
-
-
ForkThread(&CAimProto::aim_protocol_negotiation, nullptr);
}
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index da05270f3d..3d6eb53414 100755 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -98,7 +98,7 @@ struct CAimProto : public PROTO<CAimProto> mir_cs connMutex;
char* COOKIE;
- int COOKIE_LENGTH;
+ size_t COOKIE_LENGTH;
char* MAIL_COOKIE;
int MAIL_COOKIE_LENGTH;
char* AVATAR_COOKIE;
diff --git a/protocols/Discord/src/avatars.cpp b/protocols/Discord/src/avatars.cpp index d2b629e442..73c5b49da4 100644 --- a/protocols/Discord/src/avatars.cpp +++ b/protocols/Discord/src/avatars.cpp @@ -191,7 +191,7 @@ INT_PTR CDiscordProto::SetMyAvatar(WPARAM, LPARAM lParam) ptrA szFileContents((char*)mir_alloc(iFileLength)); fread(szFileContents, 1, iFileLength, in); fclose(in); - szPayload.Append(ptrA(mir_base64_encode((BYTE*)szFileContents.get(), iFileLength))); + szPayload.Append(ptrA(mir_base64_encode(szFileContents.get(), iFileLength))); JSONNode root; root << CHAR_PARAM("avatar", szPayload); Push(new AsyncHttpRequest(this, REQUEST_PATCH, "/users/@me", nullptr, &root)); diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index ea3ad14b32..941f7f0327 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -204,7 +204,7 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url, if (facy.loading_history) return; - std::string b64 = ptrA(mir_base64_encode((PBYTE)sticker.c_str(), (unsigned)sticker.length())); + std::string b64 = ptrA(mir_base64_encode(sticker.c_str(), sticker.length())); b64 = utils::url::encode(b64); std::wstring filename = GetAvatarFolder() + L"\\stickers\\"; diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 0bdf8f04d7..096ae7bfbe 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -382,7 +382,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) _read(file_fd, avatarFile, avatarFileLen);
_close(file_fd);
- ptrA avatarFileB64(mir_base64_encode((PBYTE)avatarFile, avatarFileLen));
+ ptrA avatarFileB64(mir_base64_encode(avatarFile, avatarFileLen));
mir_free(avatarFile);
ptrA avatarFileB64Enc(mir_urlEncode(avatarFileB64));
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 94d2432ff6..89d3bf9c13 100755 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -498,7 +498,7 @@ void CJabberClientCapsManager::UpdateFeatHash() BYTE hash[MIR_SHA1_HASH_SIZE];
mir_sha1_hash((BYTE*)feat_buf.c_str(), feat_buf.GetLength(), hash);
- ptrA szHash(mir_base64_encode((BYTE*)&hash, sizeof(hash)));
+ ptrA szHash(mir_base64_encode(&hash, sizeof(hash)));
m_szFeaturesCrc = szHash;
}
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 31112306bb..6fcc3418a5 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -141,7 +141,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info) if (o == nullptr || XmlGetText(o) == nullptr)
return false;
- unsigned bufferLen;
+ size_t bufferLen;
ptrA buffer((char*)mir_base64_decode( _T2A(XmlGetText(o)), &bufferLen));
if (buffer == nullptr)
return false;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 94a7fae28b..1da840f38e 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -244,7 +244,7 @@ BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft) // let others send data too
Sleep(2);
- char *encoded = mir_base64_encode((PBYTE)(char*)buffer, numRead);
+ char *encoded = mir_base64_encode(buffer, numRead);
msg << XCHILD(L"data", _A2T(encoded)) << XATTR(L"xmlns", JABBER_FEAT_IBB)
<< XATTR(L"sid", ft->jibb->sid) << XATTRI(L"seq", ft->jibb->wPacketId);
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp index 68d2e942eb..aa6d60f45c 100644 --- a/protocols/JabberG/src/jabber_ibb.cpp +++ b/protocols/JabberG/src/jabber_ibb.cpp @@ -178,7 +178,7 @@ BOOL CJabberProto::OnIbbRecvdData(const wchar_t *data, const wchar_t *sid, const item->jibb->wPacketId++;
- unsigned length;
+ size_t length;
ptrA decodedData((char*)mir_base64_decode( _T2A(data), &length));
if (decodedData == nullptr)
return FALSE;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index b5ef1970c6..f48da30b6e 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -172,7 +172,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) fread(buffer, bytes, 1, in);
fclose(in);
- ptrA str(mir_base64_encode((PBYTE)(char*)buffer, bytes));
+ ptrA str(mir_base64_encode(buffer, bytes));
m_ThreadInfo->send(XmlNodeIq(L"result", pInfo) << XQUERY(JABBER_FEAT_AVATAR) << XCHILD(L"query", _A2T(str)) << XATTR(L"mimetype", szMimeType));
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 0b3fc98448..a021a4bf40 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -588,7 +588,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP if (o == nullptr || ptszBinval == nullptr)
return;
- unsigned bufferLen;
+ size_t bufferLen;
ptrA buffer((char*)mir_base64_decode(_T2A(ptszBinval), &bufferLen));
if (buffer == nullptr)
return;
@@ -1406,7 +1406,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t *mimeType)
{
- unsigned resultLen;
+ size_t resultLen;
ptrA body((char*)mir_base64_decode(_T2A(XmlGetText(n)), &resultLen));
if (body == nullptr)
return;
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index c0c14eb400..f255edfd28 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -476,7 +476,7 @@ CMStringW CJabberProto::ExtractImage(HXML node) if (h != INVALID_HANDLE_VALUE) {
DWORD n;
- unsigned int bufferLen;
+ size_t bufferLen;
ptrA buffer((char*)mir_base64_decode(_T2A(image), &bufferLen));
WriteFile(h, buffer, bufferLen, &n, nullptr);
CloseHandle(h);
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index 5d09ec7042..0ac611151a 100755 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -570,7 +570,7 @@ namespace omemo { signal_buffer *key_buf;
ec_public_key_serialize(&key_buf, public_key);
// SIGNAL_UNREF(public_key);
- char *key = mir_base64_encode(signal_buffer_data(key_buf), (unsigned int)signal_buffer_len(key_buf));
+ char *key = mir_base64_encode(signal_buffer_data(key_buf), signal_buffer_len(key_buf));
char *fingerprint = (char*)mir_alloc((signal_buffer_len(key_buf) * 2) + 1);
bin2hex(signal_buffer_data(key_buf), signal_buffer_len(key_buf), fingerprint);
proto->setString("OmemoFingerprintOwn", fingerprint);
@@ -581,7 +581,7 @@ namespace omemo { ec_private_key *private_key = ratchet_identity_key_pair_get_private(new_dev->device_key);
ec_private_key_serialize(&key_buf, private_key);
// SIGNAL_UNREF(private_key);
- key = mir_base64_encode(signal_buffer_data(key_buf), (unsigned int)signal_buffer_len(key_buf));
+ key = mir_base64_encode(signal_buffer_data(key_buf), signal_buffer_len(key_buf));
proto->setString("OmemoDevicePrivateKey", key);
mir_free(key);
signal_buffer_free(key_buf);
@@ -608,11 +608,11 @@ namespace omemo { public_key = ec_key_pair_get_public(signed_pre_key_pair);
ec_public_key_serialize(&key_buf, public_key);
// SIGNAL_UNREF(public_key);
- key = mir_base64_encode(signal_buffer_data(key_buf), (unsigned int)signal_buffer_len(key_buf));
+ key = mir_base64_encode(signal_buffer_data(key_buf), signal_buffer_len(key_buf));
proto->setString("OmemoSignedPreKeyPublic", key);
mir_free(key);
signal_buffer_free(key_buf);
- char *signature = mir_base64_encode(session_signed_pre_key_get_signature(signed_pre_key), (unsigned int)session_signed_pre_key_get_signature_len(signed_pre_key));
+ char *signature = mir_base64_encode(session_signed_pre_key_get_signature(signed_pre_key), session_signed_pre_key_get_signature_len(signed_pre_key));
proto->setString("OmemoSignedPreKeySignature", signature);
mir_free(signature);
@@ -638,7 +638,7 @@ namespace omemo { public_key = ec_key_pair_get_public(pre_key_pair);
ec_public_key_serialize(&key_buf, public_key);
SIGNAL_UNREF(public_key);
- key = mir_base64_encode(signal_buffer_data(key_buf), (unsigned int)signal_buffer_len(key_buf));
+ key = mir_base64_encode(signal_buffer_data(key_buf), signal_buffer_len(key_buf));
mir_snprintf(setting_name, "OmemoPreKey%uPublic", pre_key_id);
proto->setString(setting_name, key);
mir_free(key);
@@ -689,7 +689,7 @@ namespace omemo { char *id_buf_ptr = id_buf;
id_buf_ptr += address->name_len;
memcpy(id_buf_ptr, &address->device_id, sizeof(int32_t));
- char *id_str = mir_base64_encode((BYTE*)id_buf, (unsigned int)(address->name_len + sizeof(int32_t)));
+ char *id_str = mir_base64_encode(id_buf, address->name_len + sizeof(int32_t));
mir_free(id_buf);
char *setting_name = (char*)mir_alloc(strlen(id_str) + 65);
mir_snprintf(setting_name, strlen(id_str) + 64, "%s%s", "OmemoSignalSession_", id_str);
@@ -729,12 +729,12 @@ namespace omemo { {
char *ptr = (char*)szSetting;
ptr += mir_strlen("OmemoSignalSession_");
- char *current_name = mir_base64_encode((BYTE*)data->name, (unsigned int)data->name_len);
+ char *current_name = mir_base64_encode(data->name, data->name_len);
if (strstr(ptr, current_name))
{
char *dev_encoded = ptr;
dev_encoded += strlen(current_name);
- unsigned int len;
+ size_t len;
void *dev_tmp = mir_base64_decode(dev_encoded, &len);
signal_int_list_push_back(data->sessions, *((int *)dev_tmp));
data->arr_size++;
@@ -790,7 +790,7 @@ namespace omemo { char *id_buf_ptr = id_buf;
id_buf_ptr += address->name_len;
memcpy(id_buf_ptr, &address->device_id, sizeof(int32_t));
- char *id_str = mir_base64_encode((BYTE*)id_buf, (unsigned int)(address->name_len + sizeof(int32_t)));
+ char *id_str = mir_base64_encode(id_buf, address->name_len + sizeof(int32_t));
mir_free(id_buf);
char *setting_name = (char*)mir_alloc(strlen(id_str) + 65);
mir_snprintf(setting_name, strlen(id_str) + 64, "%s%s", "OmemoSignalSession_", id_str);
@@ -817,7 +817,7 @@ namespace omemo { char *id_buf_ptr = id_buf;
id_buf_ptr += address->name_len;
memcpy(id_buf_ptr, &address->device_id, sizeof(int32_t));
- char *id_str = mir_base64_encode((BYTE*)id_buf, (unsigned int)(address->name_len + sizeof(int32_t)));
+ char *id_str = mir_base64_encode(id_buf, address->name_len + sizeof(int32_t));
mir_free(id_buf);
char *setting_name = (char*)mir_alloc(strlen(id_str) + 65);
mir_snprintf(setting_name, strlen(id_str) + 64, "%s%s", "OmemoSignalSession_", id_str);
@@ -852,7 +852,7 @@ namespace omemo { char *id_buf_ptr = id_buf;
id_buf_ptr += address->name_len;
memcpy(id_buf_ptr, &address->device_id, sizeof(int32_t));
- char *id_str = mir_base64_encode((BYTE*)id_buf, (unsigned int)(address->name_len + sizeof(int32_t)));
+ char *id_str = mir_base64_encode(id_buf, address->name_len + sizeof(int32_t));
mir_free(id_buf);
char *setting_name = (char*)mir_alloc(strlen(id_str) + 65);
mir_snprintf(setting_name, strlen(id_str) + 64, "%s%s", "OmemoSignalSession_", id_str);
@@ -877,7 +877,7 @@ namespace omemo { {
char *ptr = (char*)szSetting;
ptr += mir_strlen("OmemoSignalSession_");
- char *current_name = mir_base64_encode((BYTE*)data->name, (unsigned int)data->name_len);
+ char *current_name = mir_base64_encode(data->name, data->name_len);
if (strstr(ptr, current_name))
data->settings.push_back(mir_strdup(szSetting));
mir_free(current_name);
@@ -984,7 +984,7 @@ namespace omemo { public_key = ec_key_pair_get_public(pre_key_pair);
ec_public_key_serialize(&key_buf, public_key);
SIGNAL_UNREF(public_key);
- key = mir_base64_encode(signal_buffer_data(key_buf), (unsigned int)signal_buffer_len(key_buf));
+ key = mir_base64_encode(signal_buffer_data(key_buf), signal_buffer_len(key_buf));
mir_snprintf(setting_name, strlen("OmemoSignalPreKey_") + 31, "OmemoPreKey%uPublic", pre_key_id);
data->proto->setString(setting_name, key);
mir_free(key);
@@ -992,7 +992,7 @@ namespace omemo { /* private_key = ec_key_pair_get_private(pre_key_pair);
ec_private_key_serialize(&key_buf, private_key);
SIGNAL_UNREF(private_key);
- key = mir_base64_encode(signal_buffer_data(key_buf), (unsigned int)signal_buffer_len(key_buf));
+ key = mir_base64_encode(signal_buffer_data(key_buf), signal_buffer_len(key_buf));
mir_snprintf(setting_name, strlen("OmemoSignalPreKey_") + 31, "OmemoPreKey%uPrivate", pre_key_id);
data->proto->setString(setting_name, key);
mir_free(key);
@@ -1187,7 +1187,7 @@ namespace omemo { signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
char *pub_key = data->proto->getStringA("OmemoDevicePublicKey");
char *priv_key = data->proto->getStringA("OmemoDevicePrivateKey");
- unsigned int pub_key_len = 0, priv_key_len = 0;
+ size_t pub_key_len = 0, priv_key_len = 0;
char *pub_key_buf = (char*)mir_base64_decode(pub_key, &pub_key_len);
mir_free(pub_key);
char *priv_key_buf = (char*)mir_base64_decode(priv_key, &priv_key_len);
@@ -1242,7 +1242,7 @@ namespace omemo { char *id_buf_ptr = id_buf;
id_buf_ptr += address->name_len;
memcpy(id_buf_ptr, &address->device_id, sizeof(int32_t));
- char *id_str = mir_base64_encode((BYTE*)id_buf, (unsigned int)(address->name_len + sizeof(int32_t)));
+ char *id_str = mir_base64_encode(id_buf, address->name_len + sizeof(int32_t));
mir_free(id_buf);
char *setting_name = (char*)mir_alloc(strlen(id_str) + 65);
mir_snprintf(setting_name, strlen(id_str) + 64, "%s%s", "OmemoSignalIdentity_", id_str);
@@ -1284,7 +1284,7 @@ namespace omemo { char *id_buf_ptr = id_buf;
id_buf_ptr += address->name_len;
memcpy(id_buf_ptr, &address->device_id, sizeof(int32_t));
- char *id_str = mir_base64_encode((BYTE*)id_buf, (unsigned int)(address->name_len + sizeof(int32_t)));
+ char *id_str = mir_base64_encode(id_buf, address->name_len + sizeof(int32_t));
mir_free(id_buf);
char *setting_name = (char*)mir_alloc(strlen(id_str) + 65);
mir_snprintf(setting_name, strlen(id_str) + 64, "%s%s", "OmemoSignalIdentity_", id_str);
@@ -1400,7 +1400,7 @@ namespace omemo { unsigned int key_id_int = _wtoi(key_id);
char *pre_key_a = mir_u2a(pre_key_public);
- unsigned int key_buf_len;
+ size_t key_buf_len;
uint8_t *key_buf = (uint8_t*)mir_base64_decode(pre_key_a, &key_buf_len);
ec_public_key *prekey;
if (curve_decode_point(&prekey, key_buf, key_buf_len, global_context))
@@ -1542,7 +1542,7 @@ namespace omemo { public_key = ec_key_pair_get_public(pre_key_pair);
ec_public_key_serialize(&key_buf, public_key);
SIGNAL_UNREF(public_key);
- key = mir_base64_encode(signal_buffer_data(key_buf), (unsigned int)signal_buffer_len(key_buf));
+ key = mir_base64_encode(signal_buffer_data(key_buf), signal_buffer_len(key_buf));
mir_snprintf(setting_name, "OmemoPreKey%uPublic", pre_key_id);
proto->setString(setting_name, key);
mir_free(key);
@@ -1670,14 +1670,14 @@ void CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime) debugLogA("Jabber OMEMO: message does not have decryption key for our device");
return; //node does not contain key for our device
}
- unsigned int encrypted_key_len;
+ size_t encrypted_key_len;
unsigned char *encrypted_key;
{
char *key_buf = mir_u2a(encrypted_key_base64);
encrypted_key = (unsigned char*)mir_base64_decode(key_buf, &encrypted_key_len);
mir_free(key_buf);
}
- unsigned int iv_len;
+ size_t iv_len;
unsigned char *iv;
{
char *iv_buf = mir_u2a(iv_base64);
@@ -1799,7 +1799,7 @@ void CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime) char *out = nullptr;
{
int dec_success = 0;
- unsigned int payload_len = 0;
+ size_t payload_len = 0;
int outl = 0, round_len = 0;
char *payload_base64 = mir_u2a(payload_base64w);
unsigned char *payload = (unsigned char*)mir_base64_decode(payload_base64, &payload_len);
@@ -2317,7 +2317,7 @@ unsigned int CJabberProto::OmemoEncryptMessage(XmlNode &msg, const wchar_t *msg_ mir_free(in);
HXML encrypted = msg << XCHILDNS(L"encrypted", JABBER_FEAT_OMEMO);
HXML payload = encrypted << XCHILD(L"payload");
- char *payload_base64 = mir_base64_encode((BYTE*)out, tmp_len);
+ char *payload_base64 = mir_base64_encode(out, tmp_len);
wchar_t *payload_base64w = mir_a2u(payload_base64);
mir_free(payload_base64);
xmlSetText(payload, payload_base64w);
@@ -2357,7 +2357,7 @@ unsigned int CJabberProto::OmemoEncryptMessage(XmlNode &msg, const wchar_t *msg_ key_node << XATTR(L"prekey", L"true");
}
signal_buffer *serialized_encrypted_key = ciphertext_message_get_serialized(encrypted_key);
- char *key_base64 = mir_base64_encode(signal_buffer_data(serialized_encrypted_key), (unsigned int)signal_buffer_len(serialized_encrypted_key));
+ char *key_base64 = mir_base64_encode(signal_buffer_data(serialized_encrypted_key), signal_buffer_len(serialized_encrypted_key));
wchar_t *key_base64w = mir_a2u(key_base64);
mir_free(key_base64);
xmlSetText(key_node, key_base64w);
@@ -2367,7 +2367,7 @@ unsigned int CJabberProto::OmemoEncryptMessage(XmlNode &msg, const wchar_t *msg_ }
}
HXML iv_node = header << XCHILD(L"iv");
- char *iv_base64 = mir_base64_encode((BYTE*)iv, _countof_portable(iv));
+ char *iv_base64 = mir_base64_encode(iv, _countof_portable(iv));
wchar_t *iv_base64w = mir_a2u(iv_base64);
mir_free(iv_base64);
xmlSetText(iv_node, iv_base64w);
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index edf0324766..25a0f2bad4 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -144,7 +144,7 @@ char* TMD5Auth::getChallenge(const wchar_t *challenge) iCallCount++;
- unsigned resultLen;
+ size_t resultLen;
ptrA text((char*)mir_base64_decode( _T2A(challenge), &resultLen));
TStringPairs pairs(text);
@@ -201,7 +201,7 @@ char* TMD5Auth::getChallenge(const wchar_t *challenge) uname, realm, nonce, cnonce, iCallCount, serv,
htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
- return mir_base64_encode((PBYTE)buf, cbLen);
+ return mir_base64_encode(buf, cbLen);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -240,7 +240,7 @@ void TScramAuth::Hi(BYTE* res, char* passw, size_t passwLen, char* salt, size_t char* TScramAuth::getChallenge(const wchar_t *challenge)
{
- unsigned chlLen, saltLen = 0;
+ size_t chlLen, saltLen = 0;
ptrA snonce, salt;
int ind = -1;
@@ -293,12 +293,12 @@ char* TScramAuth::getChallenge(const wchar_t *challenge) BYTE srvSig[MIR_SHA1_HASH_SIZE];
mir_hmac_sha1(srvSig, serverKey, sizeof(serverKey), (BYTE*)authmsg, authmsgLen);
- serverSignature = mir_base64_encode((PBYTE)srvSig, sizeof(srvSig));
+ serverSignature = mir_base64_encode(srvSig, sizeof(srvSig));
char buf[4096];
- ptrA encproof(mir_base64_encode((PBYTE)clientProof, sizeof(clientProof)));
+ ptrA encproof(mir_base64_encode(clientProof, sizeof(clientProof)));
int cbLen = mir_snprintf(buf, "c=biws,r=%s,p=%s", snonce, encproof);
- return mir_base64_encode((PBYTE)buf, cbLen);
+ return mir_base64_encode(buf, cbLen);
}
char* TScramAuth::getInitialRequest()
@@ -307,17 +307,17 @@ char* TScramAuth::getInitialRequest() unsigned char nonce[24];
Utils_GetRandom(nonce, sizeof(nonce));
- cnonce = mir_base64_encode((PBYTE)nonce, sizeof(nonce));
+ cnonce = mir_base64_encode(nonce, sizeof(nonce));
char buf[4096];
int cbLen = mir_snprintf(buf, "n,,n=%s,r=%s", uname, cnonce);
msg1 = mir_strdup(buf + 3);
- return mir_base64_encode((PBYTE)buf, cbLen);
+ return mir_base64_encode(buf, cbLen);
}
bool TScramAuth::validateLogin(const wchar_t *challenge)
{
- unsigned chlLen;
+ size_t chlLen;
ptrA chl((char*)mir_base64_decode(_T2A(challenge), &chlLen));
return chl && strncmp((char*)chl + 2, serverSignature, chlLen - 2) == 0;
}
@@ -347,7 +347,7 @@ char* TPlainAuth::getInitialRequest() else
size = mir_snprintf(toEncode, size, "%c%s%c%s", 0, uname, 0, passw);
- return mir_base64_encode((PBYTE)toEncode, (int)size);
+ return mir_base64_encode(toEncode, size);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 9c3214a985..550d9f5612 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -1130,7 +1130,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) if (buffer != nullptr) {
DWORD nRead;
if (ReadFile(hFile, buffer, st.st_size, &nRead, nullptr)) {
- ptrA str(mir_base64_encode((PBYTE)(LPSTR)buffer, nRead));
+ ptrA str(mir_base64_encode(buffer, nRead));
const wchar_t *szFileType = ProtoGetAvatarMimeType(ProtoGetBufferFormat(buffer));
if (str != nullptr && szFileType != nullptr) {
n = v << XCHILD(L"PHOTO");
diff --git a/protocols/MRA/src/MraOfflineMsg.cpp b/protocols/MRA/src/MraOfflineMsg.cpp index a5e786a6ba..1495f6d2a2 100644 --- a/protocols/MRA/src/MraOfflineMsg.cpp +++ b/protocols/MRA/src/MraOfflineMsg.cpp @@ -138,7 +138,7 @@ static DWORD PlainText2message(const CMStringA &szContentType, const CMStringA & // Content-Type: text/plain; charset = CP-1251
if ( strstr(szContentType, "utf-16le")) {
// charset = UTF-16LE// предполагаем что оно в base64
- unsigned dwTextSize;
+ size_t dwTextSize;
ptrA lpszText((LPSTR)mir_base64_decode(szBody, &dwTextSize));
if (lpszText) {
plpsText = CMStringA(lpszText, dwTextSize);
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 32dd012880..54352926ac 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -89,7 +89,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType buf.SetUL(2);
buf.SetLPSW(L"");//***deb possible nick here
buf.SetLPSW(lpwszMessage);
- lpszMessageConverted = mir_base64_encode(buf.Data(), (int)buf.Len());
+ lpszMessageConverted = mir_base64_encode(buf.Data(), buf.Len());
dwMessageConvertedSize = mir_strlen(lpszMessageConverted);
}
// messages with Flash
@@ -109,7 +109,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType DWORD dwBufSize = DWORD(buf.Len() + 128);
lpszBuf.Truncate(dwBufSize);
if (compress2((LPBYTE)(LPCSTR)lpszBuf, &dwBufSize, buf.Data(), (int)buf.Len(), Z_BEST_COMPRESSION) == Z_OK) {
- lpszMessageRTF = mir_base64_encode((LPBYTE)(LPCSTR)lpszBuf, dwBufSize);
+ lpszMessageRTF = mir_base64_encode(lpszBuf, dwBufSize);
dwMessageRTFSize = mir_strlen(lpszMessageRTF);
}
}
@@ -129,7 +129,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType DWORD dwRTFDataSize = lpbRTFData.GetLength();
if (compress2((LPBYTE)(LPCSTR)lpbRTFData, &dwRTFDataSize, buf.Data(), (int)buf.Len(), Z_BEST_COMPRESSION) == Z_OK) {
- lpszMessageRTF = mir_base64_encode((LPBYTE)(LPCSTR)lpbRTFData, dwRTFDataSize);
+ lpszMessageRTF = mir_base64_encode(lpbRTFData, dwRTFDataSize);
dwMessageRTFSize = mir_strlen(lpszMessageRTF);
}
}
@@ -205,7 +205,7 @@ DWORD CMraProto::MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwG buf2.SetUL(2);
buf2.SetLPSW(L"");//***deb possible nick here
buf2.SetLPSW((wszAuthMessage == NULL) ? L"" : *wszAuthMessage);
- buf.SetLPS(CMStringA(ptrA(mir_base64_encode(buf2.Data(), (int)buf2.Len()))));
+ buf.SetLPS(CMStringA(ptrA(mir_base64_encode(buf2.Data(), buf2.Len()))));
buf.SetUL(0);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 9339d5f94c..dd1768c5c3 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1337,7 +1337,7 @@ bool CMraProto::GetPassDB(CMStringA &res) dwPassSize = (*btCryptedPass);
btCryptedPass[dwPassSize + 1 + MIR_SHA1_HASH_SIZE] = 0;
- unsigned dwDecodedSize;
+ size_t dwDecodedSize;
mir_ptr<BYTE> pDecoded((PBYTE)mir_base64_decode((LPCSTR)&btCryptedPass[1 + MIR_SHA1_HASH_SIZE], &dwDecodedSize));
SHA1GetDigest(pDecoded, dwDecodedSize, btRandomData);
if (0 != memcmp(&btCryptedPass[1], btRandomData, MIR_SHA1_HASH_SIZE))
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 5f48fdac43..0cf552080d 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -1570,7 +1570,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & // pre processing - extracting/decoding
if (dwFlags & MESSAGE_FLAG_AUTHORIZE) { // extract auth message из обычного текста
- unsigned dwAuthDataSize;
+ size_t dwAuthDataSize;
LPBYTE lpbAuthData = (LPBYTE)mir_base64_decode(plpsText, &dwAuthDataSize);
if (lpbAuthData) {
BinBuffer buf(lpbAuthData, dwAuthDataSize);
@@ -1607,7 +1607,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & mir_ptr<BYTE> lpbRTFData((LPBYTE)mir_calloc(dwRFTBuffSize));
if (lpbRTFData) {
- unsigned dwCompressedSize;
+ size_t dwCompressedSize;
mir_ptr<BYTE> lpbCompressed((LPBYTE)mir_base64_decode(plpsRFTText, &dwCompressedSize));
DWORD dwRTFDataSize = (DWORD)dwRFTBuffSize;
if (uncompress(lpbRTFData, &dwRTFDataSize, lpbCompressed, dwCompressedSize) == Z_OK) {
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index df0e2542fe..228792b274 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -543,7 +543,7 @@ CMStringA CMsnProto::HotmailLogin(const char* url) unsigned char nonce[24];
Utils_GetRandom(nonce, sizeof(nonce));
- unsigned key1len;
+ size_t key1len;
mir_ptr<BYTE> key1((BYTE*)mir_base64_decode(hotSecretToken, &key1len));
static const unsigned char encdata[] = "WS-SecureConversation";
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 5bf2bb2aa3..9a7f7157bf 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -119,7 +119,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) ezxml_t xmli = ezxml_parse_str(NEWSTR_ALLOCA(szContext), mir_strlen(szContext));
const char *szAvatarHash = ezxml_attr(xmli, "SHA1D");
if (szAvatarHash != nullptr) {
- unsigned hashLen;
+ size_t hashLen;
mir_ptr<BYTE> hash((BYTE*)mir_base64_decode(szAvatarHash, &hashLen));
if (hash)
res = arrayToHex(hash, hashLen);
@@ -217,7 +217,7 @@ int CMsnProto::MSN_SetMyAvatar(const wchar_t* sztFname, void* pData, size_t cbLe mir_sha1_append(&sha1ctx, (BYTE*)pData, (int)cbLen);
mir_sha1_finish(&sha1ctx, sha1d);
- ptrA szSha1d(mir_base64_encode((PBYTE)sha1d, sizeof(sha1d)));
+ ptrA szSha1d(mir_base64_encode(sha1d, sizeof(sha1d)));
mir_sha1_init(&sha1ctx);
ezxml_t xmlp = ezxml_new("msnobj");
@@ -250,7 +250,7 @@ int CMsnProto::MSN_SetMyAvatar(const wchar_t* sztFname, void* pData, size_t cbLe mir_sha1_finish(&sha1ctx, sha1c);
- ptrA szSha1c(mir_base64_encode((PBYTE)sha1c, sizeof(sha1c)));
+ ptrA szSha1c(mir_base64_encode(sha1c, sizeof(sha1c)));
// ezxml_set_attr(xmlp, "SHA1C", szSha1c);
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index 2f82ab7a1c..fa55291a53 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -812,7 +812,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
if (!msnLoggedIn && msnNsThread) {
char *szCircleTicket = ezxml_txt(ezxml_get(body, "CircleResult", 0, "CircleTicket", -1));
- ptrA szCircleTicketEnc(mir_base64_encode((PBYTE)szCircleTicket, (unsigned)mir_strlen(szCircleTicket)));
+ ptrA szCircleTicketEnc(mir_base64_encode(szCircleTicket, mir_strlen(szCircleTicket)));
if (szCircleTicketEnc)
msnNsThread->sendPacket("USR", "SHA A %s", szCircleTicketEnc);
}
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index 35401b533a..35e35259e8 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -296,7 +296,7 @@ void CMsnProto::msn_storeAvatarThread(void* arg) ptrA szEncBuf;
if (dat)
- szEncBuf = mir_base64_encode(dat->data, (unsigned)dat->dataSize);
+ szEncBuf = mir_base64_encode(dat->data, dat->dataSize);
if (photoid[0] && dat)
MSN_StoreUpdateDocument(dat->szName, dat->szMimeType, szEncBuf);
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index 29c93ecf72..9a7aca80ae 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. std::string b64encode(const std::string &s)
{
- return std::string(ptrA(mir_base64_encode((BYTE*)s.c_str(), (unsigned)s.length())));
+ return std::string(ptrA(mir_base64_encode(s.c_str(), s.length())));
}
std::string int2str(int32_t iVal)
|