From 77778c2b9236077c7e79f06aa798affa2f90a1db Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 6 Jun 2015 10:23:34 +0000 Subject: fix for some warnings git-svn-id: http://svn.miranda-ng.org/main/trunk@14023 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SMS/src/recvdlg.cpp | 20 +++++++++----------- plugins/SMS/src/send.cpp | 8 ++++---- plugins/SMS/src/senddlg.cpp | 32 +++++++++++++++++--------------- 3 files changed, 30 insertions(+), 30 deletions(-) (limited to 'plugins/SMS/src') diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index 0409ba6693..f8f401f26f 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -166,7 +166,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l //This function create a new SMS receive window, and insert it to the list. //The function gets void and return the window HWND -HWND RecvSMSWindowAdd(MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size_t dwPhoneSize,LPSTR lpszMessage,size_t dwMessageSize) +HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, size_t dwPhoneSize, LPSTR lpszMessage, size_t dwMessageSize) { HWND hRet = NULL; @@ -207,22 +207,21 @@ HWND RecvSMSWindowAdd(MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(iIcon),IMAGE_ICON,0,0,LR_SHARED); break; default: - lpwszTitlepart=_T("Unknown event type"); + lpwszTitlepart = _T("Unknown event type"); hIcon = 0; } - wszPhoneLocal[0]='+'; + wszPhoneLocal[0] = '+'; if (dwPhoneSize) - { - dwPhoneSize=CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize); - }else{ + dwPhoneSize = CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize); + else { GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(SIZEOF(wszPhoneLocal)-1),&dwPhoneSize,NULL); dwPhoneSize++; } - lpwszContactDisplayName=GetContactNameW(hContact); - mir_sntprintf(wszTitle,SIZEOF(wszTitle),_T("%s - %s"),lpwszContactDisplayName,lpwszTitlepart); - MultiByteToWideChar(CP_UTF8,0,lpszMessage,dwMessageSize,lpwszMessage,(dwMessageSize+MAX_PATH)); + lpwszContactDisplayName = GetContactNameW(hContact); + mir_sntprintf(wszTitle, SIZEOF(wszTitle),_T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart); + MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize+MAX_PATH); SetWindowText(prswdWindowData->hWnd, wszTitle); SetDlgItemText(prswdWindowData->hWnd,IDC_NAME,lpwszContactDisplayName); @@ -232,9 +231,8 @@ HWND RecvSMSWindowAdd(MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size SetFocus(GetDlgItem(prswdWindowData->hWnd,IDC_MESSAGE)); hRet=prswdWindowData->hWnd; - }else{ - MEMFREE(prswdWindowData); } + else MEMFREE(prswdWindowData); } MEMFREE(lpwszMessage); return(hRet); diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp index f1a7afc41b..f07fb812b4 100644 --- a/plugins/SMS/src/send.cpp +++ b/plugins/SMS/src/send.cpp @@ -49,7 +49,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP lpszMessageUTF = (LPSTR)MEMALLOC(dwMessageUTFBuffSize); if (lpszMessageUTF) { - dwBuffSize = (dwPhoneSize + MAX_PATH+WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, dwMessageSize, lpszMessageUTF, dwMessageUTFBuffSize, NULL, NULL)); + dwBuffSize = (dwPhoneSize + MAX_PATH+WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, (int)dwMessageSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, NULL, NULL)); pdbei = (DBEVENTINFO*)MEMALLOC((sizeof(DBEVENTINFO) + dwBuffSize)); if (pdbei) { @@ -57,7 +57,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP LPSTR lpszBuff = (LPSTR)(pdbei + 1); HANDLE hProcess; - WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, dwPhoneSize, szPhone, MAX_PHONE_LEN, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, NULL, NULL); dwPhoneSize=CopyNumberA(szPhone, szPhone, dwPhoneSize); pdbei->timestamp = time(NULL); @@ -68,8 +68,8 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP SendSMSWindowDbeiSet(hWndDlg, pdbei); char *szProto = ssSMSSettings.ppaSMSAccounts[dwModuleIndex]->szModuleName; - if ( ProtoServiceExists(szProto, MS_ICQ_SENDSMS)) { - WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, dwMessageXMLEncodedSize, lpszMessageUTF, dwMessageUTFBuffSize, NULL, NULL); + if (ProtoServiceExists(szProto, MS_ICQ_SENDSMS)) { + WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, (int)dwMessageXMLEncodedSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, NULL, NULL); hProcess = (HANDLE)CallProtoService(szProto, MS_ICQ_SENDSMS, (WPARAM)szPhone, (LPARAM)lpszMessageUTF); SendSMSWindowHProcessSet(hWndDlg, hProcess); } diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 6f336ecdf9..73b3457cb2 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -150,8 +150,9 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l { SetDlgItemText(hWndDlg,IDC_MESSAGE,tszSign); - if (DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS)) SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETSEL,dwSignLen,dwSignLen); - EnableWindow(GetDlgItem(hWndDlg,IDOK),dwSignLen); + if (DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS)) + SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETSEL,dwSignLen,dwSignLen); + EnableWindow(GetDlgItem(hWndDlg,IDOK), dwSignLen != 0); } mir_sntprintf(tszSign,SIZEOF(tszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg)); @@ -281,16 +282,16 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l if (psswdWindowData->bMultiple) { TVITEM tvi; - tvi.mask=TVIF_TEXT; - tvi.hItem=psswdWindowData->hItemSend; - tvi.pszText=tszPhone; - tvi.cchTextMax=SIZEOF(tszPhone); + tvi.mask = TVIF_TEXT; + tvi.hItem = psswdWindowData->hItemSend; + tvi.pszText = tszPhone; + tvi.cchTextMax = SIZEOF(tszPhone); TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi); - dwPhoneSize=mir_tstrlen(tszPhone); - }else{ - dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone)); + dwPhoneSize = mir_tstrlen(tszPhone); } - dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); + else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, SIZEOF(tszPhone)); + + dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(int)dwMessageSize+2); SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize); StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lpwszMessage,dwMessageSize); MEMFREE(lpwszMessage); @@ -358,7 +359,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l LPTSTR lpwszMessage=(LPTSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR)); if (lpwszMessage) { - dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2)); + dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lpwszMessage, (int)dwMessageSize+2); SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize); EnableWindow(GetDlgItem(hWndDlg,IDOK),FALSE); EnableWindow(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),FALSE); @@ -392,7 +393,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l TCHAR tszBuff[MAX_PATH]; size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE); - EnableWindow(GetDlgItem(hWndDlg,IDOK),dwMessageSize); + EnableWindow(GetDlgItem(hWndDlg,IDOK), dwMessageSize != 0); mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg)); SetDlgItemText(hWndDlg,IDC_COUNT,tszBuff); } @@ -874,7 +875,7 @@ void SendSMSWindowNext(HWND hWndDlg) if ( !lptszMessage) return; - dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lptszMessage,dwMessageSize+2); + dwMessageSize = GetDlgItemText(hWndDlg,IDC_MESSAGE, lptszMessage, (int)dwMessageSize+2); // if (SendSMSWindowNextHItemGet(hWndDlg,SendSMSWindowHItemSendGet(hWndDlg))==NULL) SendSMSWindowMultipleSet(hWndDlg,FALSE); tvi.mask=TVIF_TEXT; @@ -1115,8 +1116,9 @@ size_t GetSMSMessageLenMax(HWND hWndDlg) LPTSTR lptszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR))); if (lptszMessage) { - dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lptszMessage,(dwMessageSize+2)); - if (dwMessageSize!=WideCharToMultiByte(CP_UTF8,0,lptszMessage,dwMessageSize,NULL,0,NULL,NULL)) dwLenght=70; + dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize+2); + if (dwMessageSize != WideCharToMultiByte(CP_UTF8, 0, lptszMessage, (int)dwMessageSize, NULL, 0, NULL, NULL)) + dwLenght = 70; MEMFREE(lptszMessage); } return(dwLenght); -- cgit v1.2.3