From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/SMS/src/SMS_svc.cpp | 4 +- plugins/SMS/src/functions.cpp | 12 +++--- plugins/SMS/src/main.cpp | 8 ++-- plugins/SMS/src/options.cpp | 2 +- plugins/SMS/src/receive.cpp | 24 +++++------ plugins/SMS/src/recvdlg.cpp | 40 +++++++++--------- plugins/SMS/src/send.cpp | 8 ++-- plugins/SMS/src/senddlg.cpp | 96 +++++++++++++++++++++---------------------- 8 files changed, 97 insertions(+), 97 deletions(-) (limited to 'plugins/SMS') diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index b224343cd0..330c089f08 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -102,7 +102,7 @@ int ReadMsgSMS(WPARAM, LPARAM lParam) if (db_event_get(cle->hDbEvent, &dbei) == 0) if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) { - if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMS, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) { + if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMS, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) { db_event_markRead(cle->hContact, cle->hDbEvent); return 0; } @@ -123,7 +123,7 @@ int ReadAckSMS(WPARAM, LPARAM lParam) if (db_event_get(cle->hDbEvent, &dbei) == 0) if (dbei.eventType == ICQEVENTTYPE_SMS || dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) { - if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMSCONFIRMATION, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) { + if (RecvSMSWindowAdd(cle->hContact, ICQEVENTTYPE_SMSCONFIRMATION, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) { db_event_delete(cle->hContact, cle->hDbEvent); return 0; } diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index 7f36b72935..78c7f5851c 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -32,7 +32,7 @@ LPSTR GetModuleName(MCONTACT hContact) if (hContact) { lpszRet = GetContactProto(hContact); - if (lpszRet == NULL) + if (lpszRet == nullptr) lpszRet = PROTOCOL_NAMEA; } else lpszRet = PROTOCOL_NAMEA; @@ -243,7 +243,7 @@ BOOL GetXMLFieldEx(LPSTR lpszXML, size_t dwXMLSize, LPSTR *plpszData, size_t *pd { BOOL bRet = FALSE; int thisLevel = 0; - LPSTR lpszFindTag = (LPSTR)tag1, lpszTagEnd = lpszXML, lpszDataStart = NULL; + LPSTR lpszFindTag = (LPSTR)tag1, lpszTagEnd = lpszXML, lpszDataStart = nullptr; va_list va; va_start(va, tag1); @@ -272,7 +272,7 @@ BOOL GetXMLFieldEx(LPSTR lpszXML, size_t dwXMLSize, LPSTR *plpszData, size_t *pd if (++thisLevel == 1) if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszFindTag, -1, lpszTagStart, ((lpszTagEnd + 1) - lpszTagStart)) == CSTR_EQUAL) { lpszFindTag = va_arg(va, LPSTR); - if (lpszFindTag == NULL) lpszDataStart = (lpszTagEnd + 2); + if (lpszFindTag == nullptr) lpszDataStart = (lpszTagEnd + 2); thisLevel = 0; } } @@ -286,7 +286,7 @@ BOOL GetXMLFieldExBuff(LPSTR lpszXML, size_t dwXMLSize, LPSTR lpszBuff, size_t d { BOOL bRet = FALSE; int thisLevel = 0; - LPSTR lpszFindTag = (LPSTR)tag1, lpszTagStart, lpszTagEnd = lpszXML, lpszDataStart = NULL; + LPSTR lpszFindTag = (LPSTR)tag1, lpszTagStart, lpszTagEnd = lpszXML, lpszDataStart = nullptr; va_list va; @@ -313,7 +313,7 @@ BOOL GetXMLFieldExBuff(LPSTR lpszXML, size_t dwXMLSize, LPSTR lpszBuff, size_t d if (++thisLevel == 1) if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszFindTag, -1, lpszTagStart, ((lpszTagEnd + 1) - lpszTagStart)) == CSTR_EQUAL) { lpszFindTag = va_arg(va, LPSTR); - if (lpszFindTag == NULL) lpszDataStart = (lpszTagEnd + 2); + if (lpszFindTag == nullptr) lpszDataStart = (lpszTagEnd + 2); thisLevel = 0; } } @@ -359,7 +359,7 @@ DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplaceItemsC while (dwFoundedCount) { // looking for first to replace for (i = 0; i < dwReplaceItemsCount; i++) - if (plpszFound[i] && (plpszFound[i] < plpszFound[dwFirstFoundedIndex] || plpszFound[dwFirstFoundedIndex] == NULL)) + if (plpszFound[i] && (plpszFound[i] < plpszFound[dwFirstFoundedIndex] || plpszFound[dwFirstFoundedIndex] == nullptr)) dwFirstFoundedIndex = i; // in founded diff --git a/plugins/SMS/src/main.cpp b/plugins/SMS/src/main.cpp index 839b2dc395..c62edf3376 100644 --- a/plugins/SMS/src/main.cpp +++ b/plugins/SMS/src/main.cpp @@ -67,7 +67,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) break; case DLL_PROCESS_DETACH: HeapDestroy(ssSMSSettings.hHeap); - ssSMSSettings.hHeap = NULL; + ssSMSSettings.hHeap = nullptr; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: break; @@ -119,17 +119,17 @@ void VersionConversions() { WCHAR wsztm[MAX_PATH]; - if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,_countof(wsztm),NULL)) + if (DB_SMS_GetStaticStringW(NULL,"UseSignature",wsztm,_countof(wsztm),nullptr)) DB_SMS_SetByte(NULL,"UseSignature",(wsztm[0]=='0')); else DB_SMS_SetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE); - if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,_countof(wsztm),NULL)) + if (DB_SMS_GetStaticStringW(NULL,"SignaturePos",wsztm,_countof(wsztm),nullptr)) DB_SMS_SetByte(NULL,"SignaturePos",(wsztm[0]=='0')); else DB_SMS_SetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS); - if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,_countof(wsztm),NULL)) + if (DB_SMS_GetStaticStringW(NULL,"ShowACK",wsztm,_countof(wsztm),nullptr)) DB_SMS_SetByte(NULL,"ShowACK",(wsztm[0]=='0')); else DB_SMS_SetByte(NULL,"ShowACK",SMS_DEFAULT_SHOWACK); diff --git a/plugins/SMS/src/options.cpp b/plugins/SMS/src/options.cpp index 54fc700a62..6998611134 100644 --- a/plugins/SMS/src/options.cpp +++ b/plugins/SMS/src/options.cpp @@ -37,7 +37,7 @@ INT_PTR CALLBACK DlgProcEditorOptions(HWND hWndDlg, UINT msg, WPARAM wParam, LPA case WM_INITDIALOG: TranslateDialogDefault(hWndDlg); - if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),NULL)==FALSE) + if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,_countof(tszSign),nullptr)==FALSE) mir_snwprintf(tszSign, TranslateT("From %s:\r\n\r\n"), pcli->pfnGetContactDisplayName(0, 0)); SetDlgItemText(hWndDlg,IDC_SIGNATURE,tszSign); diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index c576e2cdd3..40d2ed7933 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -58,14 +58,14 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) dwMessageXMLEncodedSize = MultiByteToWideChar(CP_UTF8, 0, lpszData, (int)dwDataSize, lpwszMessageXMLEncoded, (int)dwBuffLen); DecodeXML(lpwszMessageXMLEncoded, dwMessageXMLEncodedSize, lpwszMessageXMLDecoded, dwBuffLen, &dwMessageXMLDecodedSize); lpszMessageUTF = (LPSTR)lpwszMessageXMLEncoded; - WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLDecoded, (int)dwMessageXMLDecodedSize, lpszMessageUTF, (int)dwBuffLen, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLDecoded, (int)dwMessageXMLDecodedSize, lpszMessageUTF, (int)dwBuffLen, nullptr, nullptr); dwPhoneSize = CopyNumberA(szPhone, lpszPhone, dwPhoneSize); dwPhoneSize = MultiByteToWideChar(CP_UTF8, 0, szPhone, (int)dwPhoneSize, tszPhone, MAX_PHONE_LEN); MCONTACT hContact = HContactFromPhone(tszPhone, dwPhoneSize); dbei.szModule = GetModuleName(hContact); - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.flags = DBEF_UTF; dbei.eventType = ICQEVENTTYPE_SMS; dbei.cbBlob = (mir_snprintf((LPSTR)dbei.pBlob, ((dwBuffLen + dwPhoneSize)), "SMS From: +%s\r\n%s", szPhone, lpszMessageUTF) + sizeof(DWORD)); @@ -93,7 +93,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = {}; dbei.szModule = GetModuleName(hContact); - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.flags = DBEF_UTF; dbei.eventType = ICQEVENTTYPE_SMSCONFIRMATION; if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL) { @@ -133,7 +133,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) char szNetwork[MAX_PATH]; KillTimer(hWndDlg, wParam); - GetXMLFieldExBuff(lpszXML, dwXMLSize, szNetwork, sizeof(szNetwork), NULL, "sms_response", "network", NULL); + GetXMLFieldExBuff(lpszXML, dwXMLSize, szNetwork, sizeof(szNetwork), nullptr, "sms_response", "network", NULL); if (ack->result == ACKRESULT_FAILED || CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "no", 2) == CSTR_EQUAL) { char szBuff[1024]; @@ -154,7 +154,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) lpszErrorDescription = lpszXML; else { lpszErrorDescription = szBuff; - GetXMLFieldExBuff(lpszXML, dwXMLSize, szBuff, sizeof(szBuff), NULL, "sms_response", "error", "params", "param", NULL); + GetXMLFieldExBuff(lpszXML, dwXMLSize, szBuff, sizeof(szBuff), nullptr, "sms_response", "error", "params", "param", NULL); } mir_snwprintf(tszErrorMessage, TranslateT("SMS message didn't send by %S to %s because: %S"), szNetwork, tszPhone, lpszErrorDescription); @@ -181,14 +181,14 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) if (DB_SMS_GetByte(NULL, "ShowACK", SMS_DEFAULT_SHOWACK)) { HWND hwndAccepted = CreateDialog(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMSACCEPT), hWndDlg, SMSAcceptedDlgProc); if (CompareStringA(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, lpszData, (int)dwDataSize, "yes", 3) == CSTR_EQUAL) { - GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), NULL, "sms_response", "source", NULL); - GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), NULL, "sms_response", "message_id", NULL); + GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), nullptr, "sms_response", "source", NULL); + GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), nullptr, "sms_response", "message_id", NULL); } else { SetDlgItemText(hwndAccepted, IDC_ST_SOURCE, TranslateT("From:")); SetDlgItemText(hwndAccepted, IDC_ST_MESSAGEID, TranslateT("To:")); - GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), NULL, "sms_response", "from", NULL); - GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), NULL, "sms_response", "to", NULL); + GetXMLFieldExBuff(lpszXML, dwXMLSize, szSource, sizeof(szSource), nullptr, "sms_response", "from", NULL); + GetXMLFieldExBuff(lpszXML, dwXMLSize, szMessageID, sizeof(szMessageID), nullptr, "sms_response", "to", NULL); } SetDlgItemTextA(hwndAccepted, IDC_NETWORK, szNetwork); SetDlgItemTextA(hwndAccepted, IDC_SOURCE, szSource); @@ -226,7 +226,7 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN) { Skin_PlaySound("RecvSMSMsg"); if (DB_SMS_GetByte(NULL, "AutoPopup", 0)) { - if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMS, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) + if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMS, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) db_event_markRead(hContact, hDbEvent); } else { @@ -247,12 +247,12 @@ int handleNewMessage(WPARAM hContact, LPARAM hDbEvent) else if (dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION) { Skin_PlaySound("RecvSMSConfirmation"); if (DB_SMS_GetByte(NULL, "AutoPopup", 0)) { - if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMSCONFIRMATION, NULL, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) + if (RecvSMSWindowAdd(hContact, ICQEVENTTYPE_SMSCONFIRMATION, nullptr, 0, (LPSTR)dbei.pBlob, dbei.cbBlob)) db_event_delete(hContact, hDbEvent); } else { UINT iIcon; - if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, NULL, NULL, 0, NULL, &iIcon)) { + if (GetDataFromMessage((LPSTR)dbei.pBlob, dbei.cbBlob, nullptr, nullptr, 0, nullptr, &iIcon)) { memcpy(pszServiceFunctionName, SMS_READ_ACK, sizeof(SMS_READ_ACK)); mir_snwprintf(szToolTip, TranslateT("SMS Confirmation from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index 4734d8cf0e..5e2d194e05 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -53,7 +53,7 @@ void RecvSMSWindowDestroy() RECV_SMS_WINDOW_DATA *prswdWindowData; ListMTLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); - while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT, NULL, (LPVOID*)&prswdWindowData) == NO_ERROR) {// цикл + while (ListMTItemGetFirst(&ssSMSSettings.lmtRecvSMSWindowsListMT, nullptr, (LPVOID*)&prswdWindowData) == NO_ERROR) {// цикл RecvSMSWindowRemove(prswdWindowData->hWnd); } ListMTUnLock(&ssSMSSettings.lmtRecvSMSWindowsListMT); @@ -77,7 +77,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA LOGFONT lf; HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0); if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont); - LoadMsgDlgFont(MSGFONTID_YOURMSG, &lf, NULL); + LoadMsgDlgFont(MSGFONTID_YOURMSG, &lf, nullptr); hFont = CreateFontIndirect(&lf); SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0)); @@ -87,16 +87,16 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA // def pos if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? prswdWindowData->hContact : NULL), PROTOCOL_NAMEA, "recv")) - SetWindowPos(hWndDlg, 0, 200, 200, 400, 350, SWP_NOZORDER); + SetWindowPos(hWndDlg, nullptr, 200, 200, 400, 350, SWP_NOZORDER); - InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), NULL, FALSE); + InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, FALSE); break; case WM_CTLCOLORSTATIC: if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) { COLORREF colour; - LoadMsgDlgFont(MSGFONTID_YOURMSG, NULL, &colour); + LoadMsgDlgFont(MSGFONTID_YOURMSG, nullptr, &colour); SetTextColor((HDC)wParam, colour); SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); return (INT_PTR)prswdWindowData->hBkgBrush; @@ -114,15 +114,15 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA { int cx = rcWin.right - rcWin.left - 10; int cy = rcWin.bottom - rcWin.top - 10; - SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), 0, 0, 0, cx - 14, cy - 112, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBER), 0, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_NUMBER), 0, cx - (cx * 35) / 100 - 58, 5, 40, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_READNEXT), 0, cx - 87, cy - 60, 80, 25, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDOK), 0, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), 0, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, 0, 0, cx - 14, cy - 112, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBER), nullptr, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_NUMBER), nullptr, cx - (cx * 35) / 100 - 58, 5, 40, 20, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_READNEXT), nullptr, cx - 87, cy - 60, 80, 25, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDOK), nullptr, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), nullptr, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER); } - RedrawWindow(hWndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + RedrawWindow(hWndDlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE); break; case WM_COMMAND: @@ -160,22 +160,22 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA //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 hRet = NULL; + HWND hRet = nullptr; if ((dwPhoneSize + dwMessageSize) <= MIN_SMS_DBEVENT_LEN) - return NULL; + return nullptr; LPWSTR lpwszMessage; lpwszMessage = (LPWSTR)MEMALLOC(((dwMessageSize + MAX_PATH) * sizeof(WCHAR))); if (!lpwszMessage) - return NULL; + return nullptr; RECV_SMS_WINDOW_DATA *prswdWindowData; prswdWindowData = (RECV_SMS_WINDOW_DATA*)MEMALLOC(sizeof(RECV_SMS_WINDOW_DATA)); if (prswdWindowData) { prswdWindowData->hContact = hContact; - prswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_RECVSMS), NULL, RecvSmsDlgProc, (LPARAM)prswdWindowData); + prswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_RECVSMS), nullptr, RecvSmsDlgProc, (LPARAM)prswdWindowData); if (prswdWindowData->hWnd) { HICON hIcon; WCHAR wszTitle[MAX_PATH] = { 0 }, wszPhoneLocal[MAX_PHONE_LEN] = { 0 }; @@ -193,19 +193,19 @@ HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, s break; case ICQEVENTTYPE_SMSCONFIRMATION: lpwszTitlepart = TranslateT("Received SMS Confirmation"); - GetDataFromMessage(lpszMessage, dwMessageSize, NULL, NULL, 0, NULL, &iIcon); + GetDataFromMessage(lpszMessage, dwMessageSize, nullptr, nullptr, 0, nullptr, &iIcon); hIcon = (HICON)LoadImage(ssSMSSettings.hInstance, MAKEINTRESOURCE(iIcon), IMAGE_ICON, 0, 0, LR_SHARED); break; default: lpwszTitlepart = L"Unknown event type"; - hIcon = 0; + hIcon = nullptr; } wszPhoneLocal[0] = '+'; if (dwPhoneSize) dwPhoneSize = CopyNumberW((wszPhoneLocal + 1), lpwszPhone, dwPhoneSize); else { - GetDataFromMessage(lpszMessage, dwMessageSize, NULL, (wszPhoneLocal + 1), (_countof(wszPhoneLocal) - 1), &dwPhoneSize, NULL); + GetDataFromMessage(lpszMessage, dwMessageSize, nullptr, (wszPhoneLocal + 1), (_countof(wszPhoneLocal) - 1), &dwPhoneSize, nullptr); dwPhoneSize++; } diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp index c0ab45f149..01cd0ac02c 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, (int)dwMessageSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, NULL, NULL)); + dwBuffSize = (dwPhoneSize + MAX_PATH+WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, (int)dwMessageSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, nullptr, nullptr)); pdbei = (DBEVENTINFO*)MEMALLOC((sizeof(DBEVENTINFO) + dwBuffSize)); if (pdbei) { @@ -57,10 +57,10 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP LPSTR lpszBuff = (LPSTR)(pdbei + 1); HANDLE hProcess; - WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, nullptr, nullptr); dwPhoneSize=CopyNumberA(szPhone, szPhone, dwPhoneSize); - pdbei->timestamp = time(NULL); + pdbei->timestamp = time(nullptr); pdbei->flags = (DBEF_SENT | DBEF_UTF); pdbei->eventType = ICQEVENTTYPE_SMS; pdbei->cbBlob = (mir_snprintf(lpszBuff, dwBuffSize, "SMS To: +%s\r\n%s", szPhone, lpszMessageUTF) + 4); @@ -69,7 +69,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP char *szProto = ssSMSSettings.ppaSMSAccounts[dwModuleIndex]->szModuleName; if (ProtoServiceExists(szProto, MS_ICQ_SENDSMS)) { - WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, (int)dwMessageXMLEncodedSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, (int)dwMessageXMLEncodedSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, nullptr, nullptr); 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 c1fb06c02d..bb501bf051 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -65,7 +65,7 @@ void SendSMSWindowDestroy() SEND_SMS_WINDOW_DATA *psswdWindowData; ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); - while (ListMTItemGetFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR) + while (ListMTItemGetFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) SendSMSWindowRemove(psswdWindowData->hWnd); ListMTUnLock(&ssSMSSettings.lmtSendSMSWindowsListMT); @@ -103,7 +103,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA LOGFONT lf; HFONT hFont = (HFONT)SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0); if (hFont && hFont != (HFONT)SendDlgItemMessage(hWndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont); - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, nullptr); hFont = CreateFontIndirect(&lf); SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0)); @@ -111,7 +111,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA psswdWindowData->hBkgBrush = CreateSolidBrush(colour); } { - HWND hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, TEXT(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); + HWND hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, TEXT(""), WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandle(nullptr), nullptr); TOOLINFO ti; memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); @@ -136,7 +136,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA RECT rcWin, rcList; GetWindowRect(hWndDlg, &rcWin); GetWindowRect(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), &rcList); - SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 10, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 10, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); } SendSMSWindowUpdateAccountList(hWndDlg); @@ -159,9 +159,9 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA } if (Utils_RestoreWindowPosition(hWndDlg, (DB_SMS_GetByte(NULL, "SavePerContact", 0) ? psswdWindowData->hMyContact : NULL), PROTOCOL_NAMEA, "send")) {// def pos - SetWindowPos(hWndDlg, 0, 200, 200, 400, 350, SWP_NOZORDER); + SetWindowPos(hWndDlg, nullptr, 200, 200, 400, 350, SWP_NOZORDER); } - InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), NULL, FALSE); + InvalidateRect(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, FALSE); return TRUE; case WM_GETMINMAXINFO: if (psswdWindowData->bMultiple) { @@ -188,22 +188,22 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA } cx -= 10; /* XXX: fix window sizes for aero. */ cy -= 10; - SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), 0, 0, 0, cx - 14, cy - 132, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ACCOUNTS), 0, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDRESS), 0, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_ADDRESS), 0, cx - (cx * 35) / 100 - 68, 5, 50, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_MULTIPLE), 0, cx - ((cx * 35) / 100 + 35) / 2 - 11, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_SAVENUMBER), 0, cx - (cx * 35) / 100 - 58, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_HISTORY), 0, 0, 0, 20, 20, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(GetDlgItem(hWndDlg, IDC_COUNT), 0, cx - 61, 52, 50, 15, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_CHARS), 0, cx - 106, 52, 40, 15, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDNUMBER), 0, cx, 5, 170, 20, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), 0, cx, 25, 170, cy - 90, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_MESSAGE), nullptr, 0, 0, cx - 14, cy - 132, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(GetDlgItem(hWndDlg, IDC_NAME), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(GetDlgItem(hWndDlg, IDC_ACCOUNTS), nullptr, 0, 0, (cx * 35) / 100, 20, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDRESS), nullptr, cx - (cx * 35) / 100 - 11, 5, (cx * 35) / 100, 20, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_ADDRESS), nullptr, cx - (cx * 35) / 100 - 68, 5, 50, 20, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_MULTIPLE), nullptr, cx - ((cx * 35) / 100 + 35) / 2 - 11, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_SAVENUMBER), nullptr, cx - (cx * 35) / 100 - 58, 30, ((cx * 35) / 100 + 35) / 2, 20, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_HISTORY), nullptr, 0, 0, 20, 20, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(GetDlgItem(hWndDlg, IDC_COUNT), nullptr, cx - 61, 52, 50, 15, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_ST_CHARS), nullptr, cx - 106, 52, 40, 15, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_ADDNUMBER), nullptr, cx, 5, 170, 20, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), nullptr, cx, 25, 170, cy - 90, SWP_NOZORDER); //SetWindowPos(GetDlgItem(hWndDlg,IDC_REMOVENUMBER),0,cx,cy - 110 + 25,170,20,SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDOK), 0, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER); - SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), 0, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER); - RedrawWindow(hWndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + SetWindowPos(GetDlgItem(hWndDlg, IDOK), nullptr, cx / 2 - 87, cy - 60, 80, 25, SWP_NOZORDER); + SetWindowPos(GetDlgItem(hWndDlg, IDCANCEL), nullptr, cx / 2 + 7, cy - 60, 80, 25, SWP_NOZORDER); + RedrawWindow(hWndDlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE); } break; case WM_TIMER: @@ -234,7 +234,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA if ((HWND)lParam == GetDlgItem(hWndDlg, IDC_MESSAGE)) { COLORREF colour; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &colour); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &colour); SetTextColor((HDC)wParam, colour); SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); return((INT_PTR)psswdWindowData->hBkgBrush); @@ -263,7 +263,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hWndDlg, IDC_NUMBERSLIST), TRUE); if (psswdWindowData->hMyContact == NULL) EnableWindow(GetDlgItem(hWndDlg, IDC_NAME), TRUE); SetFocus(GetDlgItem(hWndDlg, IDC_MESSAGE)); - psswdWindowData->hItemSend = NULL; + psswdWindowData->hItemSend = nullptr; } break; case TIMEDOUT_RETRY: @@ -291,7 +291,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA MEMFREE(lpwszMessage); } } - SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL); + SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr); break; } break; @@ -305,7 +305,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA { wchar_t tszPhone[MAX_PHONE_LEN]; if (IsPhoneW(tszPhone, GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, _countof(tszPhone)))) { - TVINSERTSTRUCT tvis = { 0 }; + TVINSERTSTRUCT tvis = {}; tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.hInsertAfter = TVI_SORT; tvis.item.pszText = tszPhone; @@ -362,7 +362,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hWndDlg, IDC_ADDRESS), FALSE); SendDlgItemMessage(hWndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0); StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lpwszMessage, dwMessageSize); - SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL); + SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr); MEMFREE(lpwszMessage); } @@ -495,7 +495,7 @@ INT_PTR CALLBACK SMSTimedOutDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hWndDlg); GetWindowRect(hWndDlg, &rc); GetWindowRect(GetParent(hWndDlg), &rcParent); - SetWindowPos(hWndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(hWndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE); KillTimer(GetParent(hWndDlg), TIMERID_MSGSEND); } return TRUE; @@ -524,7 +524,7 @@ INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA RECT rc, rcParent; GetWindowRect(hWndDlg, &rc); GetWindowRect(GetParent(hWndDlg), &rcParent); - SetWindowPos(hWndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + SetWindowPos(hWndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } return TRUE; @@ -546,12 +546,12 @@ INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA //The function gets void and return the window HWND HWND SendSMSWindowAdd(MCONTACT hContact) { - HWND hRet = NULL; + HWND hRet = nullptr; SEND_SMS_WINDOW_DATA *psswdWindowData = (SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA)); if (!psswdWindowData) - return NULL; + return nullptr; psswdWindowData->hMyContact = hContact; - psswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMS), NULL, SendSmsDlgProc, (LPARAM)psswdWindowData); + psswdWindowData->hWnd = CreateDialogParam(ssSMSSettings.hInstance, MAKEINTRESOURCE(IDD_SENDSMS), nullptr, SendSmsDlgProc, (LPARAM)psswdWindowData); if (psswdWindowData->hWnd) { ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); ListMTItemAdd(&ssSMSSettings.lmtSendSMSWindowsListMT, &psswdWindowData->lmtListMTItem, psswdWindowData); @@ -616,14 +616,14 @@ void SendSMSWindowHContactSet(HWND hWndDlg, MCONTACT hContact) //the same process HWND SendSMSWindowHwndByHProcessGet(HANDLE hProcess) { - HWND hRet = NULL; + HWND hRet = nullptr; SEND_SMS_WINDOW_DATA *psswdWindowData; LIST_MT_ITERATOR lmtiIterator; ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator); do {// цикл - if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR) + if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) if (psswdWindowData->hProcess == hProcess) { hRet = psswdWindowData->hWnd; break; @@ -675,16 +675,16 @@ void SendSMSWindowMultipleSet(HWND hWndDlg, BOOL bMultiple) EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), FALSE); SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("<< Single")); - if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); - SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right - rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); + if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, nullptr, 0, 0, rcWin.right - rcWin.left - (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left + (rcList.right - rcList.left) + 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); } else { if (psswdWindowData->hMyContact) AddContactPhonesToCombo(hWndDlg, psswdWindowData->hMyContact); EnableWindow(GetDlgItem(hWndDlg, IDC_SAVENUMBER), TRUE); SetDlgItemText(hWndDlg, IDC_MULTIPLE, TranslateT("Multiple >>")); - SetWindowPos(hWndDlg, 0, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); - if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, 0, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); + SetWindowPos(hWndDlg, nullptr, rcWin.left, rcWin.top, rcWin.right - rcWin.left - (rcList.right - rcList.left) - 11, rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); + if (wp.showCmd == SW_MAXIMIZE) SetWindowPos(hWndDlg, nullptr, 0, 0, rcWin.right - rcWin.left + (rcList.right - rcList.left + 11), rcWin.bottom - rcWin.top, SWP_NOZORDER | SWP_NOMOVE); } } @@ -750,7 +750,7 @@ void SendSMSWindowHItemSendSet(HWND hWndDlg, HTREEITEM hItemSend) // HTREEITEM SendSMSWindowHItemSendGet(HWND hWndDlg) { - HTREEITEM hRet = NULL; + HTREEITEM hRet = nullptr; SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg); if (psswdWindowData) hRet = psswdWindowData->hItemSend; @@ -811,7 +811,7 @@ HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg, HTREEITEM hItem) } } } - return(NULL); + return(nullptr); } //This function get the HANDLE of an user. if there is already a SMS send window for this contact @@ -819,14 +819,14 @@ HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg, HTREEITEM hItem) //The function gets the HANDLE of a contact and return HWND HWND SendSMSWindowIsOtherInstanceHContact(MCONTACT hContact) { - HWND hRet = NULL; + HWND hRet = nullptr; SEND_SMS_WINDOW_DATA *psswdWindowData; LIST_MT_ITERATOR lmtiIterator; ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator); do {// цикл - if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR) + if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) if (psswdWindowData->hMyContact == hContact) { hRet = psswdWindowData->hWnd; break; @@ -861,7 +861,7 @@ void SendSMSWindowNext(HWND hWndDlg) dwPhoneSize = mir_wstrlen(tszPhone); SendSMSWindowNumberSet(hWndDlg, tszPhone, dwPhoneSize); StartSmsSend(hWndDlg, SendDlgItemMessage(hWndDlg, IDC_ACCOUNTS, CB_GETCURSEL, 0, 0), tszPhone, dwPhoneSize, lptszMessage, dwMessageSize); - SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, NULL); + SetTimer(hWndDlg, TIMERID_MSGSEND, TIMEOUT_MSGSEND, nullptr); MEMFREE(lptszMessage); } @@ -934,7 +934,7 @@ void SendSMSWindowsUpdateAllAccountLists() ListMTLock(&ssSMSSettings.lmtSendSMSWindowsListMT); ListMTIteratorMoveFirst(&ssSMSSettings.lmtSendSMSWindowsListMT, &lmtiIterator); do {// цикл - if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&psswdWindowData) == NO_ERROR) { + if (ListMTIteratorGet(&lmtiIterator, nullptr, (LPVOID*)&psswdWindowData) == NO_ERROR) { SendSMSWindowUpdateAccountList(psswdWindowData->hWnd); } } while (ListMTIteratorMoveNext(&lmtiIterator)); @@ -1004,7 +1004,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact, LPSTR lpszModule, LPSTR char szBuff[MAX_PATH]; wchar_t tszPhone[MAX_PHONE_LEN], tszPhoneRaw[MAX_PHONE_LEN]; size_t i, dwPhoneSize; - TVINSERTSTRUCT tvis = { 0 }; + TVINSERTSTRUCT tvis = {}; if (phParent) tvis.hParent = (*phParent); tvis.item.mask = (TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE); @@ -1015,7 +1015,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact, LPSTR lpszModule, LPSTR tszPhone[0] = '+'; dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize); if (IsPhoneW(tszPhone, dwPhoneSize)) { - if (tvis.hParent == NULL) { + if (tvis.hParent == nullptr) { tvis.item.pszText = pcli->pfnGetContactDisplayName(hContact, 0); tvis.hParent = TreeView_InsertItem(hWndList, &tvis); } @@ -1030,7 +1030,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact, LPSTR lpszModule, LPSTR tszPhone[0] = '+'; dwPhoneSize = CopyNumberW(tszPhone + 1, tszPhoneRaw, dwPhoneSize); if (IsPhoneW(tszPhone, dwPhoneSize)) { - if (tvis.hParent == NULL) { + if (tvis.hParent == nullptr) { tvis.item.pszText = pcli->pfnGetContactDisplayName(hContact, 0); tvis.hParent = TreeView_InsertItem(hWndList, &tvis); } @@ -1052,7 +1052,7 @@ void SendSMSWindowFillTreeView(HWND hWnd) TreeView_DeleteAllItems(hWndTreeView); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - HTREEITEM hParent = NULL; + HTREEITEM hParent = nullptr; LPSTR lpszProto = GetContactProto(hContact); if (lpszProto) { AddContactPhonesToTreeViewParam(hContact, lpszProto, "Phone", hWndTreeView, &hParent); @@ -1075,7 +1075,7 @@ size_t GetSMSMessageLenMax(HWND hWndDlg) LPTSTR lptszMessage = (LPTSTR)MEMALLOC(((dwMessageSize + 4)*sizeof(wchar_t))); if (lptszMessage) { dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize + 2); - if (dwMessageSize != WideCharToMultiByte(CP_UTF8, 0, lptszMessage, (int)dwMessageSize, NULL, 0, NULL, NULL)) + if (dwMessageSize != WideCharToMultiByte(CP_UTF8, 0, lptszMessage, (int)dwMessageSize, nullptr, 0, nullptr, nullptr)) dwLenght = 70; MEMFREE(lptszMessage); } -- cgit v1.2.3