From 1c0172cca4f1e90679321912e20436a7f42f122d Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Sat, 24 Feb 2018 15:32:06 +0100 Subject: more nullptr --- protocols/MRA/src/MraProto.h | 4 +-- protocols/MRA/src/MraSendCommand.cpp | 26 +++++++++---------- protocols/MRA/src/Mra_functions.cpp | 46 +++++++++++++++++----------------- protocols/MRA/src/Sdk/ListMT.h | 22 ++++++++-------- protocols/MRA/src/Sdk/MemoryFind.h | 2 +- protocols/MRA/src/Sdk/MemoryFindByte.h | 2 +- 6 files changed, 51 insertions(+), 51 deletions(-) (limited to 'protocols/MRA/src') diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 86da122f9d..a9a95fbc07 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -198,8 +198,8 @@ struct CMraProto : public PROTO DWORD MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &wszMessage, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize); DWORD MraMessageAsk(DWORD dwMsgID, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &wszMessage, const CMStringW &wszMessageRTF); DWORD MraMessageRecv(const CMStringA &szFrom, DWORD dwMsgID); - DWORD MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones = 0, const CMStringW *wszAuthMessage = 0); - DWORD MraModifyContact(MCONTACT hContact, DWORD *pdwID = 0, DWORD *pdwContactFlag = 0, DWORD *pdwGroupID = 0, const CMStringA *pszEmail = 0, const CMStringW *pwszCustomName = 0, const CMStringA *pszPhones = 0); + DWORD MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones = nullptr, const CMStringW *wszAuthMessage = nullptr); + DWORD MraModifyContact(MCONTACT hContact, DWORD *pdwID = nullptr, DWORD *pdwContactFlag = nullptr, DWORD *pdwGroupID = nullptr, const CMStringA *pszEmail = nullptr, const CMStringW *pwszCustomName = nullptr, const CMStringA *pszPhones = nullptr); DWORD MraOfflineMessageDel(DWORDLONG dwMsgUIDL); DWORD MraMoveContactToGroup(MCONTACT hContact, DWORD dwGroupID, LPCTSTR ptszGroup); DWORD MraAuthorize(const CMStringA &szEmail); diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 54352926ac..8e26f28364 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -8,7 +8,7 @@ class OutBuffer size_t m_max, m_actual; public: - OutBuffer() : m_buf(0), m_max(0), m_actual(0) {} + OutBuffer() : m_buf(nullptr), m_max(0), m_actual(0) {} ~OutBuffer() { if (m_buf) free(m_buf); } void* Allocate(size_t len) @@ -77,7 +77,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType DWORD dwRet = 0; LPSTR lpszMessageConverted = (LPSTR)lpwszMessage.GetString(); - LPSTR lpszMessageRTF = NULL; + LPSTR lpszMessageRTF = nullptr; size_t dwMessageConvertedSize = lpwszMessage.GetLength()*sizeof(WCHAR), dwMessageRTFSize = 0; if (MraIsMessageFlashAnimation(lpwszMessage)) @@ -136,8 +136,8 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType } } - if (lpszMessageRTF == NULL || dwMessageRTFSize == 0) dwFlags &= ~(MESSAGE_FLAG_RTF | MESSAGE_FLAG_FLASH); - if (lpbMultiChatData == NULL || dwMultiChatDataSize == 0) dwFlags &= ~MESSAGE_FLAG_MULTICHAT; + if (lpszMessageRTF == nullptr || dwMessageRTFSize == 0) dwFlags &= ~(MESSAGE_FLAG_RTF | MESSAGE_FLAG_FLASH); + if (lpbMultiChatData == nullptr || dwMultiChatDataSize == 0) dwFlags &= ~MESSAGE_FLAG_MULTICHAT; OutBuffer buf; buf.SetUL(dwFlags); @@ -148,7 +148,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType buf.SetLPS(CMStringA((LPSTR)lpbMultiChatData, (int)dwMultiChatDataSize)); if (bAddToQueue) - dwRet = MraSendQueueCMD(hSendQueueHandle, 0, hContact, dwAckType, NULL, 0, MRIM_CS_MESSAGE, buf.Data(), buf.Len()); + dwRet = MraSendQueueCMD(hSendQueueHandle, 0, hContact, dwAckType, nullptr, 0, MRIM_CS_MESSAGE, buf.Data(), buf.Len()); else dwRet = MraSendCMD(MRIM_CS_MESSAGE, buf.Data(), buf.Len()); @@ -198,18 +198,18 @@ DWORD CMraProto::MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwG buf.SetUL(dwGroupID); buf.SetLPSLowerCase(szEmail); buf.SetLPSW(wszCustomName); - buf.SetLPS((szPhones == NULL) ? "" : *szPhones); + buf.SetLPS((szPhones == nullptr) ? "" : *szPhones); // pack auth message OutBuffer buf2; buf2.SetUL(2); buf2.SetLPSW(L"");//***deb possible nick here - buf2.SetLPSW((wszAuthMessage == NULL) ? L"" : *wszAuthMessage); + buf2.SetLPSW((wszAuthMessage == nullptr) ? L"" : *wszAuthMessage); buf.SetLPS(CMStringA(ptrA(mir_base64_encode(buf2.Data(), buf2.Len())))); buf.SetUL(0); - return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, NULL, 0, MRIM_CS_ADD_CONTACT, buf.Data(), buf.Len()); + return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, nullptr, 0, MRIM_CS_ADD_CONTACT, buf.Data(), buf.Len()); } // change contact @@ -219,7 +219,7 @@ DWORD CMraProto::MraModifyContact(MCONTACT hContact, DWORD *pdwID, DWORD *pdwCon CMStringW wszNick, wszCustomName; DWORD dwID, dwGroupID, dwContactFlag; if (hContact) - GetContactBasicInfoW(hContact, &dwID, &dwGroupID, &dwContactFlag, NULL, NULL, &szEmail, &wszNick, &szPhones); + GetContactBasicInfoW(hContact, &dwID, &dwGroupID, &dwContactFlag, nullptr, nullptr, &szEmail, &wszNick, &szPhones); else dwID = dwGroupID = dwContactFlag = 0; @@ -241,7 +241,7 @@ DWORD CMraProto::MraModifyContact(MCONTACT hContact, DWORD *pdwID, DWORD *pdwCon buf.SetLPSW(wszCustomName); buf.SetLPS(szPhones); - return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, NULL, 0, MRIM_CS_MODIFY_CONTACT, buf.Data(), buf.Len()); + return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, nullptr, 0, MRIM_CS_MODIFY_CONTACT, buf.Data(), buf.Len()); } // remove stored message @@ -377,7 +377,7 @@ HANDLE CMraProto::MraWPRequestW(MCONTACT hContact, DWORD dwAckType, DWORD dwRequ buf.SetLPS(tmp); } - return (HANDLE)MraSendQueueCMD(hSendQueueHandle, dwRequestFlags, hContact, dwAckType, NULL, 0, MRIM_CS_WP_REQUEST, buf.Data(), buf.Len()); + return (HANDLE)MraSendQueueCMD(hSendQueueHandle, dwRequestFlags, hContact, dwAckType, nullptr, 0, MRIM_CS_WP_REQUEST, buf.Data(), buf.Len()); } // Поиск контакта по EMail @@ -407,7 +407,7 @@ DWORD CMraProto::MraGame(const CMStringA &szEmail, DWORD dwGameSessionID, DWORD buf.SetUL(dwGameSessionID); buf.SetUL(dwGameMsg); buf.SetUL(dwGameMsgID); - buf.SetUL(_time32(NULL)); + buf.SetUL(_time32(nullptr)); buf.SetLPS(szData); return MraSendCMD(MRIM_CS_GAME, buf.Data(), buf.Len()); } @@ -449,7 +449,7 @@ DWORD CMraProto::MraSMSW(MCONTACT hContact, const CMStringA &lpszPhone, const CM /* Save phone number for ack notify after send. */ LPBYTE lpbData = (LPBYTE)mir_calloc(lpszPhone.GetLength() + sizeof(size_t)); - if (NULL == lpbData) + if (nullptr == lpbData) return (0); memcpy(lpbData, lpszPhone, lpszPhone.GetLength()); return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ICQACKTYPE_SMS, lpbData, lpszPhone.GetLength(), MRIM_CS_SMS, buf.Data(), buf.Len()); diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 7acb2c8b80..da0902c387 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -114,7 +114,7 @@ DWORD MraAddrListGetFromBuff(const CMStringA &szAddresses, MRA_ADDR_LIST *pmalAd while (TRUE) { LPSTR lpszEndItem = strchr(lpszCurrentItem, ';'); - if (lpszEndItem == NULL) + if (lpszEndItem == nullptr) lpszEndItem = buf + szAddresses.GetLength(); if (!lpszEndItem) break; @@ -189,7 +189,7 @@ bool DB_GetStaticStringA(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueN if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0) { size_t dwRetBuffSizeLocal, dwReadedStringLen = mir_wstrlen(dbv.pwszVal); if (lpszRetBuff && (dwRetBuffSize > dwReadedStringLen)) { - dwRetBuffSizeLocal = WideCharToMultiByte(MRA_CODE_PAGE, 0, dbv.pwszVal, (int)dwReadedStringLen, lpszRetBuff, (int)dwRetBuffSize, NULL, NULL); + dwRetBuffSizeLocal = WideCharToMultiByte(MRA_CODE_PAGE, 0, dbv.pwszVal, (int)dwReadedStringLen, lpszRetBuff, (int)dwRetBuffSize, nullptr, nullptr); (*((CHAR*)(lpszRetBuff + dwRetBuffSizeLocal))) = 0; bRet = true; } @@ -305,7 +305,7 @@ bool DB_GetContactSettingBlob(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszV DWORD CMraProto::MraMoveContactToGroup(MCONTACT hContact, DWORD dwGroupID, LPCTSTR ptszName) { - MraGroupItem *p = NULL; + MraGroupItem *p = nullptr; for (auto &it : m_groups) if (it->m_name == ptszName) { @@ -313,13 +313,13 @@ DWORD CMraProto::MraMoveContactToGroup(MCONTACT hContact, DWORD dwGroupID, LPCTS break; } - if (p == NULL) { + if (p == nullptr) { if (m_groups.getCount() == 20) return 0; DWORD id; for (id = 0; id < 20; id++) - if (m_groups.find((MraGroupItem*)&id) == NULL) + if (m_groups.find((MraGroupItem*)&id) == nullptr) break; DWORD dwContactFlags = CONTACT_FLAG_UNICODE_NAME | CONTACT_FLAG_GROUP | (id << 24); @@ -448,7 +448,7 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D if (dwFlags & SCBIF_ID) setDword(hContact, "ContactID", dwID); - if ((dwFlags & SCBIF_EMAIL) && szEmail != NULL && !szEmail->IsEmpty()) + if ((dwFlags & SCBIF_EMAIL) && szEmail != nullptr && !szEmail->IsEmpty()) mraSetStringExA(hContact, "e-mail", *szEmail); // поля изменения которых отслеживаются @@ -463,14 +463,14 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D } } - if ((dwFlags & SCBIF_NICK) && wszNick != NULL && !wszNick->IsEmpty()) { + if ((dwFlags & SCBIF_NICK) && wszNick != nullptr && !wszNick->IsEmpty()) { if ((dwFlags & SCBIF_FLAG) && ((dwContactFlag & CONTACT_FLAG_UNICODE_NAME) == 0)) DB_SetStringExA(hContact, "CList", "MyHandle", CMStringA(*wszNick)); else DB_SetStringExW(hContact, "CList", "MyHandle", *wszNick); } - if ((dwFlags & SCBIF_PHONES) && szPhones != NULL && !szPhones->IsEmpty()) { + if ((dwFlags & SCBIF_PHONES) && szPhones != nullptr && !szPhones->IsEmpty()) { int iStart = 0, i = 0; while (true) { CMStringA szPhone = szPhones->Tokenize(",", iStart); @@ -525,7 +525,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe if (IsEMailChatAgent(szEmail)) { CMStringW wszEMail = szEmail; GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, wszEMail); - if (si != 0) { + if (si != nullptr) { bool bChatAdded = (si->hContact != NULL); if (bChatAdded == FALSE) hContact = NULL; @@ -538,12 +538,12 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe if (hContact) { if (IsEMailChatAgent(szEmail)) - SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_ONLINE, &szEmail, 0, 0); + SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_ONLINE, &szEmail, nullptr, nullptr); else { if (bTemporary) db_set_b(hContact, "CList", "NotOnList", 1); mraSetStringExA(hContact, "MirVer", MIRVER_UNKNOWN); - SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_OFFLINE, &szEmail, 0, 0); + SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_OFFLINE, &szEmail, nullptr, nullptr); } } } @@ -608,7 +608,7 @@ DWORD CMraProto::MraSetContactStatus(MCONTACT hContact, DWORD dwNewStatus) } else { if (dwOldStatus == ID_STATUS_OFFLINE) { - DWORD dwTime = (DWORD)_time32(NULL); + DWORD dwTime = (DWORD)_time32(nullptr); setDword(hContact, "LogonTS", dwTime); if (bChatAgent) @@ -639,7 +639,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & if (!pszFrom.IsEmpty() || !pszSubject.IsEmpty()) { CMStringA szFrom, szSubject; if (GetEMailFromString(szFrom, szEmail)) - hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL); + hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, nullptr); mir_snwprintf(szStatusText, TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus); } @@ -675,7 +675,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & if (bTrayIconNewMailNotify) pcli->pfnRemoveEvent(0, (LPARAM)m_szModuleName); PUDeletePopup(hWndEMailPopupStatus); - hWndEMailPopupStatus = NULL; + hWndEMailPopupStatus = nullptr; } else { mir_snwprintf(szStatusText, TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal); @@ -861,7 +861,7 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode if (dwErrorCode == NO_ERROR) wcsncpy_s(szErrorText, TranslateW(lpwszErrText), _TRUNCATE); else { - dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), NULL) - 2); + dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), nullptr) - 2); szErrDescription[dwErrDescriptionSize] = 0; mir_snwprintf(szErrorText, L"%s %lu: %s", TranslateW(lpwszErrText), dwErrorCode, szErrDescription); } @@ -996,7 +996,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP SetDlgItemText(hWndDlg, IDC_XMSG, L""); SendMessage(hWndDlg, WM_TIMER, 0, 0); - SetTimer(hWndDlg, 1, 1000, 0); + SetTimer(hWndDlg, 1, 1000, nullptr); iRet = TRUE; } break; @@ -1065,7 +1065,7 @@ bool CMraProto::MraRequestXStatusDetails(DWORD dwXStatus) SetXStatusData *dat = (SetXStatusData*)mir_calloc(sizeof(SetXStatusData)); dat->dwXStatus = dwXStatus; dat->ppro = this; - return DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), NULL, SetXStatusDlgProc, (LPARAM)dat) != -1; + return DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)dat) != -1; } return false; @@ -1181,7 +1181,7 @@ bool CMraProto::MraSendReplyBlogStatus(MCONTACT hContact) SetBlogStatusData* dat = (SetBlogStatusData*)mir_calloc(sizeof(SetBlogStatusData)); dat->ppro = this; dat->hContact = hContact; - return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MINIBLOG), NULL, SendReplyBlogStatusDlgProc, (LPARAM)dat) != NULL; + return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MINIBLOG), nullptr, SendReplyBlogStatusDlgProc, (LPARAM)dat) != nullptr; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1238,7 +1238,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwRetErrorCode = ERROR_FILE_NOT_FOUND; prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0; - prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0); + prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, nullptr, 0); if (prdsiItems[dwRecDeepCurPos].hFind != INVALID_HANDLE_VALUE) { do { dwPathLen -= prdsiItems[dwRecDeepCurPos].dwFileNameLen; @@ -1256,13 +1256,13 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD if (dwRecDeepCurPos == dwRecDeepAllocated) { // need more space dwRecDeepAllocated += RECURSION_DATA_STACK_ITEMS_MIN; prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_realloc(prdsiItems, dwRecDeepAllocated * sizeof(RECURSION_DATA_STACK_ITEM)); - if (prdsiItems == NULL) { + if (prdsiItems == nullptr) { dwRecDeepCurPos = 0; dwRetErrorCode = GetLastError(); break; } } - prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0); + prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, nullptr, 0); } } else {// file @@ -1375,7 +1375,7 @@ static DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplac while (dwFoundCount) { for (i = 0; i < dwReplaceItemsCount; i++) - if (plpbtFounded[i] && (plpbtFounded[i] < plpbtFounded[dwFirstFoundIndex] || plpbtFounded[dwFirstFoundIndex] == NULL)) + if (plpbtFounded[i] && (plpbtFounded[i] < plpbtFounded[dwFirstFoundIndex] || plpbtFounded[dwFirstFoundIndex] == nullptr)) dwFirstFoundIndex = i; if (plpbtFounded[dwFirstFoundIndex]) {// in found @@ -1388,7 +1388,7 @@ static DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplac for (i = 0; i < dwReplaceItemsCount; i++) {// looking for in next time if (plpbtFounded[i] && plpbtFounded[i] < lpbtInBuffCurPrev) { plpbtFounded[i] = (LPBYTE)MemoryFind((lpbtInBuffCurPrev - (LPBYTE)lpInBuff), lpInBuff, dwInBuffSize, plpInReplaceItems[i], pdwInReplaceItemsCounts[i]); - if (plpbtFounded[i] == NULL) dwFoundCount--; + if (plpbtFounded[i] == nullptr) dwFoundCount--; } } } diff --git a/protocols/MRA/src/Sdk/ListMT.h b/protocols/MRA/src/Sdk/ListMT.h index 4c3f6dd5b2..ed9b8cfec9 100644 --- a/protocols/MRA/src/Sdk/ListMT.h +++ b/protocols/MRA/src/Sdk/ListMT.h @@ -76,7 +76,7 @@ typedef CONST PLIST_MT_ITERATOR PCLIST_MT_ITERATOR, LPCLIST_MT_ITERATOR; __inline size_t ListMTGetCount(PCLIST_MT pclmtListMT) { - return((size_t)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount,NULL,NULL)); + return((size_t)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount, nullptr, nullptr)); } @@ -89,12 +89,12 @@ __inline size_t ListMTItemAdd(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTIt if (pclmtListMT->plmtiLast) {// add node to end of list pclmtListMTItem->plmtiPrev=pclmtListMT->plmtiLast; - pclmtListMTItem->plmtiNext=NULL; + pclmtListMTItem->plmtiNext= nullptr; pclmtListMT->plmtiLast->plmtiNext=pclmtListMTItem; pclmtListMT->plmtiLast=pclmtListMTItem; }else{// add the first node to the linked list - pclmtListMTItem->plmtiPrev=NULL; - pclmtListMTItem->plmtiNext=NULL; + pclmtListMTItem->plmtiPrev= nullptr; + pclmtListMTItem->plmtiNext= nullptr; pclmtListMT->plmtiFirst=pclmtListMTItem; pclmtListMT->plmtiLast=pclmtListMTItem; } @@ -113,16 +113,16 @@ __inline DWORD ListMTItemDelete(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMT if (plmtiPrevNode || plmtiNextNode) { - if (plmtiPrevNode && plmtiNextNode==NULL) + if (plmtiPrevNode && plmtiNextNode == nullptr) {// This is the start node in the list to delete // отключился последний подключившийся - plmtiPrevNode->plmtiNext=NULL; + plmtiPrevNode->plmtiNext = nullptr; pclmtListMT->plmtiLast=plmtiPrevNode; }else{ - if (plmtiPrevNode==NULL && plmtiNextNode) + if (plmtiPrevNode == nullptr && plmtiNextNode) {// This is the end node in the list to delete // отключился первый подключившийся - plmtiNextNode->plmtiPrev=NULL; + plmtiNextNode->plmtiPrev = nullptr; pclmtListMT->plmtiFirst=plmtiNextNode; }else{// оключился клиент не первый и не последний //if (plmtiPrev && plmtiNext) @@ -133,11 +133,11 @@ __inline DWORD ListMTItemDelete(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMT } } }else{// This is the only node in the list to delete - pclmtListMT->plmtiFirst=NULL; - pclmtListMT->plmtiLast=NULL; + pclmtListMT->plmtiFirst = nullptr; + pclmtListMT->plmtiLast = nullptr; } - pclmtListMTItem->lpListMT=NULL; + pclmtListMTItem->lpListMT = nullptr; InterlockedDecrementPointer(&pclmtListMT->nCount);// pclmtListMT->nCount--; dwRetErrorCode=NO_ERROR; }else{// попытались удалить элемент не относящийся к данному списку diff --git a/protocols/MRA/src/Sdk/MemoryFind.h b/protocols/MRA/src/Sdk/MemoryFind.h index 75072540bd..f41ea64b6d 100644 --- a/protocols/MRA/src/Sdk/MemoryFind.h +++ b/protocols/MRA/src/Sdk/MemoryFind.h @@ -34,7 +34,7 @@ __inline void *MemoryFind(size_t dwFrom,const void *pBuff,size_t dwBuffSize,const void *pWhatFind,size_t dwWhatFindSize) { - void *pRet=NULL; + void *pRet = nullptr; if (pBuff && dwBuffSize && pWhatFind && dwWhatFindSize && (dwFrom+dwWhatFindSize)<=dwBuffSize) { diff --git a/protocols/MRA/src/Sdk/MemoryFindByte.h b/protocols/MRA/src/Sdk/MemoryFindByte.h index 27a3b96149..146fd74b30 100644 --- a/protocols/MRA/src/Sdk/MemoryFindByte.h +++ b/protocols/MRA/src/Sdk/MemoryFindByte.h @@ -34,7 +34,7 @@ __inline void *MemoryFindByte(size_t dwFrom,const void *pBuff,size_t dwBuffSize,unsigned char chWhatFind) { - void *pRet=NULL; + void *pRet = nullptr; if (pBuff && dwBuffSize && dwFrom