summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_core.h8
-rw-r--r--plugins/CloudFile/src/http_request.h2
-rw-r--r--plugins/CrashDumper/src/upload.cpp2
-rw-r--r--plugins/CryptoPP/src/base16.cpp6
-rw-r--r--plugins/CryptoPP/src/base16.h6
-rw-r--r--plugins/CryptoPP/src/base64.cpp6
-rw-r--r--plugins/CryptoPP/src/cpp_keys.cpp2
-rw-r--r--plugins/CryptoPP/src/cpp_svcs.cpp4
-rw-r--r--plugins/FileAsMessage/src/dialog.cpp2
-rw-r--r--plugins/GmailNotifier/src/check.cpp2
-rw-r--r--plugins/NewsAggregator/Src/Authentication.cpp2
-rw-r--r--plugins/Quotes/src/ImportExport.cpp2
-rw-r--r--plugins/SmileyAdd/src/customsmiley.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp8
-rwxr-xr-xprotocols/AimOscar/src/connection.cpp5
-rwxr-xr-xprotocols/AimOscar/src/proto.h2
-rw-r--r--protocols/Discord/src/avatars.cpp2
-rw-r--r--protocols/FacebookRM/src/messages.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.cpp2
-rw-r--r--protocols/JabberG/src/jabber_captcha.cpp2
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp2
-rw-r--r--protocols/JabberG/src/jabber_ibb.cpp2
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_misc.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_omemo.cpp50
-rw-r--r--protocols/JabberG/src/jabber_secur.cpp20
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp2
-rw-r--r--protocols/MRA/src/MraOfflineMsg.cpp2
-rw-r--r--protocols/MRA/src/MraSendCommand.cpp8
-rw-r--r--protocols/MRA/src/Mra_functions.cpp2
-rw-r--r--protocols/MRA/src/Mra_proto.cpp4
-rw-r--r--protocols/MSN/src/msn_auth.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp6
-rw-r--r--protocols/MSN/src/msn_soapab.cpp2
-rw-r--r--protocols/MSN/src/msn_srv.cpp2
-rw-r--r--protocols/Twitter/src/utility.cpp2
-rw-r--r--src/mir_app/src/netlibsecurity.cpp6
-rwxr-xr-xsrc/mir_core/src/http.cpp13
40 files changed, 101 insertions, 103 deletions
diff --git a/include/m_core.h b/include/m_core.h
index 7502a967b5..ff2e754157 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -397,11 +397,11 @@ MIR_CORE_DLL(void) mir_hmac_sha256(BYTE hashout[MIR_SHA256_HASH_SIZE], const BYT
///////////////////////////////////////////////////////////////////////////////
// strings
-MIR_CORE_DLL(void*) mir_base64_decode(const char *input, unsigned *outputLen);
-MIR_CORE_DLL(char*) mir_base64_encode(const BYTE *input, unsigned inputLen);
-MIR_CORE_DLL(char*) mir_base64_encodebuf(const BYTE *input, unsigned inputLen, char *output, unsigned outLen);
+MIR_CORE_DLL(void*) mir_base64_decode(const char *input, size_t *outputLen);
+MIR_CORE_DLL(char*) mir_base64_encode(const void *input, size_t inputLen);
+MIR_CORE_DLL(char*) mir_base64_encodebuf(const void *input, size_t inputLen, char *output, size_t outLen);
-__forceinline unsigned mir_base64_encode_bufsize(unsigned inputLen)
+__forceinline size_t mir_base64_encode_bufsize(size_t inputLen)
{
return 4 * ((inputLen + 2) / 3) + 1;
}
diff --git a/plugins/CloudFile/src/http_request.h b/plugins/CloudFile/src/http_request.h
index 39d0d98b57..aed8167b98 100644
--- a/plugins/CloudFile/src/http_request.h
+++ b/plugins/CloudFile/src/http_request.h
@@ -60,7 +60,7 @@ protected:
szLogin,
szPassword);
- ptrA ePair(mir_base64_encode((BYTE*)(char*)cPair, length));
+ ptrA ePair(mir_base64_encode(cPair, length));
length = mir_strlen(ePair) + 7;
char *value = (char*)mir_calloc(length + 1);
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp
index 9b3b501b89..62baee1071 100644
--- a/plugins/CrashDumper/src/upload.cpp
+++ b/plugins/CrashDumper/src/upload.cpp
@@ -83,7 +83,7 @@ void CreateAuthString(char* auth)
char str[110];
int len = mir_snprintf(str, "%s:%s", user, pass);
- mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode((PBYTE)str, len)));
+ mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode(str, len)));
}
diff --git a/plugins/CryptoPP/src/base16.cpp b/plugins/CryptoPP/src/base16.cpp
index e716b4be4f..f75ebe1d1b 100644
--- a/plugins/CryptoPP/src/base16.cpp
+++ b/plugins/CryptoPP/src/base16.cpp
@@ -1,6 +1,6 @@
#include "commonheaders.h"
-char *base16encode(const char *inBuffer, int count)
+char* base16encode(const char *inBuffer, size_t count)
{
char *outBuffer = (char *)malloc(count * 2 + 1);
char *outBufferPtr = outBuffer;
@@ -16,7 +16,7 @@ char *base16encode(const char *inBuffer, int count)
return outBuffer;
}
-char *base16decode(const char *inBuffer, unsigned int *count)
+char* base16decode(const char *inBuffer, size_t *count)
{
char *outBuffer = (char *)mir_alloc(*count);
BYTE *outBufferPtr = (BYTE *)outBuffer;
@@ -53,6 +53,6 @@ char *base16decode(const char *inBuffer, unsigned int *count)
char *base16decode(const char *inBuffer)
{
- unsigned count = (unsigned)strlen(inBuffer);
+ size_t count = strlen(inBuffer);
return base16decode(inBuffer, &count);
}
diff --git a/plugins/CryptoPP/src/base16.h b/plugins/CryptoPP/src/base16.h
index 871bca3fbd..0146428abc 100644
--- a/plugins/CryptoPP/src/base16.h
+++ b/plugins/CryptoPP/src/base16.h
@@ -43,9 +43,9 @@ static const byte asciiToBin16[] =
static const byte binToAscii16[] = "0123456789ABCDEF";
-char *base16encode(const char *, const int);
-char *base16decode(const char *, unsigned*);
-char *base16decode(const char *);
+char* base16encode(const char*, size_t);
+char* base16decode(const char*, size_t*);
+char* base16decode(const char*);
#define encode16(data) binToAscii16[data]
#define decode16(data) asciiToBin16[data]
diff --git a/plugins/CryptoPP/src/base64.cpp b/plugins/CryptoPP/src/base64.cpp
index 9a855cdb8d..779e33e5b1 100644
--- a/plugins/CryptoPP/src/base64.cpp
+++ b/plugins/CryptoPP/src/base64.cpp
@@ -2,19 +2,19 @@
string base64encode(const string& buf)
{
- return (char*)ptrA(mir_base64_encode((PBYTE)buf.data(), (unsigned)buf.length()));
+ return (char*)ptrA(mir_base64_encode(buf.data(), buf.length()));
}
string base64decode(const string& buf)
{
- unsigned len;
+ size_t len;
ptrA plain((char*)mir_base64_decode(buf.data(), &len));
return (plain == NULL) ? string() : string(plain, len);
}
string base64decode(const char *buf)
{
- unsigned len;
+ size_t len;
ptrA plain((char*)mir_base64_decode(buf, &len));
return (plain == NULL) ? string() : string(plain, len);
}
diff --git a/plugins/CryptoPP/src/cpp_keys.cpp b/plugins/CryptoPP/src/cpp_keys.cpp
index 8cfea1c040..ffcf0645a0 100644
--- a/plugins/CryptoPP/src/cpp_keys.cpp
+++ b/plugins/CryptoPP/src/cpp_keys.cpp
@@ -74,7 +74,7 @@ int __cdecl cpp_init_keyb(HANDLE context, LPCSTR key)
pCNTX ptr = get_context_on_id(context); if (!ptr) return 0;
pSIMDATA p = (pSIMDATA)cpp_alloc_pdata(ptr);
- unsigned clen = (unsigned)rtrim(key);
+ size_t clen = rtrim(key);
ptr->features = 0;
LPSTR pub_binary;
diff --git a/plugins/CryptoPP/src/cpp_svcs.cpp b/plugins/CryptoPP/src/cpp_svcs.cpp
index 089d535a8f..00f8b19d8a 100644
--- a/plugins/CryptoPP/src/cpp_svcs.cpp
+++ b/plugins/CryptoPP/src/cpp_svcs.cpp
@@ -50,7 +50,7 @@ LPSTR __cdecl cpp_encrypt(pCNTX ptr, LPCSTR szPlainMsg)
clen = (unsigned)ciphered.length();
mir_free(ptr->tmp);
if (ptr->features & FEATURES_BASE64)
- ptr->tmp = mir_base64_encode((PBYTE)ciphered.data(), clen);
+ ptr->tmp = mir_base64_encode(ciphered.data(), clen);
else {
char *base16 = base16encode(ciphered.data(), clen);
ptr->tmp = mir_strdup(base16);
@@ -70,7 +70,7 @@ LPSTR __cdecl cpp_decrypt(pCNTX ptr, LPCSTR szEncMsg)
ptr->error = ERROR_SEH;
pSIMDATA p = (pSIMDATA)ptr->pdata;
- unsigned clen = (unsigned)strlen(szEncMsg);
+ size_t clen = strlen(szEncMsg);
if (ptr->features & FEATURES_BASE64)
ciphered = (LPSTR)mir_base64_decode(szEncMsg, &clen);
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp
index 36fbd38780..f2339ba63c 100644
--- a/plugins/FileAsMessage/src/dialog.cpp
+++ b/plugins/FileAsMessage/src/dialog.cpp
@@ -680,7 +680,7 @@ void FILEECHO::cmdDATA(char *param)
}
else
{
- unsigned bufLen;
+ size_t bufLen;
mir_ptr<BYTE> buf((BYTE*)mir_base64_decode(param, &bufLen));
memcpy(data, buf, min(bufLen, unsigned(data_end - data)));
data += bufLen;
diff --git a/plugins/GmailNotifier/src/check.cpp b/plugins/GmailNotifier/src/check.cpp
index 6bf60cd2c7..0d642a8a42 100644
--- a/plugins/GmailNotifier/src/check.cpp
+++ b/plugins/GmailNotifier/src/check.cpp
@@ -98,7 +98,7 @@ void CheckMailInbox(Account *curAcc)
// go!
CMStringA loginPass(FORMAT, "%s:%s", curAcc->name, curAcc->pass);
- ptrA loginPassEncoded(mir_base64_encode((BYTE*)loginPass.c_str(), loginPass.GetLength()));
+ ptrA loginPassEncoded(mir_base64_encode(loginPass.c_str(), loginPass.GetLength()));
CMStringA szUrl("https://mail.google.com"), szAuth(FORMAT, "Basic %s", loginPassEncoded.get());
if (curAcc->hosted[0])
diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp
index 4d01851929..e53c4791a0 100644
--- a/plugins/NewsAggregator/Src/Authentication.cpp
+++ b/plugins/NewsAggregator/Src/Authentication.cpp
@@ -42,7 +42,7 @@ void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg)
mir_free(tlogin);
mir_free(tpass);
- mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode((PBYTE)str, len)));
+ mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode(str, len)));
}
INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp
index b2c15faa0d..6836c11520 100644
--- a/plugins/Quotes/src/ImportExport.cpp
+++ b/plugins/Quotes/src/ImportExport.cpp
@@ -331,7 +331,7 @@ bool handle_module(MCONTACT hContact, const IXMLNode::TXMLNodePtr& pXmlModule)
mir_free(dbs.value.pwszVal);
}
else if (0 == mir_wstrcmpi(g_pszXmlTypeBlob, sType.c_str())) {
- unsigned bufLen;
+ size_t bufLen;
mir_ptr<BYTE> buf((PBYTE)mir_base64_decode(_T2A(sValue.c_str()), &bufLen));
if (buf) {
dbs.value.pbVal = buf;
diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp
index aa631e3b2e..72690198d3 100644
--- a/plugins/SmileyAdd/src/customsmiley.cpp
+++ b/plugins/SmileyAdd/src/customsmiley.cpp
@@ -72,7 +72,7 @@ bool SmileyCType::CreateTriggerText(char *text)
int len = (int)mir_strlen(text);
if (len == 0) return false;
- unsigned reslen;
+ size_t reslen;
ptrA res((char*)mir_base64_decode(text, &reslen));
if (res == NULL)
return false;
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index 1eb4404029..1dec35ecbf 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -355,7 +355,7 @@ int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LP
str = (LPSTR)mir_alloc(baselen + 6);
assert(str != nullptr);
// encode data
- if ( mir_base64_encodebuf(dbv.pbVal, dbv.cpbVal, str+1, baselen)) {
+ if (mir_base64_encodebuf(dbv.pbVal, dbv.cpbVal, str+1, baselen)) {
str[baselen+1] = 0;
str[0] = 'n';
xmlValue = new TiXmlText(str);
@@ -537,7 +537,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact)
LPCSTR pUID = xContact->Attribute("uidv");
if (pUID != nullptr) {
- unsigned valLen;
+ size_t valLen;
PBYTE pbVal = nullptr;
switch (*(pUID++)) {
@@ -866,7 +866,7 @@ int CExImContactXML::ImportSetting(LPCSTR pszModule, TiXmlElement *xmlEntry)
DBVARIANT dbv = { 0 };
// convert data
- unsigned baselen;
+ size_t baselen;
switch (value[0]) {
case 'b': //'b' bVal and cVal are valid
@@ -952,7 +952,7 @@ int CExImContactXML::ImportEvent(LPCSTR pszModule, TiXmlElement *xmlEvent)
if (!tmp || tmp[0] == 0)
return ERROR_INVALID_VALUE;
- unsigned baselen;
+ size_t baselen;
mir_ptr<BYTE> tmpVal((PBYTE)mir_base64_decode(tmp, &baselen));
if (tmpVal != NULL) {
// event owning module
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)
diff --git a/src/mir_app/src/netlibsecurity.cpp b/src/mir_app/src/netlibsecurity.cpp
index ee507c7d13..0c678ea6b7 100644
--- a/src/mir_app/src/netlibsecurity.cpp
+++ b/src/mir_app/src/netlibsecurity.cpp
@@ -218,7 +218,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
bool isGSSAPI = mir_wstrcmpi(hNtlm->szProvider, L"Kerberos") == 0;
bool hasChallenge = szChallenge != nullptr && szChallenge[0] != '\0';
if (hasChallenge) {
- unsigned tokenLen;
+ size_t tokenLen;
BYTE *token = (BYTE*)mir_base64_decode(szChallenge, &tokenLen);
if (token == nullptr)
return nullptr;
@@ -336,14 +336,14 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
return nullptr;
}
- szOutputToken = mir_base64_encode((PBYTE)outputSecurityToken.pvBuffer, outputSecurityToken.cbBuffer);
+ szOutputToken = mir_base64_encode(outputSecurityToken.pvBuffer, outputSecurityToken.cbBuffer);
}
else {
if (!login || !psw)
return nullptr;
CMStringA szAuth(FORMAT, "%S:%S", login, psw);
- szOutputToken = mir_base64_encode((BYTE*)szAuth.c_str(), szAuth.GetLength());
+ szOutputToken = mir_base64_encode(szAuth.c_str(), szAuth.GetLength());
complete = true;
}
diff --git a/src/mir_core/src/http.cpp b/src/mir_core/src/http.cpp
index 3b9140c1e9..d46886a5b7 100755
--- a/src/mir_core/src/http.cpp
+++ b/src/mir_core/src/http.cpp
@@ -61,7 +61,7 @@ MIR_CORE_DLL(char*) mir_urlEncode(const char *szUrl)
static char cb64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-MIR_CORE_DLL(char*) mir_base64_encode(const BYTE *input, unsigned inputLen)
+MIR_CORE_DLL(char*) mir_base64_encode(const void *input, size_t inputLen)
{
if (input == nullptr)
return nullptr;
@@ -74,7 +74,7 @@ MIR_CORE_DLL(char*) mir_base64_encode(const BYTE *input, unsigned inputLen)
return mir_base64_encodebuf(input, inputLen, output, outputLen);
}
-MIR_CORE_DLL(char*) mir_base64_encodebuf(const BYTE *input, unsigned inputLen, char *output, unsigned outputLen)
+MIR_CORE_DLL(char*) mir_base64_encodebuf(const void *input, size_t inputLen, char *output, size_t outputLen)
{
if (input == nullptr)
return nullptr;
@@ -82,13 +82,14 @@ MIR_CORE_DLL(char*) mir_base64_encodebuf(const BYTE *input, unsigned inputLen, c
if (outputLen < mir_base64_encode_bufsize(inputLen))
return nullptr;
+ const BYTE *s = (const BYTE*)input;
char *p = output;
for (unsigned i=0; i < inputLen; ) {
int rest = 0;
BYTE chr[3];
- chr[0] = input[i++];
- chr[1] = (i < inputLen) ? input[i++] : rest++, 0;
- chr[2] = (i < inputLen) ? input[i++] : rest++, 0;
+ chr[0] = s[i++];
+ chr[1] = (i < inputLen) ? s[i++] : rest++, 0;
+ chr[2] = (i < inputLen) ? s[i++] : rest++, 0;
*p++ = cb64[ chr[0] >> 2 ];
*p++ = cb64[ ((chr[0] & 0x03) << 4) | (chr[1] >> 4) ];
@@ -126,7 +127,7 @@ static BYTE Base64DecodeTable[] =
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1
};
-MIR_CORE_DLL(void*) mir_base64_decode(const char *input, unsigned *outputLen)
+MIR_CORE_DLL(void*) mir_base64_decode(const char *input, size_t *outputLen)
{
if (input == nullptr)
return nullptr;