summaryrefslogtreecommitdiff
path: root/plugins/Variables/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Variables/src')
-rw-r--r--plugins/Variables/src/contact.cpp38
-rw-r--r--plugins/Variables/src/help.cpp162
-rw-r--r--plugins/Variables/src/lookup3.cpp6
-rw-r--r--plugins/Variables/src/options.cpp14
-rw-r--r--plugins/Variables/src/parse_alias.cpp40
-rw-r--r--plugins/Variables/src/parse_external.cpp42
-rw-r--r--plugins/Variables/src/parse_inet.cpp22
-rw-r--r--plugins/Variables/src/parse_logic.cpp46
-rw-r--r--plugins/Variables/src/parse_math.cpp38
-rw-r--r--plugins/Variables/src/parse_metacontacts.cpp24
-rw-r--r--plugins/Variables/src/parse_miranda.cpp142
-rw-r--r--plugins/Variables/src/parse_regexp.cpp18
-rw-r--r--plugins/Variables/src/parse_str.cpp192
-rw-r--r--plugins/Variables/src/parse_system.cpp254
-rw-r--r--plugins/Variables/src/parse_variables.cpp24
-rw-r--r--plugins/Variables/src/tokenregister.cpp60
-rw-r--r--plugins/Variables/src/variables.cpp56
17 files changed, 589 insertions, 589 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 471502da27..c9a5785f16 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -96,7 +96,7 @@ static mir_cs csContactCache;
// converts a string into a CNF_ type
BYTE getContactInfoType(wchar_t* type)
{
- if (type == NULL || mir_wstrlen(type) == 0)
+ if (type == nullptr || mir_wstrlen(type) == 0)
return 0;
for (int i = 0; i < _countof(builtinCnfs); i++)
@@ -111,13 +111,13 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact)
{
/* returns dynamic allocated buffer with info, or NULL if failed */
if (hContact == NULL)
- return NULL;
+ return nullptr;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
switch (type) {
case CCNF_PROTOID:
return mir_a2u(szProto);
@@ -125,13 +125,13 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact)
case CCNF_ACCOUNT:
{
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- return pa ? mir_wstrdup(pa->tszAccountName) : NULL;
+ return pa ? mir_wstrdup(pa->tszAccountName) : nullptr;
}
case CCNF_PROTOCOL:
char protoname[128];
if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))
- return NULL;
+ return nullptr;
return mir_a2u(protoname);
case CCNF_STATUS:
@@ -147,17 +147,17 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact)
return mir_a2u(inet_ntoa(in));
}
}
- return NULL;
+ return nullptr;
case CCNF_GROUP:
- if ((res = db_get_wsa(hContact, "CList", "Group")) != NULL)
+ if ((res = db_get_wsa(hContact, "CList", "Group")) != nullptr)
return res;
break;
case CNF_UNIQUEID:
//UID for ChatRoom
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
- if ((res = db_get_wsa(hContact, szProto, "ChatRoomID")) != NULL)
+ if ((res = db_get_wsa(hContact, szProto, "ChatRoomID")) != nullptr)
return res;
//UID for other contact
@@ -171,7 +171,7 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact)
MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMatch)
{
/* service to retrieve a contact's HANDLE from a given string */
- if (tszContact == NULL || *tszContact == 0)
+ if (tszContact == nullptr || *tszContact == 0)
return INVALID_CONTACT_ID;
bool bReturnCount;
@@ -187,7 +187,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
mir_cslock lck(csContactCache);
CONTACTCE *p = arContactCache.find(&tmp);
- if (p != NULL)
+ if (p != nullptr)
return (bReturnCount) ? 1 : p->hContact; // found in cache
}
@@ -203,7 +203,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
bool bMatch = (tmp == tszContact);
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
continue;
// <proto:id> (exact)
@@ -304,7 +304,7 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam)
DBCONTACTWRITESETTING *dbw = (DBCONTACTWRITESETTING*)lParam;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return 0;
char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
@@ -314,7 +314,7 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam)
bool isLastName = !strcmp(dbw->szSetting, "LastName");
bool isEmail = !strcmp(dbw->szSetting, "e-mail");
bool isMyHandle = !strcmp(dbw->szSetting, "MyHandle");
- bool isUid = (((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != NULL)) && (!strcmp(dbw->szSetting, uid));
+ bool isUid = (((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != nullptr)) && (!strcmp(dbw->szSetting, uid));
mir_cslock lck(csContactCache);
for (int i = 0; i < arContactCache.getCount(); i++) {
@@ -358,12 +358,12 @@ int deinitContactModule()
wchar_t* encodeContactToString(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
wchar_t *tszUniqueId = getContactInfoT(CNF_UNIQUEID, hContact);
- if (tszUniqueId == NULL)
- return NULL;
+ if (tszUniqueId == nullptr)
+ return nullptr;
size_t size = mir_wstrlen(tszUniqueId) + mir_strlen(szProto) + 4;
wchar_t *tszResult = (wchar_t *)mir_calloc(size * sizeof(wchar_t));
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index c32efb2dcb..a605833839 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -33,9 +33,9 @@ extern HINSTANCE hInst;
extern HCURSOR hCurSplitNS;
-static HWND hwndHelpDialog = NULL;
+static HWND hwndHelpDialog = nullptr;
-static HICON hHelpIcon = NULL;
+static HICON hHelpIcon = nullptr;
static int defaultHelpDialogResize(HWND, LPARAM, UTILRESIZECONTROL *urc) {
@@ -131,7 +131,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if (hContact == INVALID_CONTACT_ID) {
wchar_t *tszContact = db_get_wsa(NULL, MODULENAME, SETTING_SUBJECT);
log_debugA("VARM_SETSUBJECT: %s", tszContact);
- if (tszContact != NULL) {
+ if (tszContact != nullptr) {
hContact = getContactFromString(tszContact, CI_PROTOID);
log_debugA("VARM_SETSUBJECT decoded: %u", hContact);
mir_free(tszContact);
@@ -203,7 +203,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
MCONTACT hContact = (MCONTACT)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0);
if (hContact != NULL) {
wchar_t *tszContact = encodeContactToString(hContact);
- if (tszContact != NULL) {
+ if (tszContact != nullptr) {
db_set_ws(NULL, MODULENAME, SETTING_SUBJECT, tszContact);
mir_free(tszContact);
} }
@@ -215,12 +215,12 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
// dialog box for the tokens
static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) {
- if (tr == NULL) {
- return NULL;
+ if (tr == nullptr) {
+ return nullptr;
}
char *helpText = mir_strdup(tr->szHelpText);
- if (helpText == NULL) {
- return NULL;
+ if (helpText == nullptr) {
+ return nullptr;
}
char *cur = helpText;
while (*cur != 0) {
@@ -243,8 +243,8 @@ static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) {
static wchar_t *getHelpDescription(TOKENREGISTEREX *tr)
{
- if (tr == NULL)
- return NULL;
+ if (tr == nullptr)
+ return nullptr;
char *cur = tr->szHelpText + mir_strlen(tr->szHelpText);
while (cur > tr->szHelpText) {
@@ -265,49 +265,49 @@ static wchar_t *getHelpDescription(TOKENREGISTEREX *tr)
static wchar_t *getTokenDescription(TOKENREGISTEREX *tr)
{
- if (tr == NULL)
- return NULL;
+ if (tr == nullptr)
+ return nullptr;
- if (tr->szHelpText == NULL)
+ if (tr->szHelpText == nullptr)
return mir_wstrdup(tr->tszTokenString);
char *helpText = mir_strdup(tr->szHelpText);
- if (helpText == NULL)
- return NULL;
+ if (helpText == nullptr)
+ return nullptr;
char *cur = helpText;
- wchar_t *tArgs = NULL;
- char *args = NULL, *first = NULL, *second = NULL;
+ wchar_t *tArgs = nullptr;
+ char *args = nullptr, *first = nullptr, *second = nullptr;
while (*cur != 0) {
if (*cur == '\t') {
- if (first == NULL)
+ if (first == nullptr)
first = cur;
- else if (second == NULL)
+ else if (second == nullptr)
second = cur;
}
cur++;
}
- if ((first != NULL) && (second != NULL)) {
+ if ((first != nullptr) && (second != nullptr)) {
*second = 0;
args = first+1;
}
- else args = NULL;
+ else args = nullptr;
- size_t len = mir_wstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3;
+ size_t len = mir_wstrlen(tr->tszTokenString) + (args!=nullptr?mir_strlen(args):0) + 3;
wchar_t *desc = (wchar_t*)mir_calloc(len * sizeof(wchar_t));
- if (desc == NULL) {
+ if (desc == nullptr) {
mir_free(helpText);
- return NULL;
+ return nullptr;
}
if (tr->flags&TRF_FIELD)
mir_snwprintf(desc, len, L"%c%s%c", FIELD_CHAR, tr->szTokenString, FIELD_CHAR);
else {
- if (args != NULL)
+ if (args != nullptr)
tArgs = mir_a2u(args);
- mir_snwprintf(desc, len, L"%c%s%s", FUNC_CHAR, tr->tszTokenString, (tArgs!=NULL?tArgs:L""));
+ mir_snwprintf(desc, len, L"%c%s%s", FUNC_CHAR, tr->tszTokenString, (tArgs!=nullptr?tArgs:L""));
}
mir_free(tArgs);
@@ -319,7 +319,7 @@ static int CALLBACK compareTokenHelp(LPARAM lParam1, LPARAM lParam2, LPARAM)
{
TOKENREGISTEREX *tr1 = (TOKENREGISTEREX *)lParam1;
TOKENREGISTEREX *tr2 = (TOKENREGISTEREX *)lParam2;
- if (tr1 == NULL || tr2 == NULL)
+ if (tr1 == nullptr || tr2 == nullptr)
return 0;
ptrW cat1(getTokenCategory(tr1));
@@ -331,7 +331,7 @@ static int CALLBACK compareTokenHelp(LPARAM lParam1, LPARAM lParam2, LPARAM)
if (res != 0)
return res;
- if (tr1->tszTokenString == NULL || tr2->tszTokenString == NULL)
+ if (tr1->tszTokenString == nullptr || tr2->tszTokenString == nullptr)
return 0;
return mir_wstrcmp(tr1->tszTokenString, tr2->tszTokenString);
@@ -361,24 +361,24 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
int i = -1;
do {
i++;
- tszHelpDesc = tszTokenDesc = NULL;
+ tszHelpDesc = tszTokenDesc = nullptr;
tr = getTokenRegister(i);
- if ((tr == NULL) || (tr->tszTokenString == NULL))
+ if ((tr == nullptr) || (tr->tszTokenString == nullptr))
continue;
- else if (hdd != NULL) {
+ else if (hdd != nullptr) {
if (!mir_wstrcmp(tr->tszTokenString, SUBJECT)) {
if (hdd->vhs->flags&VHF_HIDESUBJECTTOKEN)
continue;
- if (hdd->vhs->szSubjectDesc != NULL)
+ if (hdd->vhs->szSubjectDesc != nullptr)
tszHelpDesc = mir_a2u(hdd->vhs->szSubjectDesc);
}
if (!mir_wstrcmp(tr->tszTokenString, MIR_EXTRATEXT)) {
if (hdd->vhs->flags & VHF_HIDEEXTRATEXTTOKEN)
continue;
- if (hdd->vhs->szExtraTextDesc != NULL)
+ if (hdd->vhs->szExtraTextDesc != nullptr)
tszHelpDesc = mir_a2u(hdd->vhs->szExtraTextDesc);
}
}
@@ -388,7 +388,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
lvItem.iItem = ListView_GetItemCount(hList);
lvItem.lParam = (LPARAM)tr;
tszTokenDesc = getTokenDescription(tr);
- if (tszTokenDesc == NULL)
+ if (tszTokenDesc == nullptr)
continue;
lvItem.pszText = tszTokenDesc;
@@ -396,10 +396,10 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
mir_free(tszTokenDesc);
lvItem.mask = LVIF_TEXT;
- if (tszHelpDesc == NULL)
+ if (tszHelpDesc == nullptr)
tszHelpDesc = getHelpDescription(tr);
- if (tszHelpDesc == NULL)
+ if (tszHelpDesc == nullptr)
tszHelpDesc = mir_wstrdup(L"unknown");
lvItem.iSubItem = 1;
@@ -407,12 +407,12 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
ListView_SetItem(hList, &lvItem);
mir_free(tszHelpDesc);
}
- while (tr != NULL);
+ while (tr != nullptr);
ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
ListView_SetColumnWidth(hList, 1, LVSCW_AUTOSIZE);
ListView_SortItems(hList, compareTokenHelp, 0);
- last = text = NULL;
+ last = text = nullptr;
for (i = 0; i < ListView_GetItemCount(hList); i++) {
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_PARAM;
@@ -421,17 +421,17 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
continue;
cat = getTokenCategory((TOKENREGISTEREX *)lvItem.lParam);
- if (cat != NULL) {
+ if (cat != nullptr) {
text = mir_wstrdup(TranslateW(cat));
mir_free(cat);
}
- else text = NULL;
+ else text = nullptr;
- if (text != NULL && (last == NULL || mir_wstrcmpi(last, text))) {
+ if (text != nullptr && (last == nullptr || mir_wstrcmpi(last, text))) {
lvItem.mask = LVIF_TEXT;
lvItem.pszText = text;
ListView_InsertItem(hList, &lvItem);
- if (last != NULL) {
+ if (last != nullptr) {
mir_free(last);
lvItem.iSubItem = 0;
lvItem.pszText = L"";
@@ -448,7 +448,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
case WM_NOTIFY:
if ((((NMHDR*)lParam)->idFrom == IDC_TOKENLIST) && (((NMHDR*)lParam)->code == NM_DBLCLK)) {
HWND hwndInputDlg = (HWND)SendMessage(GetParent(hwndDlg), VARM_GETDIALOG, (WPARAM)VHF_INPUT, 0);
- if (hwndInputDlg == NULL)
+ if (hwndInputDlg == nullptr)
break;
HWND hList = GetDlgItem(hwndDlg, IDC_TOKENLIST);
@@ -461,12 +461,12 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
break;
TOKENREGISTER *tr = (TOKENREGISTER *)lvItem.lParam;
- if (tr == NULL)
+ if (tr == nullptr)
break;
size_t len = mir_wstrlen(tr->tszTokenString) + 2;
wchar_t *tokenString = (wchar_t*)mir_alloc((len+1)*sizeof(wchar_t));
- if (tokenString == NULL)
+ if (tokenString == nullptr)
break;
memset(tokenString, 0, ((len + 1) * sizeof(wchar_t)));
@@ -611,7 +611,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
dat->hwndHelpDlg = GetParent(hwndDlg);
SendMessage(hwndDlg, VARM_PARSE, 0, 0);
- SetTimer(hwndDlg, IDT_PARSE, 1000, NULL);
+ SetTimer(hwndDlg, IDT_PARSE, 1000, nullptr);
SetFocus(GetDlgItem(hwndDlg, IDC_TESTSTRING));
break;
@@ -679,17 +679,17 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
extraText = (wchar_t*)mir_calloc((len + 1)* sizeof(wchar_t));
SendMessage(GetParent(hwndDlg), VARM_GETEXTRATEXT, (WPARAM)len + 1, (LPARAM)extraText);
}
- else extraText = NULL;
+ else extraText = nullptr;
- if (string != NULL) {
+ if (string != nullptr) {
wchar_t *newString = variables_parsedup(string, extraText, (MCONTACT)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0));
- if (newString != NULL) {
+ if (newString != nullptr) {
wchar_t *oldString = Hlp_GetDlgItemText(hwndDlg, IDC_RESULT);
- if (oldString == NULL || mir_wstrcmp(oldString, newString))
+ if (oldString == nullptr || mir_wstrcmp(oldString, newString))
SetDlgItemText(hwndDlg, IDC_RESULT, newString);
mir_free(newString);
- if (oldString != NULL)
+ if (oldString != nullptr)
mir_free(oldString);
}
mir_free(string);
@@ -718,7 +718,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
case WM_DESTROY:
KillTimer(hwndDlg, IDT_PARSE);
- if (dat == NULL)
+ if (dat == nullptr)
break;
db_set_dw(NULL, MODULENAME, SETTING_SPLITTERPOS, dat->splitterPos);
mir_free(dat);
@@ -781,7 +781,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
GetWindowRect(hwndDlg, &rcParent);
TCITEM tci = { 0 };
- HWND hPage, hShow = 0;
+ HWND hPage, hShow = nullptr;
if (dat->vhs->flags&VHF_TOKENS) {
// token tab
tci.mask = TCIF_TEXT | TCIF_PARAM;
@@ -793,7 +793,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE);
ShowWindow(hPage, SW_HIDE);
TabCtrl_InsertItem(hTab, tabCount++, &tci);
- hShow = hShow == 0 ? hPage : hShow;
+ hShow = hShow == nullptr ? hPage : hShow;
}
if (dat->vhs->flags&VHF_INPUT) {
// input tab
@@ -806,8 +806,8 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE);
ShowWindow(hPage, SW_HIDE);
TabCtrl_InsertItem(hTab, tabCount++, &tci);
- hShow = hShow == 0 ? hPage : hShow;
- if ((dat->vhs->fi != NULL) && (dat->vhs->fi->szFormat != NULL)) {
+ hShow = hShow == nullptr ? hPage : hShow;
+ if ((dat->vhs->fi != nullptr) && (dat->vhs->fi->szFormat != nullptr)) {
if (dat->vhs->fi->flags & FIF_UNICODE)
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)dat->vhs->fi->tszFormat);
else {
@@ -818,20 +818,20 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
}
}
- else if (dat->vhs->hwndCtrl != NULL) {
+ else if (dat->vhs->hwndCtrl != nullptr) {
wchar_t *tszText = Hlp_GetWindowText(dat->vhs->hwndCtrl);
- if (tszText != NULL) {
+ if (tszText != nullptr) {
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)tszText);
mir_free(tszText);
}
}
- if (dat->vhs->fi != NULL || dat->vhs->hwndCtrl != NULL) {
+ if (dat->vhs->fi != nullptr || dat->vhs->hwndCtrl != nullptr) {
SetDlgItemText(hwndDlg, IDC_CANCEL, TranslateT("Cancel"));
ShowWindow(GetDlgItem(hwndDlg, IDC_OK), SW_SHOW);
}
}
if ((dat->vhs->flags&VHF_SUBJECT) ||
- ((dat->vhs->flags&VHF_INPUT) && (((dat->vhs->fi != NULL) && (dat->vhs->fi->hContact != NULL)) || (dat->vhs->flags&VHF_SETLASTSUBJECT)))) {
+ ((dat->vhs->flags&VHF_INPUT) && (((dat->vhs->fi != nullptr) && (dat->vhs->fi->hContact != NULL)) || (dat->vhs->flags&VHF_SETLASTSUBJECT)))) {
// subject window is created, but not necessarily shown
dat->hwndSubjectDlg = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CLIST_DIALOG), hwndDlg, clistDlgProc, (LPARAM)GetParent(hwndDlg));
EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
@@ -839,7 +839,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE);
ShowWindow(hPage, SW_HIDE);
- if ((dat->vhs->fi != NULL) && (dat->vhs->fi->hContact != NULL))
+ if ((dat->vhs->fi != nullptr) && (dat->vhs->fi->hContact != NULL))
SendMessage(hwndDlg, VARM_SETSUBJECT, (WPARAM)dat->vhs->fi->hContact, 0);
else if (dat->vhs->flags&VHF_SETLASTSUBJECT)
SendMessage(hwndDlg, VARM_SETSUBJECT, (WPARAM)INVALID_HANDLE_VALUE, 0);
@@ -850,18 +850,18 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
tci.mask = TCIF_TEXT | TCIF_PARAM;
tci.pszText = TranslateT("%subject%");
TabCtrl_InsertItem(hTab, tabCount++, &tci);
- hShow = hShow == 0 ? hPage : hShow;
+ hShow = hShow == nullptr ? hPage : hShow;
}
}
if ((dat->vhs->flags&VHF_EXTRATEXT) ||
- ((dat->vhs->flags&VHF_INPUT) && (dat->vhs->fi != NULL) && (dat->vhs->fi->tszExtraText != NULL))) {
+ ((dat->vhs->flags&VHF_INPUT) && (dat->vhs->fi != nullptr) && (dat->vhs->fi->tszExtraText != nullptr))) {
// extratext window is created, but not necessarily shown
dat->hwndExtraTextDlg = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EXTRATEXT_DIALOG), hwndDlg, extratextDlgProc, (LPARAM)GetParent(hwndDlg));
EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE);
ShowWindow(hPage, SW_HIDE);
- if ((dat->vhs->fi != NULL) && (dat->vhs->fi->tszExtraText != NULL)) {
+ if ((dat->vhs->fi != nullptr) && (dat->vhs->fi->tszExtraText != nullptr)) {
if (dat->vhs->fi->flags & FIF_UNICODE)
SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)dat->vhs->fi->tszExtraText);
else {
@@ -878,7 +878,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
tci.pszText = TranslateT("%extratext%");
tci.lParam = (LPARAM)hPage;
TabCtrl_InsertItem(hTab, tabCount++, &tci);
- hShow = hShow == 0 ? hPage : hShow;
+ hShow = hShow == nullptr ? hPage : hShow;
}
}
if (dat->vhs->flags&VHF_HELP) {
@@ -892,7 +892,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE);
ShowWindow(hPage, SW_HIDE);
TabCtrl_InsertItem(hTab, tabCount++, &tci);
- hShow = hShow == 0 ? hPage : hShow;
+ hShow = hShow == nullptr ? hPage : hShow;
}
Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, MODULENAME, "help");
SetWindowText(hwndDlg, TranslateT("Variables Help"));
@@ -903,10 +903,10 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_OK:
- if ((dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) {
+ if ((dat->vhs->fi != nullptr) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) {
int len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0);
if (len > 0) {
- if ((dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) {
+ if ((dat->vhs->fi != nullptr) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) {
if (dat->vhs->fi->flags&FIF_UNICODE) {
dat->vhs->fi->tszFormat = (wchar_t*)mir_calloc((len + 1)*sizeof(WCHAR));
SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len + 1, (LPARAM)dat->vhs->fi->tszFormat);
@@ -919,13 +919,13 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
}
}
- if (dat->vhs->hwndCtrl != NULL) {
+ if (dat->vhs->hwndCtrl != nullptr) {
int len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0);
if (len > 0) {
wchar_t *tszText;
tszText = (wchar_t*)mir_calloc((len + 1)*sizeof(wchar_t));
- if (tszText != NULL) {
+ if (tszText != nullptr) {
SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len + 1, (LPARAM)tszText);
SetWindowText(dat->vhs->hwndCtrl, tszText);
mir_free(tszText);
@@ -938,7 +938,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
(LPARAM)dat->vhs->hwndCtrl);
}
- if ((dat->vhs->flags&VHF_FULLFILLSTRUCT) && (dat->vhs->fi != NULL)) {
+ if ((dat->vhs->flags&VHF_FULLFILLSTRUCT) && (dat->vhs->fi != nullptr)) {
int len = SendMessage(hwndDlg, VARM_GETEXTRATEXTLENGTH, 0, 0);
if (len > 0) {
if (dat->vhs->fi->flags&FIF_UNICODE) {
@@ -955,7 +955,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
// fall through
case IDC_CANCEL:
- if (GetParent(hwndDlg) == NULL)
+ if (GetParent(hwndDlg) == nullptr)
DestroyWindow(hwndDlg);
else
EndDialog(hwndDlg, 0);
@@ -1077,7 +1077,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
break;
case WM_CLOSE:
- if (GetParent(hwndDlg) == NULL)
+ if (GetParent(hwndDlg) == nullptr)
DestroyWindow(hwndDlg);
else
EndDialog(hwndDlg, 0);
@@ -1105,7 +1105,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
DestroyWindow(dat->hwndExtraTextDlg);
mir_free(dat);
- dat = NULL;
+ dat = nullptr;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
break;
}
@@ -1128,23 +1128,23 @@ INT_PTR showHelpExService(WPARAM wParam, LPARAM lParam)
if (wParam)
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELP_DIALOG), (HWND)wParam, helpDlgProc, (LPARAM)lParam);
else
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HELP_DIALOG), NULL, helpDlgProc, (LPARAM)lParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HELP_DIALOG), nullptr, helpDlgProc, (LPARAM)lParam);
return 0;
}
INT_PTR showHelpService(WPARAM wParam, LPARAM lParam)
{
- static VARHELPINFO *vhs = NULL;
- static FORMATINFO *fi = NULL;
+ static VARHELPINFO *vhs = nullptr;
+ static FORMATINFO *fi = nullptr;
- if (fi == NULL)
+ if (fi == nullptr)
fi = (FORMATINFO*)mir_alloc(sizeof(FORMATINFO));
memset(fi, 0, sizeof(FORMATINFO));
fi->cbSize = sizeof(FORMATINFO);
fi->szFormat = (char *)lParam;
- if (vhs == NULL)
+ if (vhs == nullptr)
vhs = (VARHELPINFO*)mir_alloc(sizeof(VARHELPINFO));
memset(vhs, 0, sizeof(VARHELPINFO));
@@ -1164,7 +1164,7 @@ INT_PTR getSkinItemService(WPARAM, LPARAM lParam)
switch (item) {
case VSI_HELPICON:
- if (hHelpIcon == NULL)
+ if (hHelpIcon == nullptr)
hHelpIcon = IcoLib_GetIcon("vars_help");
return (INT_PTR)hHelpIcon;
@@ -1177,6 +1177,6 @@ INT_PTR getSkinItemService(WPARAM, LPARAM lParam)
int iconsChanged(WPARAM, LPARAM)
{
- hHelpIcon = NULL;
+ hHelpIcon = nullptr;
return 0;
}
diff --git a/plugins/Variables/src/lookup3.cpp b/plugins/Variables/src/lookup3.cpp
index 7f28ed0498..ecc39f1352 100644
--- a/plugins/Variables/src/lookup3.cpp
+++ b/plugins/Variables/src/lookup3.cpp
@@ -221,7 +221,7 @@ uint32 hashlittle( void *key, size_t length, uint32 initval)
/* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32)length) + initval;
- if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x3)) {
+ if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x3)) {
uint32 *k = ( uint32 *)key; /* read 32-bit chunks */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
@@ -253,7 +253,7 @@ uint32 hashlittle( void *key, size_t length, uint32 initval)
case 0 : return c; /* zero length strings require no mixing */
}
- } else if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x1)) {
+ } else if (HASH_LITTLE_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x1)) {
uint16 *k = (uint16 *)key; /* read 16-bit chunks */
/*--------------- all but last block: aligned reads and different mixing */
@@ -360,7 +360,7 @@ uint32 hashbig( void *key, size_t length, uint32 initval)
/* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32)length) + initval;
- if (HASH_BIG_ENDIAN && !((((uint8 *)key)-(uint8 *)0) & 0x3)) {
+ if (HASH_BIG_ENDIAN && !((((uint8 *)key)-(uint8 *)nullptr) & 0x3)) {
uint32 *k = (uint32 *)key; /* read 32-bit chunks */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp
index 4c917a55f0..48e04098f9 100644
--- a/plugins/Variables/src/options.cpp
+++ b/plugins/Variables/src/options.cpp
@@ -65,13 +65,13 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
case IDC_AUTOPARSE:
SendMessage(hwndDlg, VARM_PARSE, 0, 0);
if (IsDlgButtonChecked( hwndDlg, IDC_AUTOPARSE ))
- SetTimer(hwndDlg, IDT_PARSE, 1000, NULL);
+ SetTimer(hwndDlg, IDT_PARSE, 1000, nullptr);
else
KillTimer(hwndDlg, IDT_PARSE);
break;
case IDC_SHOWHELP:
- variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
+ variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG|VHF_SETLASTSUBJECT, nullptr, nullptr);
break;
case IDC_STRIPALL:
@@ -86,7 +86,7 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
int len = SendDlgItemMessage(hwndDlg, IDC_FORMATTEXT, WM_GETTEXTLENGTH, 0, 0);
if (len >= 0) {
wchar_t *szFormatText = (wchar_t*)mir_calloc((len+1)* sizeof(wchar_t));
- if (szFormatText == NULL)
+ if (szFormatText == nullptr)
break;
if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len+1) != 0)
@@ -104,9 +104,9 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
case VARM_PARSE:
{
wchar_t *string = Hlp_GetDlgItemText(hwndDlg, IDC_FORMATTEXT);
- if (string != NULL) {
- wchar_t *newString = variables_parsedup(string, NULL, NULL);
- if (newString != NULL) {
+ if (string != nullptr) {
+ wchar_t *newString = variables_parsedup(string, nullptr, NULL);
+ if (newString != nullptr) {
SetDlgItemText(hwndDlg, IDC_RESULT, newString);
mir_free(newString);
}
@@ -120,7 +120,7 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
break;
case WM_DESTROY:
- setParseOptions(NULL);
+ setParseOptions(nullptr);
break;
}
diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp
index 0c3f1a8060..e90595a68e 100644
--- a/plugins/Variables/src/parse_alias.cpp
+++ b/plugins/Variables/src/parse_alias.cpp
@@ -32,15 +32,15 @@ static mir_cs csAliasRegister;
static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias)
{
- if (szAlias == NULL || *szAlias == 0)
- return NULL;
+ if (szAlias == nullptr || *szAlias == 0)
+ return nullptr;
mir_cslock lck(csAliasRegister);
for (int i = 0; i < arAliases.getCount(); i++)
if (!mir_wstrcmp(arAliases[i]->szAlias, szAlias))
return arAliases[i];
- return NULL;
+ return nullptr;
}
static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
@@ -58,8 +58,8 @@ static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
if (((signed int)mir_wstrlen(tArg) == (ecur - cur)) && (!wcsncmp(tArg, res + cur, mir_wstrlen(tArg)))) {
if (mir_wstrlen(rArg) > mir_wstrlen(tArg)) {
res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + (mir_wstrlen(rArg) - mir_wstrlen(tArg)) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
}
memmove(res + ecur + (mir_wstrlen(rArg) - mir_wstrlen(tArg)), res + ecur, (mir_wstrlen(res + ecur) + 1)*sizeof(wchar_t));
wcsncpy(res + cur, rArg, mir_wstrlen(rArg));
@@ -74,14 +74,14 @@ static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai)
{
ALIASREGISTER *areg = searchAliasRegister(ai->targv[0]);
- if (areg == NULL || areg->argc != ai->argc - 1)
- return NULL;
+ if (areg == nullptr || areg->argc != ai->argc - 1)
+ return nullptr;
wchar_t *res = mir_wstrdup(areg->szTranslation);
for (unsigned i = 0; i < areg->argc; i++) {
res = replaceArguments(res, areg->argv[i], ai->targv[i + 1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
}
return res;
@@ -89,7 +89,7 @@ static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai)
static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** argv, wchar_t *szTranslation)
{
- if (szAlias == NULL || szTranslation == NULL || mir_wstrlen(szAlias) == 0)
+ if (szAlias == nullptr || szTranslation == nullptr || mir_wstrlen(szAlias) == 0)
return -1;
mir_cslock lck(csAliasRegister);
@@ -105,19 +105,19 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg
p->argc = argc;
p->argv = (wchar_t**)mir_realloc(p->argv, argc * sizeof(wchar_t*));
- if (p->argv == NULL)
+ if (p->argv == nullptr)
return -1;
for (unsigned j = 0; j < argc; j++) {
- if (argv[j] != NULL)
+ if (argv[j] != nullptr)
p->argv[j] = mir_wstrdup(argv[j]);
else
- p->argv[j] = NULL;
+ p->argv[j] = nullptr;
}
return 0;
}
wchar_t **pargv = (wchar_t**)mir_alloc(argc * sizeof(wchar_t*));
- if (pargv == NULL)
+ if (pargv == nullptr)
return -1;
ALIASREGISTER *p = new ALIASREGISTER;
@@ -127,10 +127,10 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg
p->argv = pargv;
for (unsigned j = 0; j < p->argc; j++) {
- if (argv[j] != NULL)
+ if (argv[j] != nullptr)
p->argv[j] = mir_wstrdup(argv[j]);
else
- p->argv[j] = NULL;
+ p->argv[j] = nullptr;
}
arAliases.insert(p);
return 0;
@@ -139,7 +139,7 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg
static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
char *szHelp, *szArgsA;
wchar_t *cur = ai->targv[1];
@@ -153,7 +153,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
deRegisterToken(alias);
addToAliasRegister(alias, argv.getCount(), argv.getArray(), ai->targv[2]);
- wchar_t *szArgs = NULL;
+ wchar_t *szArgs = nullptr;
for (int i = 0; i < argv.getCount(); i++) {
if (i == 0)
szArgs = (wchar_t*)mir_calloc((mir_wstrlen(argv[i]) + 2)*sizeof(wchar_t));
@@ -165,7 +165,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
mir_wstrcat(szArgs, L",");
}
int res;
- if (szArgs != NULL && argv.getCount() > 0) {
+ if (szArgs != nullptr && argv.getCount() > 0) {
szArgsA = mir_u2a(szArgs);
size_t size = 32 + mir_strlen(szArgsA);
@@ -184,7 +184,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
mir_free(szArgs);
mir_free(szHelp);
argv.destroy();
- return (res == 0) ? mir_wstrdup(L"") : NULL;
+ return (res == 0) ? mir_wstrdup(L"") : nullptr;
}
void registerAliasTokens()
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp
index 820b4a01ee..10de3d36cb 100644
--- a/plugins/Variables/src/parse_external.cpp
+++ b/plugins/Variables/src/parse_external.cpp
@@ -21,26 +21,26 @@
static wchar_t *getFullWinampTitleText()
{
- HWND hwndWinamp = FindWindow(L"STUDIO", NULL);
- if (hwndWinamp == NULL)
- hwndWinamp = FindWindow(L"Winamp v1.x", NULL);
+ HWND hwndWinamp = FindWindow(L"STUDIO", nullptr);
+ if (hwndWinamp == nullptr)
+ hwndWinamp = FindWindow(L"Winamp v1.x", nullptr);
- if (hwndWinamp == NULL)
- return NULL;
+ if (hwndWinamp == nullptr)
+ return nullptr;
SIZE_T dwWinTextLength = (GetWindowTextLength(hwndWinamp) + 1);
wchar_t *szWinText = (wchar_t*)mir_alloc(dwWinTextLength * sizeof(wchar_t));
- if (szWinText == NULL)
- return NULL;
+ if (szWinText == nullptr)
+ return nullptr;
if (GetWindowText(hwndWinamp, szWinText, dwWinTextLength) == 0) {
mir_free(szWinText);
- return NULL;
+ return nullptr;
}
wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_wstrlen(szWinText) + 1)*sizeof(wchar_t));
- if (szTitle == NULL) {
+ if (szTitle == nullptr) {
mir_free(szWinText);
- return NULL;
+ return nullptr;
}
mir_wstrcpy(szTitle, szWinText);
mir_wstrcpy(szTitle + mir_wstrlen(szTitle), szWinText);
@@ -52,18 +52,18 @@ static wchar_t *getFullWinampTitleText()
static wchar_t *parseWinampSong(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
wchar_t *szTitle = getFullWinampTitleText();
- if (szTitle == NULL)
- return NULL;
+ if (szTitle == nullptr)
+ return nullptr;
wchar_t *scur = wcschr(szTitle, '.');
wchar_t *cur;
- if ((scur == NULL) || ((cur = wcsstr(scur, L" - Winamp")) == NULL) || (scur >= cur) || (scur > (szTitle + mir_wstrlen(szTitle) - 2)) || (cur > (szTitle + mir_wstrlen(szTitle)))) {
+ if ((scur == nullptr) || ((cur = wcsstr(scur, L" - Winamp")) == nullptr) || (scur >= cur) || (scur > (szTitle + mir_wstrlen(szTitle) - 2)) || (cur > (szTitle + mir_wstrlen(szTitle)))) {
mir_free(szTitle);
- return NULL;
+ return nullptr;
}
scur++;
scur++;
@@ -78,16 +78,16 @@ static wchar_t *parseWinampSong(ARGUMENTSINFO *ai)
static wchar_t *parseWinampState(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
wchar_t *szTitle = getFullWinampTitleText();
- if (szTitle == NULL)
- return NULL;
+ if (szTitle == nullptr)
+ return nullptr;
wchar_t *scur = wcschr(szTitle, '.');
wchar_t *cur;
- if (scur == NULL || (cur = wcsstr(scur, L" - Winamp")) == NULL)
+ if (scur == nullptr || (cur = wcsstr(scur, L" - Winamp")) == nullptr)
res = mir_wstrdup(TranslateT("Stopped"));
else if ((!wcsncmp(cur + 10, L"[Stopped]", 9)))
res = mir_wstrdup(TranslateT("Stopped"));
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp
index cd927fb98b..d4c00aad23 100644
--- a/plugins/Variables/src/parse_inet.cpp
+++ b/plugins/Variables/src/parse_inet.cpp
@@ -22,11 +22,11 @@
static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
char *res = mir_u2a(ai->targv[1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
size_t cur = 0;
while (cur < mir_strlen(res)) {
@@ -35,8 +35,8 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai)
continue;
}
res = (char*)mir_realloc(res, mir_strlen(res) + 4);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
char hex[8];
memmove(res + cur + 3, res + cur + 1, mir_strlen(res + cur + 1) + 1);
@@ -53,11 +53,11 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai)
static wchar_t *parseUrlDec(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
char *res = mir_u2a(ai->targv[1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
unsigned int cur = 0;
while (cur < mir_strlen(res)) {
@@ -65,7 +65,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai)
char hex[8];
memset(hex, '\0', sizeof(hex));
strncpy(hex, res + cur + 1, 2);
- *(res + cur) = (char)strtol(hex, NULL, 16);
+ *(res + cur) = (char)strtol(hex, nullptr, 16);
memmove(res + cur + 1, res + cur + 3, mir_strlen(res + cur + 3) + 1);
}
cur++;
@@ -80,7 +80,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai)
static wchar_t *parseNToA(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
struct in_addr in;
in.s_addr = ttoi(ai->targv[1]);
@@ -90,7 +90,7 @@ static wchar_t *parseNToA(ARGUMENTSINFO *ai)
static wchar_t *parseHToA(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
struct in_addr in;
in.s_addr = htonl(ttoi(ai->targv[1]));
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp
index 02378ee230..2c234b9890 100644
--- a/plugins/Variables/src/parse_logic.cpp
+++ b/plugins/Variables/src/parse_logic.cpp
@@ -22,7 +22,7 @@
static wchar_t *parseAnd(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -42,7 +42,7 @@ static wchar_t *parseAnd(ARGUMENTSINFO *ai)
static wchar_t *parseFalse(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_FALSE;
return mir_wstrdup(L"");
@@ -51,7 +51,7 @@ static wchar_t *parseFalse(ARGUMENTSINFO *ai)
static wchar_t *parseIf(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -65,7 +65,7 @@ static wchar_t *parseIf(ARGUMENTSINFO *ai)
static wchar_t *parseIf2(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -93,13 +93,13 @@ static wchar_t *parseIf3(ARGUMENTSINFO *ai)
mir_free(szCondition);
}
- return NULL;
+ return nullptr;
}
static wchar_t *parseIfequal(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -108,7 +108,7 @@ static wchar_t *parseIfequal(ARGUMENTSINFO *ai)
fi.szFormat = ai->argv[2];
ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
- return NULL;
+ return nullptr;
if (ttoi(tszFirst) == ttoi(tszSecond))
return mir_wstrdup(ai->targv[3]);
@@ -119,7 +119,7 @@ static wchar_t *parseIfequal(ARGUMENTSINFO *ai)
static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -128,7 +128,7 @@ static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
fi.szFormat = ai->argv[2];
ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
- return NULL;
+ return nullptr;
if (ttoi(tszFirst) > ttoi(tszSecond))
return mir_wstrdup(ai->targv[3]);
@@ -139,7 +139,7 @@ static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -148,7 +148,7 @@ static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
fi.szFormat = ai->argv[2];
ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
- return NULL;
+ return nullptr;
if (mir_wstrlen(tszFirst) > mir_wstrlen(tszSecond))
return mir_wstrdup(ai->targv[3]);
@@ -164,7 +164,7 @@ static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
static wchar_t *parseFor(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(L"");
@@ -178,12 +178,12 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai)
while (fi.eCount == 0) {
fi.tszFormat = ai->targv[4];
wchar_t *parsed = formatString(&fi);
- if (parsed != NULL) {
- if (res == NULL) {
+ if (parsed != nullptr) {
+ if (res == nullptr) {
res = (wchar_t*)mir_alloc(mir_wstrlen(parsed) + 1 * sizeof(wchar_t));
- if (res == NULL) {
+ if (res == nullptr) {
mir_free(parsed);
- return NULL;
+ return nullptr;
}
}
else res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(parsed) + 1)*sizeof(wchar_t));
@@ -204,7 +204,7 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai)
static wchar_t *parseEqual(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (ttoi(ai->targv[1]) != ttoi(ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -215,7 +215,7 @@ static wchar_t *parseEqual(ARGUMENTSINFO *ai)
static wchar_t *parseGreater(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (ttoi(ai->targv[1]) <= ttoi(ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -226,7 +226,7 @@ static wchar_t *parseGreater(ARGUMENTSINFO *ai)
static wchar_t *parseLonger(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (mir_wstrlen(ai->targv[1]) <= mir_wstrlen(ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -237,7 +237,7 @@ static wchar_t *parseLonger(ARGUMENTSINFO *ai)
static wchar_t *parseNot(ARGUMENTSINFO *ai)
{
if (ai->argc != 2) {
- return NULL;
+ return nullptr;
}
FORMATINFO fi;
@@ -254,7 +254,7 @@ static wchar_t *parseNot(ARGUMENTSINFO *ai)
static wchar_t *parseOr(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -273,13 +273,13 @@ static wchar_t *parseOr(ARGUMENTSINFO *ai)
static wchar_t *parseTrue(ARGUMENTSINFO *ai)
{
- return (ai->argc != 1) ? NULL : mir_wstrdup(L"");
+ return (ai->argc != 1) ? nullptr : mir_wstrdup(L"");
}
static wchar_t *parseXor(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp
index cd028d3651..7bb12ada35 100644
--- a/plugins/Variables/src/parse_math.cpp
+++ b/plugins/Variables/src/parse_math.cpp
@@ -22,7 +22,7 @@
static wchar_t *parseAdd(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
int result = 0;
for (unsigned int i = 1; i < ai->argc; i++)
@@ -34,12 +34,12 @@ static wchar_t *parseAdd(ARGUMENTSINFO *ai)
static wchar_t *parseDiv(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int val1 = ttoi(ai->targv[1]);
int val2 = ttoi(ai->targv[2]);
if (val2 == 0)
- return NULL;
+ return nullptr;
return itot(val1 / val2);
}
@@ -50,15 +50,15 @@ static wchar_t *parseHex(ARGUMENTSINFO *ai)
wchar_t szVal[34];
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
mir_snwprintf(szVal, L"%x", val);
unsigned int zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 3)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((zeros + mir_wstrlen(szVal) + 3) * sizeof(wchar_t)));
mir_wstrcpy(res, L"0x");
@@ -72,12 +72,12 @@ static wchar_t *parseHex(ARGUMENTSINFO *ai)
static wchar_t *parseMod(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int val1 = ttoi(ai->targv[1]);
int val2 = ttoi(ai->targv[2]);
if (val2 == 0)
- return NULL;
+ return nullptr;
return itot(val1 % val2);
}
@@ -85,7 +85,7 @@ static wchar_t *parseMod(ARGUMENTSINFO *ai)
static wchar_t *parseMul(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
int result = ttoi(ai->targv[1]);
for (unsigned i = 2; i < ai->argc; i++)
@@ -97,10 +97,10 @@ static wchar_t *parseMul(ARGUMENTSINFO *ai)
static wchar_t *parseMuldiv(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
if (ttoi(ai->targv[3]) == 0)
- return NULL;
+ return nullptr;
return itot((ttoi(ai->targv[1])*ttoi(ai->targv[2])) / ttoi(ai->targv[3]));
}
@@ -108,7 +108,7 @@ static wchar_t *parseMuldiv(ARGUMENTSINFO *ai)
static wchar_t *parseMin(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
int minVal = ttoi(ai->targv[1]);
for (unsigned i = 2; i < ai->argc; i++)
@@ -120,7 +120,7 @@ static wchar_t *parseMin(ARGUMENTSINFO *ai)
static wchar_t *parseMax(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
int maxVal = ttoi(ai->targv[1]);
for (unsigned i = 2; i < ai->argc; i++)
@@ -132,19 +132,19 @@ static wchar_t *parseMax(ARGUMENTSINFO *ai)
static wchar_t *parseNum(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
wchar_t *szVal = itot(val);
- if (szVal == NULL)
- return NULL;
+ if (szVal == nullptr)
+ return nullptr;
unsigned zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 1)*sizeof(wchar_t));
- if (res == NULL) {
+ if (res == nullptr) {
mir_free(szVal);
- return NULL;
+ return nullptr;
}
memset(res, 0, ((zeros + mir_wstrlen(szVal) + 1) * sizeof(wchar_t)));
@@ -166,7 +166,7 @@ static wchar_t *parseRand(ARGUMENTSINFO *)
static wchar_t *parseSub(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
int result = ttoi(ai->targv[1]);
for (unsigned i = 2; i < ai->argc; i++)
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp
index 9fc394c6f9..b071cd4c25 100644
--- a/plugins/Variables/src/parse_metacontacts.cpp
+++ b/plugins/Variables/src/parse_metacontacts.cpp
@@ -22,19 +22,19 @@
static wchar_t *parseGetParent(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
hContact = db_mc_getMeta(hContact);
if (hContact == NULL)
- return NULL;
+ return nullptr;
ptrW szUniqueID;
char* szProto = GetContactProto(hContact);
- if (szProto != NULL)
+ if (szProto != nullptr)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL) {
@@ -50,19 +50,19 @@ static wchar_t *parseGetParent(ARGUMENTSINFO *ai)
static wchar_t *parseGetDefault(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
hContact = db_mc_getDefault(hContact);
if (hContact == NULL)
- return NULL;
+ return nullptr;
ptrW szUniqueID;
char* szProto = GetContactProto(hContact);
- if (szProto != NULL)
+ if (szProto != nullptr)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL) {
@@ -78,19 +78,19 @@ static wchar_t *parseGetDefault(ARGUMENTSINFO *ai)
static wchar_t *parseGetMostOnline(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
hContact = db_mc_getMostOnline(hContact);
if (hContact == NULL)
- return NULL;
+ return nullptr;
ptrW szUniqueID;
char *szProto = GetContactProto(hContact);
- if (szProto != NULL)
+ if (szProto != nullptr)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL) {
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index 0c3c2af113..e6280737d5 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -22,14 +22,14 @@
static wchar_t* parseCodeToStatus(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
unsigned int status = ttoi(ai->targv[1]);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
- if (szStatus != NULL)
+ if (szStatus != nullptr)
return mir_wstrdup(szStatus);
- return NULL;
+ return nullptr;
}
static int getContactInfoFlags(wchar_t *tszDesc)
@@ -77,7 +77,7 @@ static int getContactInfoFlags(wchar_t *tszDesc)
static wchar_t* parseContact(ARGUMENTSINFO *ai)
{
if (ai->argc < 3 || ai->argc > 4)
- return NULL;
+ return nullptr;
int n = 0;
if (ai->argc == 4) {
@@ -89,7 +89,7 @@ static wchar_t* parseContact(ARGUMENTSINFO *ai)
MCONTACT hContact = getContactFromString(ai->targv[1], getContactInfoFlags(ai->targv[2]), n);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
log_debugA("contact: %x", hContact);
return encodeContactToString(hContact);
@@ -98,7 +98,7 @@ static wchar_t* parseContact(ARGUMENTSINFO *ai)
static wchar_t* parseContactCount(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int count = getContactFromString(ai->targv[1], CI_NEEDCOUNT | getContactInfoFlags(ai->targv[2]));
return itot(count);
@@ -107,15 +107,15 @@ static wchar_t* parseContactCount(ARGUMENTSINFO *ai)
static wchar_t* parseContactInfo(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
BYTE type = getContactInfoType(ai->targv[2]);
if (type == 0)
- return NULL;
+ return nullptr;
return getContactInfoT(type, hContact);
}
@@ -123,11 +123,11 @@ static wchar_t* parseContactInfo(ARGUMENTSINFO *ai)
static wchar_t* parseDBProfileName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
wchar_t name[MAX_PATH];
if (Profile_GetNameW(_countof(name), name))
- return NULL;
+ return nullptr;
return mir_wstrdup(name);
}
@@ -135,7 +135,7 @@ static wchar_t* parseDBProfileName(ARGUMENTSINFO *ai)
static wchar_t* parseDBProfilePath(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
wchar_t path[MAX_PATH];
Profile_GetPathW(_countof(path), path);
@@ -148,7 +148,7 @@ static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wch
if (db_get_s(hContact, module, setting, &dbv, 0))
return defaultValue;
- wchar_t *var = NULL;
+ wchar_t *var = nullptr;
switch (dbv.type) {
case DBVT_BYTE:
var = itot(dbv.bVal);
@@ -177,26 +177,26 @@ static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wch
static wchar_t* parseDBSetting(ARGUMENTSINFO *ai)
{
if (ai->argc < 4)
- return NULL;
+ return nullptr;
MCONTACT hContact = NULL;
if (mir_wstrlen(ai->targv[1]) > 0) {
hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
}
char *szModule = mir_u2a(ai->targv[2]);
- if (szModule == NULL)
- return NULL;
+ if (szModule == nullptr)
+ return nullptr;
char *szSetting = mir_u2a(ai->targv[3]);
- if (szSetting == NULL) {
+ if (szSetting == nullptr) {
mir_free(szModule);
- return NULL;
+ return nullptr;
}
- wchar_t *szDefaultValue = ((ai->argc > 4 && mir_wstrlen(ai->targv[4]) > 0) ? mir_wstrdup(ai->targv[4]) : NULL);
+ wchar_t *szDefaultValue = ((ai->argc > 4 && mir_wstrlen(ai->targv[4]) > 0) ? mir_wstrdup(ai->targv[4]) : nullptr);
wchar_t *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
mir_free(szDefaultValue);
mir_free(szSetting);
@@ -207,15 +207,15 @@ static wchar_t* parseDBSetting(ARGUMENTSINFO *ai)
static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
wchar_t *szFormat;
if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[2];
@@ -223,7 +223,7 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai)
char *szModule = SEEN_MODULE;
lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
if (lsTime.wYear == 0)
- return NULL;
+ return nullptr;
lsTime.wMilliseconds = 0;
lsTime.wSecond = db_get_w(hContact, szModule, "Seconds", 0);
@@ -233,14 +233,14 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai)
lsTime.wDayOfWeek = db_get_w(hContact, szModule, "WeekDay", 0);
lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0);
- int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
+ int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -249,15 +249,15 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai)
static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
wchar_t *szFormat;
if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[2];
@@ -265,7 +265,7 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai)
char *szModule = SEEN_MODULE;
lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
if (lsTime.wYear == 0)
- return NULL;
+ return nullptr;
lsTime.wMilliseconds = 0;
lsTime.wSecond = db_get_w(hContact, szModule, "Seconds", 0);
@@ -276,14 +276,14 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai)
lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0);
lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
- int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
+ int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -292,33 +292,33 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai)
static wchar_t* parseLastSeenStatus(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
char *szModule = SEEN_MODULE;
int status = db_get_w(hContact, szModule, "Status", 0);
if (status == 0)
- return NULL;
+ return nullptr;
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
- if (szStatus != NULL)
+ if (szStatus != nullptr)
return mir_wstrdup(szStatus);
- return NULL;
+ return nullptr;
}
static wchar_t* parseMirandaPath(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
wchar_t path[MAX_PATH];
- if (GetModuleFileName(NULL, path, _countof(path)) == 0)
- return NULL;
+ if (GetModuleFileName(nullptr, path, _countof(path)) == 0)
+ return nullptr;
return mir_wstrdup(path);
}
@@ -326,7 +326,7 @@ static wchar_t* parseMirandaPath(ARGUMENTSINFO *ai)
static wchar_t* parseMyStatus(ARGUMENTSINFO *ai)
{
if (ai->argc > 2)
- return NULL;
+ return nullptr;
int status;
if (ai->argc == 1 || mir_wstrlen(ai->targv[1]) == 0)
@@ -335,16 +335,16 @@ static wchar_t* parseMyStatus(ARGUMENTSINFO *ai)
status = CallProtoService(_T2A(ai->targv[1]), PS_GETSTATUS, 0, 0);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
- return (szStatus != NULL) ? mir_wstrdup(szStatus) : NULL;
+ return (szStatus != nullptr) ? mir_wstrdup(szStatus) : nullptr;
}
static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
- char *szRes = NULL;
- wchar_t *tszRes = NULL;
+ char *szRes = nullptr;
+ wchar_t *tszRes = nullptr;
ptrA szProto(mir_u2a(ai->targv[1]));
if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINAME)))
@@ -352,20 +352,20 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) {
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
- return NULL;
+ return nullptr;
}
else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) {
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
- return NULL;
+ return nullptr;
}
else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINICK)))
tszRes = Contact_GetInfo(CNF_DISPLAY, NULL, szProto);
- if (szRes == NULL && tszRes == NULL)
- return NULL;
+ if (szRes == nullptr && tszRes == nullptr)
+ return nullptr;
- if (szRes != NULL && tszRes == NULL)
+ if (szRes != nullptr && tszRes == nullptr)
tszRes = mir_a2u(szRes);
return tszRes;
@@ -374,24 +374,24 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai)
{
if (ai->argc != 1 || ai->fi->hContact == NULL)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
ptrW szUniqueID;
char *szProto = GetContactProto(ai->fi->hContact);
- if (szProto != NULL)
+ if (szProto != nullptr)
szUniqueID = getContactInfoT(CNF_UNIQUEID, ai->fi->hContact);
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
szUniqueID = (wchar_t*)mir_alloc(40);
if (szUniqueID == NULL)
- return NULL;
+ return nullptr;
mir_snwprintf(szUniqueID, 20, L"%p", ai->fi->hContact);
}
if (szUniqueID == NULL)
- return NULL;
+ return nullptr;
return CMStringW(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
}
@@ -524,7 +524,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags)
static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
- return NULL;
+ return nullptr;
int flags = DBE_MESSAGE;
switch (*ai->targv[2]) {
@@ -560,18 +560,18 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
MCONTACT hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
- return NULL;
+ return nullptr;
MEVENT hDbEvent = findDbEvent(hContact, NULL, flags);
if (hDbEvent == NULL)
- return NULL;
+ return nullptr;
DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hDbEvent);
dbe.pBlob = (PBYTE)mir_calloc(dbe.cbBlob);
if (db_event_get(hDbEvent, &dbe)) {
mir_free(dbe.pBlob);
- return NULL;
+ return nullptr;
}
wchar_t *res = DbEvent_GetTextW(&dbe, CP_ACP);
@@ -582,16 +582,16 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
static wchar_t* parseTranslate(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = TranslateW(ai->targv[1]);
- return (res == NULL) ? NULL : mir_wstrdup(res);
+ return (res == nullptr) ? nullptr : mir_wstrdup(res);
}
static wchar_t* parseVersionString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
char versionString[128];
@@ -602,28 +602,28 @@ static wchar_t* parseVersionString(ARGUMENTSINFO *ai)
static wchar_t *parseContactNameString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1 || ai->fi->hContact == NULL)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
wchar_t *ret = (wchar_t*)pcli->pfnGetContactDisplayName(ai->fi->hContact, 0);
- return (ret == NULL) ? NULL : mir_wstrdup(ret);
+ return (ret == nullptr) ? nullptr : mir_wstrdup(ret);
}
static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
wchar_t ret[128];
- return mir_wstrdup(TimeZone_ToStringT(time(NULL), L"d s", ret, _countof(ret)));
+ return mir_wstrdup(TimeZone_ToStringT(time(nullptr), L"d s", ret, _countof(ret)));
}
static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
@@ -635,7 +635,7 @@ static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
static wchar_t *parseMirSrvExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
if (!ServiceExists(_T2A(ai->targv[1])))
ai->flags |= AIF_FALSE;
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp
index 7031fc4cc6..b401d15aae 100644
--- a/plugins/Variables/src/parse_regexp.cpp
+++ b/plugins/Variables/src/parse_regexp.cpp
@@ -30,13 +30,13 @@ static wchar_t *parseRegExpCheck(ARGUMENTSINFO *ai)
int offsets[99];
if (ai->argc != 3)
- return NULL;
+ return nullptr;
ai->flags = AIF_FALSE;
- pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, NULL);
- if (ppat == NULL)
- return NULL;
+ pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, nullptr);
+ if (ppat == nullptr)
+ return nullptr;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_wstrlen(ai->targv[2]), 0, 0, offsets, 99);
@@ -60,16 +60,16 @@ static wchar_t *parseRegExpSubstr(ARGUMENTSINFO *ai)
int offsets[99];
if (ai->argc != 4)
- return NULL;
+ return nullptr;
number = _wtoi(ai->targv[3]);
if (number < 0)
- return NULL;
+ return nullptr;
ai->flags = AIF_FALSE;
- pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, NULL);
- if (ppat == NULL)
- return NULL;
+ pcre16 *ppat = pcre16_compile(ai->targv[1], 0, &err, &erroffset, nullptr);
+ if (ppat == nullptr)
+ return nullptr;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_wstrlen(ai->targv[2]), 0, 0, offsets, 99);
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp
index 5779f13dc1..81207853b1 100644
--- a/plugins/Variables/src/parse_str.cpp
+++ b/plugins/Variables/src/parse_str.cpp
@@ -22,7 +22,7 @@
static wchar_t *parseCaps(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
@@ -47,7 +47,7 @@ static wchar_t *parseCaps(ARGUMENTSINFO *ai)
static wchar_t *parseCaps2(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
@@ -73,13 +73,13 @@ static wchar_t *parseCrlf(ARGUMENTSINFO *ai)
static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
do {
cur = wcschr(cur, '\n');
- if ((cur == NULL) || ((cur > res) && (*(cur - 1) == '\r')))
+ if ((cur == nullptr) || ((cur > res) && (*(cur - 1) == '\r')))
continue;
log_debug(cur);
@@ -90,7 +90,7 @@ static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
memcpy(cur, L"\r\n", 2 * sizeof(wchar_t));
cur += 2;
}
- while (cur != NULL);
+ while (cur != nullptr);
return res;
}
@@ -103,7 +103,7 @@ static wchar_t *parseFixeol(ARGUMENTSINFO *ai)
else if (ai->argc == 3)
szReplacement = ai->targv[2];
else
- return NULL;
+ return nullptr;
wchar_t *cur = ai->targv[1];
while (mir_wstrcmp(cur, L"\r\n") && *cur != '\n' && *cur != 0)
@@ -114,7 +114,7 @@ static wchar_t *parseFixeol(ARGUMENTSINFO *ai)
cur--;
wchar_t *res = (wchar_t*)mir_alloc((cur - ai->targv[1] + mir_wstrlen(szReplacement) + 1)*sizeof(wchar_t));
- if (res == NULL)
+ if (res == nullptr)
return res;
memset(res, 0, (((cur - ai->targv[1]) + 1) * sizeof(wchar_t)));
@@ -129,20 +129,20 @@ static wchar_t *parseFixeol2(ARGUMENTSINFO *ai)
switch (ai->argc) {
case 2: szReplacement = L" "; break;
case 3: szReplacement = ai->targv[2]; break;
- default: return NULL;
+ default: return nullptr;
}
wchar_t *res = mir_wstrdup(ai->targv[1]);
for (size_t pos = 0; pos < mir_wstrlen(res); pos++) {
wchar_t *cur = res + pos;
- wchar_t *szEol = NULL;
+ wchar_t *szEol = nullptr;
if (!wcsncmp(cur, L"\r\n", mir_wstrlen(L"\r\n")))
szEol = L"\r\n";
if (*cur == '\n')
szEol = L"\n";
- if (szEol != NULL) {
+ if (szEol != nullptr) {
if (mir_wstrlen(szReplacement) > mir_wstrlen(szEol)) {
res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(szReplacement) - mir_wstrlen(szEol) + 1)*sizeof(wchar_t));
cur = res + pos;
@@ -158,15 +158,15 @@ static wchar_t *parseFixeol2(ARGUMENTSINFO *ai)
static wchar_t *parseInsert(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
unsigned int pos = ttoi(ai->targv[3]);
if (pos > mir_wstrlen(ai->targv[1]))
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((mir_wstrlen(ai->targv[1]) + mir_wstrlen(ai->targv[2]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((mir_wstrlen(ai->targv[1]) + mir_wstrlen(ai->targv[2]) + 1) * sizeof(wchar_t)));
wcsncpy(res, ai->targv[1], pos);
@@ -178,16 +178,16 @@ static wchar_t *parseInsert(ARGUMENTSINFO *ai)
static wchar_t *parseLeft(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int len = ttoi(ai->targv[2]);
if (len < 0)
- return NULL;
+ return nullptr;
len = min(len, (signed int)mir_wstrlen(ai->targv[1]));
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((len + 1) * sizeof(wchar_t)));
wcsncpy(res, ai->targv[1], len);
@@ -197,7 +197,7 @@ static wchar_t *parseLeft(ARGUMENTSINFO *ai)
static wchar_t *parseLen(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
return itot((int)mir_wstrlen(ai->targv[1]));
}
@@ -205,7 +205,7 @@ static wchar_t *parseLen(ARGUMENTSINFO *ai)
static wchar_t *parseLineCount(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
int count = 1;
wchar_t *cur = ai->targv[1];
@@ -226,11 +226,11 @@ static wchar_t *parseLineCount(ARGUMENTSINFO *ai)
static wchar_t *parseLower(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
return CharLower(res);
}
@@ -238,7 +238,7 @@ static wchar_t *parseLower(ARGUMENTSINFO *ai)
static wchar_t *parseLongest(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
unsigned int iLong = 1;
for (unsigned int i = 2; i < ai->argc; i++)
@@ -251,7 +251,7 @@ static wchar_t *parseLongest(ARGUMENTSINFO *ai)
static wchar_t *parseNoOp(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
return mir_wstrdup(ai->targv[1]);
}
@@ -262,17 +262,17 @@ static wchar_t *parsePad(ARGUMENTSINFO *ai)
switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
- default: return NULL;
+ default: return nullptr;
}
int padding = ttoi(ai->targv[2]);
if (padding < 0)
- return NULL;
+ return nullptr;
unsigned int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((addcount + mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
wchar_t *cur = res;
@@ -289,17 +289,17 @@ static wchar_t *parsePadright(ARGUMENTSINFO *ai)
switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
- default: return NULL;
+ default: return nullptr;
}
int padding = ttoi(ai->targv[2]);
if (padding < 0)
- return NULL;
+ return nullptr;
unsigned int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((addcount + mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
mir_wstrcpy(res, ai->targv[1]);
@@ -316,17 +316,17 @@ static wchar_t *parsePadcut(ARGUMENTSINFO *ai)
switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
- default: return NULL;
+ default: return nullptr;
}
int padding = ttoi(ai->targv[2]);
if (padding < 0)
- return NULL;
+ return nullptr;
int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((padding + 1) * sizeof(wchar_t)));
wchar_t *cur = res;
@@ -345,17 +345,17 @@ static wchar_t *parsePadcutright(ARGUMENTSINFO *ai)
switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
- default: return NULL;
+ default: return nullptr;
}
int padding = ttoi(ai->targv[2]);
if (padding < 0)
- return NULL;
+ return nullptr;
int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((padding + 1) * sizeof(wchar_t)));
wchar_t *cur = res + padding - addcount;
@@ -371,15 +371,15 @@ static wchar_t *parsePadcutright(ARGUMENTSINFO *ai)
static wchar_t *parseRepeat(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int count = ttoi(ai->targv[2]);
if (count < 0)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((count * mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((count * mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
for (int i = 0; i < count; i++)
@@ -391,7 +391,7 @@ static wchar_t *parseRepeat(ARGUMENTSINFO *ai)
static wchar_t *parseReplace(ARGUMENTSINFO *ai)
{
if ((ai->argc < 4) || (ai->argc % 2 != 0))
- return NULL;
+ return nullptr;
wchar_t *cur;
@@ -422,16 +422,16 @@ static wchar_t *parseReplace(ARGUMENTSINFO *ai)
static wchar_t *parseRight(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
int len = ttoi(ai->targv[2]);
if (len < 0)
- return NULL;
+ return nullptr;
len = min(len, (signed int)mir_wstrlen(ai->targv[1]));
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((len + 1)*sizeof(wchar_t)));
wcsncpy(res, ai->targv[1] + mir_wstrlen(ai->targv[1]) - len, len);
@@ -444,7 +444,7 @@ static wchar_t *parseRight(ARGUMENTSINFO *ai)
static wchar_t *parseScroll(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
if (mir_wstrlen(ai->targv[1]) == 0)
return mir_wstrdup(ai->targv[1]);
@@ -455,8 +455,8 @@ static wchar_t *parseScroll(ARGUMENTSINFO *ai)
display = (unsigned)mir_wstrlen(ai->targv[1]);
wchar_t *res = (wchar_t*)mir_alloc((2 * mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((2 * mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
mir_wstrcpy(res, ai->targv[1]);
@@ -471,7 +471,7 @@ static wchar_t *parseScroll(ARGUMENTSINFO *ai)
static wchar_t *parseShortest(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
int iShort = 1;
for (unsigned i = 2; i < ai->argc; i++)
@@ -484,12 +484,12 @@ static wchar_t *parseShortest(ARGUMENTSINFO *ai)
static wchar_t *parseStrchr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
char *szVal[34];
memset(szVal, 0, sizeof(szVal));
wchar_t *c = wcschr(ai->targv[1], *ai->targv[2]);
- if (c == NULL || *c == 0)
+ if (c == nullptr || *c == 0)
return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
@@ -498,7 +498,7 @@ static wchar_t *parseStrchr(ARGUMENTSINFO *ai)
static wchar_t *parseStrcmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (mir_wstrcmp(ai->targv[1], ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -509,7 +509,7 @@ static wchar_t *parseStrcmp(ARGUMENTSINFO *ai)
static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
ai->flags |= AIF_FALSE;
for (unsigned i = 2; i < ai->argc; i++) {
@@ -525,11 +525,11 @@ static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai)
static wchar_t *parseStrncmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
int n = ttoi(ai->targv[3]);
if (n <= 0)
- return NULL;
+ return nullptr;
if (wcsncmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
@@ -540,7 +540,7 @@ static wchar_t *parseStrncmp(ARGUMENTSINFO *ai)
static wchar_t *parseStricmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (mir_wstrcmpi(ai->targv[1], ai->targv[2]))
ai->flags |= AIF_FALSE;
@@ -551,11 +551,11 @@ static wchar_t *parseStricmp(ARGUMENTSINFO *ai)
static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
- return NULL;
+ return nullptr;
int n = ttoi(ai->targv[3]);
if (n <= 0)
- return NULL;
+ return nullptr;
if (wcsnicmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
@@ -566,10 +566,10 @@ static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai)
static wchar_t *parseStrrchr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
wchar_t *c = wcsrchr(ai->targv[1], *ai->targv[2]);
- if ((c == NULL) || (*c == 0))
+ if ((c == nullptr) || (*c == 0))
return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
@@ -578,10 +578,10 @@ static wchar_t *parseStrrchr(ARGUMENTSINFO *ai)
static wchar_t *parseStrstr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
wchar_t *c = wcsstr(ai->targv[1], ai->targv[2]);
- if ((c == NULL) || (*c == 0))
+ if ((c == nullptr) || (*c == 0))
return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
@@ -590,7 +590,7 @@ static wchar_t *parseStrstr(ARGUMENTSINFO *ai)
static wchar_t *parseSubstr(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
- return NULL;
+ return nullptr;
int to, from = max(ttoi(ai->targv[2]) - 1, 0);
if (ai->argc > 3)
@@ -599,7 +599,7 @@ static wchar_t *parseSubstr(ARGUMENTSINFO *ai)
to = (int)mir_wstrlen(ai->targv[1]);
if (to < from)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((to - from + 1)*sizeof(wchar_t));
memset(res, 0, ((to - from + 1) * sizeof(wchar_t)));
@@ -610,11 +610,11 @@ static wchar_t *parseSubstr(ARGUMENTSINFO *ai)
static wchar_t *parseSelect(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
int n = ttoi(ai->targv[1]);
if ((n > (signed int)ai->argc - 2) || n <= 0)
- return NULL;
+ return nullptr;
return mir_wstrdup(ai->targv[n + 1]);
}
@@ -622,19 +622,19 @@ static wchar_t *parseSelect(ARGUMENTSINFO *ai)
static wchar_t *parseSwitch(ARGUMENTSINFO *ai)
{
if (ai->argc % 2 != 0)
- return NULL;
+ return nullptr;
for (unsigned i = 2; i < ai->argc; i += 2)
if (!mir_wstrcmp(ai->targv[1], ai->targv[i]))
return mir_wstrdup(ai->targv[i + 1]);
- return NULL;
+ return nullptr;
}
static wchar_t *parseTrim(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *scur = ai->targv[1];
while (*scur == ' ')
@@ -648,8 +648,8 @@ static wchar_t *parseTrim(ARGUMENTSINFO *ai)
return mir_wstrdup(L"");
wchar_t *res = (wchar_t*)mir_alloc((ecur - scur + 2)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((ecur - scur + 2) * sizeof(wchar_t)));
wcsncpy(res, scur, ecur - scur + 1);
@@ -664,11 +664,11 @@ static wchar_t *parseTab(ARGUMENTSINFO *ai)
count = ttoi(ai->targv[1]);
if (count < 0)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((count + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, (count + 1)*sizeof(wchar_t));
wchar_t *cur = res;
@@ -681,19 +681,19 @@ static wchar_t *parseTab(ARGUMENTSINFO *ai)
static wchar_t *parseUpper(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
wchar_t *res = mir_wstrdup(ai->targv[1]);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
return CharUpper(res);
}
static wchar_t *getNthWord(wchar_t *szString, int w)
{
- if (szString == NULL)
- return NULL;
+ if (szString == nullptr)
+ return nullptr;
int count = 0;
wchar_t *scur = szString;
@@ -712,15 +712,15 @@ static wchar_t *getNthWord(wchar_t *szString, int w)
scur++;
}
if (count != w)
- return NULL;
+ return nullptr;
wchar_t *ecur = scur;
while ((*ecur != ' ') && (*ecur != 0))
ecur++;
wchar_t *res = (wchar_t*)mir_alloc((ecur - scur + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((ecur - scur + 1) * sizeof(wchar_t)));
wcsncpy(res, scur, ecur - scur);
@@ -730,9 +730,9 @@ static wchar_t *getNthWord(wchar_t *szString, int w)
static wchar_t *parseWord(ARGUMENTSINFO *ai)
{
if (ai->argc < 3 || ai->argc > 4)
- return NULL;
+ return nullptr;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
int to, from = ttoi(ai->targv[2]);
if (ai->argc == 4) {
if (mir_wstrlen(ai->targv[3]) > 0)
@@ -743,16 +743,16 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai)
else to = from;
if ((from == 0) || (to == 0) || (from > to))
- return NULL;
+ return nullptr;
for (int i = from; i <= to; i++) {
wchar_t *szWord = getNthWord(ai->targv[1], i);
- if (szWord == NULL)
+ if (szWord == nullptr)
return res;
- if (res != NULL) {
+ if (res != nullptr) {
wchar_t *pres = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(szWord) + 2)*sizeof(wchar_t));
- if (pres != NULL) {
+ if (pres != nullptr) {
res = pres;
mir_wstrcat(res, L" ");
mir_wstrcat(res, szWord);
@@ -768,13 +768,13 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai)
static wchar_t *parseExtratext(ARGUMENTSINFO *ai)
{
if (ai->argc > 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
- if (ai->fi->szExtraText != NULL)
+ if (ai->fi->szExtraText != nullptr)
return mir_wstrdup(ai->fi->tszExtraText);
- return NULL;
+ return nullptr;
}
void registerStrTokens()
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp
index 947a6b33e4..02bfdd4407 100644
--- a/plugins/Variables/src/parse_system.cpp
+++ b/plugins/Variables/src/parse_system.cpp
@@ -22,17 +22,17 @@
static wchar_t *parseComputerName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
DWORD len = MAX_COMPUTERNAME_LENGTH;
wchar_t *res = (wchar_t*)mir_calloc((len + 1) * sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (!GetComputerName(res, &len)) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
}
@@ -49,40 +49,40 @@ static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai)
wchar_t *szCounter, szVal[32];
if (ai->argc != 2)
- return NULL;
+ return nullptr;
if (mir_wstrlen(ai->targv[1]) == 0)
szCounter = mir_wstrdup(L"\\Processor(_Total)\\% Processor Time");
else {
int size = (int)mir_wstrlen(ai->targv[1]) + 32;
szCounter = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
- if (szCounter == NULL)
- return NULL;
+ if (szCounter == nullptr)
+ return nullptr;
mir_snwprintf(szCounter, size, L"\\Process(%s)\\%% Processor Time", ai->targv[1]);
}
PDH_STATUS pdhStatus = PdhValidatePath(szCounter);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
- return NULL;
+ return nullptr;
}
- pdhStatus = PdhOpenQuery(NULL, 0, &hQuery);
+ pdhStatus = PdhOpenQuery(nullptr, 0, &hQuery);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
- return NULL;
+ return nullptr;
}
pdhStatus = PdhAddCounter(hQuery, szCounter, 0, &hCounter);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
pdhStatus = PdhCollectQueryData(hQuery);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
Sleep(100);
pdhStatus = PdhCollectQueryData(hQuery);
@@ -90,20 +90,20 @@ static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai)
mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
- pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_DOUBLE, (LPDWORD)NULL, &cValue);
+ pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_DOUBLE, (LPDWORD)nullptr, &cValue);
if (pdhStatus != ERROR_SUCCESS) {
mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
if (cValue.CStatus != ERROR_SUCCESS) {
mir_free(szCounter);
PdhRemoveCounter(hCounter);
pdhStatus = PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
mir_snwprintf(szVal, L"%.0f", cValue.doubleValue);
//PdhRemoveCounter(*hCounter);
@@ -117,18 +117,18 @@ static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai)
{
wchar_t *szFormat;
if (ai->argc == 1 || (ai->argc > 1 && mir_wstrlen(ai->targv[1]) == 0))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[1];
- int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, NULL, 0);
+ int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, nullptr, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
- if (GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, res, len) == 0) {
+ if (GetDateFormat(LOCALE_USER_DEFAULT, 0, nullptr, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -138,18 +138,18 @@ static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai)
{
wchar_t *szFormat;
if (ai->argc == 1 || (ai->argc > 1) && (mir_wstrlen(ai->targv[1]) == 0))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[1];
- int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, NULL, 0);
+ int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
- if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, res, len) == 0) {
+ if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, nullptr, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -158,7 +158,7 @@ static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai)
static wchar_t *parseDirectory(ARGUMENTSINFO *ai)
{
if (ai->argc < 2 || ai->argc > 3)
- return NULL;
+ return nullptr;
int depth = 0;
if (ai->argc == 3)
@@ -194,14 +194,14 @@ static wchar_t *parseDirectory(ARGUMENTSINFO *ai)
static wchar_t *parseDirectory2(ARGUMENTSINFO *ai)
{
if (ai->argc < 2 || ai->argc > 3)
- return NULL;
+ return nullptr;
int depth = 1;
if (ai->argc == 3)
depth = ttoi(ai->targv[2]);
if (depth <= 0)
- return NULL;
+ return nullptr;
wchar_t *ecur = ai->targv[1] + mir_wstrlen(ai->targv[1]);
while (depth > 0) {
@@ -209,14 +209,14 @@ static wchar_t *parseDirectory2(ARGUMENTSINFO *ai)
ecur--;
if (*ecur != '\\')
- return NULL;
+ return nullptr;
depth -= 1;
ecur--;
}
wchar_t *res = (wchar_t*)mir_calloc((ecur - ai->targv[1] + 2) * sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
wcsncpy(res, ai->targv[1], (ecur - ai->targv[1]) + 1);
return res;
@@ -271,15 +271,15 @@ static wchar_t *parseDiffTime(ARGUMENTSINFO *ai)
double diff;
if (ai->argc != 3)
- return NULL;
+ return nullptr;
memset(&t0, 0, sizeof(t0));
memset(&t1, 0, sizeof(t1));
if (getTime(ai->targv[1], &t0) != 0)
- return NULL;
+ return nullptr;
if (getTime(ai->targv[2], &t1) != 0)
- return NULL;
+ return nullptr;
diff = difftime(mktime(&t1), mktime(&t0));
mir_snwprintf(szTime, L"%.0f", diff);
@@ -290,9 +290,9 @@ static wchar_t *parseDiffTime(ARGUMENTSINFO *ai)
static wchar_t *parseDirExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
- HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
ai->flags |= AIF_FALSE;
else
@@ -304,20 +304,20 @@ static wchar_t *parseDirExists(ARGUMENTSINFO *ai)
static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
- DWORD len = ExpandEnvironmentStrings(ai->targv[1], NULL, 0);
+ DWORD len = ExpandEnvironmentStrings(ai->targv[1], nullptr, 0);
if (len <= 0)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, ((len + 1) * sizeof(wchar_t)));
if (ExpandEnvironmentStrings(ai->targv[1], res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
}
@@ -325,9 +325,9 @@ static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai)
static wchar_t *parseFileExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
- HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
ai->flags |= AIF_FALSE;
else
@@ -339,15 +339,15 @@ static wchar_t *parseFileExists(ARGUMENTSINFO *ai)
static wchar_t *parseFindWindow(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
- HWND hWin = FindWindow(ai->targv[1], NULL);
- if (hWin == NULL)
- return NULL;
+ HWND hWin = FindWindow(ai->targv[1], nullptr);
+ if (hWin == nullptr)
+ return nullptr;
int len = GetWindowTextLength(hWin);
if (len == 0)
- return NULL;
+ return nullptr;
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
memset(res, 0, ((len + 1) * sizeof(wchar_t)));
@@ -362,13 +362,13 @@ static wchar_t *parseFindWindow(ARGUMENTSINFO *ai)
static wchar_t *parseListDir(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
- return NULL;
+ return nullptr;
wchar_t tszFirst[MAX_PATH], *tszRes, *tszSeperator, *tszFilter;
tszFirst[0] = 0;
tszSeperator = L"\r\n";
tszFilter = L"*";
- tszRes = NULL;
+ tszRes = nullptr;
if (ai->argc > 1)
wcsncpy(tszFirst, ai->targv[1], _countof(tszFirst) - 1);
@@ -396,7 +396,7 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai)
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(tszFirst, &ffd);
if (hFind == INVALID_HANDLE_VALUE) {
- return NULL;
+ return nullptr;
}
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
tszRes = (wchar_t*)mir_alloc((mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
@@ -404,7 +404,7 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai)
}
while (FindNextFile(hFind, &ffd) != 0) {
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
- if (tszRes != NULL) {
+ if (tszRes != nullptr) {
mir_wstrcat(tszRes, tszSeperator);
tszRes = (wchar_t*)mir_realloc(tszRes, (mir_wstrlen(tszRes) + mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
}
@@ -424,8 +424,8 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai)
static BOOL CALLBACK MyProcessEnumerator(DWORD, WORD, char *szProcess, LPARAM lParam)
{
char **szProc = (char **)lParam;
- if ((*szProc != NULL) && (!_stricmp(*szProc, szProcess)))
- *szProc = NULL;
+ if ((*szProc != nullptr) && (!_stricmp(*szProc, szProcess)))
+ *szProc = nullptr;
return TRUE;
}
@@ -433,13 +433,13 @@ static BOOL CALLBACK MyProcessEnumerator(DWORD, WORD, char *szProcess, LPARAM lP
static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
char *szProc, *ref;
szProc = ref = mir_u2a(ai->targv[1]);
EnumProcs(MyProcessEnumerator, (LPARAM)&szProc);
- if (szProc != NULL)
+ if (szProc != nullptr)
ai->flags |= AIF_FALSE;
mir_free(ref);
@@ -450,18 +450,18 @@ static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai)
static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
DWORD len, type;
wchar_t *key = mir_wstrdup(ai->targv[1]);
- if (key == NULL)
- return NULL;
+ if (key == nullptr)
+ return nullptr;
wchar_t *cur = wcschr(key, '\\');
- if (cur == NULL) {
+ if (cur == nullptr) {
mir_free(key);
- return NULL;
+ return nullptr;
}
*cur = 0;
@@ -476,25 +476,25 @@ static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai)
hKey = HKEY_USERS;
else {
mir_free(key);
- return NULL;
+ return nullptr;
}
wchar_t *subKey = cur + 1;
if (RegOpenKeyEx(hKey, subKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS) {
mir_free(key);
- return NULL;
+ return nullptr;
}
mir_free(key);
len = MAX_REGVALUE_LENGTH + 1;
wchar_t *res = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, (len * sizeof(wchar_t)));
- int err = RegQueryValueEx(hKey, ai->targv[2], NULL, &type, (BYTE*)res, &len);
+ int err = RegQueryValueEx(hKey, ai->targv[2], nullptr, &type, (BYTE*)res, &len);
if ((err != ERROR_SUCCESS) || (type != REG_SZ)) {
RegCloseKey(hKey);
mir_free(res);
- return NULL;
+ return nullptr;
}
RegCloseKey(hKey);
@@ -504,7 +504,7 @@ static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai)
static int TsToSystemTime(SYSTEMTIME *sysTime, time_t timestamp)
{
struct tm *pTime = localtime(&timestamp);
- if (pTime == NULL)
+ if (pTime == nullptr)
return -1;
memset(sysTime, 0, sizeof(SYSTEMTIME));
@@ -522,30 +522,30 @@ static int TsToSystemTime(SYSTEMTIME *sysTime, time_t timestamp)
static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
SYSTEMTIME sysTime;
wchar_t *szFormat;
time_t timestamp = ttoi(ai->targv[1]);
if (timestamp == 0)
- return NULL;
+ return nullptr;
if ((ai->argc == 2) || ((ai->argc > 2) && (mir_wstrlen(ai->targv[2]) == 0)))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[2];
if (TsToSystemTime(&sysTime, timestamp) != 0)
- return NULL;
+ return nullptr;
- int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, NULL, 0);
+ int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_calloc((len + 1) * sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -554,30 +554,30 @@ static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai)
static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
- return NULL;
+ return nullptr;
SYSTEMTIME sysTime;
time_t timestamp = ttoi(ai->targv[1]);
if (timestamp == 0)
- return NULL;
+ return nullptr;
wchar_t *szFormat;
if ((ai->argc == 2) || ((ai->argc > 2) && (mir_wstrlen(ai->targv[2]) == 0)))
- szFormat = NULL;
+ szFormat = nullptr;
else
szFormat = ai->targv[2];
if (TsToSystemTime(&sysTime, timestamp) != 0)
- return NULL;
+ return nullptr;
- int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, NULL, 0);
+ int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, res, len) == 0) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
@@ -586,16 +586,16 @@ static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai)
static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
- HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
- return NULL;
+ return nullptr;
- DWORD fileSz = GetFileSize(hFile, NULL);
+ DWORD fileSz = GetFileSize(hFile, nullptr);
if (fileSz == INVALID_FILE_SIZE) {
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
int lineNo = ttoi(ai->targv[2]);
@@ -605,11 +605,11 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
unsigned long linePos;
wchar_t tUC, *res;
BYTE *pBuf, *pCur;
- ReadFile(hFile, &tUC, sizeof(wchar_t), &readSz, NULL);
+ ReadFile(hFile, &tUC, sizeof(wchar_t), &readSz, nullptr);
if (tUC != (wchar_t)0xFEFF) {
tUC = 0;
csz = sizeof(char);
- SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
+ SetFilePointer(hFile, 0, nullptr, FILE_BEGIN);
}
else csz = sizeof(wchar_t);
@@ -619,15 +619,15 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
// complete file
bufSz = fileSz + csz;
pBuf = (PBYTE)mir_calloc(bufSz);
- if (pBuf == NULL) {
+ if (pBuf == nullptr) {
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
- if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
+ if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, nullptr) == 0) {
CloseHandle(hFile);
mir_free(pBuf);
- return NULL;
+ return nullptr;
}
CloseHandle(hFile);
@@ -643,18 +643,18 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
}
bufSz = TXTFILEBUFSZ*csz;
pBuf = (PBYTE)mir_calloc(bufSz);
- if (pBuf == NULL) {
+ if (pBuf == nullptr) {
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
// count number of lines
do {
memset(pBuf, 0, bufSz);
- if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
+ if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, nullptr) == 0) {
CloseHandle(hFile);
mir_free(pBuf);
- return NULL;
+ return nullptr;
}
totalReadSz += readSz;
for (pCur = pBuf; *pCur != '\0'; pCur += csz) {
@@ -686,12 +686,12 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
totalReadSz = 0;
lineCount = 1;
linePos = 0xFFFFFFFF;
- SetFilePointer(hFile, tUC ? csz : 0, NULL, FILE_BEGIN);
+ SetFilePointer(hFile, tUC ? csz : 0, nullptr, FILE_BEGIN);
// find the position in the file where the requested line starts
do {
- if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
+ if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, nullptr) == 0) {
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
totalReadSz += readSz;
for (pCur = pBuf; ((pCur < pBuf + bufSz) && (linePos == 0xFFFFFFFF)); pCur += csz) {
@@ -717,25 +717,25 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
}
if (((tUC) && (*(wchar_t*)pCur == '\r')) || ((!tUC) && (*(char *)pCur == '\r'))) {
// in case the \r was at the end of the buffer, \n could be next
- SetFilePointer(hFile, -1 * csz, NULL, FILE_CURRENT);
+ SetFilePointer(hFile, -1 * csz, nullptr, FILE_CURRENT);
totalReadSz -= csz;
}
}
while ((totalReadSz < fileSz) && (readSz > 0));
- if (SetFilePointer(hFile, linePos, NULL, FILE_BEGIN) != linePos) {
+ if (SetFilePointer(hFile, linePos, nullptr, FILE_BEGIN) != linePos) {
CloseHandle(hFile);
mir_free(pBuf);
- return NULL;
+ return nullptr;
}
memset(pBuf, 0, bufSz);
pCur = pBuf;
do {
icur = 0;
- if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
+ if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, nullptr) == 0) {
mir_free(pBuf);
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
for (pCur = pBuf; (pCur < pBuf + readSz); pCur += csz) {
if ((tUC) && ((!wcsncmp((wchar_t*)pCur, L"\r\n", 2)) || (*(wchar_t*)pCur == '\n')) ||
@@ -784,38 +784,38 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
while (readSz > 0);
CloseHandle(hFile);
- return NULL;
+ return nullptr;
}
static wchar_t *parseUpTime(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
HQUERY hQuery;
- PDH_STATUS pdhStatus = PdhOpenQuery(NULL, 0, &hQuery);
+ PDH_STATUS pdhStatus = PdhOpenQuery(nullptr, 0, &hQuery);
if (pdhStatus != ERROR_SUCCESS)
- return NULL;
+ return nullptr;
HCOUNTER hCounter;
pdhStatus = PdhAddCounter(hQuery, L"\\System\\System Up Time", 0, &hCounter);
if (pdhStatus != ERROR_SUCCESS) {
PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
pdhStatus = PdhCollectQueryData(hQuery);
if (pdhStatus != ERROR_SUCCESS) {
PdhRemoveCounter(hCounter);
PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
PDH_FMT_COUNTERVALUE cValue;
- pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_LARGE, (LPDWORD)NULL, &cValue);
+ pdhStatus = PdhGetFormattedCounterValue(hCounter, PDH_FMT_LARGE, (LPDWORD)nullptr, &cValue);
if (pdhStatus != ERROR_SUCCESS) {
PdhRemoveCounter(hCounter);
PdhCloseQuery(hQuery);
- return NULL;
+ return nullptr;
}
wchar_t szVal[32];
@@ -828,18 +828,18 @@ static wchar_t *parseUpTime(ARGUMENTSINFO *ai)
static wchar_t *parseUserName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
DWORD len = UNLEN;
wchar_t *res = (wchar_t*)mir_alloc(len + 1);
- if (res == NULL)
- return NULL;
+ if (res == nullptr)
+ return nullptr;
memset(res, 0, (len + 1));
if (!GetUserName(res, &len)) {
mir_free(res);
- return NULL;
+ return nullptr;
}
return res;
}
@@ -848,16 +848,16 @@ static wchar_t *parseUserName(ARGUMENTSINFO *ai)
static wchar_t *parseClipboard(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
- return NULL;
+ return nullptr;
ai->flags |= AIF_DONTPARSE;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
if (IsClipboardFormatAvailable(CF_TEXT)) {
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
- if (hData != NULL) {
+ if (hData != nullptr) {
wchar_t *tszText = (wchar_t*)GlobalLock(hData);
size_t len = mir_wstrlen(tszText);
res = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp
index 11d168e678..6fce6cd3fb 100644
--- a/plugins/Variables/src/parse_variables.cpp
+++ b/plugins/Variables/src/parse_variables.cpp
@@ -21,12 +21,12 @@
// this is for get and put(s)
static mir_cs csVarRegister;
-static VARIABLEREGISTER *vr = NULL;
+static VARIABLEREGISTER *vr = nullptr;
static int vrCount = 0;
static int addToVariablesRegister(wchar_t *szName, wchar_t *szText)
{
- if ((szName == NULL) || (szText == NULL) || (mir_wstrlen(szName) <= 0))
+ if ((szName == nullptr) || (szText == nullptr) || (mir_wstrlen(szName) <= 0))
return -1;
mir_cslock lck(csVarRegister);
@@ -38,7 +38,7 @@ static int addToVariablesRegister(wchar_t *szName, wchar_t *szText)
}
}
VARIABLEREGISTER *pvr = (VARIABLEREGISTER*)mir_realloc(vr, (vrCount + 1)*sizeof(VARIABLEREGISTER));
- if (pvr == NULL)
+ if (pvr == nullptr)
return -1;
vr = pvr;
@@ -50,25 +50,25 @@ static int addToVariablesRegister(wchar_t *szName, wchar_t *szText)
static wchar_t *searchVariableRegister(wchar_t *szName)
{
- if ((szName == NULL) || (mir_wstrlen(szName) <= 0))
- return NULL;
+ if ((szName == nullptr) || (mir_wstrlen(szName) <= 0))
+ return nullptr;
mir_cslock lck(csVarRegister);
for (int i = 0; i < vrCount; i++)
if ((!mir_wstrcmp(vr[i].szName, szName)))
return mir_wstrdup(vr[i].szText);
- return NULL;
+ return nullptr;
}
static wchar_t *parsePut(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
// ai->flags |= AIF_DONTPARSE;
if (addToVariablesRegister(ai->targv[1], ai->targv[2]))
- return NULL;
+ return nullptr;
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -80,10 +80,10 @@ static wchar_t *parsePut(ARGUMENTSINFO *ai)
static wchar_t *parsePuts(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
- return NULL;
+ return nullptr;
if (addToVariablesRegister(ai->targv[1], ai->targv[2]))
- return NULL;
+ return nullptr;
return mir_wstrdup(L"");
}
@@ -91,7 +91,7 @@ static wchar_t *parsePuts(ARGUMENTSINFO *ai)
static wchar_t *parseGet(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
- return NULL;
+ return nullptr;
return searchVariableRegister(ai->targv[1]);
}
@@ -111,6 +111,6 @@ void unregisterVariablesTokens()
mir_free(vr[i].szText);
}
mir_free(vr);
- vr = NULL;
+ vr = nullptr;
vrCount = 0;
}
diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp
index 158a429582..11c2212449 100644
--- a/plugins/Variables/src/tokenregister.cpp
+++ b/plugins/Variables/src/tokenregister.cpp
@@ -67,29 +67,29 @@ int registerIntToken(wchar_t *szToken, wchar_t *(*parseFunction)(ARGUMENTSINFO *
int deRegisterToken(wchar_t *token)
{
- if (token == NULL)
+ if (token == nullptr)
return -1;
TokenRegisterEntry *tre;
{
mir_cslock lck(csRegister);
tre = FindTokenRegisterByName(token);
- if (tre == NULL)
+ if (tre == nullptr)
return -1;
tokens.remove(tre);
}
- if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != NULL)
+ if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != nullptr)
mir_free(tre->tr.szService);
- if (tre->tr.tszTokenString != NULL)
+ if (tre->tr.tszTokenString != nullptr)
mir_free(tre->tr.tszTokenString);
- if (tre->tr.szHelpText != NULL)
+ if (tre->tr.szHelpText != nullptr)
mir_free(tre->tr.szHelpText);
- if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != NULL)
+ if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != nullptr)
mir_free(tre->tr.szCleanupService);
mir_free(tre);
@@ -101,7 +101,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam)
DWORD hash;
TOKENREGISTEREX *newVr = (TOKENREGISTEREX*)lParam;
- if (newVr == NULL || newVr->szTokenString == NULL || newVr->cbSize <= 0)
+ if (newVr == nullptr || newVr->szTokenString == nullptr || newVr->cbSize <= 0)
return -1;
if (newVr->flags & TRF_TCHAR) {
@@ -116,7 +116,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam)
}
TokenRegisterEntry *tre = (TokenRegisterEntry*)mir_alloc(sizeof(TokenRegisterEntry));
- if (tre == NULL)
+ if (tre == nullptr)
return -1;
memcpy(&tre->tr, newVr, newVr->cbSize);
@@ -124,7 +124,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam)
if (!mir_wstrcmp(newVr->tszTokenString, L"alias"))
log_debugA("alias");
- if (!(newVr->flags & TRF_PARSEFUNC) && newVr->szService != NULL)
+ if (!(newVr->flags & TRF_PARSEFUNC) && newVr->szService != nullptr)
tre->tr.szService = mir_strdup(newVr->szService);
if (newVr->flags & TRF_TCHAR)
@@ -132,10 +132,10 @@ INT_PTR registerToken(WPARAM, LPARAM lParam)
else
tre->tr.tszTokenString = mir_a2u(newVr->szTokenString);
- if (newVr->szHelpText != NULL)
+ if (newVr->szHelpText != nullptr)
tre->tr.szHelpText = mir_strdup(newVr->szHelpText);
- if ((newVr->flags & TRF_CLEANUP) && !(newVr->flags & TRF_CLEANUPFUNC) && newVr->szCleanupService != NULL)
+ if ((newVr->flags & TRF_CLEANUP) && !(newVr->flags & TRF_CLEANUPFUNC) && newVr->szCleanupService != nullptr)
tre->tr.szCleanupService = mir_strdup(newVr->szCleanupService);
mir_cslock lck(csRegister);
@@ -145,31 +145,31 @@ INT_PTR registerToken(WPARAM, LPARAM lParam)
TOKENREGISTEREX *searchRegister(wchar_t *tvar, int type)
{
- if (tvar == NULL)
- return 0;
+ if (tvar == nullptr)
+ return nullptr;
mir_cslock lck(csRegister);
TokenRegisterEntry *tre = FindTokenRegisterByName(tvar);
- if (tre == NULL || (type != 0 && (tre->tr.flags & (TRF_FIELD | TRF_FUNCTION)) != 0 && !(tre->tr.flags & type)))
- return NULL;
+ if (tre == nullptr || (type != 0 && (tre->tr.flags & (TRF_FIELD | TRF_FUNCTION)) != 0 && !(tre->tr.flags & type)))
+ return nullptr;
return &tre->tr;
}
wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
{
- if (ai == NULL || ai->argc == 0 || ai->targv[0] == NULL)
- return NULL;
+ if (ai == nullptr || ai->argc == 0 || ai->targv[0] == nullptr)
+ return nullptr;
INT_PTR callRes = 0;
- wchar_t *res = NULL;
+ wchar_t *res = nullptr;
mir_cslock lck(csRegister);
/* note the following limitation: you cannot add/remove tokens during a call from a different thread */
TOKENREGISTEREX *thisVr = searchRegister(ai->targv[0], 0);
- if (thisVr == NULL)
- return NULL;
+ if (thisVr == nullptr)
+ return nullptr;
TOKENREGISTEREX trCopy = *thisVr;
@@ -184,23 +184,23 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
if (thisVr->flags & TRF_PARSEFUNC)
callRes = (INT_PTR)thisVr->parseFunction(&cAi);
- else if (thisVr->szService != NULL)
+ else if (thisVr->szService != nullptr)
callRes = CallService(thisVr->szService, 0, (LPARAM)&cAi);
for (unsigned j = 0; j < cAi.argc; j++)
mir_free(cAi.argv[j]);
- if ((char *)callRes != NULL)
+ if ((char *)callRes != nullptr)
res = mir_a2u((char*)callRes);
}
else {
// unicode variables calls unicode plugin
if (thisVr->flags & TRF_PARSEFUNC)
callRes = (INT_PTR)thisVr->parseFunctionT(ai);
- else if (thisVr->szService != NULL)
+ else if (thisVr->szService != nullptr)
callRes = CallService(thisVr->szService, 0, (LPARAM)ai);
- if ((wchar_t*)callRes != NULL)
+ if ((wchar_t*)callRes != nullptr)
res = mir_wstrdup((wchar_t*)callRes);
}
@@ -208,7 +208,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
if (trCopy.flags & TRF_CLEANUP) {
if (trCopy.flags & TRF_CLEANUPFUNC)
trCopy.cleanupFunctionT((wchar_t*)callRes);
- else if (trCopy.szCleanupService != NULL)
+ else if (trCopy.szCleanupService != nullptr)
CallService(trCopy.szCleanupService, 0, (LPARAM)callRes);
}
if ((trCopy.flags & TRF_FREEMEM) && trCopy.memType == TR_MEM_MIRANDA)
@@ -220,7 +220,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
TOKENREGISTEREX* getTokenRegister(int i)
{
mir_cslock lck(csRegister);
- return (i >= tokens.getCount() || i < 0) ? NULL : &tokens[i]->tr;
+ return (i >= tokens.getCount() || i < 0) ? nullptr : &tokens[i]->tr;
}
int getTokenRegisterCount()
@@ -240,16 +240,16 @@ int deinitTokenRegister()
{
for (int i = 0; i < tokens.getCount(); i++) {
TokenRegisterEntry *tre = tokens[i];
- if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != NULL)
+ if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != nullptr)
mir_free(tre->tr.szService);
- if (tre->tr.tszTokenString != NULL)
+ if (tre->tr.tszTokenString != nullptr)
mir_free(tre->tr.tszTokenString);
- if (tre->tr.szHelpText != NULL)
+ if (tre->tr.szHelpText != nullptr)
mir_free(tre->tr.szHelpText);
- if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != NULL)
+ if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != nullptr)
mir_free(tre->tr.szCleanupService);
mir_free(tre);
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp
index d5d9690372..3ba1ae1ab3 100644
--- a/plugins/Variables/src/variables.cpp
+++ b/plugins/Variables/src/variables.cpp
@@ -21,8 +21,8 @@
/* some handles */
static HANDLE
- hOptionsHook = NULL,
- hIconsChangedHook = NULL;
+ hOptionsHook = nullptr,
+ hIconsChangedHook = nullptr;
HCURSOR hCurSplitNS;
@@ -35,7 +35,7 @@ wchar_t* getArguments(wchar_t *string, TArgList &argv)
cur++;
if (*cur != '(')
- return NULL;
+ return nullptr;
wchar_t *scur = cur;
cur++;
@@ -66,10 +66,10 @@ wchar_t* getArguments(wchar_t *string, TArgList &argv)
}
if (bNewArg) {
- wchar_t *tszArg = NULL;
+ wchar_t *tszArg = nullptr;
if (cur > scur)
tszArg = mir_wstrndup(scur + 1, cur - (scur + 1));
- if (tszArg == NULL)
+ if (tszArg == nullptr)
tszArg = mir_wstrdup(L"");
argv.insert(tszArg);
@@ -82,7 +82,7 @@ wchar_t* getArguments(wchar_t *string, TArgList &argv)
// set args
if (cur[-1] != ')') {
argv.destroy();
- return NULL;
+ return nullptr;
}
return cur;
@@ -105,14 +105,14 @@ int isValidTokenChar(wchar_t tc)
/* pretty much the main loop */
static wchar_t* replaceDynVars(FORMATINFO *fi)
{
- if (fi->tszFormat == NULL)
- return NULL;
+ if (fi->tszFormat == nullptr)
+ return nullptr;
int i, scurPos, curPos, tmpVarPos;
wchar_t *string = mir_wstrdup(fi->tszFormat);
- if (string == NULL)
- return NULL;
+ if (string == nullptr)
+ return nullptr;
TArgList argv;
@@ -179,7 +179,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
continue;
}
- TOKENREGISTEREX *tr = NULL;
+ TOKENREGISTEREX *tr = nullptr;
{
ptrW token(mir_wstrndup(cur + 1, tcur - scur));
@@ -198,7 +198,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
tr = searchRegister(token, (*cur == FIELD_CHAR) ? TRF_FIELD : TRF_FUNCTION);
}
- if (tmpVarPos < 0 && tr == NULL) {
+ if (tmpVarPos < 0 && tr == nullptr) {
fi->eCount++;
// token not found, continue
continue;
@@ -206,7 +206,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
scur = cur; // store this pointer for later use
if (*cur == FIELD_CHAR) {
- size_t len = mir_wstrlen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]);
+ size_t len = mir_wstrlen(tr != nullptr ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]);
cur++;
if (cur[len] != FIELD_CHAR) { // the next char after the token should be %
fi->eCount++;
@@ -217,7 +217,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
else if ((*cur == FUNC_CHAR) || (*cur == FUNC_ONCE_CHAR)) {
cur += mir_wstrlen(tr->tszTokenString) + 1;
wchar_t *argcur = getArguments(cur, argv);
- if (argcur == cur || argcur == NULL) {
+ if (argcur == cur || argcur == nullptr) {
fi->eCount++;
// error getting arguments
continue;
@@ -240,7 +240,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
// cur should now point at the character after FIELD_CHAR or after the last ')'
ARGUMENTSINFO ai = { 0 };
ptrW parsedToken;
- if (tr != NULL) {
+ if (tr != nullptr) {
argv.insert(mir_wstrdup(tr->tszTokenString), 0);
ai.cbSize = sizeof(ai);
@@ -275,9 +275,9 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
if (tokenLen < parsedTokenLen) {
// string needs more memory
string = (wchar_t*)mir_realloc(string, (initStrLen - tokenLen + parsedTokenLen + 1)*sizeof(wchar_t));
- if (string == NULL) {
+ if (string == nullptr) {
fi->eCount++;
- return NULL;
+ return nullptr;
}
}
scur = string + scurPos;
@@ -334,10 +334,10 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM)
if (!(fi->flags & FIF_TCHAR)) {
copied = TRUE;
log_debugA("mir_a2u (%s)", fi->szExtraText);
- tszFormat = fi->szFormat != NULL ? mir_a2u(fi->szFormat) : NULL;
- tszSource = fi->szExtraText != NULL ? mir_a2u(fi->szExtraText) : NULL;
+ tszFormat = fi->szFormat != nullptr ? mir_a2u(fi->szFormat) : nullptr;
+ tszSource = fi->szExtraText != nullptr ? mir_a2u(fi->szExtraText) : nullptr;
for (i = 0; i < fi->cbTemporaryVarsSize; i++) {
- fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i] != NULL ? mir_a2u(fi->szaTemporaryVars[i]) : NULL;
+ fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i] != nullptr ? mir_a2u(fi->szaTemporaryVars[i]) : nullptr;
}
}
else {
@@ -378,14 +378,14 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM)
wchar_t* formatString(FORMATINFO *fi)
{
- if (fi == NULL)
- return NULL;
+ if (fi == nullptr)
+ return nullptr;
/* the service to format a given string */
if ((fi->eCount + fi->pCount) > 5000) {
fi->eCount++;
fi->pCount++;
log_debugA("Variables: Overflow protection; %d parses", (fi->eCount + fi->pCount));
- return NULL;
+ return nullptr;
}
return replaceDynVars(fi);
@@ -393,7 +393,7 @@ wchar_t* formatString(FORMATINFO *fi)
int setParseOptions(struct ParseOptions *po)
{
- if (po == NULL)
+ if (po == nullptr)
po = &gParseOpts;
memset(po, 0, sizeof(struct ParseOptions));
@@ -413,11 +413,11 @@ int LoadVarModule()
if (initTokenRegister() != 0 || initContactModule() != 0)
return -1;
- setParseOptions(NULL);
+ setParseOptions(nullptr);
CreateServiceFunction(MS_VARS_FORMATSTRING, formatStringService);
CreateServiceFunction(MS_VARS_REGISTERTOKEN, registerToken);
// help dialog
- hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
+ hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS);
CreateServiceFunction(MS_VARS_SHOWHELP, showHelpService);
CreateServiceFunction(MS_VARS_SHOWHELPEX, showHelpExService);
@@ -448,7 +448,7 @@ int LoadVarModule()
FORMATINFO fi = { 0 };
fi.cbSize = sizeof(fi);
fi.tszFormat = db_get_wsa(NULL, MODULENAME, SETTING_STARTUPTEXT);
- if (fi.tszFormat != NULL) {
+ if (fi.tszFormat != nullptr) {
mir_free(formatString(&fi));
mir_free(fi.tszFormat);
}
@@ -461,7 +461,7 @@ int LoadVarModule()
int UnloadVarModule()
{
UnhookEvent(hOptionsHook);
- if (hIconsChangedHook != NULL)
+ if (hIconsChangedHook != nullptr)
UnhookEvent(hIconsChangedHook);
DestroyCursor(hCurSplitNS);