summaryrefslogtreecommitdiff
path: root/src/core/stdclist
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 /src/core/stdclist
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'src/core/stdclist')
-rw-r--r--src/core/stdclist/src/clcfonts.cpp4
-rw-r--r--src/core/stdclist/src/clcopts.cpp8
-rw-r--r--src/core/stdclist/src/clcpaint.cpp12
-rw-r--r--src/core/stdclist/src/clistopts.cpp4
-rw-r--r--src/core/stdclist/src/cluiopts.cpp14
-rw-r--r--src/core/stdclist/src/contact.cpp2
-rw-r--r--src/core/stdclist/src/init.cpp6
7 files changed, 25 insertions, 25 deletions
diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp
index a2fae81932..b1678d1ef9 100644
--- a/src/core/stdclist/src/clcfonts.cpp
+++ b/src/core/stdclist/src/clcfonts.cpp
@@ -56,7 +56,7 @@ void RegisterCListFonts()
strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup));
wcsncpy(fontid.group, LPGENW("Contact list"), _countof(fontid.group));
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
for (int i = 0; i < _countof(clistFontDescr); i++) {
LOGFONT lf;
pcli->pfnGetFontSetting(i, &lf, &fontid.deffontsettings.colour);
@@ -78,7 +78,7 @@ void RegisterCListFonts()
fontid.order = i;
Font_RegisterW(&fontid);
}
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
// and colours
ColourIDW colourid = { 0 };
diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp
index 0beae07eec..c431534d3f 100644
--- a/src/core/stdclist/src/clcopts.cpp
+++ b/src/core/stdclist/src/clcopts.cpp
@@ -89,7 +89,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++) {
@@ -120,7 +120,7 @@ static DWORD MakeCheckBoxTreeFlags(HWND hwndTree)
static LONG CalcMinRowHeight()
{
LONG minHeight = 16;
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
for (int i = 0; i < FONTID_LAST; i++) {
LOGFONT lf;
COLORREF color;
@@ -135,7 +135,7 @@ static LONG CalcMinRowHeight()
hFont = (HFONT)SelectObject(hdc, hFont);
DeleteObject(hFont);
}
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
return minHeight;
}
@@ -346,7 +346,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
Bitmap_GetFilter(filter, _countof(filter));
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp
index 456497a34c..c5b13837ba 100644
--- a/src/core/stdclist/src/clcpaint.cpp
+++ b/src/core/stdclist/src/clcpaint.cpp
@@ -162,14 +162,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
RECT clRect;
GetClientRect(hwnd, &clRect);
- if (rcPaint == NULL)
+ if (rcPaint == nullptr)
rcPaint = &clRect;
if (IsRectEmpty(rcPaint))
return;
int y = -dat->yScroll;
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;
@@ -180,7 +180,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
GetTextMetrics(hdcMem, &tm);
groupCountsFontTopShift -= tm.tmAscent;
- HBRUSH hBrushAlternateGrey = NULL;
+ HBRUSH hBrushAlternateGrey = nullptr;
if (style & CLS_GREYALTERNATE)
hBrushAlternateGrey = CreateSolidBrush(GetNearestColor(hdcMem, RGB(GetRValue(tmpbkcolour) - 10, GetGValue(tmpbkcolour) - 10, GetBValue(tmpbkcolour) - 10)));
@@ -266,7 +266,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
int indent = 0;
for (int index = 0; y < rcPaint->bottom;) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
group->scanIndex++;
indent--;
@@ -316,7 +316,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
GetTextExtentPoint32(hdcMem, cc->szText, (int)mir_wstrlen(cc->szText), &textSize);
width = textSize.cx;
- wchar_t *ptszGroupCount = NULL;
+ wchar_t *ptszGroupCount = nullptr;
if (cc->type == CLCIT_GROUP) {
ptszGroupCount = pcli->pfnGetGroupCountsText(dat, cc);
if (*ptszGroupCount) {
@@ -432,7 +432,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
else if (hottrack)
SetHotTrackColour(hdcMem, dat);
rc.right--;
- ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, (int)mir_wstrlen(cc->szText), NULL);
+ ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, cc->szText, (int)mir_wstrlen(cc->szText), nullptr);
}
else TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace, y + ((dat->rowHeight - fontHeight) >> 1), cc->szText, (int)mir_wstrlen(cc->szText));
diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp
index 8a92ee1146..f9442fb5ce 100644
--- a/src/core/stdclist/src/clistopts.cpp
+++ b/src/core/stdclist/src/clistopts.cpp
@@ -31,7 +31,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
MCONTACT hContact = 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);
}
@@ -176,7 +176,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/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp
index e97dcc9667..df06e1d9e2 100644
--- a/src/core/stdclist/src/cluiopts.cpp
+++ b/src/core/stdclist/src/cluiopts.cpp
@@ -155,7 +155,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));
@@ -195,12 +195,12 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW);
if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) {
- HWND hProgMan = FindWindow(L"Progman", NULL);
+ HWND hProgMan = FindWindow(L"Progman", nullptr);
if (hProgMan)
SetParent(pcli->hwndContactList, hProgMan);
}
else
- SetParent(pcli->hwndContactList, NULL);
+ SetParent(pcli->hwndContactList, nullptr);
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) {
int style = GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
@@ -212,12 +212,12 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
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);
@@ -297,7 +297,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/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp
index 56d7826474..f883bf1438 100644
--- a/src/core/stdclist/src/contact.cpp
+++ b/src/core/stdclist/src/contact.cpp
@@ -65,7 +65,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/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp
index 4bd2f23e92..4c8c0bc39c 100644
--- a/src/core/stdclist/src/init.cpp
+++ b/src/core/stdclist/src/init.cpp
@@ -24,9 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-HINSTANCE g_hInst = 0;
-CLIST_INTERFACE* pcli = NULL, coreCli;
-HIMAGELIST himlCListClc = NULL;
+HINSTANCE g_hInst = nullptr;
+CLIST_INTERFACE* pcli = nullptr, coreCli;
+HIMAGELIST himlCListClc = nullptr;
int hLangpack;
/////////////////////////////////////////////////////////////////////////////////////////