summaryrefslogtreecommitdiff
path: root/plugins/Clist_blind
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/Clist_blind
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/Clist_blind')
-rw-r--r--plugins/Clist_blind/src/clcopts.cpp2
-rw-r--r--plugins/Clist_blind/src/clcpaint.cpp12
-rw-r--r--plugins/Clist_blind/src/clistopts.cpp4
-rw-r--r--plugins/Clist_blind/src/cluiopts.cpp14
-rw-r--r--plugins/Clist_blind/src/contact.cpp2
-rw-r--r--plugins/Clist_blind/src/init.cpp58
6 files changed, 46 insertions, 46 deletions
diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp
index 4e726ab299..3721ec3e13 100644
--- a/plugins/Clist_blind/src/clcopts.cpp
+++ b/plugins/Clist_blind/src/clcopts.cpp
@@ -88,7 +88,7 @@ static const struct CheckBoxValues_t offlineValues[] = {
static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style)
{
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
for (int i = 0; i < nValues; i++) {
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp
index 2da3351ab1..de6c0c2e7c 100644
--- a/plugins/Clist_blind/src/clcpaint.cpp
+++ b/plugins/Clist_blind/src/clcpaint.cpp
@@ -148,7 +148,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE);
int status = GetGeneralisedStatus();
int grey = 0, groupCountsFontTopShift;
- HBRUSH hBrushAlternateGrey = NULL;
+ HBRUSH hBrushAlternateGrey = nullptr;
// yes I know about GetSysColorBrush()
COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->bUseWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
@@ -157,13 +157,13 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS)
grey = 1;
GetClientRect(hwnd, &clRect);
- if (rcPaint == NULL)
+ if (rcPaint == nullptr)
rcPaint = &clRect;
if (IsRectEmpty(rcPaint))
return;
HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), NULL);
+ HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr);
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
{
TEXTMETRIC tm;
@@ -256,7 +256,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
if (group->scanIndex == group->cl.getCount()) {
group = group->parent;
indent--;
- if (group == NULL)
+ if (group == nullptr)
break;
group->scanIndex++;
continue;
@@ -269,7 +269,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
int hottrack = dat->exStyle & CLS_EX_TRACKSELECT && cc->type != CLCIT_DIVIDER && dat->iHotTrack == index;
SIZE textSize, countsSize = { 0 }, spaceSize = { 0 };
int width, checkboxWidth;
- wchar_t *szCounts = NULL;
+ wchar_t *szCounts = nullptr;
// alternating grey
if (style & CLS_GREYALTERNATE && index & 1) {
@@ -398,7 +398,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
SetHotTrackColour(hdcMem, dat);
rc.right--;
ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText,
- (int)mir_wstrlen(cc->szText), NULL);
+ (int)mir_wstrlen(cc->szText), nullptr);
}
else
TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace,
diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp
index 1eb7292daa..b2866b67e4 100644
--- a/plugins/Clist_blind/src/clistopts.cpp
+++ b/plugins/Clist_blind/src/clistopts.cpp
@@ -30,7 +30,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
MCONTACT hContact = (MCONTACT)wParam;
DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam;
- if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL &&
+ if (hContact == NULL && ws != nullptr && ws->szModule != nullptr && ws->szSetting != nullptr &&
strcmp(ws->szModule, "CList") == 0 && strcmp(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg))
CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED);
}
@@ -159,7 +159,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
int cur = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0);
- if (pa == NULL)
+ if (pa == nullptr)
db_unset(NULL, "CList", "PrimaryStatus");
else
db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName);
diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp
index 1fc8925d6c..3dc4c83b17 100644
--- a/plugins/Clist_blind/src/cluiopts.cpp
+++ b/plugins/Clist_blind/src/cluiopts.cpp
@@ -153,7 +153,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
db_set_b(NULL, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
db_set_b(NULL, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
db_set_b(NULL, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE));
+ db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
@@ -189,11 +189,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW);
if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) {
- HWND hProgMan = FindWindowA("Progman", NULL);
+ HWND hProgMan = FindWindowA("Progman", nullptr);
if (IsWindow(hProgMan))
SetParent(pcli->hwndContactList, hProgMan);
}
- else SetParent(pcli->hwndContactList, NULL);
+ else SetParent(pcli->hwndContactList, nullptr);
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION))
SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE,
@@ -202,11 +202,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE,
GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX));
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU))
- SetMenu(pcli->hwndContactList, NULL);
+ SetMenu(pcli->hwndContactList, nullptr);
else
SetMenu(pcli->hwndContactList, pcli->hMenuMain);
- SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
- RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
+ SetWindowPos(pcli->hwndContactList, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
+ RedrawWindow(pcli->hwndContactList, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
if (IsIconic(pcli->hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND))
ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW);
if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) {
@@ -283,7 +283,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
DestroyWindow(pcli->hwndStatus);
flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
- pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL);
+ pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_hInst, nullptr);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR))
ShowWindow(pcli->hwndStatus, SW_SHOW);
diff --git a/plugins/Clist_blind/src/contact.cpp b/plugins/Clist_blind/src/contact.cpp
index 4dc6cbf55f..6270630213 100644
--- a/plugins/Clist_blind/src/contact.cpp
+++ b/plugins/Clist_blind/src/contact.cpp
@@ -63,7 +63,7 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2)
return 2 * (statusa == ID_STATUS_OFFLINE) - 1;
}
/* both are online, now check protocols */
- if (c1->proto != NULL && c2->proto != NULL) {
+ if (c1->proto != nullptr && c2->proto != nullptr) {
int rc = mir_strcmp(c1->proto, c2->proto);
if (rc != 0)
return rc;
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp
index 011c8574aa..eac2270f0d 100644
--- a/plugins/Clist_blind/src/init.cpp
+++ b/plugins/Clist_blind/src/init.cpp
@@ -25,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
int hLangpack;
-HINSTANCE g_hInst = 0;
-CLIST_INTERFACE *pcli = NULL, coreCli;
-HIMAGELIST himlCListClc = NULL;
+HINSTANCE g_hInst = nullptr;
+CLIST_INTERFACE *pcli = nullptr, coreCli;
+HIMAGELIST himlCListClc = nullptr;
LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -189,13 +189,13 @@ wchar_t* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* set
MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, out, (int)len);
else if (dbv.type == DBVT_WCHAR)
mir_wstrncpy(out, dbv.pwszVal, (int)len);
- else if (def != NULL)
+ else if (def != nullptr)
mir_wstrncpy(out, def, (int)len);
db_free(&dbv);
}
else {
- if (def != NULL)
+ if (def != nullptr)
mir_wstrncpy(out, def, (int)len);
}
@@ -219,7 +219,7 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len)
if (len == 0)
return 0;
- if (text == NULL)
+ if (text == nullptr)
return 0;
totalSize = str->used + len + 1;
@@ -227,10 +227,10 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len)
if (totalSize > str->allocated) {
totalSize += DATA_BLOCK - (totalSize % DATA_BLOCK);
- if (str->text != NULL) {
+ if (str->text != nullptr) {
wchar_t *tmp = (wchar_t *)mir_realloc(str->text, sizeof(wchar_t) * totalSize);
- if (tmp == NULL) {
+ if (tmp == nullptr) {
mir_free(str->text);
return -1;
}
@@ -240,7 +240,7 @@ int CopyData(StringHelper *str, const wchar_t *text, size_t len)
else {
str->text = (wchar_t *)mir_alloc(sizeof(wchar_t) * totalSize);
- if (str->text == NULL) {
+ if (str->text == nullptr) {
return -2;
}
}
@@ -262,7 +262,7 @@ wchar_t * ParseText(const wchar_t *text,
{
size_t length = mir_wstrlen(text);
size_t nextPos = 0;
- StringHelper ret = { 0 };
+ StringHelper ret = {};
size_t i;
// length - 1 because a % in last char will be a % and point
@@ -271,11 +271,11 @@ wchar_t * ParseText(const wchar_t *text,
BOOL found = FALSE;
if (CopyData(&ret, &text[nextPos], i - nextPos))
- return NULL;
+ return nullptr;
if (text[i + 1] == '%') {
if (CopyData(&ret, L"%", 1))
- return NULL;
+ return nullptr;
i++;
@@ -291,7 +291,7 @@ wchar_t * ParseText(const wchar_t *text,
if (wcsnicmp(&text[i], variables[j], vlen) == 0) {
if (CopyData(&ret, data[j], mir_wstrlen(data[j])))
- return NULL;
+ return nullptr;
i += vlen - 1;
@@ -311,7 +311,7 @@ wchar_t * ParseText(const wchar_t *text,
if (nextPos < length)
if (CopyData(&ret, &text[nextPos], length - nextPos))
- return NULL;
+ return nullptr;
return ret.text;
}
@@ -343,16 +343,16 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
dat->hwnd_list = CreateWindow(L"LISTBOX", L"",
(WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | WS_VSCROLL),
- 0, 0, 0, 0, hwnd, NULL, g_hInst, 0);
+ 0, 0, 0, 0, hwnd, nullptr, g_hInst, nullptr);
dat->need_rebuild = FALSE;
GetClientRect(hwnd, &r);
- SetWindowPos(dat->hwnd_list, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(dat->hwnd_list, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
break;
case WM_SIZE:
GetClientRect(hwnd, &r);
- SetWindowPos(dat->hwnd_list, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(dat->hwnd_list, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
break;
case WM_PRINTCLIENT:
@@ -396,7 +396,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
KillTimer(hwnd, TIMERID_INFOTIP);
KillTimer(hwnd, TIMERID_RENAME);
dat->szQuickSearch[0] = 0;
- pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
+ pcli->pfnInvalidateRect(hwnd, nullptr, FALSE);
pcli->pfnEnsureVisible(hwnd, (ClcData*)dat, dat->selection, 0);
UpdateWindow(hwnd);
break;
@@ -416,11 +416,11 @@ wchar_t* GetStatusName(struct ClcContact *item)
int status;
status_name[0] = '\0';
- if (item->hContact == NULL || item->proto == NULL)
+ if (item->hContact == NULL || item->proto == nullptr)
return status_name;
// Get XStatusName
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), NULL);
+ MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusName", status_name, _countof(status_name), nullptr);
if (status_name[0] != '\0')
return status_name;
@@ -436,16 +436,16 @@ wchar_t status_message[256];
wchar_t* GetStatusMessage(struct ClcContact *item)
{
status_message[0] = '\0';
- if (item->hContact == NULL || item->proto == NULL)
+ if (item->hContact == NULL || item->proto == nullptr)
return status_message;
// Get XStatusMsg
- MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), NULL);
+ MyDBGetContactSettingTString(item->hContact, item->proto, "XStatusMsg", status_message, _countof(status_message), nullptr);
if (status_message[0] != '\0')
return status_message;
// Get status message
- MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, _countof(status_message), NULL);
+ MyDBGetContactSettingTString(item->hContact, "CList", "StatusMsg", status_message, _countof(status_message), nullptr);
return status_message;
}
@@ -459,13 +459,13 @@ wchar_t* GetProtoName(struct ClcContact *item)
#endif
proto_name[0] = '\0';
- if (item->hContact == NULL || item->proto == NULL) {
+ if (item->hContact == NULL || item->proto == nullptr) {
mir_wstrncpy(proto_name, TranslateT("Unknown protocol"), _countof(proto_name));
return proto_name;
}
PROTOACCOUNT *acc = Proto_GetAccount(item->proto);
- if (acc == NULL) {
+ if (acc == nullptr) {
#ifdef UNICODE
CallProtoService(item->proto, PS_GETNAME, sizeof(description), (LPARAM)description);
mir_snwprintf(proto_name, L"%S", description);
@@ -516,7 +516,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
size_t size = _countof(tmp);
while (true) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
text -= 2;
size += 2;
@@ -547,7 +547,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
count[0] = '\0';
wchar_t *txt = ParseText(template_group, t, _countof(t), v, _countof(v));
- if (txt != NULL)
+ if (txt != nullptr)
mir_wstrncpy(text, txt, size);
mir_free(txt);
}
@@ -569,7 +569,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
};
wchar_t *txt = ParseText(template_contact, t, _countof(t), v, _countof(v));
- if (txt != NULL)
+ if (txt != nullptr)
mir_wstrncpy(text, txt, size);
mir_free(txt);
}
@@ -599,7 +599,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig)
}
SendMessage(dat->hwnd_list, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(dat->hwnd_list, NULL, TRUE);
+ InvalidateRect(dat->hwnd_list, nullptr, TRUE);
dat->selection = selection;
SendMessage(dat->hwnd_list, LB_SETCURSEL, dat->selection, 0);