diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:03:31 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:07:33 +0100 |
commit | a7c24ca48995cf2bf436156302f96b91bf135409 (patch) | |
tree | 953835509ff1b778833e78fd7b74b05e05e77c84 /src/core/stduserinfo | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'src/core/stduserinfo')
-rw-r--r-- | src/core/stduserinfo/src/contactinfo.cpp | 14 | ||||
-rw-r--r-- | src/core/stduserinfo/src/stdinfo.cpp | 26 | ||||
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 40 |
3 files changed, 40 insertions, 40 deletions
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp index a8df0ebeb5..2d9caa7525 100644 --- a/src/core/stduserinfo/src/contactinfo.cpp +++ b/src/core/stduserinfo/src/contactinfo.cpp @@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-static HFONT hEmailFont = NULL;
-static HCURSOR hHandCursor = NULL;
+static HFONT hEmailFont = nullptr;
+static HCURSOR hHandCursor = nullptr;
static INT_PTR CALLBACK EditUserEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -126,7 +126,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar if (noRecursion) break;
noRecursion = 1;
{
- char szText[256], *pText = NULL, *pArea, *pNumber;
+ char szText[256], *pText = nullptr, *pArea, *pNumber;
int i, isValid = 1;
GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, _countof(szText));
if (szText[0] != '+')
@@ -224,8 +224,8 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lf.lfUnderline = 1;
hEmailFont = CreateFontIndirect(&lf);
}
- if (hHandCursor == NULL)
- hHandCursor = LoadCursor(NULL, IDC_HAND);
+ if (hHandCursor == nullptr)
+ hHandCursor = LoadCursor(nullptr, IDC_HAND);
{
RECT rc;
GetClientRect(GetDlgItem(hwndDlg, IDC_EMAILS), &rc);
@@ -257,7 +257,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hContact != NULL) {
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
//e-mails
@@ -516,7 +516,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP GetCursorPos(&pt);
ScreenToClient(hwndDlg, &pt);
}
- if (IsOverEmail(hwndDlg, NULL, 0)) {
+ if (IsOverEmail(hwndDlg, nullptr, 0)) {
SetCursor(hHandCursor);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index af0e8acc97..e158eae615 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -53,22 +53,22 @@ static wchar_t* Proto_GetContactInfoSettingStr(bool proto_service, MCONTACT hCon DBCONTACTGETSETTING cgs = { szModule, szSetting, &dbv };
dbv.type = DBVT_WCHAR;
if (CallProtoService(szModule, PS_GETINFOSETTING, hContact, (LPARAM)&cgs))
- return NULL;
+ return nullptr;
return dbv.ptszVal;
}
static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special)
{
- char str[80], *pstr = NULL;
- wchar_t *ptstr = NULL;
+ char str[80], *pstr = nullptr;
+ wchar_t *ptstr = nullptr;
char *szProto = GetContactProto(hContact);
bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC);
DBVARIANT dbv = { DBVT_DELETED };
int unspecified;
- if (szModule == NULL)
+ if (szModule == nullptr)
unspecified = 1;
else if (proto_service)
unspecified = Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0);
@@ -159,7 +159,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule }
pstr = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, wSave, 0));
- unspecified = pstr == NULL;
+ unspecified = pstr == nullptr;
}
else {
unspecified = (special == SVS_ZEROISUNSPEC && dbv.wVal == 0);
@@ -194,7 +194,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule }
pstr = dbv.pszVal;
- Utf8Decode(dbv.pszVal, NULL);
+ Utf8Decode(dbv.pszVal, nullptr);
break;
default:
@@ -206,7 +206,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule if (unspecified)
SetDlgItemText(hwndDlg, idCtrl, TranslateT("<not specified>"));
- else if (ptstr != NULL)
+ else if (ptstr != nullptr)
SetDlgItemText(hwndDlg, idCtrl, ptstr);
else
SetDlgItemTextA(hwndDlg, idCtrl, pstr);
@@ -230,7 +230,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
SetValue(hwndDlg, IDC_NICK, hContact, szProto, "Nick", 0);
@@ -275,7 +275,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
TranslateDialogDefault(hwndDlg);
- SetTimer(hwndDlg, 1, 1000, NULL);
+ SetTimer(hwndDlg, 1, 1000, nullptr);
TimeZone_PrepareList(lParam, NULL, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB);
SendMessage(hwndDlg, WM_TIMER, 0, 0);
@@ -305,7 +305,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
SetValue(hwndDlg, IDC_STREET, hContact, szProto, "Street", SVS_ZEROISUNSPEC);
@@ -355,7 +355,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
char *szProto = GetContactProto(hContact);
- if (szProto == NULL) break;
+ if (szProto == nullptr) break;
SetValue(hwndDlg, IDC_COMPANY, hContact, szProto, "Company", SVS_ZEROISUNSPEC);
SetValue(hwndDlg, IDC_DEPARTMENT, hContact, szProto, "CompanyDepartment", SVS_ZEROISUNSPEC);
SetValue(hwndDlg, IDC_POSITION, hContact, szProto, "CompanyPosition", SVS_ZEROISUNSPEC);
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC;
@@ -604,7 +604,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) if (lParam == NULL)
return 0;
- if (GetContactProto(lParam) == 0)
+ if (GetContactProto(lParam) == nullptr)
return 0;
OPTIONSDIALOGPAGE odp = { 0 };
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 916a89f4f8..ce59b8864d 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int DetailsInit(WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static MWindowList hWindowList = NULL;
+static MWindowList hWindowList = nullptr;
static HANDLE hDetailsInitEvent;
struct DetailsPageInit
@@ -103,7 +103,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM) DetailsPageInit opi = { 0 };
opi.pageCount = 0;
- opi.odp = NULL;
+ opi.odp = nullptr;
NotifyEventHooks(hDetailsInitEvent, (WPARAM)&opi, wParam);
if (opi.pageCount == 0)
return 0;
@@ -112,16 +112,16 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM) PROPSHEETHEADER psh = { sizeof(psh) };
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
- psh.hwndParent = NULL;
+ psh.hwndParent = nullptr;
psh.nPages = opi.pageCount;
- psh.pStartPage = 0;
+ psh.pStartPage = nullptr;
psh.pszCaption = (wchar_t*)wParam; //more abuses of structure: this is hContact
psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
for (int i = 0; i < opi.pageCount; i++) {
//cleanup moved to WM_DESTROY
- if (opi.odp[i].szGroup.w != NULL)
+ if (opi.odp[i].szGroup.w != nullptr)
mir_free(opi.odp[i].szGroup.a);
if ((DWORD_PTR)opi.odp[i].pszTemplate & 0xFFFF0000)
mir_free((char*)opi.odp[i].pszTemplate);
@@ -135,7 +135,7 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)lParam;
struct DetailsPageInit *opi = (struct DetailsPageInit*)wParam;
- if (odp == NULL || opi == NULL)
+ if (odp == nullptr || opi == nullptr)
return 1;
opi->odp = (OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount + 1));
@@ -147,12 +147,12 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) dst->pszTemplate = ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000) ? mir_strdup(odp->pszTemplate) : odp->pszTemplate;
if (odp->flags & ODPF_UNICODE) {
- dst->szTitle.w = (odp->szTitle.w == 0) ? NULL : mir_wstrdup(odp->szTitle.w);
- dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_wstrdup(odp->szTab.w) : NULL;
+ dst->szTitle.w = (odp->szTitle.w == nullptr) ? nullptr : mir_wstrdup(odp->szTitle.w);
+ dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_wstrdup(odp->szTab.w) : nullptr;
}
else {
dst->szTitle.w = mir_a2u(odp->szTitle.a);
- dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_a2u(odp->szTab.a) : NULL;
+ dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_a2u(odp->szTab.a) : nullptr;
}
dst->hLangpack = odp->hLangpack;
@@ -218,7 +218,7 @@ static void CreateDetailsPageWindow(HWND hwndDlg, DetailsData *dat, DetailsPageD static int UserInfoContactDelete(WPARAM wParam, LPARAM)
{
HWND hwnd = WindowList_Find(hWindowList, wParam);
- if (hwnd != NULL)
+ if (hwnd != nullptr)
DestroyWindow(hwnd);
return 0;
}
@@ -269,7 +269,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP ptszLastTab = NEWWSTR_ALLOCA(dbv.ptszVal);
db_free(&dbv);
}
- else ptszLastTab = NULL;
+ else ptszLastTab = nullptr;
dat->currentPage = 0;
dat->pageCount = psh->nPages;
@@ -296,7 +296,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
tvis.item.lParam = (LPARAM)i;
@@ -342,7 +342,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(hwndDlg, M_CHECKONLINE, 0, 0);
if (!ProtoChainSend(dat->hContact, PSS_GETINFO, SGIF_ONOPEN, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
- SetTimer(hwndDlg, 1, 100, NULL);
+ SetTimer(hwndDlg, 1, 100, nullptr);
}
else ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_HIDE);
@@ -394,7 +394,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i = 0; i < dat->pageCount; i++) {
DetailsPageData &odp = dat->opd[i];
pshn.hdr.hwndFrom = odp.hwnd;
- if (odp.hwnd != NULL)
+ if (odp.hwnd != nullptr)
SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
}
break;
@@ -402,7 +402,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP case M_CHECKONLINE:
if (dat->hContact != NULL) {
char *szProto = GetContactProto(dat->hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
else {
if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE)
@@ -431,7 +431,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(hwndDlg, M_CHECKONLINE, 0, 0);
break;
} //if
- if (dat->infosUpdated == NULL)
+ if (dat->infosUpdated == nullptr)
dat->infosUpdated = (int*)mir_calloc(sizeof(int)*(INT_PTR)ack->hProcess);
if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED)
dat->infosUpdated[ack->lParam] = 1;
@@ -521,7 +521,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i = 0; i < dat->pageCount; i++) {
DetailsPageData &odp = dat->opd[i];
- if (odp.hwnd == NULL || !odp.changed)
+ if (odp.hwnd == nullptr || !odp.changed)
continue;
pshn.hdr.hwndFrom = odp.hwnd;
SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
@@ -542,7 +542,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP pshn.hdr.code = PSN_APPLY;
for (i = 0; i < dat->pageCount; i++) {
DetailsPageData &odp = dat->opd[i];
- if (odp.hwnd == NULL || !odp.changed)
+ if (odp.hwnd == nullptr || !odp.changed)
continue;
pshn.hdr.hwndFrom = odp.hwnd;
if (SendMessage(odp.hwnd, WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) {
@@ -565,7 +565,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!ProtoChainSend(dat->hContact, PSS_GETINFO, 0, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_UPDATING), SW_SHOW);
- SetTimer(hwndDlg, 1, 100, NULL);
+ SetTimer(hwndDlg, 1, 100, nullptr);
}
}
break;
@@ -594,7 +594,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i = 0; i < dat->pageCount; i++) {
DetailsPageData &odp = dat->opd[i];
- if (odp.hwnd != NULL)
+ if (odp.hwnd != nullptr)
DestroyWindow(odp.hwnd);
mir_free(odp.ptszTitle);
mir_free(odp.ptszTab);
|