summaryrefslogtreecommitdiff
path: root/plugins/ContactsPlus
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:03:31 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:07:33 +0100
commita7c24ca48995cf2bf436156302f96b91bf135409 (patch)
tree953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/ContactsPlus
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/ContactsPlus')
-rw-r--r--plugins/ContactsPlus/src/main.cpp6
-rw-r--r--plugins/ContactsPlus/src/receive.cpp18
-rw-r--r--plugins/ContactsPlus/src/send.cpp26
-rw-r--r--plugins/ContactsPlus/src/utils.cpp16
4 files changed, 33 insertions, 33 deletions
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp
index 5e3289a06a..66b604553d 100644
--- a/plugins/ContactsPlus/src/main.cpp
+++ b/plugins/ContactsPlus/src/main.cpp
@@ -130,7 +130,7 @@ static int HookPreBuildContactMenu(WPARAM hContact, LPARAM)
static int HookModulesLoaded(WPARAM, LPARAM)
{
- char* modules[2] = { 0 };
+ char* modules[2] = {};
modules[0] = MODULENAME;
CallService("DBEditorpp/RegisterModule", (WPARAM)modules, 1);
@@ -179,7 +179,7 @@ static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM)
//find window for hContact
HWND hWnd = WindowList_Find(g_hSendWindowList, wParam);
if (!hWnd)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), NULL, SendDlgProc, wParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), nullptr, SendDlgProc, wParam);
else {
SetForegroundWindow(hWnd);
SetFocus(hWnd);
@@ -189,7 +189,7 @@ static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM)
static INT_PTR ServiceReceiveCommand(WPARAM, LPARAM lParam)
{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_RECEIVE), NULL, RecvDlgProc, lParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_RECEIVE), nullptr, RecvDlgProc, lParam);
return 0;
}
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp
index 511b4c0972..75a07be4fe 100644
--- a/plugins/ContactsPlus/src/receive.cpp
+++ b/plugins/ContactsPlus/src/receive.cpp
@@ -28,10 +28,10 @@
TRecvContactsData::TRecvContactsData(MCONTACT contact)
{
mhContact = contact;
- hHook = NULL;
+ hHook = nullptr;
cbReceived = 0;
- maReceived = NULL;
- haUin = NULL;
+ maReceived = nullptr;
+ haUin = nullptr;
}
TRecvContactsData::~TRecvContactsData()
@@ -103,12 +103,12 @@ static void EnableGroupCombo(HWND hwndDlg)
static void RebuildGroupCombo(HWND hwndDlg)
{
- int bHasGroups = Clist_GroupGetName(0, NULL) != 0;
+ int bHasGroups = Clist_GroupGetName(0, nullptr) != nullptr;
HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS);
if (bHasGroups) {
int curs = SendMessage(hGroupsCombo, CB_GETCURSEL, 0, 0);
- wchar_t *curst = NULL;
+ wchar_t *curst = nullptr;
EnableDlgItem(hwndDlg, IDC_ENABLEGROUPS, TRUE);
EnableGroupCombo(hwndDlg);
@@ -120,7 +120,7 @@ static void RebuildGroupCombo(HWND hwndDlg)
SendMessage(hGroupsCombo, CB_RESETCONTENT, 0, 0);
wchar_t *szGroup;
- for (int i=1; (szGroup = Clist_GroupGetName(i, NULL)) != NULL; i++) {
+ for (int i=1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++) {
int nIndex = SendMessage(hGroupsCombo, CB_ADDSTRING, 0, (LPARAM)szGroup);
SendMessage(hGroupsCombo, CB_SETITEMDATA, nIndex, i);
}
@@ -299,7 +299,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
HWND hGroupsCombo = GetDlgItem(hwndDlg, IDC_GROUPS);
HWND hGroupsCheck = GetDlgItem(hwndDlg, IDC_ENABLEGROUPS);
int curs = SendMessage(hGroupsCombo, CB_GETCURSEL, 0, 0);
- wchar_t* caGroup = NULL;
+ wchar_t* caGroup = nullptr;
int nGroupId = -1;
if (curs != CB_ERR && IsWindowEnabled(hGroupsCheck) && SendMessage(hGroupsCheck, BM_GETCHECK, 0, 0))
{ //got groups, get the one selected in combo
@@ -375,7 +375,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
RECT rc;
GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU), &rc);
HMENU hMenu = Menu_BuildContactMenu(wndData->mhContact);
- TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr);
DestroyMenu(hMenu);
}
break;
@@ -413,7 +413,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
int ci = ListView_HitTest(hLV, &lvh);
if (ci==-1) break; // mouse is not over any item
wndData->iPopupItem = ci;
- TrackPopupMenu(GetSubMenu(wndData->mhPopup, 0), TPM_LEFTALIGN|TPM_TOPALIGN, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, NULL);
+ TrackPopupMenu(GetSubMenu(wndData->mhPopup, 0), TPM_LEFTALIGN|TPM_TOPALIGN, LOWORD(lParam), HIWORD(lParam), 0, hwndDlg, nullptr);
}
break;
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp
index 1016a386dc..6ddd675442 100644
--- a/plugins/ContactsPlus/src/send.cpp
+++ b/plugins/ContactsPlus/src/send.cpp
@@ -29,7 +29,7 @@
TSendProcessList::TSendProcessList()
{
Count = 0;
- Items = NULL;
+ Items = nullptr;
}
TSendProcessList::~TSendProcessList()
@@ -61,9 +61,9 @@ void TSendProcessList::Remove(HANDLE hProcc)
TSendContactsData::TSendContactsData(MCONTACT contact) : uacklist()
{
hContact = contact;
- hHook = NULL;
- hError = NULL;
- aContacts = NULL;
+ hHook = nullptr;
+ hError = nullptr;
+ aContacts = nullptr;
nContacts = 0;
}
@@ -84,7 +84,7 @@ void TSendContactsData::UnhookProtoAck()
{
if (hHook) {
UnhookEvent(hHook);
- hHook = NULL;
+ hHook = nullptr;
}
}
@@ -197,7 +197,7 @@ static void SetAllContactChecks(HWND hwndList, MCONTACT hReceiver) // doubtful n
binListEvent = TRUE;
char *szProto = GetContactProto(hReceiver);
- if (szProto == NULL)
+ if (szProto == nullptr)
return;
if (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT))
@@ -266,7 +266,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
case DM_ERRORDECIDED:
EnableWindow(hwndDlg, TRUE);
- wndData->hError = NULL;
+ wndData->hError = nullptr;
switch (wParam) {
case MSGERROR_CANCEL:
wndData->UnhookProtoAck();
@@ -275,7 +275,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
delete g_aAckData.Remove(wndData->uacklist.Items[i]); // remove our ackdata & release structure
mir_free(wndData->uacklist.Items);
- wndData->uacklist.Items = NULL;
+ wndData->uacklist.Items = nullptr;
wndData->uacklist.Count = 0;
}
EnableDlgItem(hwndDlg, IDOK, TRUE);
@@ -333,7 +333,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
if (!wndData->SendContacts(hwndDlg))
break;
- SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), NULL);
+ SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), nullptr);
}
break;
@@ -358,7 +358,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
RECT rc;
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
HMENU hMenu = Menu_BuildContactMenu(wndData->hContact);
- TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, nullptr);
DestroyMenu(hMenu);
}
break;
@@ -384,7 +384,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
break;
TAckData *ackData = g_aAckData.Get(ack->hProcess);
- if (ackData == NULL)
+ if (ackData == nullptr)
break; // on unknown hprocc go away
if (ackData->hContact != ack->hContact)
@@ -402,7 +402,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
dbei.szModule = GetContactProto(ackData->hContact);
dbei.eventType = EVENTTYPE_CONTACTS;
dbei.flags = DBEF_SENT | DBEF_UTF;
- dbei.timestamp = time(NULL);
+ dbei.timestamp = time(nullptr);
//make blob
TCTSend* maSend = (TCTSend*)_alloca(ackData->nContacts*sizeof(TCTSend));
memset(maSend, 0, (ackData->nContacts * sizeof(TCTSend)));
@@ -484,7 +484,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
RECT rc, rcParent;
GetWindowRect(hwndDlg, &rc);
GetWindowRect(GetParent(hwndDlg), &rcParent);
- SetWindowPos(hwndDlg, 0,
+ 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);
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp
index 257cdb555f..9ea296f915 100644
--- a/plugins/ContactsPlus/src/utils.cpp
+++ b/plugins/ContactsPlus/src/utils.cpp
@@ -52,19 +52,19 @@ char* __fastcall null_strdup(const char *string)
if (string)
return strdup(string);
- return NULL;
+ return nullptr;
}
wchar_t* GetContactUID(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == 0)
- return NULL;
+ if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == nullptr)
+ return nullptr;
DBVARIANT vrUid;
if (db_get_s(hContact, szProto, uid, &vrUid, 0))
- return NULL;
+ return nullptr;
if (vrUid.type == DBVT_DWORD) {
wchar_t tmp[100];
@@ -84,7 +84,7 @@ wchar_t* GetContactUID(MCONTACT hContact)
return res;
}
- return NULL;
+ return nullptr;
}
void DialogAddContactExecute(HWND hwndDlg, MCONTACT hNewContact)
@@ -105,7 +105,7 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, MCONTACT hContact)
HICON hIcon = LoadContactProtoIcon(hContact);
if (hIcon)
{
- DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, nullptr, DI_NORMAL);
DestroyIcon(hIcon);
}
}
@@ -162,7 +162,7 @@ HICON LoadContactProtoIcon(MCONTACT hContact)
char *szProto = GetContactProto(hContact);
if (szProto)
return (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- return NULL;
+ return nullptr;
}
@@ -187,5 +187,5 @@ wchar_t* __fastcall strdupT(const wchar_t *string)
{
if (string)
return (wchar_t*)wcsdup((wchar_t*)string);
- return NULL;
+ return nullptr;
}