summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-04-29 21:45:13 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-04-29 21:45:13 +0000
commitd88e1dd586130798e44682bcb43380d1e3d25412 (patch)
treeebb1144799baf2fdd451770dd113dc3a23f25cf2
parent6571a527400a6b5efc787305f57f3052abd1e761 (diff)
mra - warning fixes for 64-bit mode
git-svn-id: http://svn.miranda-ng.org/main/trunk@13261 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/MRA/src/MraFilesQueue.cpp22
-rw-r--r--protocols/MRA/src/MraMRIMProxy.cpp2
-rw-r--r--protocols/MRA/src/MraOfflineMsg.cpp12
-rw-r--r--protocols/MRA/src/MraPopUp.cpp3
-rw-r--r--protocols/MRA/src/MraSendCommand.cpp10
-rw-r--r--protocols/MRA/src/stdafx.h2
6 files changed, 24 insertions, 27 deletions
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp
index 1f06e03b45..f6b1e3ebd8 100644
--- a/protocols/MRA/src/MraFilesQueue.cpp
+++ b/protocols/MRA/src/MraFilesQueue.cpp
@@ -412,7 +412,7 @@ bool CMraProto::MraFilesQueueHandCheck(HANDLE hConnection, MRA_FILES_QUEUE_ITEM
if (!_memicmp(btBuff, btBuff + dwBuffSize, dwBuffSize)) {
// email verified
dwBuffSize = (mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1);
- if (dwBuffSize == (size_t)Netlib_Send(hConnection, (LPSTR)btBuff, dwBuffSize, 0))
+ if (dwBuffSize == (size_t)Netlib_Send(hConnection, (LPSTR)btBuff, (int)dwBuffSize, 0))
return true;
}
}
@@ -454,7 +454,7 @@ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat)
dwConnectReTryCount = getDword("ConnectReTryCountFileSend", MRA_DEFAULT_CONN_RETRY_COUNT_FILES);
nloc.cbSize = sizeof(nloc);
nloc.flags = NLOCF_V2;
- nloc.timeout = getDword("TimeOutConnectFileSend", ((MRA_TIMEOUT_DIRECT_CONN - 1) / (dwAddrCount*dwConnectReTryCount)));// -1 сек чтобы был запас
+ nloc.timeout = getDword("TimeOutConnectFileSend", (int)((MRA_TIMEOUT_DIRECT_CONN - 1) / (dwAddrCount*dwConnectReTryCount)));// -1 сек чтобы был запас
if (nloc.timeout < MRA_TIMEOUT_CONN_MIN) nloc.timeout = MRA_TIMEOUT_CONN_MIN;
if (nloc.timeout > MRA_TIMEOUT_CONN_MAX) nloc.timeout = MRA_TIMEOUT_CONN_MAX;
@@ -680,7 +680,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags
lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%s - %s\r\n", dat->pmfqfFiles[i].lpwszName, szBuff);
}
- lpwszCurrentItem += MultiByteToWideChar(MRA_CODE_PAGE, 0, szAddresses, szAddresses.GetLength(), lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)));
+ lpwszCurrentItem += MultiByteToWideChar(MRA_CODE_PAGE, 0, szAddresses, (int)szAddresses.GetLength(), lpwszCurrentItem, (int)((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)));
*lpwszCurrentItem = 0;
MraAddrListGetFromBuff(szAddresses, &dat->malAddrList);
@@ -763,7 +763,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
if (bConnected) {// email verified
bFailed = FALSE;
for (i = 0; i < dat->dwFilesCount; i++) {// receiving files
- pfts.currentFileNumber = i;
+ pfts.currentFileNumber = (int)i;
pfts.wszCurrentFile = wszFileName;
pfts.currentFileSize = dat->pmfqfFiles[i].dwSize;
pfts.currentFileProgress = 0;
@@ -789,11 +789,11 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
//dwBuffSizeUsed = (mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %S", MRA_FT_GET_FILE, dat->pmfqfFiles[i].lpwszName)+1);
memcpy(btBuff, MRA_FT_GET_FILE, sizeof(MRA_FT_GET_FILE));
btBuff[(sizeof(MRA_FT_GET_FILE)-1)] = ' ';
- dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE)+WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (SIZEOF(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL);
+ dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE) + WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, (int)dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (int)(SIZEOF(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL);
btBuff[dwBuffSizeUsed] = 0;
dwBuffSizeUsed++;
- if (dwBuffSizeUsed == (size_t)Netlib_Send(dat->hConnection, (LPSTR)btBuff, dwBuffSizeUsed, 0)) {// file request sended
+ if (dwBuffSizeUsed == (size_t)Netlib_Send(dat->hConnection, (LPSTR)btBuff, (int)dwBuffSizeUsed, 0)) {// file request sended
hFile = CreateFileW(wszFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {// file opened/created, pre allocating disk space, for best perfomance
bOK = FALSE;
@@ -1014,7 +1014,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter)
dwBuffSizeUsed = 0;
while (TRUE) {
- dwReceived = Netlib_Recv(dat->hConnection, ((LPSTR)btBuff + dwBuffSizeUsed), (SIZEOF(btBuff) - dwBuffSizeUsed), 0);
+ dwReceived = Netlib_Recv(dat->hConnection, ((LPSTR)btBuff + dwBuffSizeUsed), (int)(SIZEOF(btBuff) - dwBuffSizeUsed), 0);
if (dwReceived == 0 || dwReceived == SOCKET_ERROR) { // err on receive file name to send
dwRetErrorCode = GetLastError();
ShowFormattedErrorMessage(L"Send files: file send request not received, error", dwRetErrorCode);
@@ -1038,7 +1038,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter)
bFailed = TRUE;
for (j = 0; j < dat->dwFilesCount; j++) {
lpwszFileName = GetFileNameFromFullPathW(dat->pmfqfFiles[j].lpwszName, dat->pmfqfFiles[j].dwNameLen);
- szFileName[WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszFileName, (dat->pmfqfFiles[j].dwNameLen - (lpwszFileName - dat->pmfqfFiles[j].lpwszName)), szFileName, SIZEOF(szFileName), NULL, NULL)] = 0;
+ szFileName[WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszFileName, (int)(dat->pmfqfFiles[j].dwNameLen - (lpwszFileName - dat->pmfqfFiles[j].lpwszName)), szFileName, SIZEOF(szFileName), NULL, NULL)] = 0;
if (!_memicmp(btBuff + sizeof(MRA_FT_GET_FILE), szFileName, dwBuffSizeUsed - (sizeof(MRA_FT_GET_FILE)+1))) {
bFailed = FALSE;
@@ -1051,18 +1051,18 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter)
if (hFile != INVALID_HANDLE_VALUE) {
bOK = FALSE;
dwUpdateTimeNext = GetTickCount();
- pfts.currentFileNumber = i;
+ pfts.currentFileNumber = (int)i;
pfts.wszCurrentFile = dat->pmfqfFiles[j].lpwszName;
pfts.currentFileSize = dat->pmfqfFiles[j].dwSize;
pfts.currentFileProgress = 0;
//pfts.currentFileTime; //as seconds since 1970
- WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[j].lpwszName, dat->pmfqfFiles[j].dwNameLen, szFileName, SIZEOF(szFileName), NULL, NULL);
+ WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[j].lpwszName, (int)dat->pmfqfFiles[j].dwNameLen, szFileName, SIZEOF(szFileName), NULL, NULL);
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)dat->dwIDRequest, (LPARAM)&pfts);
while (TRUE) { // read and sending
if (ReadFile(hFile, btBuff, dwSendBlockSize, (DWORD*)&dwBuffSizeUsed, NULL)) {
- dwReceived = Netlib_Send(dat->hConnection, (LPSTR)btBuff, dwBuffSizeUsed, 0);
+ dwReceived = Netlib_Send(dat->hConnection, (LPSTR)btBuff, (int)dwBuffSizeUsed, 0);
if (dwBuffSizeUsed == dwReceived) {
pfts.currentFileProgress += dwBuffSizeUsed;
pfts.totalProgress += dwBuffSizeUsed;
diff --git a/protocols/MRA/src/MraMRIMProxy.cpp b/protocols/MRA/src/MraMRIMProxy.cpp
index d34282bbb3..e70374d242 100644
--- a/protocols/MRA/src/MraMRIMProxy.cpp
+++ b/protocols/MRA/src/MraMRIMProxy.cpp
@@ -151,7 +151,7 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HANDLE *phConnect
_CrtDbgBreak();
}
else {
- dwBytesReceived = Netlib_Recv(nls.hReadConns[0], (LPSTR)(lpbBufferRcv+dwRcvBuffSizeUsed), (dwRcvBuffSize-dwRcvBuffSizeUsed), 0);
+ dwBytesReceived = Netlib_Recv(nls.hReadConns[0], (LPSTR)(lpbBufferRcv + dwRcvBuffSizeUsed), (int)(dwRcvBuffSize - dwRcvBuffSizeUsed), 0);
if (dwBytesReceived && dwBytesReceived != SOCKET_ERROR) { // connected
dwRcvBuffSizeUsed += dwBytesReceived;
if (dwRcvBuffSizeUsed >= sizeof(mrim_packet_header_t)) { // packet header received
diff --git a/protocols/MRA/src/MraOfflineMsg.cpp b/protocols/MRA/src/MraOfflineMsg.cpp
index 9c5f5269ec..dd0d93f1c5 100644
--- a/protocols/MRA/src/MraOfflineMsg.cpp
+++ b/protocols/MRA/src/MraOfflineMsg.cpp
@@ -81,7 +81,7 @@ static DWORD MraOfflineMessageGetHeaderValue(LPSTR lpszHeader, LPSTR lpszHeaderL
size_t dwValueSize = lpszValueEnd - lpszValue;
lpszValue = lpszHeader + (lpszValue-lpszHeaderLow);
SkeepSPWSP(lpszValue, dwValueSize, &lpszValue, &dwValueSize);
- plpszValue = CMStringA(lpszValue, dwValueSize);
+ plpszValue = CMStringA(lpszValue, (int)dwValueSize);
return NO_ERROR;
}
}
@@ -229,15 +229,15 @@ DWORD MraOfflineMessageGet(const CMStringA &plpsMsg, DWORD &pdwTime, DWORD &pdwF
if (MraOfflineMessageGetHeaderValueLow(lpszMIMEHeaderLow, dwMIMEHeaderSize, "content-type", 12, &lpszMIMEContentType, &dwMIMEContentTypeSize) == NO_ERROR) {
if (MemoryFind(0, lpszMIMEContentType, dwMIMEContentTypeSize, "text/plain", 10)) {
// this is simple text part: text/plain
- return PlainText2message(CMStringA(lpszMIMEContentType, dwMIMEContentTypeSize), CMStringA(lpszMIMEBody, dwMIMEBodySize), plpsText, &pdwFlags);
+ return PlainText2message(CMStringA(lpszMIMEContentType, (int)dwMIMEContentTypeSize), CMStringA(lpszMIMEBody, (int)dwMIMEBodySize), plpsText, &pdwFlags);
}
if (MemoryFind(0, lpszMIMEContentType, dwMIMEContentTypeSize, "application/x-mrim-rtf", 22)) {
- plpsRTFText = CMStringA(lpszMIMEBody, dwMIMEBodySize);
+ plpsRTFText = CMStringA(lpszMIMEBody, (int)dwMIMEBodySize);
pdwFlags |= MESSAGE_FLAG_RTF; // set RTF flag if not exist
return NO_ERROR;
}
if (MemoryFind(0, lpszMIMEContentType, dwMIMEContentTypeSize, "application/x-mrim+xml", 22)) {
- plpsMultiChatData = CMStringA(lpszMIMEBody, dwMIMEBodySize);
+ plpsMultiChatData = CMStringA(lpszMIMEBody, (int)dwMIMEBodySize);
pdwFlags |= MESSAGE_FLAG_MULTICHAT; // set MESSAGE_FLAG_MULTICHAT flag if not exist
return NO_ERROR;
}
@@ -253,10 +253,10 @@ DWORD MraOfflineMessageGet(const CMStringA &plpsMsg, DWORD &pdwTime, DWORD &pdwF
}
if (MemoryFind(0, lpszContentTypeLow, dwContentTypeSize, "text/plain", 10))
- return PlainText2message(CMStringA(lpszContentTypeLow, dwContentTypeSize), CMStringA(lpszBody, dwBodySize), plpsText, &pdwFlags);
+ return PlainText2message(CMStringA(lpszContentTypeLow, (int)dwContentTypeSize), CMStringA(lpszBody, (int)dwBodySize), plpsText, &pdwFlags);
if (MemoryFind(0, lpszContentTypeLow, dwContentTypeSize, "application/x-mrim-auth-req", 27)) { // Content-Type: application/x-mrim-auth-req
- plpsText = CMStringA(lpszBody, dwBodySize);
+ plpsText = CMStringA(lpszBody, (int)dwBodySize);
return NO_ERROR;
}
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp
index 2f04793ffc..0f95e24cd2 100644
--- a/protocols/MRA/src/MraPopUp.cpp
+++ b/protocols/MRA/src/MraPopUp.cpp
@@ -68,9 +68,8 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR
case IDC_PREVIEW:
{
- for (size_t i = 0; i < POPUPS_TYPES_COUNT; i++) {
+ for (int i = 0; i < POPUPS_TYPES_COUNT; i++)
ppro->MraPopupShowFromAgentW(i, 0, TranslateTS(lpcwszPopupsTypes[i]));
- }
}
break;
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp
index e3a5eae541..4852f8a19e 100644
--- a/protocols/MRA/src/MraSendCommand.cpp
+++ b/protocols/MRA/src/MraSendCommand.cpp
@@ -142,10 +142,10 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType
OutBuffer buf;
buf.SetUL(dwFlags);
buf.SetLPSLowerCase(szEmail);
- buf.SetLPS(CMStringA(lpszMessageConverted, dwMessageConvertedSize));
+ buf.SetLPS(CMStringA(lpszMessageConverted, (int)dwMessageConvertedSize));
buf.SetLPS(lpszMessageRTF);
if (dwFlags & MESSAGE_FLAG_MULTICHAT)
- buf.SetLPS(CMStringA((LPSTR)lpbMultiChatData, dwMultiChatDataSize));
+ buf.SetLPS(CMStringA((LPSTR)lpbMultiChatData, (int)dwMultiChatDataSize));
if (bAddToQueue)
dwRet = MraSendQueueCMD(hSendQueueHandle, 0, hContact, dwAckType, NULL, 0, MRIM_CS_MESSAGE, buf.Data(), buf.Len());
@@ -205,7 +205,7 @@ DWORD CMraProto::MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwG
buf2.SetUL(2);
buf2.SetLPSW(_T(""));//***deb possible nick here
buf2.SetLPSW((wszAuthMessage == NULL) ? _T("") : *wszAuthMessage);
- buf.SetLPS(CMStringA( ptrA( mir_base64_encode(buf2.Data(), buf2.Len()))));
+ buf.SetLPS(CMStringA(ptrA(mir_base64_encode(buf2.Data(), (int)buf2.Len()))));
buf.SetUL(0);
@@ -508,12 +508,12 @@ DWORD CMraProto::MraSendPacket(HANDLE hConnection, DWORD dwCMDNum, DWORD dwType,
pmaHeader->proto = (PROTO_VERSION_MAJOR << 16) + PROTO_VERSION_MINOR; // Версия протокола
pmaHeader->seq = dwCMDNum;// Sequence
pmaHeader->msg = dwType;// Тип пакета
- pmaHeader->dlen = dwDataSize;// Длина данных
+ pmaHeader->dlen = (unsigned)dwDataSize;// Длина данных
debugLogA("Sending packet %08x\n", dwType);
memcpy((lpbData + sizeof(mrim_packet_header_t)), lpData, dwDataSize);
- return Netlib_Send(hConnection, (LPSTR)lpbData, (dwDataSize + sizeof(mrim_packet_header_t)), 0);
+ return Netlib_Send(hConnection, (LPSTR)lpbData, (int)(dwDataSize + sizeof(mrim_packet_header_t)), 0);
}
DWORD CMraProto::MraSendCMD(DWORD dwType, LPVOID lpData, size_t dwDataSize)
diff --git a/protocols/MRA/src/stdafx.h b/protocols/MRA/src/stdafx.h
index 7b93e1b833..fa3a91473c 100644
--- a/protocols/MRA/src/stdafx.h
+++ b/protocols/MRA/src/stdafx.h
@@ -14,8 +14,6 @@
#include <WS2tcpip.h>
#pragma comment(lib,"shlwapi.lib")
-#pragma comment(lib,"ws2_32.lib")
-#pragma comment(lib,"mswsock.lib")
#include <crtdbg.h>
#include <malloc.h>