summaryrefslogtreecommitdiff
path: root/plugins/DbEditorPP
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:03:31 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:07:33 +0100
commita7c24ca48995cf2bf436156302f96b91bf135409 (patch)
tree953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/DbEditorPP
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/DbEditorPP')
-rw-r--r--plugins/DbEditorPP/src/copymodule.cpp8
-rw-r--r--plugins/DbEditorPP/src/deletemodule.cpp8
-rw-r--r--plugins/DbEditorPP/src/exportimport.cpp32
-rw-r--r--plugins/DbEditorPP/src/findwindow.cpp18
-rw-r--r--plugins/DbEditorPP/src/icons.cpp6
-rw-r--r--plugins/DbEditorPP/src/main.cpp12
-rw-r--r--plugins/DbEditorPP/src/main_window.cpp20
-rw-r--r--plugins/DbEditorPP/src/modsettingenum.cpp28
-rw-r--r--plugins/DbEditorPP/src/moduletree.cpp36
-rw-r--r--plugins/DbEditorPP/src/options.cpp2
-rw-r--r--plugins/DbEditorPP/src/renamemodule.cpp2
-rw-r--r--plugins/DbEditorPP/src/settinglist.cpp42
-rw-r--r--plugins/DbEditorPP/src/settingsdlg.cpp4
-rw-r--r--plugins/DbEditorPP/src/watchedvars.cpp24
14 files changed, 121 insertions, 121 deletions
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp
index ae2430bb68..95a27b2f68 100644
--- a/plugins/DbEditorPP/src/copymodule.cpp
+++ b/plugins/DbEditorPP/src/copymodule.cpp
@@ -36,13 +36,13 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
if (ApplyProtoFilter(hContact))
continue;
- GetContactName(hContact, NULL, name, _countof(name));
+ GetContactName(hContact, nullptr, name, _countof(name));
int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact);
}
- GetContactName(NULL, NULL, name, _countof(name));
+ GetContactName(NULL, nullptr, name, _countof(name));
int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0);
SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0);
@@ -61,11 +61,11 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
copyModule(mac->module, mac->hContact, hContact);
}
else {
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
copyModule(mac->module, mac->hContact, hContact);
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
}
refreshTree(1);
// fall through
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp
index 8ea862845e..62e63426fd 100644
--- a/plugins/DbEditorPP/src/deletemodule.cpp
+++ b/plugins/DbEditorPP/src/deletemodule.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
volatile BOOL working;
-static HWND hwnd2Delete = NULL;
+static HWND hwnd2Delete = nullptr;
int deleteModule(MCONTACT hContact, const char *module, int confirm)
{
@@ -93,13 +93,13 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
{
char module[FLD_SIZE];
GetDlgItemTextA(hwnd, IDC_CONTACTS, module, _countof(module));
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
deleteModule(hContact, module, 0);
// do the null
deleteModule(NULL, module, 0);
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
refreshTree(1);
}
// fall through
@@ -113,7 +113,7 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
break;
case WM_DESTROY:
- hwnd2Delete = NULL;
+ hwnd2Delete = nullptr;
break;
}
return 0;
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp
index 6f33002d52..e9c6efe468 100644
--- a/plugins/DbEditorPP/src/exportimport.cpp
+++ b/plugins/DbEditorPP/src/exportimport.cpp
@@ -150,20 +150,20 @@ void exportDB(MCONTACT hContact, const char *module)
wchar_t fileName[MAX_PATH];
- if (Openfile(fileName, (hContact == INVALID_CONTACT_ID) ? NULL : module, MAX_PATH)) {
+ if (Openfile(fileName, (hContact == INVALID_CONTACT_ID) ? nullptr : module, MAX_PATH)) {
FILE *file = _wfopen(fileName, L"wt");
if (!file) {
msg(TranslateT("Couldn't open file for writing"));
return;
}
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
// exporting entire db
if (hContact == INVALID_CONTACT_ID) {
hContact = NULL;
- if (module == NULL) {
+ if (module == nullptr) {
fprintf(file, "SETTINGS:\n");
mod = modlist.first;
while (mod) {
@@ -179,7 +179,7 @@ void exportDB(MCONTACT hContact, const char *module)
}
else {
if (*module == 0)
- module = NULL; // reset module for all contacts export
+ module = nullptr; // reset module for all contacts export
}
hContact = db_find_first();
@@ -195,7 +195,7 @@ void exportDB(MCONTACT hContact, const char *module)
fprintf(file, "CONTACT: %s\n", NickFromHContact(hContact));
- if (module == NULL) // export all modules
+ if (module == nullptr) // export all modules
{
mod = modlist.first;
while (mod) {
@@ -247,7 +247,7 @@ void exportDB(MCONTACT hContact, const char *module)
}
fclose(file);
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
}
FreeModuleSettingLL(&modlist);
@@ -276,18 +276,18 @@ void importSettings(MCONTACT hContact, char *utf8)
importstring = strtok(importstring, "\n");
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
- while (importstring != NULL) {
+ while (importstring != nullptr) {
i = 0;
rtrim(importstring);
if (importstring[i] == '\0') {
- importstring = strtok(NULL, "\n");
+ importstring = strtok(nullptr, "\n");
continue;
}
if (!strncmp(&importstring[i], "SETTINGS:", mir_strlen("SETTINGS:"))) {
- importstring = strtok(NULL, "\n");
+ importstring = strtok(nullptr, "\n");
continue;
}
@@ -414,9 +414,9 @@ void importSettings(MCONTACT hContact, char *utf8)
}
}
}
- importstring = strtok(NULL, "\n");
+ importstring = strtok(nullptr, "\n");
}
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
}
INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -429,7 +429,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara
wchar_t name[NAME_SIZE], msg[MSG_SIZE];
- GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
+ GetContactName((MCONTACT)lParam, nullptr, name, _countof(name));
mir_snwprintf(msg, TranslateT("Import to \"%s\""), name);
SetWindowText(hwnd, msg);
@@ -515,10 +515,10 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath)
mir_wstrcat(szFile, &szFileNames[index]);
index += (int)mir_wstrlen(&szFileNames[index]) + 1;
- HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
- if (GetFileSize(hFile, NULL) > 0) {
- HANDLE hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if (GetFileSize(hFile, nullptr) > 0) {
+ HANDLE hMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, 0, nullptr);
if (hMap) {
char *pFile = (char*)MapViewOfFile(hMap, FILE_MAP_COPY, 0, 0, 0);
if (pFile) {
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp
index b97dd4ab0d..ccfc80060a 100644
--- a/plugins/DbEditorPP/src/findwindow.cpp
+++ b/plugins/DbEditorPP/src/findwindow.cpp
@@ -49,7 +49,7 @@ ColumnsSettings csResultList[] = {
{ LPGENW("Module"), 2, "Search2width", 100 },
{ LPGENW("Setting"), 3, "Search3width", 100 },
{ LPGENW("Value"), 4, "Search4width", 150 },
- {0}
+ {nullptr}
};
@@ -237,7 +237,7 @@ void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *set
else
mode = TranslateT("Found");
- GetContactName(hContact, NULL, name, _countof(name));
+ GetContactName(hContact, nullptr, name, _countof(name));
LVITEM lvi = {0};
lvi.mask = LVIF_PARAM;
@@ -376,13 +376,13 @@ void __cdecl FindSettings(LPVOID param)
if (!(fi->options & F_UNICODE) && (fi->options & F_SETVAL)) {
char val[16];
- numsearch = strtoul(search, NULL, 10);
+ numsearch = strtoul(search, nullptr, 10);
_ultoa(numsearch, val, 10);
if (!mir_strcmp(search, val)) {
fi->options |= F_NUMSRCH;
// replace numeric values only entirely
if (replace && (fi->options & F_ENTIRE)) {
- numreplace = strtoul(replace, NULL, 10);
+ numreplace = strtoul(replace, nullptr, 10);
_ultoa(numreplace, val, 10);
if (!replace[0] || !mir_strcmp(replace, val))
fi->options |= F_NUMREPL;
@@ -429,7 +429,7 @@ void __cdecl FindSettings(LPVOID param)
// check in settings value
if (fi->options & F_SETVAL) {
- wchar_t *value = NULL;
+ wchar_t *value = nullptr;
switch(dbv.type) {
@@ -527,7 +527,7 @@ void __cdecl FindSettings(LPVOID param)
}
}
- ItemFound(fi->hwnd, hContact, module->name, newSetting, NULL, flag);
+ ItemFound(fi->hwnd, hContact, module->name, newSetting, nullptr, flag);
}
db_free(&dbv);
@@ -549,19 +549,19 @@ void __cdecl FindSettings(LPVOID param)
if (!newModule[0]) {
deleteModule(hContact, module->name, 0);
- replaceTreeItem(hContact, module->name, NULL);
+ replaceTreeItem(hContact, module->name, nullptr);
flag |= F_DELETED;
newModule = module->name;
deleteCount++;
}
else if (renameModule(hContact, module->name, newModule)) {
- replaceTreeItem(hContact, module->name, NULL);
+ replaceTreeItem(hContact, module->name, nullptr);
flag |= F_REPLACED;
replaceCount++;
}
}
- ItemFound(fi->hwnd, hContact, newModule, 0, 0, flag);
+ ItemFound(fi->hwnd, hContact, newModule, nullptr, nullptr, flag);
}
} // for(module)
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp
index 3e388b7244..683b90fbe7 100644
--- a/plugins/DbEditorPP/src/icons.cpp
+++ b/plugins/DbEditorPP/src/icons.cpp
@@ -67,13 +67,13 @@ HIMAGELIST LoadIcons()
HICON hIcon;
HIMAGELIST hil = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, _countof(dbeIcons), 5);
if (!hil)
- return NULL;
+ return nullptr;
for(int i = 0; i < _countof(dbeIcons); i++)
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(dbeIcons[i]));
int protoCount = 0;
- PROTOACCOUNT **protocols = NULL;
+ PROTOACCOUNT **protocols = nullptr;
Proto_EnumAccounts(&protoCount, &protocols);
for (int i = 0; i < protoCount; i++) {
@@ -92,7 +92,7 @@ int GetProtoIconIndex(const char *szProto)
{
if (szProto && szProto[0]) {
int protoCount = 0;
- PROTOACCOUNT **protocols = NULL;
+ PROTOACCOUNT **protocols = nullptr;
Proto_EnumAccounts(&protoCount, &protocols);
for (int i = 0; i < protoCount; i++)
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp
index fe31957c25..e3c6084450 100644
--- a/plugins/DbEditorPP/src/main.cpp
+++ b/plugins/DbEditorPP/src/main.cpp
@@ -1,10 +1,10 @@
#include "stdafx.h"
-HINSTANCE hInst = NULL;
+HINSTANCE hInst = nullptr;
MIDatabase *g_db;
-HANDLE hTTBButt = NULL;
+HANDLE hTTBButt = nullptr;
bool g_bServiceMode = false;
bool g_bUsePopups;
@@ -97,7 +97,7 @@ INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM)
static int OnTTBLoaded(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = "DBEditorpp/MenuCommand";
ttb.name = LPGEN("Database Editor++");
@@ -123,7 +123,7 @@ int ModulesLoaded(WPARAM, LPARAM)
Menu_AddMainMenuItem(&mi);
SET_UID(mi, 0x2fed8613, 0xac43, 0x4148, 0xbd, 0x5c, 0x44, 0x88, 0xaf, 0x68, 0x69, 0x10);
- mi.root = NULL;
+ mi.root = nullptr;
mi.hIcolibItem = GetIcoLibHandle(ICO_REGUSER);
mi.name.a = LPGEN("Open user tree in DBE++");
mi.pszService = "DBEditorpp/MenuCommand";
@@ -184,7 +184,7 @@ extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfoEx);
- hwnd2mainWindow = NULL;
+ hwnd2mainWindow = nullptr;
hRestore = NULL;
g_db = db_get_current();
@@ -313,7 +313,7 @@ int setNumericValue(MCONTACT hContact, const char *module, const char *setting,
int IsRealUnicode(wchar_t *value)
{
BOOL nonascii = 0;
- WideCharToMultiByte(Langpack_GetDefaultCodePage(), WC_NO_BEST_FIT_CHARS, value, -1, NULL, 0, NULL, &nonascii);
+ WideCharToMultiByte(Langpack_GetDefaultCodePage(), WC_NO_BEST_FIT_CHARS, value, -1, nullptr, 0, nullptr, &nonascii);
return nonascii;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp
index 6868493943..318a1fc8e1 100644
--- a/plugins/DbEditorPP/src/main_window.cpp
+++ b/plugins/DbEditorPP/src/main_window.cpp
@@ -2,7 +2,7 @@
HWND hwnd2mainWindow;
-static HIMAGELIST hImg = 0;
+static HIMAGELIST hImg = nullptr;
int g_Hex;
int g_Mode;
@@ -63,7 +63,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
{
RECT rc;
GetClientRect(hwnd, &rc);
- SetCursor(rc.right > rc.bottom ? LoadCursor(NULL, IDC_SIZENS) : LoadCursor(NULL, IDC_SIZEWE));
+ SetCursor(rc.right > rc.bottom ? LoadCursor(nullptr, IDC_SIZENS) : LoadCursor(nullptr, IDC_SIZEWE));
}
return TRUE;
@@ -369,13 +369,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
freeTree(0);
- hwnd2mainWindow = NULL;
- hwnd2Tree = NULL;
- hwnd2List = NULL;
+ hwnd2mainWindow = nullptr;
+ hwnd2Tree = nullptr;
+ hwnd2List = nullptr;
if (hImg) {
ImageList_Destroy(hImg);
- hImg = NULL;
+ hImg = nullptr;
}
FreeResidentSettings();
@@ -416,16 +416,16 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
freeAllWatches();
break;
case MENU_EXPORTDB: // all db
- exportDB(INVALID_CONTACT_ID, 0);
+ exportDB(INVALID_CONTACT_ID, nullptr);
break;
case MENU_EXPORTCONTACT: // all contacts
exportDB(INVALID_CONTACT_ID, "");
break;
case MENU_EXPORTMODULE: // all settings
- exportDB(NULL, 0);
+ exportDB(NULL, nullptr);
break;
case MENU_IMPORTFROMFILE:
- ImportSettingsFromFileMenuItem(NULL, NULL);
+ ImportSettingsFromFileMenuItem(NULL, nullptr);
break;
case MENU_IMPORTFROMTEXT:
ImportSettingsMenuItem(NULL);
@@ -539,5 +539,5 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void openMainWindow()
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), 0, MainDlgProc);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, MainDlgProc);
}
diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp
index e1e7de6e33..551fc3a171 100644
--- a/plugins/DbEditorPP/src/modsettingenum.cpp
+++ b/plugins/DbEditorPP/src/modsettingenum.cpp
@@ -3,7 +3,7 @@
void FreeModuleSettingLL(ModuleSettingLL *msll)
{
- if (msll == NULL)
+ if (msll == nullptr)
return;
ModSetLinkLinkItem *item = msll->first;
@@ -16,8 +16,8 @@ void FreeModuleSettingLL(ModuleSettingLL *msll)
mir_free(temp);
}
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
}
@@ -30,7 +30,7 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam)
return 1;
msll->first->name = mir_strdup(setting);
- msll->first->next = 0;
+ msll->first->next = nullptr;
msll->last = msll->first;
}
else {
@@ -41,7 +41,7 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam)
msll->last->next = item;
msll->last = item;
item->name = mir_strdup(setting);
- item->next = 0;
+ item->next = nullptr;
}
return 0;
}
@@ -49,8 +49,8 @@ int enumModulesSettingsProc(const char *setting, DWORD, LPARAM lParam)
int EnumModules(ModuleSettingLL *msll) // 1 = success, 0 = fail
{
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
if (db_enum_modules(enumModulesSettingsProc, msll)) {
msg(TranslateT("Error loading module list"));
return 0;
@@ -68,8 +68,8 @@ int enumSettingsProc(const char *setting, LPARAM lParam)
int EnumSettings(MCONTACT hContact, const char *module, ModuleSettingLL *msll)
{
// enum all setting the contact has for the module
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
if (db_enum_settings(hContact, enumSettingsProc, module, msll)) {
msg(TranslateT("Error loading setting list"));
return 0;
@@ -118,7 +118,7 @@ int enumResidentProc(const char *setting, DWORD, LPARAM)
int LoadResidentSettings()
{
if (g_db)
- return !g_db->EnumResidentSettings(enumResidentProc, 0);
+ return !g_db->EnumResidentSettings(enumResidentProc, nullptr);
return 0;
}
@@ -154,8 +154,8 @@ int IsResidentSetting(const char *module, const char *setting)
int EnumResidentSettings(const char *module, ModuleSettingLL *msll)
{
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
if (!module) return 0;
if (!m_lResidentSettings.getCount()) return 0;
@@ -179,8 +179,8 @@ int EnumResidentSettings(const char *module, ModuleSettingLL *msll)
int EnumResidentModules(ModuleSettingLL *msll)
{
- msll->first = 0;
- msll->last = 0;
+ msll->first = nullptr;
+ msll->last = nullptr;
if (!m_lResidentModules.getCount()) return 0;
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp
index 34c43fb7e8..6abd34c7ec 100644
--- a/plugins/DbEditorPP/src/moduletree.cpp
+++ b/plugins/DbEditorPP/src/moduletree.cpp
@@ -1,6 +1,6 @@
#include "stdafx.h"
-HWND hwnd2Tree = 0;
+HWND hwnd2Tree = nullptr;
volatile BOOL populating = 0;
volatile int Select = 0;
@@ -38,7 +38,7 @@ int doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelec
ModuleTreeInfoStruct *lParam;
int itemscount = 0;
int icon = 0;
- HTREEITEM hItem = 0;
+ HTREEITEM hItem = nullptr;
SetWindowText(hwnd2mainWindow, TranslateT("Loading contacts..."));
@@ -155,7 +155,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module)
wchar_t text[FLD_SIZE];
if (!TreeView_GetCount(hwnd2Tree))
- return 0;
+ return nullptr;
_A2T szModule(module);
@@ -182,7 +182,7 @@ HTREEITEM findItemInTree(MCONTACT hContact, const char* module)
} while (item.hItem);
- return 0;
+ return nullptr;
}
// the following code to go through the whole tree is nicked from codeguru..
@@ -296,7 +296,7 @@ void replaceTreeItem(MCONTACT hContact, const char* module, const char* newModul
return;
if (hParent) {
- replaceTreeItem(hContact, newModule, NULL);
+ replaceTreeItem(hContact, newModule, nullptr);
insertItem(hContact, newModule, hParent);
}
}
@@ -374,7 +374,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param)
/// contact root item
contacts_mtis.type = CONTACT_ROOT_ITEM;
tvi.item.lParam = (LPARAM)&contacts_mtis;
- tvi.hParent = NULL;
+ tvi.hParent = nullptr;
tvi.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_STATE | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.item.state = TVIS_BOLD;
tvi.item.stateMask = TVIS_BOLD;
@@ -391,7 +391,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param)
tvi.item.lParam = (LPARAM)&settings_mtis;
tvi.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.item.cChildren = 1;
- tvi.hParent = NULL;
+ tvi.hParent = nullptr;
tvi.hInsertAfter = TVI_FIRST;
tvi.item.pszText = TranslateT("Settings");
tvi.item.iImage = IMAGE_SETTINGS;
@@ -665,11 +665,11 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t
case 5: // contact module
{
// check if the setting is being watched and if it is then check the menu item
- int watchIdx = WatchedArrayIndex(hContact, module, NULL, 1);
+ int watchIdx = WatchedArrayIndex(hContact, module, nullptr, 1);
if (watchIdx >= 0)
CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
case MENU_RENAME_MOD:
TreeView_EditLabel(hwnd2Tree, tvi.hItem);
break;
@@ -688,7 +688,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t
////////////////////////////////////////////////////////////////////// divider
case MENU_WATCH_ITEM:
if (watchIdx < 0)
- addSettingToWatchList(hContact, module, 0);
+ addSettingToWatchList(hContact, module, nullptr);
else
freeWatchListItem(watchIdx);
PopulateWatchedWindow();
@@ -710,7 +710,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t
break;
case 2: // contact
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
case MENU_CLONE_CONTACT:
if (CloneContact(hContact))
refreshTree(1);
@@ -730,13 +730,13 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t
////////////////////////////////////////////////////////////////////// divider
case MENU_EXPORTCONTACT:
- exportDB(hContact, 0);
+ exportDB(hContact, nullptr);
break;
case MENU_IMPORTFROMTEXT:
ImportSettingsMenuItem(hContact);
break;
case MENU_IMPORTFROMFILE:
- ImportSettingsFromFileMenuItem(hContact, NULL);
+ ImportSettingsFromFileMenuItem(hContact, nullptr);
break;
////////////////////////////////////////////////////////////////////// divider
@@ -752,18 +752,18 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t
break;
case 3: // NULL contact
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
case MENU_ADD_MODULE:
addModuleDlg(hContact);
break;
case MENU_EXPORTCONTACT:
- exportDB(NULL, 0);
+ exportDB(NULL, nullptr);
break;
case MENU_IMPORTFROMTEXT:
ImportSettingsMenuItem(NULL);
break;
case MENU_IMPORTFROMFILE:
- ImportSettingsFromFileMenuItem(NULL, NULL);
+ ImportSettingsFromFileMenuItem(NULL, nullptr);
break;
case MENU_REFRESH:
refreshTree(1);
@@ -772,7 +772,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t
break;
case 4: // Contacts root
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
case MENU_EXPORTCONTACT:
exportDB(INVALID_CONTACT_ID, "");
break;
@@ -780,7 +780,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t
ImportSettingsMenuItem(NULL);
break;
case MENU_IMPORTFROMFILE:
- ImportSettingsFromFileMenuItem(NULL, NULL);
+ ImportSettingsFromFileMenuItem(NULL, nullptr);
break;
case MENU_REFRESH:
refreshTree(1);
diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp
index c6c59a83ad..3e2ca49646 100644
--- a/plugins/DbEditorPP/src/options.cpp
+++ b/plugins/DbEditorPP/src/options.cpp
@@ -47,7 +47,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
db_set_b(NULL, modname, "WarnOnDelete", (BYTE)IsDlgButtonChecked(hwnd, IDC_WARNONDEL));
g_bUsePopups = IsDlgButtonChecked(hwnd, IDC_POPUPS) != 0;
db_set_b(NULL, modname, "UsePopUps", (BYTE)g_bUsePopups);
- db_set_w(NULL, modname, "PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, NULL, 0));
+ db_set_w(NULL, modname, "PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, nullptr, 0));
db_set_dw(NULL, modname, "PopupColour", (DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
}
return TRUE;
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp
index 1844907aba..3f87c49644 100644
--- a/plugins/DbEditorPP/src/renamemodule.cpp
+++ b/plugins/DbEditorPP/src/renamemodule.cpp
@@ -31,7 +31,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara
TranslateDialogDefault(hwnd);
wchar_t msg[MSG_SIZE], name[NAME_SIZE];
- GetContactName((MCONTACT)lParam, NULL, name, _countof(name));
+ GetContactName((MCONTACT)lParam, nullptr, name, _countof(name));
mir_snwprintf(msg, TranslateT("Add module to \"%s\""), name);
SetWindowText(hwnd, msg);
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp
index 501aa0e75e..8718da8bec 100644
--- a/plugins/DbEditorPP/src/settinglist.cpp
+++ b/plugins/DbEditorPP/src/settinglist.cpp
@@ -2,7 +2,7 @@
SettingListInfo info = {0};
-HWND hwnd2List = 0;
+HWND hwnd2List = nullptr;
static int lastColumn = -1;
@@ -14,7 +14,7 @@ struct ColumnsSettings csSettingList[] =
{ LPGENW("Type"), 2, "Column2width", 60 },
{ LPGENW("Size"), 3, "Column3width", 80 },
{ LPGENW("#"), 4, "Column4width", 30 },
- { 0 }
+ { nullptr }
};
int ListView_GetItemTextA(HWND hwndLV, int i, int iSubItem, char *pszText, int cchTextMax)
@@ -74,7 +74,7 @@ int convertSetting(MCONTACT hContact, const char *module, const char *setting, i
value = mir_a2u(dbv.pszVal);
if (mir_wstrlen(value) < 11)
- val = wcstoul(value, NULL, NULL);
+ val = wcstoul(value, nullptr, NULL);
}
switch (toType) {
@@ -108,7 +108,7 @@ void EditFinish(int selected)
{
if (info.hwnd2Edit) {
SendMessage(info.hwnd2Edit, WM_COMMAND, MAKEWPARAM(IDOK, 0), 0);
- info.hwnd2Edit = NULL;
+ info.hwnd2Edit = nullptr;
}
info.selectedItem = selected;
}
@@ -157,7 +157,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s
}
if (ListView_GetItemCount(hwnd2List) == 0)
- replaceTreeItem(hContact, module, 0);
+ replaceTreeItem(hContact, module, nullptr);
}
@@ -301,7 +301,7 @@ void addListHandle(MCONTACT hContact)
lvi.lParam = hContact;
lvi.iImage = IMAGE_HANDLE;
- GetContactName(hContact, NULL, name, _countof(name));
+ GetContactName(hContact, nullptr, name, _countof(name));
lvi.pszText = name;
int index = ListView_InsertItem(hwnd2List, &lvi);
@@ -408,7 +408,7 @@ void settingChanged(MCONTACT hContact, const char *module, const char *setting,
if (dbv->type != DBVT_DELETED) {
HTREEITEM hItem = findItemInTree(hContact, module);
if (!hItem) {
- HTREEITEM hParent = findItemInTree(hContact, NULL);
+ HTREEITEM hParent = findItemInTree(hContact, nullptr);
if (hParent)
insertItem(hContact, module, hParent);
}
@@ -510,7 +510,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM
switch (value[0]) {
case 'b':
case 'B':
- val = wcstoul(&value[1], NULL, 0);
+ val = wcstoul(&value[1], nullptr, 0);
if (!val || value[1] == '0') {
res = !db_set_b(info.hContact, info.module, info.setting, (BYTE)val);
}
@@ -519,7 +519,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM
break;
case 'w':
case 'W':
- val = wcstoul(&value[1], NULL, 0);
+ val = wcstoul(&value[1], nullptr, 0);
if (!val || value[1] == '0')
res = !db_set_w(info.hContact, info.module, info.setting, (WORD)val);
else
@@ -527,7 +527,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM
break;
case 'd':
case 'D':
- val = wcstoul(&value[1], NULL, 0);
+ val = wcstoul(&value[1], nullptr, 0);
if (!val || value[1] == '0')
res = !db_set_dw(info.hContact, info.module, info.setting, val);
else
@@ -550,9 +550,9 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM
case 'x':
case 'X':
if (value[i] == 'x' || value[i] == 'X')
- val = wcstoul(&value[i + 1], NULL, 16);
+ val = wcstoul(&value[i + 1], nullptr, 16);
else
- val = wcstoul(value, NULL, 10);
+ val = wcstoul(value, nullptr, 10);
switch (dbv.type) {
case DBVT_BYTE:
@@ -608,7 +608,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM
return DLGC_WANTALLKEYS;
case WM_DESTROY:
- info.hwnd2Edit = NULL;
+ info.hwnd2Edit = nullptr;
break;
}
return mir_callNextSubclass(hwnd, SettingLabelEditSubClassProc, msg, wParam, lParam);
@@ -622,7 +622,7 @@ void EditLabel(int item, int subitem)
if (info.hwnd2Edit) {
SendMessage(info.hwnd2Edit, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0); // ignore the new value of the last edit
- info.hwnd2Edit = NULL;
+ info.hwnd2Edit = nullptr;
}
if (!ListView_GetItemTextA(hwnd2List, item, 0, setting, _countof(setting))) return;
@@ -636,9 +636,9 @@ void EditLabel(int item, int subitem)
info.subitem = subitem;
if (!subitem)
- info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, 0, hInst, 0);
+ info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, hInst, nullptr);
else {
- wchar_t *str = NULL, value[16] = { 0 };
+ wchar_t *str = nullptr, value[16] = { 0 };
switch (dbv.type) {
case DBVT_ASCIIZ:
@@ -670,11 +670,11 @@ void EditLabel(int item, int subitem)
GetClientRect(hwnd2List, &rclist);
if (rc.top + height > rclist.bottom && rclist.bottom - rclist.top > height)
rc.top = rc.bottom - height;
- info.hwnd2Edit = CreateWindow(L"EDIT", str, WS_BORDER | WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, height, hwnd2List, 0, hInst, 0);
+ info.hwnd2Edit = CreateWindow(L"EDIT", str, WS_BORDER | WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, height, hwnd2List, nullptr, hInst, nullptr);
mir_free(str);
}
else if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD)
- info.hwnd2Edit = CreateWindow(L"EDIT", value, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, 0, hInst, 0);
+ info.hwnd2Edit = CreateWindow(L"EDIT", value, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, hInst, nullptr);
}
db_free(&dbv);
@@ -735,7 +735,7 @@ void SettingsListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)
case LVN_COLUMNCLICK:
LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
- ColumnsSortParams params = { 0 };
+ ColumnsSortParams params = {};
params.hList = hwnd2List;
params.column = lv->iSubItem;
params.last = lastColumn;
@@ -766,7 +766,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to
RemoveMenu(hSubMenu, 0, MF_BYPOSITION); // separator
}
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr)) {
case MENU_ADD_BYTE:
newSetting(info.hContact, info.module, DBVT_BYTE);
return;
@@ -869,7 +869,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to
if (watchIdx >= 0)
CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr)) {
case MENU_EDIT_SET:
editSetting(info.hContact, info.module, setting);
break;
diff --git a/plugins/DbEditorPP/src/settingsdlg.cpp b/plugins/DbEditorPP/src/settingsdlg.cpp
index bddbc89b0d..0690d65b62 100644
--- a/plugins/DbEditorPP/src/settingsdlg.cpp
+++ b/plugins/DbEditorPP/src/settingsdlg.cpp
@@ -235,7 +235,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
case DBVT_BYTE:
case DBVT_WORD:
case DBVT_DWORD:
- res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, NULL, IsDlgButtonChecked(hwnd, CHK_HEX)? 16 : 10), type);
+ res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, nullptr, IsDlgButtonChecked(hwnd, CHK_HEX)? 16 : 10), type);
break;
case DBVT_ASCIIZ:
case DBVT_UTF8:
@@ -328,6 +328,6 @@ void newSetting(MCONTACT hContact, const char *module, int type)
dbsetting->dbv.type = type;
dbsetting->hContact = hContact;
dbsetting->module = mir_strdup(module);
- dbsetting->setting = NULL;
+ dbsetting->setting = nullptr;
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting);
}
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp
index e4a175d1ff..f438f3dba6 100644
--- a/plugins/DbEditorPP/src/watchedvars.cpp
+++ b/plugins/DbEditorPP/src/watchedvars.cpp
@@ -1,8 +1,8 @@
#include "stdafx.h"
-HWND hwnd2watchedVarsWindow = NULL;
+HWND hwnd2watchedVarsWindow = nullptr;
-static WatchListArrayStruct WatchListArray = {0};
+static WatchListArrayStruct WatchListArray = {};
static int lastColumn = -1;
@@ -12,7 +12,7 @@ ColumnsSettings csWatchList[] = {
{ LPGENW("Setting"), 2, "Watch2width", 100 },
{ LPGENW("Value"), 3, "Watch3width", 200 },
{ LPGENW("Type"), 4, "Watch4width", 75 },
- {0}
+ {nullptr}
};
@@ -47,7 +47,7 @@ int addSettingToWatchList(MCONTACT hContact, const char *module, const char *set
if (setting)
WatchListArray.item[WatchListArray.count].setting = mir_strdup(setting);
else
- WatchListArray.item[WatchListArray.count].setting = 0;
+ WatchListArray.item[WatchListArray.count].setting = nullptr;
WatchListArray.count++;
return 1;
@@ -61,12 +61,12 @@ void freeWatchListItem(int item)
if (WatchListArray.item[item].module)
mir_free(WatchListArray.item[item].module);
- WatchListArray.item[item].module = 0;
+ WatchListArray.item[item].module = nullptr;
if (WatchListArray.item[item].setting)
mir_free(WatchListArray.item[item].setting);
- WatchListArray.item[item].setting = 0;
+ WatchListArray.item[item].setting = nullptr;
db_free(&(WatchListArray.item[item].dbv));
WatchListArray.item[item].hContact = 0;
}
@@ -111,7 +111,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam)
wchar_t data[32], tmp[16], name[NAME_SIZE];
- GetContactName(lParam->hContact, NULL, name, _countof(name));
+ GetContactName(lParam->hContact, nullptr, name, _countof(name));
lvItem.pszText = name;
int index = ListView_InsertItem(hwnd, &lvItem);
@@ -197,7 +197,7 @@ void freeAllWatches()
freeWatchListItem(i);
}
mir_free(WatchListArray.item);
- WatchListArray.item = 0;
+ WatchListArray.item = nullptr;
WatchListArray.count = 0;
}
@@ -274,7 +274,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case MENU_EXIT:
case IDCANCEL:
- hwnd2watchedVarsWindow = NULL;
+ hwnd2watchedVarsWindow = nullptr;
DestroyWindow(hwnd);
break;
case MENU_REFRESH:
@@ -331,7 +331,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
ListView_DeleteAllItems(GetDlgItem(hwnd, IDC_VARS));
saveListSettings(GetDlgItem(hwnd, IDC_VARS), csWatchList);
Utils_SaveWindowPosition(hwnd, NULL, modname, "Watch_");
- hwnd2watchedVarsWindow = NULL;
+ hwnd2watchedVarsWindow = nullptr;
break;
}
return 0;
@@ -340,7 +340,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void openWatchedVarWindow()
{
if (!hwnd2watchedVarsWindow)
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), NULL, WatchDlgProc);
+ CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), nullptr, WatchDlgProc);
else
SetForegroundWindow(hwnd2watchedVarsWindow);
}
@@ -353,7 +353,7 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting)
int timeout = db_get_b(NULL, modname, "PopupDelay", 3);
wchar_t name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE];
- GetContactName(hContact, NULL, name, _countof(name));
+ GetContactName(hContact, nullptr, name, _countof(name));
// 2nd line
int type = GetValue(hContact, module, setting, value, _countof(value));