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/ShellExt/src/shlipc.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'plugins/ShellExt/src/shlipc.cpp') diff --git a/plugins/ShellExt/src/shlipc.cpp b/plugins/ShellExt/src/shlipc.cpp index 41a195af77..ac2ba3ef01 100644 --- a/plugins/ShellExt/src/shlipc.cpp +++ b/plugins/ShellExt/src/shlipc.cpp @@ -3,13 +3,13 @@ TGroupNode* FindGroupNode(TGroupNode *p, const DWORD Hash, int Depth) { - while (p != NULL) { + while (p != nullptr) { if (p->Hash == Hash && p->Depth == Depth) return p; - if (p->Left != NULL) { + if (p->Left != nullptr) { TGroupNode *q = FindGroupNode(p->Left, Hash, Depth); - if (q != NULL) + if (q != nullptr) return q; } p = p->Right; @@ -22,19 +22,19 @@ TGroupNode* AllocGroupNode(TGroupNodeList *list, TGroupNode *Root, int Depth) TGroupNode *p = (TGroupNode*)calloc(1, sizeof(TGroupNode)); p->Depth = Depth; if (Depth > 0) { - if (Root->Left == NULL) + if (Root->Left == nullptr) Root->Left = p; else { Root = Root->Left; - while (Root->Right != NULL) + while (Root->Right != nullptr) Root = Root->Right; Root->Right = p; } } else { - if (list->First == NULL) + if (list->First == nullptr) list->First = p; - if (list->Last != NULL) + if (list->Last != nullptr) list->Last->Right = p; list->Last = p; } @@ -47,14 +47,14 @@ void ipcPrepareRequests(int ipcPacketSize, THeaderIPC *pipch, DWORD fRequests) pipch->cbSize = sizeof(THeaderIPC); pipch->dwVersion = PLUGIN_MAKE_VERSION(2, 0, 1, 2); pipch->dwFlags = 0; - pipch->pServerBaseAddress = NULL; + pipch->pServerBaseAddress = nullptr; pipch->pClientBaseAddress = pipch; pipch->fRequests = fRequests; pipch->Slots = 0; - pipch->IconsBegin = NULL; - pipch->ContactsBegin = NULL; - pipch->GroupsBegin = NULL; - pipch->NewIconsBegin = NULL; + pipch->IconsBegin = nullptr; + pipch->ContactsBegin = nullptr; + pipch->GroupsBegin = nullptr; + pipch->NewIconsBegin = nullptr; pipch->DataSize = ipcPacketSize - pipch->cbSize; // the server side will adjust these pointers as soon as it opens // the mapped file to it's base address, these are set 'ere because ipcAlloc() @@ -94,7 +94,7 @@ TSlotIPC* ipcAlloc(THeaderIPC *pipch, int nSize) UINT_PTR PSP = UINT_PTR(pipch->DataFramePtr) + sizeof(TSlotIPC) + nSize; // is it past the end? if (PSP >= UINT_PTR(pipch->DataPtrEnd)) - return NULL; + return nullptr; // return the pointer TSlotIPC *p = (TSlotIPC*)pipch->DataFramePtr; // set up the item @@ -115,16 +115,16 @@ void ipcFixupAddresses(THeaderIPC *pipch) INT_PTR diff = INT_PTR(pipch->pClientBaseAddress) - INT_PTR(pipch->pServerBaseAddress); // fix up all the pointers in the header - if (pipch->IconsBegin != NULL) + if (pipch->IconsBegin != nullptr) pipch->IconsBegin = (TSlotIPC*)(UINT_PTR(pipch->IconsBegin) + diff); - if (pipch->ContactsBegin != NULL) + if (pipch->ContactsBegin != nullptr) pipch->ContactsBegin = (TSlotIPC*)(UINT_PTR(pipch->ContactsBegin) + diff); - if (pipch->GroupsBegin != NULL) + if (pipch->GroupsBegin != nullptr) pipch->GroupsBegin = (TSlotIPC*)(UINT_PTR(pipch->GroupsBegin) + diff); - if (pipch->NewIconsBegin != NULL) + if (pipch->NewIconsBegin != nullptr) pipch->NewIconsBegin = (TSlotIPC*)(UINT_PTR(pipch->NewIconsBegin) + diff); pipch->DataPtr = (TSlotIPC*)(UINT_PTR(pipch->DataPtr) + diff); @@ -133,11 +133,11 @@ void ipcFixupAddresses(THeaderIPC *pipch) // and the link list TSlotIPC *pct = pipch->DataPtr; - while (pct != NULL) { + while (pct != nullptr) { // the first pointer is already fixed up, have to get a pointer // to the next pointer and modify where it jumps to TSlotIPC **q = &pct->Next; - if (*q != NULL) + if (*q != nullptr) *q = (TSlotIPC*)(UINT_PTR(*q) + diff); pct = *q; -- cgit v1.2.3