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/MirandaG15/src/CContactList.cpp | 58 ++++++++++++++++----------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'plugins/MirandaG15/src/CContactList.cpp') diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index d8bd87325d..672e686129 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -98,14 +98,14 @@ tstring CContactList::GetContactGroupPath(MCONTACT hContact) //************************************************************************ void CContactList::AddContact(MCONTACT hContact) { - CListContainer *pGroup = NULL; + CListContainer *pGroup = nullptr; tstring strName = CAppletManager::GetContactDisplayname(hContact); char *szProto = GetContactProto(hContact); tstring strGroup = GetContactGroupPath(hContact); // ignore contacts without a valid protocoll - if(szProto == NULL) + if(szProto == nullptr) return; int iStatus = db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE); @@ -119,7 +119,7 @@ void CContactList::AddContact(MCONTACT hContact) psContact->iStatus = iStatus; - if(szStatus != NULL) + if(szStatus != nullptr) psContact->strStatus =toTstring(szStatus); psContact->strProto = toTstring(szProto); @@ -136,7 +136,7 @@ void CContactList::AddContact(MCONTACT hContact) strGroup = L""; strGroup += (strGroup.empty()?L"":L"\\")+psContact->strName; pGroup = GetGroupByString(strGroup); - if(pGroup == NULL) + if(pGroup == nullptr) pGroup = AddGroupByString(strGroup); pGroup->GetGroupData()->hMetaContact = hContact; pGroup->GetGroupData()->pContactListEntry = psContact; @@ -164,7 +164,7 @@ void CContactList::AddContact(MCONTACT hContact) AddContact(hMetaContact); } - CListItem *pItem = NULL; + CListItem *pItem = nullptr; if((!db_mc_isSub(hContact) && !CConfig::GetBoolSetting(CLIST_USEGROUPS)) || strGroup.empty()) { pItem = AddItem(psContact); @@ -173,7 +173,7 @@ void CContactList::AddContact(MCONTACT hContact) else { pGroup = GetGroupByString(strGroup); - if(pGroup == NULL) { + if(pGroup == nullptr) { pGroup = AddGroupByString(strGroup); } pItem = pGroup->AddItem(psContact); @@ -239,7 +239,7 @@ bool CContactList::IsVisible(CContactListEntry *pEntry) { // removes a contact from the list //************************************************************************ void CContactList::RemoveContact(MCONTACT hContact) { - CListContainer *pGroup = NULL; + CListContainer *pGroup = nullptr; ///tstring strGroup = GetContactGroupPath(hContact); @@ -255,7 +255,7 @@ void CContactList::RemoveContact(MCONTACT hContact) { RemoveGroup(((CListContainer*)pContactEntry)->GetGroupData()); } else { pGroup = (CListContainer*)pContactEntry->GetParent(); - ASSERT(pGroup != NULL); + ASSERT(pGroup != nullptr); CContactListEntry *pEntry = GetContactData(pContactEntry); if(!pEntry) { @@ -285,7 +285,7 @@ void CContactList::RemoveContact(MCONTACT hContact) { } CListContainer *pParent = (CListContainer*)pGroup->GetParent(); - while(pParent != NULL && pGroup->IsEmpty() && !pGroup->GetGroupData()->hMetaContact) + while(pParent != nullptr && pGroup->IsEmpty() && !pGroup->GetGroupData()->hMetaContact) { pParent->RemoveGroup(pGroup->GetGroupData()); pGroup = pParent; @@ -308,8 +308,8 @@ CListContainer *CContactList::GetGroupByS strParse = strParse.substr(pos+1); pGroup = FindGroupInGroup(strGroup,pGroup); - if(pGroup == NULL) - return NULL; + if(pGroup == nullptr) + return nullptr; } pGroup = FindGroupInGroup(strParse,pGroup); return pGroup; @@ -324,7 +324,7 @@ CListContainer *CContactList::AddGroupByS tstring strPath = L""; CListContainer *pGroup = (CListContainer*)this; - CListContainer *pGroup2 = NULL; + CListContainer *pGroup2 = nullptr; tstring::size_type pos; while((pos = strParse.find('\\')) != tstring::npos ) { @@ -343,7 +343,7 @@ CListContainer *CContactList::AddGroupByS pGroup->sort(CContactList::CompareEntries); pGroup = pGroup2; } - ASSERT(pGroup != NULL); + ASSERT(pGroup != nullptr); strPath += L"\\"; } strPath += strParse; @@ -399,7 +399,7 @@ void CContactList::DeleteGroup(CContactListGroup*) //************************************************************************ void CContactList::DrawEntry(CLCDGfx *pGfx,CContactListEntry *pEntry,bool bSelected) { - if(pEntry == NULL) + if(pEntry == nullptr) return; tstring strText = L""; @@ -431,7 +431,7 @@ void CContactList::DrawEntry(CLCDGfx *pGfx,CContactListEntry *pEntry,bool bSelec //************************************************************************ void CContactList::DrawGroup(CLCDGfx *pGfx,CContactListGroup *pGroup,bool bOpen,bool bSelected) { - if(pGroup == NULL || ( pGroup->hMetaContact && pGroup->pContactListEntry == NULL)) { + if(pGroup == nullptr || ( pGroup->hMetaContact && pGroup->pContactListEntry == nullptr)) { return; } @@ -540,7 +540,7 @@ void CContactList::RefreshList() m_bUseGroups = CConfig::GetBoolSetting(CLIST_USEGROUPS); m_bUseMetaContacts = db_get_b(NULL,"MetaContacts","Enabled",1) != 0; - CListEntry *pContactEntry = NULL; + CListEntry *pContactEntry = nullptr; MCONTACT hContact = db_find_first(); while(hContact != NULL) { @@ -589,7 +589,7 @@ CListContainer *CContactList::FindGroup(t CListContainer *CContactList::FindGroupInGroup(tstring strGroup,CListContainer *pGroup) { CListContainer::iterator iter = pGroup->begin(); - CListContainer *pItem = NULL; + CListContainer *pItem = nullptr; while(!pGroup->empty() && iter != pGroup->end()) { if((*iter)->GetType() == CONTAINER) @@ -604,7 +604,7 @@ CListContainer *CContactList::FindGroupIn } iter++; } - return NULL; + return nullptr; } //************************************************************************ @@ -613,7 +613,7 @@ CListContainer *CContactList::FindGroupIn CListEntry *CContactList::FindContact(MCONTACT hContact) { if(hContact == NULL) - return NULL; + return nullptr; return FindContactInGroup(hContact,(CListContainer*)this); } @@ -624,11 +624,11 @@ CListEntry *CContactList::FindContact(MCO CListEntry *CContactList::FindContactInGroup(MCONTACT hContact,CListContainer *pGroup) { if(hContact == NULL) - return NULL; + return nullptr; - CListItem *pItemEntry = NULL; - CListEntry *pEntry = NULL; - CListContainer *pGroupEntry = NULL; + CListItem *pItemEntry = nullptr; + CListEntry *pEntry = nullptr; + CListContainer *pGroupEntry = nullptr; CListContainer::iterator iter = pGroup->begin(); while(iter != pGroup->end()) { @@ -650,7 +650,7 @@ CListEntry *CContactList::FindContactInGr } iter++; } - return NULL; + return nullptr; } @@ -722,7 +722,7 @@ void CContactList::OnStatusChange(MCONTACT hContact,int iStatus) // Update the list entry wchar_t *szStatus = pcli->pfnGetStatusModeDescription(iStatus, 0); - if(szStatus != NULL) + if(szStatus != nullptr) pItemData->strStatus =toTstring(szStatus); pItemData->iStatus = iStatus; @@ -828,7 +828,7 @@ void CContactList::OnContactGroupChanged(MCONTACT hContact,tstring strGroup) // Decrease the membercount of the old group CListEntry *pContactEntry = FindContact(hContact); - CContactListGroup *pOldGroup = NULL; + CContactListGroup *pOldGroup = nullptr; // If the contactentry was not found, try adding the contact (metacontacts fix) if(!pContactEntry) { return; @@ -1037,7 +1037,7 @@ CContactListGroup *CContactList::GetGroupObjectByPath(tstring strPath) { ASSERT(!strPath.empty()); - CContactListGroup *pGroup = NULL; + CContactListGroup *pGroup = nullptr; vector::iterator iter = m_Groups.begin(); for(;iter != m_Groups.end();iter++) { @@ -1058,7 +1058,7 @@ CContactListGroup *CContactList::CreateGroupObjectByPath(tstring strPath) ASSERT(!strPath.empty()); CContactListGroup *pNewGroup = new CContactListGroup(); - CContactListGroup *pParentGroup = NULL; + CContactListGroup *pParentGroup = nullptr; tstring strParsePath = L""; tstring strName = strPath; @@ -1085,7 +1085,7 @@ CContactListGroup *CContactList::CreateGroupObjectByPath(tstring strPath) pNewGroup->iGroups = 0; pNewGroup->iEvents = 0; pNewGroup->hMetaContact = NULL; - pNewGroup->pContactListEntry = NULL; + pNewGroup->pContactListEntry = nullptr; m_Groups.push_back(pNewGroup); -- cgit v1.2.3