diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-10 13:01:41 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-10 13:01:41 +0300 |
commit | fc9c6fa412aba2b1c3b2205c79152b80fd28feee (patch) | |
tree | f729c6a68c8e1e2e4908ab1b4b8e683acd1c54c0 /src | |
parent | ea7bccab81b2c637d1f9880b461a65d68ef8c8ab (diff) |
- NULL -> nullptr to resolve conflicts
- warning fixes
Diffstat (limited to 'src')
110 files changed, 2479 insertions, 2482 deletions
diff --git a/src/mir_app/src/BaseExtraIcon.cpp b/src/mir_app/src/BaseExtraIcon.cpp index 9fbc5004cb..694260cba4 100644 --- a/src/mir_app/src/BaseExtraIcon.cpp +++ b/src/mir_app/src/BaseExtraIcon.cpp @@ -70,7 +70,7 @@ void BaseExtraIcon::setDescIcon(const char *icon) void BaseExtraIcon::onClick(MCONTACT hContact)
{
- if (m_OnClick != NULL)
+ if (m_OnClick != nullptr)
m_OnClick(hContact, (LPARAM)ConvertToClistSlot(m_slot), m_onClickParam);
}
diff --git a/src/mir_app/src/CallbackExtraIcon.cpp b/src/mir_app/src/CallbackExtraIcon.cpp index fd97246797..e0aca8c1ef 100644 --- a/src/mir_app/src/CallbackExtraIcon.cpp +++ b/src/mir_app/src/CallbackExtraIcon.cpp @@ -52,7 +52,7 @@ void CallbackExtraIcon::rebuildIcons() void CallbackExtraIcon::applyIcon(MCONTACT hContact)
{
- if (!isEnabled() || hContact == NULL)
+ if (!isEnabled() || hContact == 0)
return;
if (m_needToRebuild)
@@ -63,7 +63,7 @@ void CallbackExtraIcon::applyIcon(MCONTACT hContact) int CallbackExtraIcon::setIcon(int id, MCONTACT hContact, HANDLE icon)
{
- if (!isEnabled() || hContact == NULL || id != m_id)
+ if (!isEnabled() || hContact == 0 || id != m_id)
return -1;
return ClistSetExtraIcon(hContact, icon);
diff --git a/src/mir_app/src/DefaultExtraIcons.cpp b/src/mir_app/src/DefaultExtraIcons.cpp index 03b754ae48..39848cff52 100644 --- a/src/mir_app/src/DefaultExtraIcons.cpp +++ b/src/mir_app/src/DefaultExtraIcons.cpp @@ -35,7 +35,7 @@ HANDLE hExtraVisibility, hExtraChat, hExtraGender, hExtraProto; static void SetVisibility(MCONTACT hContact, int apparentMode, bool clear)
{
- if (hContact == NULL)
+ if (hContact == 0)
return;
char *proto = GetContactProto(hContact);
@@ -45,7 +45,7 @@ static void SetVisibility(MCONTACT hContact, int apparentMode, bool clear) if (apparentMode <= 0)
apparentMode = db_get_w(hContact, proto, "ApparentMode", 0);
- HANDLE hExtraIcon, hIcolib = NULL;
+ HANDLE hExtraIcon, hIcolib = nullptr;
if (db_get_b(hContact, proto, "ChatRoom", 0)) {
// Is chat
@@ -62,7 +62,7 @@ static void SetVisibility(MCONTACT hContact, int apparentMode, bool clear) hIcolib = Skin_GetIconHandle(SKINICON_OTHER_VISIBLE_ALL);
}
- if (hIcolib != NULL || clear) {
+ if (hIcolib != nullptr || clear) {
ExtraIcon *extra = GetExtraIcon(hExtraIcon);
if (extra)
extra->setIcon((INT_PTR)hExtraIcon, hContact, hIcolib);
@@ -71,7 +71,7 @@ static void SetVisibility(MCONTACT hContact, int apparentMode, bool clear) static void SetGender(MCONTACT hContact, int gender, bool clear)
{
- if (hContact == NULL)
+ if (hContact == 0)
return;
char *proto = GetContactProto(hContact);
@@ -89,9 +89,9 @@ static void SetGender(MCONTACT hContact, int gender, bool clear) else if (gender == 'F')
ico = "gender_female";
else
- ico = NULL;
+ ico = nullptr;
- if (ico != NULL || clear) {
+ if (ico != nullptr || clear) {
ExtraIcon *extra = GetExtraIcon(hExtraGender);
if (extra)
extra->setIconByName((INT_PTR)hExtraGender, hContact, ico);
@@ -114,30 +114,30 @@ static void EmailOnClick(Info*, const char *text) {
char cmd[1024];
mir_snprintf(cmd, "mailto:%s", text);
- ShellExecuteA(NULL, "open", cmd, NULL, NULL, SW_SHOW);
+ ShellExecuteA(nullptr, "open", cmd, nullptr, nullptr, SW_SHOW);
}
static void HomepageOnClick(Info*, const char *text)
{
- ShellExecuteA(NULL, "open", text, NULL, NULL, SW_SHOW);
+ ShellExecuteA(nullptr, "open", text, nullptr, nullptr, SW_SHOW);
}
static Info infos[] =
{
{ "homepage", "Homepage", SKINICON_OTHER_MIRANDAWEB,
- { NULL, "Homepage", "UserInfo", "Homepage" },
+ { nullptr, "Homepage", "UserInfo", "Homepage" },
&HomepageOnClick, EIF_DISABLED_BY_DEFAULT },
{ "sms", "Phone/SMS", SKINICON_OTHER_SMS,
- { NULL, "Cellular", "UserInfo", "Cellular", "UserInfo", "Phone", "UserInfo", "MyPhone0" },
- NULL, EIF_DISABLED_BY_DEFAULT },
+ { nullptr, "Cellular", "UserInfo", "Cellular", "UserInfo", "Phone", "UserInfo", "MyPhone0" },
+ nullptr, EIF_DISABLED_BY_DEFAULT },
{ "email", "E-mail", SKINICON_OTHER_SENDEMAIL,
- { NULL, "e-mail", "UserInfo", "e-mail", "UserInfo", "Mye-mail0" },
+ { nullptr, "e-mail", "UserInfo", "e-mail", "UserInfo", "Mye-mail0" },
&EmailOnClick, EIF_DISABLED_BY_DEFAULT },
};
static void SetExtraIcons(MCONTACT hContact)
{
- if (hContact == NULL)
+ if (hContact == 0)
return;
char *proto = GetContactProto(hContact);
@@ -148,10 +148,10 @@ static void SetExtraIcons(MCONTACT hContact) Info &p = infos[i];
for (unsigned int j = 0; j < _countof(p.db); j += 2) {
- if (p.db[j + 1] == NULL)
+ if (p.db[j + 1] == nullptr)
break;
- ptrA szValue(db_get_sa(hContact, p.db[j] == NULL ? proto : p.db[j], p.db[j + 1]));
+ ptrA szValue(db_get_sa(hContact, p.db[j] == nullptr ? proto : p.db[j], p.db[j + 1]));
if (!IsEmpty(szValue)) {
ExtraIcon_SetIcon(p.hExtraIcon, hContact, p.hIcolib);
break;
@@ -162,7 +162,7 @@ static void SetExtraIcons(MCONTACT hContact) static int SettingChanged(WPARAM hContact, LPARAM lParam)
{
- if (hContact == NULL)
+ if (hContact == 0)
return 0;
char *proto = GetContactProto(hContact);
@@ -185,17 +185,17 @@ static int SettingChanged(WPARAM hContact, LPARAM lParam) Info &p = infos[i];
for (int j = 0; j < _countof(p.db); j += 2) {
- if (p.db[j + 1] == NULL)
+ if (p.db[j + 1] == nullptr)
break;
- if (p.db[j] == NULL && !isProto)
+ if (p.db[j] == nullptr && !isProto)
continue;
- if (p.db[j] != NULL && strcmp(cws->szModule, p.db[j]))
+ if (p.db[j] != nullptr && strcmp(cws->szModule, p.db[j]))
continue;
if (strcmp(cws->szSetting, p.db[j + 1]))
continue;
bool show = (cws->value.type != DBVT_DELETED && !IsEmpty(cws->value.pszVal));
- ExtraIcon_SetIcon(p.hExtraIcon, hContact, show ? p.hIcolib : NULL);
+ ExtraIcon_SetIcon(p.hExtraIcon, hContact, show ? p.hIcolib : nullptr);
break;
}
}
@@ -206,10 +206,10 @@ static int SettingChanged(WPARAM hContact, LPARAM lParam) static int DefaultOnClick(WPARAM hContact, LPARAM, LPARAM param)
{
Info *p = (Info*)param;
- if (p == NULL)
+ if (p == nullptr)
return 0;
- if (hContact == NULL)
+ if (hContact == 0)
return 0;
char *proto = GetContactProto(hContact);
@@ -218,10 +218,10 @@ static int DefaultOnClick(WPARAM hContact, LPARAM, LPARAM param) bool found = false;
for (int j = 0; !found && j < _countof(p->db); j += 2) {
- if (p->db[j + 1] == NULL)
+ if (p->db[j + 1] == nullptr)
break;
- ptrA szValue(db_get_sa(hContact, p->db[j] == NULL ? proto : p->db[j], p->db[j + 1]));
+ ptrA szValue(db_get_sa(hContact, p->db[j] == nullptr ? proto : p->db[j], p->db[j + 1]));
if (!IsEmpty(szValue)) {
p->OnClick(p, szValue);
found = true;
@@ -264,12 +264,12 @@ static ProtoInfo* FindProto(const char *proto) return p;
HICON hIcon = Skin_LoadProtoIcon(proto, ID_STATUS_ONLINE);
- if (hIcon == NULL)
- return NULL;
+ if (hIcon == nullptr)
+ return nullptr;
HANDLE hImage = ExtraIcon_AddIcon(hIcon);
if (hImage == INVALID_HANDLE_VALUE)
- return NULL;
+ return nullptr;
p = new ProtoInfo(proto, hImage);
arProtos.insert(p);
@@ -284,7 +284,7 @@ static int ProtocolApplyIcon(WPARAM hContact, LPARAM) HANDLE hImage = INVALID_HANDLE_VALUE;
ProtoInfo *pi = FindProto(proto);
- if (pi != NULL)
+ if (pi != nullptr)
hImage = pi->hImage;
ExtraIcon_SetIcon(hExtraProto, hContact, hImage);
diff --git a/src/mir_app/src/Docking.cpp b/src/mir_app/src/Docking.cpp index f27a6fd091..26c48ec622 100644 --- a/src/mir_app/src/Docking.cpp +++ b/src/mir_app/src/Docking.cpp @@ -139,14 +139,14 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (msg->message == WM_DESTROY) {
if (docked) {
- db_set_b(NULL, "CList", "Docked", (BYTE)docked);
- db_set_dw(NULL, "CList", "DockX", (DWORD)dockPos.x);
- db_set_dw(NULL, "CList", "DockY", (DWORD)dockPos.y);
+ db_set_b(0, "CList", "Docked", (BYTE)docked);
+ db_set_dw(0, "CList", "DockX", (DWORD)dockPos.x);
+ db_set_dw(0, "CList", "DockY", (DWORD)dockPos.y);
}
else {
- db_unset(NULL, "CList", "Docked");
- db_unset(NULL, "CList", "DockX");
- db_unset(NULL, "CList", "DockY");
+ db_unset(0, "CList", "Docked");
+ db_unset(0, "CList", "DockX");
+ db_unset(0, "CList", "DockY");
}
}
@@ -156,10 +156,10 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) switch (msg->message) {
case WM_CREATE:
draggingTitle = 0;
- docked = db_get_b(NULL, "CLUI", "DockToSides", 1) ?
- (char)db_get_b(NULL, "CList", "Docked", 0) : 0;
- dockPos.x = (int)db_get_dw(NULL, "CList", "DockX", 0);
- dockPos.y = (int)db_get_dw(NULL, "CList", "DockY", 0);
+ docked = db_get_b(0, "CLUI", "DockToSides", 1) ?
+ (char)db_get_b(0, "CList", "Docked", 0) : 0;
+ dockPos.x = (int)db_get_dw(0, "CList", "DockX", 0);
+ dockPos.y = (int)db_get_dw(0, "CList", "DockY", 0);
break;
case WM_ACTIVATE:
@@ -265,7 +265,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) ||
(ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) &&
- db_get_b(NULL, "CLUI", "DockToSides", 1)) {
+ db_get_b(0, "CLUI", "DockToSides", 1)) {
docked = (ptCursor.x < rcMonitor.left + EDGESENSITIVITY) ? DOCKED_LEFT : DOCKED_RIGHT;
PostMessage(msg->hwnd, WM_LBUTTONUP, 0, MAKELPARAM(ptCursor.x, ptCursor.y));
@@ -325,8 +325,8 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y));
SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2,
pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2,
- db_get_dw(NULL, "CList", "Width", 0),
- db_get_dw(NULL, "CList", "Height", 0),
+ db_get_dw(0, "CList", "Width", 0),
+ db_get_dw(0, "CList", "Height", 0),
SWP_NOZORDER);
Docking_Command(msg->hwnd, ABM_REMOVE);
}
diff --git a/src/mir_app/src/ExtraIconGroup.cpp b/src/mir_app/src/ExtraIconGroup.cpp index 78b648c127..70247ba823 100644 --- a/src/mir_app/src/ExtraIconGroup.cpp +++ b/src/mir_app/src/ExtraIconGroup.cpp @@ -56,7 +56,7 @@ void ExtraIconGroup::rebuildIcons() void ExtraIconGroup::applyIcon(MCONTACT hContact)
{
- if (!isEnabled() || hContact == NULL)
+ if (!isEnabled() || hContact == 0)
return;
m_setValidExtraIcon = false;
@@ -94,19 +94,19 @@ ExtraIcon * ExtraIconGroup::getCurrentItem(MCONTACT hContact) const {
int id = (int)db_get_dw(hContact, MODULE_NAME, m_szName, 0);
if (id < 1)
- return NULL;
+ return nullptr;
for (int i = 0; i < m_items.getCount(); i++)
if (id == m_items[i]->getID())
return m_items[i];
- return NULL;
+ return nullptr;
}
void ExtraIconGroup::onClick(MCONTACT hContact)
{
ExtraIcon *extra = getCurrentItem(hContact);
- if (extra != NULL)
+ if (extra != nullptr)
extra->onClick(hContact);
}
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index fd23c9942d..0fbcd62c58 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -95,7 +95,7 @@ int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT * l DrawTextWithEffectParam params;
static BYTE bIfServiceExists = ServiceExists(MS_DRAW_TEXT_WITH_EFFECT) ? 1 : 0;
- if (pEffect == NULL || pEffect->effectIndex == 0)
+ if (pEffect == nullptr || pEffect->effectIndex == 0)
return DrawText(hdc, lpchText, cchText, lprc, dwDTFormat); // If no effect specified draw by GDI it just more careful with ClearType
if (bIfServiceExists == 0)
@@ -134,7 +134,7 @@ static void WriteLine(FILE *out, const char pszText[]) static BOOL ExportSettings(HWND hwndDlg, const wchar_t *filename, OBJLIST<FontInternal>& flist, OBJLIST<ColourInternal>& clist, OBJLIST<EffectInternal>& elist)
{
FILE *out = _wfopen(filename, L"w");
- if (out == NULL) {
+ if (out == nullptr) {
MessageBox(hwndDlg, filename, TranslateT("Failed to create file"), MB_ICONWARNING | MB_OK);
return FALSE;
}
@@ -229,7 +229,7 @@ UINT_PTR CALLBACK CFHookProc(HWND hdlg, UINT uiMsg, WPARAM, LPARAM lParam) {
if (uiMsg == WM_INITDIALOG) {
CHOOSEFONT* cf = (CHOOSEFONT *)lParam;
- if (cf != NULL) {
+ if (cf != nullptr) {
if (cf->lCustData & FIDF_DISABLESTYLES) {
EnableWindow(GetDlgItem(hdlg, 1137), FALSE);
ShowWindow(GetDlgItem(hdlg, 1137), SW_HIDE);
@@ -318,7 +318,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wc tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
- return NULL;
+ return nullptr;
}
static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupName, int _hLang)
@@ -327,7 +327,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam wchar_t* sectionName;
int sectionLevel = 0;
- HTREEITEM hSection = NULL;
+ HTREEITEM hSection = nullptr;
mir_wstrcpy(itemName, groupName);
sectionName = itemName;
@@ -347,7 +347,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam if (!hItem) {
TVINSERTSTRUCT tvis = { 0 };
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
- treeItem->groupName = sectionName ? NULL : mir_wstrdup(groupName);
+ treeItem->groupName = sectionName ? nullptr : mir_wstrdup(groupName);
treeItem->paramName = mir_u2a(itemName);
tvis.hParent = hSection;
@@ -361,7 +361,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam memset(&tvis.item, 0, sizeof(tvis.item));
tvis.item.hItem = hItem;
tvis.item.mask = TVIF_HANDLE | TVIF_STATE;
- tvis.item.state = tvis.item.stateMask = db_get_b(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED);
+ tvis.item.state = tvis.item.stateMask = db_get_b(0, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED);
TreeView_SetItem(hwndTree, &tvis.item);
}
}
@@ -383,7 +383,7 @@ static void sttSaveCollapseState(HWND hwndTree) TVITEM tvi;
hti = TreeView_GetRoot(hwndTree);
- while (hti != NULL) {
+ while (hti != nullptr) {
HTREEITEM ht;
TreeItem *treeItem;
@@ -395,17 +395,17 @@ static void sttSaveCollapseState(HWND hwndTree) if (tvi.cChildren > 0) {
treeItem = (TreeItem *)tvi.lParam;
if (tvi.state & TVIS_EXPANDED)
- db_set_b(NULL, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED);
+ db_set_b(0, "FontServiceUI", treeItem->paramName, TVIS_EXPANDED);
else
- db_set_b(NULL, "FontServiceUI", treeItem->paramName, 0);
+ db_set_b(0, "FontServiceUI", treeItem->paramName, 0);
}
ht = TreeView_GetChild(hwndTree, hti);
- if (ht == NULL) {
+ if (ht == nullptr) {
ht = TreeView_GetNextSibling(hwndTree, hti);
- while (ht == NULL) {
+ while (ht == nullptr) {
hti = TreeView_GetParent(hwndTree, hti);
- if (hti == NULL) break;
+ if (hti == nullptr) break;
ht = TreeView_GetNextSibling(hwndTree, hti);
}
}
@@ -440,7 +440,7 @@ wchar_t* ModernEffectNames[] = { LPGENW("<none>"), LPGENW("Shadow at left"), LPG static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static FONTEFFECT * pEffect = NULL;
+ static FONTEFFECT * pEffect = nullptr;
switch (uMsg) {
case WM_INITDIALOG:
@@ -489,7 +489,7 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar }
break;
case WM_DESTROY:
- pEffect = NULL;
+ pEffect = nullptr;
return TRUE;
}
return FALSE;
@@ -505,10 +505,10 @@ static void sttSaveFontData(HWND hwndDlg, FontInternal &F) else
strncpy_s(str, F.prefix, _TRUNCATE);
- if (db_set_ws(NULL, F.dbSettingsGroup, str, F.value.szFace)) {
+ if (db_set_ws(0, F.dbSettingsGroup, str, F.value.szFace)) {
char buff[1024];
WideCharToMultiByte(code_page, 0, F.value.szFace, -1, buff, 1024, 0, 0);
- db_set_s(NULL, F.dbSettingsGroup, str, buff);
+ db_set_s(0, F.dbSettingsGroup, str, buff);
}
mir_snprintf(str, "%sSize", F.prefix);
@@ -523,27 +523,27 @@ static void sttSaveFontData(HWND hwndDlg, FontInternal &F) SelectObject(hdc, hOldFont);
DeleteObject(hFont);
- db_set_b(NULL, F.dbSettingsGroup, str, (char)size.cy);
+ db_set_b(0, F.dbSettingsGroup, str, (char)size.cy);
}
else if (F.flags & FIDF_SAVEPOINTSIZE) {
HDC hdc = GetDC(hwndDlg);
- db_set_b(NULL, F.dbSettingsGroup, str, (BYTE)-MulDiv(F.value.size, 72, GetDeviceCaps(hdc, LOGPIXELSY)));
+ db_set_b(0, F.dbSettingsGroup, str, (BYTE)-MulDiv(F.value.size, 72, GetDeviceCaps(hdc, LOGPIXELSY)));
ReleaseDC(hwndDlg, hdc);
}
- else db_set_b(NULL, F.dbSettingsGroup, str, F.value.size);
+ else db_set_b(0, F.dbSettingsGroup, str, F.value.size);
mir_snprintf(str, "%sSty", F.prefix);
- db_set_b(NULL, F.dbSettingsGroup, str, F.value.style);
+ db_set_b(0, F.dbSettingsGroup, str, F.value.style);
mir_snprintf(str, "%sSet", F.prefix);
- db_set_b(NULL, F.dbSettingsGroup, str, F.value.charset);
+ db_set_b(0, F.dbSettingsGroup, str, F.value.charset);
mir_snprintf(str, "%sCol", F.prefix);
- db_set_dw(NULL, F.dbSettingsGroup, str, F.value.colour);
+ db_set_dw(0, F.dbSettingsGroup, str, F.value.colour);
if (F.flags & FIDF_NOAS) {
mir_snprintf(str, "%sAs", F.prefix);
- db_set_w(NULL, F.dbSettingsGroup, str, (WORD)0x00FF);
+ db_set_w(0, F.dbSettingsGroup, str, (WORD)0x00FF);
}
mir_snprintf(str, "%sFlags", F.prefix);
- db_set_w(NULL, F.dbSettingsGroup, str, (WORD)F.flags);
+ db_set_w(0, F.dbSettingsGroup, str, (WORD)F.flags);
}
static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -687,9 +687,9 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (!itemData)
return FALSE;
- HFONT hFont = NULL, hoFont = NULL;
+ HFONT hFont = nullptr, hoFont = nullptr;
BOOL bIsFont = FALSE;
- wchar_t *itemName = NULL;
+ wchar_t *itemName = nullptr;
if (itemData->font_id >= 0) {
int iItem = itemData->font_id;
bIsFont = TRUE;
@@ -724,14 +724,14 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, FONTEFFECT Effect;
{
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
- HFONT hFont = NULL, hoFont = NULL;
+ HFONT hFont = nullptr, hoFont = nullptr;
COLORREF clBack = (COLORREF)-1;
COLORREF clText = GetSysColor(COLOR_WINDOWTEXT);
BOOL bIsFont = FALSE;
- wchar_t *itemName = NULL;
+ wchar_t *itemName = nullptr;
FSUIListItemData *itemData = (FSUIListItemData *)dis->itemData;
- FONTEFFECT * pEffect = NULL;
+ FONTEFFECT * pEffect = nullptr;
if (dis->CtlID != IDC_FONTLIST)
break;
@@ -824,7 +824,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (dis->itemState & ODS_SELECTED) {
SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- pEffect = NULL; // Do not draw effect on selected item name text
+ pEffect = nullptr; // Do not draw effect on selected item name text
}
rc = dis->rcItem;
rc.left += FSUI_FONTLEFT;
@@ -969,7 +969,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM)& mis);
SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight);
}
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), nullptr, TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
@@ -995,7 +995,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, EffectInternal& E1 = effect_id_list_w2[itemData->effect_id];
E1.value = es;
}
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), nullptr, TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
@@ -1014,7 +1014,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, font_id_list_w2[itemData->font_id].value.colour = SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_GETCOLOUR, 0, 0);
}
mir_free(selItems);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), nullptr, FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE);
}
break;
@@ -1034,7 +1034,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, }
}
mir_free(selItems);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), nullptr, FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE);
}
break;
@@ -1066,7 +1066,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, }
mir_free(selItems);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), nullptr, TRUE);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FONTLIST, LBN_SELCHANGE), 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE);
}
@@ -1130,20 +1130,20 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, ColourInternal& C = colour_id_list_w2[i];
strncpy_s(str, C.setting, _TRUNCATE);
- db_set_dw(NULL, C.dbSettingsGroup, str, C.value);
+ db_set_dw(0, C.dbSettingsGroup, str, C.value);
}
for (int i = 0; i < effect_id_list_w2.getCount(); i++) {
EffectInternal& E = effect_id_list_w2[i];
mir_snprintf(str, "%sEffect", E.setting);
- db_set_b(NULL, E.dbSettingsGroup, str, E.value.effectIndex);
+ db_set_b(0, E.dbSettingsGroup, str, E.value.effectIndex);
mir_snprintf(str, "%sEffectCol1", E.setting);
- db_set_dw(NULL, E.dbSettingsGroup, str, E.value.baseColour);
+ db_set_dw(0, E.dbSettingsGroup, str, E.value.baseColour);
mir_snprintf(str, "%sEffectCol2", E.setting);
- db_set_dw(NULL, E.dbSettingsGroup, str, E.value.secondaryColour);
+ db_set_dw(0, E.dbSettingsGroup, str, E.value.secondaryColour);
}
OptionsChanged();
@@ -1249,7 +1249,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar if (!pf)
break;
- HFONT hFont = NULL, hoFont = NULL;
+ HFONT hFont = nullptr, hoFont = nullptr;
CreateFromFontSettings(&pf->value, &lf);
hFont = CreateFontIndirect(&lf);
hoFont = (HFONT)SelectObject(dis->hDC, hFont);
@@ -1268,7 +1268,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_CHOOSEFONTGENERAL:
case IDC_CHOOSEFONTSMALL:
{
- FontInternal *pf = NULL;
+ FontInternal *pf = nullptr;
switch (LOWORD(wParam)) {
case IDC_CHOOSEFONTHEADER:
pf = &fntHeader;
@@ -1300,9 +1300,9 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar pf->value.charset = lf.lfCharSet;
wcsncpy_s(pf->value.szFace, lf.lfFaceName, _TRUNCATE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWHEADER), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWGENERAL), NULL, TRUE);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWSMALL), NULL, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWHEADER), nullptr, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWGENERAL), nullptr, TRUE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWSMALL), nullptr, TRUE);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
@@ -1367,7 +1367,7 @@ int FontsModernOptInit(WPARAM wParam, LPARAM) obj.iType = MODERNOPT_TYPE_SECTIONPAGE;
obj.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT_ACCOUNTS);
obj.pfnDlgProc = AccMgrDlgProc;
- obj.lpzClassicGroup = NULL;
+ obj.lpzClassicGroup = nullptr;
obj.lpzClassicPage = "Network";
obj.lpzHelpUrl = "http://wiki.miranda-ng.org/";
CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj);
@@ -1377,8 +1377,8 @@ int FontsModernOptInit(WPARAM wParam, LPARAM) obj.lpzTemplate = MAKEINTRESOURCEA(IDD_MODERNOPT_MODULES);
obj.pfnDlgProc = DlgPluginOpt;
obj.iBoldControls = iBoldControls;
- obj.lpzClassicGroup = NULL;
- obj.lpzClassicPage = NULL;
+ obj.lpzClassicGroup = nullptr;
+ obj.lpzClassicPage = nullptr;
obj.lpzHelpUrl = "http://wiki.miranda-ng.org/";
CallService(MS_MODERNOPT_ADDOBJECT, wParam, (LPARAM)&obj);
return 0;
diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp index f7385335dd..df8f4b11dc 100644 --- a/src/mir_app/src/FontService.cpp +++ b/src/mir_app/src/FontService.cpp @@ -142,22 +142,22 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORR strncpy_s(idstr, prefix, _TRUNCATE);
int retval = 0;
- ptrW tszGroup(db_get_wsa(NULL, settings_group, idstr));
- if (tszGroup != NULL)
+ ptrW tszGroup(db_get_wsa(0, settings_group, idstr));
+ if (tszGroup != nullptr)
wcsncpy_s(lf->lfFaceName, tszGroup, _TRUNCATE);
else
retval = 1;
if (colour) {
mir_snprintf(idstr, "%sCol", prefix);
- *colour = db_get_dw(NULL, settings_group, idstr, *colour);
+ *colour = db_get_dw(0, settings_group, idstr, *colour);
}
mir_snprintf(idstr, "%sSize", prefix);
- lf->lfHeight = (char)db_get_b(NULL, settings_group, idstr, lf->lfHeight);
+ lf->lfHeight = (char)db_get_b(0, settings_group, idstr, lf->lfHeight);
mir_snprintf(idstr, "%sSty", prefix);
- BYTE style = (BYTE)db_get_b(NULL, settings_group, idstr,
+ BYTE style = (BYTE)db_get_b(0, settings_group, idstr,
(lf->lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD) | (lf->lfItalic ? DBFONTF_ITALIC : 0) | (lf->lfUnderline ? DBFONTF_UNDERLINE : 0) | lf->lfStrikeOut ? DBFONTF_STRIKEOUT : 0);
lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0;
@@ -167,7 +167,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORR lf->lfStrikeOut = (style & DBFONTF_STRIKEOUT) != 0;
mir_snprintf(idstr, "%sSet", prefix);
- lf->lfCharSet = db_get_b(NULL, settings_group, idstr, lf->lfCharSet);
+ lf->lfCharSet = db_get_b(0, settings_group, idstr, lf->lfCharSet);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
@@ -339,7 +339,7 @@ MIR_APP_DLL(void) KillModuleFonts(int _hLang) void UpdateColourSettings(ColourIDW *colour_id, COLORREF *colour)
{
- *colour = (COLORREF)db_get_dw(NULL, colour_id->dbSettingsGroup, colour_id->setting, colour_id->defcolour);
+ *colour = (COLORREF)db_get_dw(0, colour_id->dbSettingsGroup, colour_id->setting, colour_id->defcolour);
}
static INT_PTR sttRegisterColourWorker(ColourIDW *colour_id, int _hLang)
@@ -382,7 +382,7 @@ static INT_PTR sttGetColourWorker(const wchar_t *wszGroup, const wchar_t *wszNam for (int i = 0; i < colour_id_list.getCount(); i++) {
ColourInternal& C = colour_id_list[i];
if (!mir_wstrcmp(C.group, wszGroup) && !mir_wstrcmp(C.name, wszName))
- return db_get_dw(NULL, C.dbSettingsGroup, C.setting, C.defcolour);
+ return db_get_dw(0, C.dbSettingsGroup, C.setting, C.defcolour);
}
return -1;
@@ -420,13 +420,13 @@ void UpdateEffectSettings(EffectIDW *effect_id, FONTEFFECT *effectsettings) {
char str[256];
mir_snprintf(str, "%sEffect", effect_id->setting);
- effectsettings->effectIndex = db_get_b(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.effectIndex);
+ effectsettings->effectIndex = db_get_b(0, effect_id->dbSettingsGroup, str, effect_id->defeffect.effectIndex);
mir_snprintf(str, "%sEffectCol1", effect_id->setting);
- effectsettings->baseColour = db_get_dw(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.baseColour);
+ effectsettings->baseColour = db_get_dw(0, effect_id->dbSettingsGroup, str, effect_id->defeffect.baseColour);
mir_snprintf(str, "%sEffectCol2", effect_id->setting);
- effectsettings->secondaryColour = db_get_dw(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.secondaryColour);
+ effectsettings->secondaryColour = db_get_dw(0, effect_id->dbSettingsGroup, str, effect_id->defeffect.secondaryColour);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/IcolibExtraIcon.cpp b/src/mir_app/src/IcolibExtraIcon.cpp index 5f34b979c7..399e19369e 100644 --- a/src/mir_app/src/IcolibExtraIcon.cpp +++ b/src/mir_app/src/IcolibExtraIcon.cpp @@ -48,7 +48,7 @@ void IcolibExtraIcon::rebuildIcons() void IcolibExtraIcon::applyIcon(MCONTACT hContact)
{
- if (!isEnabled() || hContact == NULL)
+ if (!isEnabled() || hContact == 0)
return;
HANDLE hImage = INVALID_HANDLE_VALUE;
@@ -62,11 +62,11 @@ void IcolibExtraIcon::applyIcon(MCONTACT hContact) int IcolibExtraIcon::setIcon(int id, MCONTACT hContact, HANDLE hIcoLib)
{
- if (hContact == NULL || id != m_id)
+ if (hContact == 0 || id != m_id)
return -1;
if (hIcoLib == INVALID_HANDLE_VALUE)
- hIcoLib = NULL;
+ hIcoLib = nullptr;
if (isEnabled()) {
ptrA szIconName(db_get_sa(hContact, MODULE_NAME, m_szName));
@@ -75,22 +75,22 @@ int IcolibExtraIcon::setIcon(int id, MCONTACT hContact, HANDLE hIcoLib) }
IcolibItem *p = (IcolibItem*)hIcoLib;
- char *szName = (p) ? p->name : NULL;
+ char *szName = (p) ? p->name : nullptr;
storeIcon(hContact, szName);
if (isEnabled())
- return ClistSetExtraIcon(hContact, (hIcoLib == NULL) ? INVALID_HANDLE_VALUE : AddIcon(szName));
+ return ClistSetExtraIcon(hContact, (hIcoLib == nullptr) ? INVALID_HANDLE_VALUE : AddIcon(szName));
return 0;
}
int IcolibExtraIcon::setIconByName(int id, MCONTACT hContact, const char *icon)
{
- if (hContact == NULL || id != m_id)
+ if (hContact == 0 || id != m_id)
return -1;
if (icon == INVALID_HANDLE_VALUE)
- icon = NULL;
+ icon = nullptr;
if (isEnabled()) {
ptrA szIconName(db_get_sa(hContact, MODULE_NAME, m_szName));
@@ -108,7 +108,7 @@ int IcolibExtraIcon::setIconByName(int id, MCONTACT hContact, const char *icon) void IcolibExtraIcon::storeIcon(MCONTACT hContact, void *icon)
{
- if (hContact == NULL)
+ if (hContact == 0)
return;
const char *icolibName = (const char *)icon;
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 7fac8f56a3..8b8de3c564 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -77,7 +77,7 @@ public: }
MCONTACT hContact;
- wchar_t *szName = NULL, *tmpStr = NULL;
+ wchar_t *szName = nullptr, *tmpStr = nullptr;
if (m_acs.handleType == HANDLE_CONTACT)
szName = cli.pfnGetContactDisplayName(hContact = m_acs.hContact, 0);
else {
@@ -101,7 +101,7 @@ public: szName = mir_a2u(szUin);
else {
szName = sttDecodeString(m_acs.psr->flags, m_acs.psr->id);
- if (szName == NULL)
+ if (szName == nullptr)
szName = sttDecodeString(m_acs.psr->flags, m_acs.psr->nick);
}
}
@@ -114,13 +114,13 @@ public: mir_free(tmpStr);
if (m_acs.handleType == HANDLE_CONTACT && m_acs.hContact)
- if (m_acs.szProto == NULL || (m_acs.szProto != NULL && *m_acs.szProto == 0))
+ if (m_acs.szProto == nullptr || (m_acs.szProto != nullptr && *m_acs.szProto == 0))
m_acs.szProto = GetContactProto(m_acs.hContact);
int groupSel = 0;
ptrW tszGroup(db_get_wsa(hContact, "CList", "Group"));
wchar_t *grpName;
- for (int groupId = 1; (grpName = Clist_GroupGetName(groupId, NULL)) != NULL; groupId++) {
+ for (int groupId = 1; (grpName = Clist_GroupGetName(groupId, nullptr)) != nullptr; groupId++) {
int id = m_group.AddString(grpName, groupId);
if (!mir_wstrcmpi(tszGroup, grpName))
groupSel = id;
@@ -134,10 +134,10 @@ public: m_chkAuth.SetState(true);
// Set last choice
- if (db_get_b(NULL, "Miranda", "AuthOpenWindow", 1))
+ if (db_get_b(0, "Miranda", "AuthOpenWindow", 1))
m_chkOpen.SetState(true);
- DWORD flags = (m_acs.szProto) ? CallProtoServiceInt(NULL, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0;
+ DWORD flags = (m_acs.szProto) ? CallProtoServiceInt(0, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0;
if (flags & PF4_FORCEADDED) // force you were added requests for this protocol
m_chkAdded.Enable(false);
@@ -159,7 +159,7 @@ public: void OnAuthClicked(CCtrlButton*)
{
- DWORD flags = CallProtoServiceInt(NULL, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ DWORD flags = CallProtoServiceInt(0, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (flags & PF4_NOCUSTOMAUTH)
m_authReq.Enable(false);
else
@@ -169,7 +169,7 @@ public: void OnOpenClicked(CCtrlButton*)
{
// Remember this choice
- db_set_b(NULL, "Miranda", "AuthOpenWindow", m_chkOpen.Enabled());
+ db_set_b(0, "Miranda", "AuthOpenWindow", m_chkOpen.Enabled());
}
void OnOk(CCtrlButton*)
@@ -180,12 +180,12 @@ public: {
DBEVENTINFO dbei = {};
db_event_get(m_acs.hDbEvent, &dbei);
- hContact = (MCONTACT)CallProtoServiceInt(NULL, dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)m_acs.hDbEvent);
+ hContact = (MCONTACT)CallProtoServiceInt(0, dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)m_acs.hDbEvent);
}
break;
case HANDLE_SEARCHRESULT:
- hContact = (MCONTACT)CallProtoServiceInt(NULL, m_acs.szProto, PS_ADDTOLIST, 0, (LPARAM)m_acs.psr);
+ hContact = (MCONTACT)CallProtoServiceInt(0, m_acs.szProto, PS_ADDTOLIST, 0, (LPARAM)m_acs.psr);
break;
case HANDLE_CONTACT:
@@ -193,7 +193,7 @@ public: break;
}
- if (hContact == NULL)
+ if (hContact == 0)
return;
ptrW szHandle(m_myHandle.GetText());
@@ -210,7 +210,7 @@ public: ProtoChainSend(hContact, PSS_ADDED, 0, 0);
if (m_chkAuth.GetState()) {
- DWORD flags = CallProtoServiceInt(NULL, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ DWORD flags = CallProtoServiceInt(0, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (flags & PF4_NOCUSTOMAUTH)
ProtoChainSend(hContact, PSS_AUTHREQUEST, 0, 0);
else
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp index 18717ecb63..6b85cefe98 100644 --- a/src/mir_app/src/button.cpp +++ b/src/mir_app/src/button.cpp @@ -47,11 +47,11 @@ static void DestroyTheme(MButtonCtrl *ctl) {
if (ctl->hThemeButton) {
CloseThemeData(ctl->hThemeButton);
- ctl->hThemeButton = NULL;
+ ctl->hThemeButton = nullptr;
}
if (ctl->hThemeToolbar) {
CloseThemeData(ctl->hThemeToolbar);
- ctl->hThemeToolbar = NULL;
+ ctl->hThemeToolbar = nullptr;
}
ctl->bIsThemed = false;
}
@@ -66,7 +66,7 @@ static void LoadTheme(MButtonCtrl *ctl) static void SetHwndPropInt(MButtonCtrl* bct, DWORD idObject, DWORD idChild, MSAAPROPID idProp, int val)
{
- if (bct->pAccPropServices == NULL) return;
+ if (bct->pAccPropServices == nullptr) return;
VARIANT var;
var.vt = VT_I4;
var.lVal = val;
@@ -179,7 +179,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) HIMAGELIST hImageList = ImageList_Create(g_iIconSX, g_iIconSY, ILC_MASK | ILC_COLOR32, 1, 0);
ImageList_AddIcon(hImageList, ctl->hIcon);
HICON hIconNew = ImageList_GetIcon(hImageList, 0, ILD_NORMAL);
- DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_iIconSX, g_iIconSY, DST_ICON | (IsWindowEnabled(ctl->hwnd) ? DSS_NORMAL : DSS_DISABLED));
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM) hIconNew, 0, ix, iy, g_iIconSX, g_iIconSY, DST_ICON | (IsWindowEnabled(ctl->hwnd) ? DSS_NORMAL : DSS_DISABLED));
ImageList_RemoveAll(hImageList);
ImageList_Destroy(hImageList);
DestroyIcon(hIconNew);
@@ -195,7 +195,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) ix++;
iy++;
}
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd)?DST_BITMAP:DST_BITMAP|DSS_DISABLED);
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd)?DST_BITMAP:DST_BITMAP|DSS_DISABLED);
}
else if (textLen > 0) {
// Draw the text and optinally the arrow
@@ -218,10 +218,10 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) sz.cx -= szHot.cx;
}
if (ctl->arrow)
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right-rcClient.left-5-g_iIconSX+(!ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0), (rcClient.bottom-rcClient.top)/2-g_iIconSY/2+(!ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0), g_iIconSX, g_iIconSY, IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED);
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->arrow, 0, rcClient.right-rcClient.left-5-g_iIconSX+(!ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0), (rcClient.bottom-rcClient.top)/2-g_iIconSY/2+(!ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0), g_iIconSX, g_iIconSY, IsWindowEnabled(ctl->hwnd)?DST_ICON:DST_ICON|DSS_DISABLED);
SelectObject(hdcMem, ctl->hFont);
- DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0,
+ DrawState(hdcMem, nullptr, nullptr, (LPARAM)szText, 0,
xOffset+(!ctl->hThemeButton && ctl->stateId == PBS_PRESSED?1:0),
ctl->hThemeButton ? yOffset : yOffset - (ctl->stateId == PBS_PRESSED?0:1),
sz.cx, sz.cy,
@@ -245,7 +245,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_NCCREATE:
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | BS_OWNERDRAW);
bct = (MButtonCtrl*)mir_calloc(sizeof(MButtonCtrl));
- if (bct == NULL)
+ if (bct == nullptr)
return FALSE;
bct->hwnd = hwnd;
bct->stateId = PBS_NORMAL;
@@ -254,10 +254,10 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR LoadTheme(bct);
// Annotating the Role of this object to be PushButton
- if (SUCCEEDED(CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, IID_IAccPropServices, (void**)&bct->pAccPropServices)))
+ if (SUCCEEDED(CoCreateInstance(CLSID_AccPropServices, nullptr, CLSCTX_SERVER, IID_IAccPropServices, (void**)&bct->pAccPropServices)))
SetHwndPropInt(bct, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_ROLE, ROLE_SYSTEM_PUSHBUTTON);
else
- bct->pAccPropServices = NULL;
+ bct->pAccPropServices = nullptr;
SetWindowLongPtr(hwnd, 0, (LONG_PTR)bct);
if (((CREATESTRUCT *)lParam)->lpszName)
@@ -268,7 +268,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (bct) {
if (bct->pAccPropServices) {
bct->pAccPropServices->Release();
- bct->pAccPropServices = NULL;
+ bct->pAccPropServices = nullptr;
}
if (bct->hwndToolTips) {
TOOLINFO ti = {0};
@@ -290,7 +290,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR lToolTips.remove(idx);
DestroyWindow(bct->hwndToolTips);
}
- bct->hwndToolTips = NULL;
+ bct->hwndToolTips = nullptr;
}
}
if (bct->arrow)
@@ -315,7 +315,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR }
tmp++;
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
break;
@@ -330,7 +330,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->bIsPushed = 1;
bct->stateId = PBS_PRESSED;
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
SendMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwnd), BN_CLICKED), (LPARAM)hwnd);
return 0;
@@ -348,7 +348,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->bIsPushed = true;
bct->stateId = PBS_PRESSED;
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
SendMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwnd), BN_CLICKED), (LPARAM)hwnd);
return 0;
@@ -359,7 +359,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR // themed changed, reload theme object
if (bct->bIsThemed)
LoadTheme(bct);
- InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it
+ InvalidateRect(bct->hwnd, nullptr, TRUE); // repaint it
break;
case WM_SETFONT: // remember the font so we can use it later
@@ -380,19 +380,19 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case BM_SETIMAGE:
{
- HGDIOBJ hnd = NULL;
+ HGDIOBJ hnd = nullptr;
if (bct->hIcon) hnd = bct->hIcon;
else if (bct->hBitmap) hnd = bct->hBitmap;
if (wParam == IMAGE_ICON) {
bct->hIcon = (HICON)lParam;
- bct->hBitmap = NULL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ bct->hBitmap = nullptr;
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
else if (wParam == IMAGE_BITMAP) {
bct->hBitmap = (HBITMAP)lParam;
- bct->hIcon = NULL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ bct->hIcon = nullptr;
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
return (LRESULT)hnd;
}
@@ -412,7 +412,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->bIsPushed = 0;
bct->stateId = PBS_NORMAL;
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BM_GETCHECK:
@@ -428,31 +428,31 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR else {
if (bct->arrow) {
IcoLib_ReleaseIcon(bct->arrow);
- bct->arrow = NULL;
+ bct->arrow = nullptr;
}
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BUTTONSETDEFAULT:
bct->bIsDefault = (wParam != 0);
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BUTTONSETASPUSHBTN:
bct->bIsPushBtn = (wParam != 0);
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BUTTONSETASFLATBTN:
bct->bIsFlat = (wParam != 0);
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BUTTONSETASTHEMEDBTN:
if ((bct->bIsThemed = (wParam != 0)) != 0)
bct->bIsSkinned = false;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case BUTTONADDTOOLTIP:
@@ -468,7 +468,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR else {
TTooltips *ptt = (TTooltips*)mir_alloc(sizeof(TTooltips));
ptt->ThreadId = tt.ThreadId;
- ptt->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", TTS_ALWAYSTIP, 0, 0, 0, 0, NULL, NULL, g_hInst, NULL);
+ ptt->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", TTS_ALWAYSTIP, 0, 0, 0, 0, nullptr, nullptr, g_hInst, nullptr);
lToolTips.insert(ptt);
bct->hwndToolTips = ptt->hwnd;
}
@@ -511,38 +511,38 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_SETFOCUS: // set keybord focus and redraw
bct->focus = 1;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_KILLFOCUS: // kill focus and redraw
bct->focus = 0;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_WINDOWPOSCHANGED:
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_ENABLE: // windows tells us to enable/disable
bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
break;
case WM_MOUSELEAVE: // faked by the WM_TIMER
if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
bct->stateId = PBS_NORMAL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
break;
case WM_LBUTTONDOWN:
if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
bct->stateId = PBS_PRESSED;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
if (bct->bSendOnDown) {
SendMessage( GetParent(hwnd), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwnd), BN_CLICKED), (LPARAM)hwnd);
bct->stateId = PBS_NORMAL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
}
break;
@@ -557,7 +557,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (bct->stateId == PBS_PRESSED)
showClick = 1;
bct->stateId = PBS_HOT;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
if (showClick && !bct->bSendOnDown) // Tell your daddy you got clicked.
SendMessage( GetParent(hwnd), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwnd), BN_CLICKED), (LPARAM)hwnd);
@@ -567,10 +567,10 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_MOUSEMOVE:
if (bct->stateId == PBS_NORMAL) {
bct->stateId = PBS_HOT;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ InvalidateRect(bct->hwnd, nullptr, TRUE);
}
// Call timer, used to start cheesy TrackMouseEvent faker
- SetTimer(hwnd, BUTTON_POLLID, BUTTON_POLLDELAY, NULL);
+ SetTimer(hwnd, BUTTON_POLLID, BUTTON_POLLDELAY, nullptr);
break;
case WM_TIMER: // use a timer to check if they have did a mouseout
@@ -612,7 +612,7 @@ int LoadButtonModule(void) wc.cbSize = sizeof(wc);
wc.lpszClassName = MIRANDABUTTONCLASS;
wc.lpfnWndProc = MButtonWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(MButtonCtrl*);
wc.hbrBackground = 0;
wc.style = CS_GLOBALCLASS;
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index 70a126dbe8..c197c92f33 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *pszDisplayName, int iType)
{
wchar_t pszGroup[50]; *pszGroup = '\0';
- ptrW groupName(db_get_wsa(NULL, CHAT_MODULE, "AddToGroup"));
+ ptrW groupName(db_get_wsa(0, CHAT_MODULE, "AddToGroup"));
if (groupName)
wcsncpy_s(pszGroup, groupName, _TRUNCATE);
else
@@ -54,8 +54,8 @@ MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *p }
// here we create a new one since no one is to be found
- if ((hContact = db_add_contact()) == NULL)
- return NULL;
+ if ((hContact = db_add_contact()) == 0)
+ return 0;
Proto_AddToContact(hContact, pszModule);
if (pszGroup[0])
@@ -105,19 +105,19 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM) return 0;
char *szProto = GetContactProto(hContact);
- if (chatApi.MM_FindModule(szProto) == NULL)
+ if (chatApi.MM_FindModule(szProto) == nullptr)
return 0;
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
ptrW roomid(db_get_wsa(hContact, szProto, "ChatRoomID"));
- if (roomid == NULL)
+ if (roomid == nullptr)
return 0;
SESSION_INFO *si = SM_FindSession(roomid, szProto);
if (si) {
// is the "toggle visibility option set, so we need to close the window?
- if (si->pDlg != NULL && db_get_b(NULL, CHAT_MODULE, "ToggleVisibility", 0) == 1 && !cli.pfnGetEvent(hContact, 0) && IsWindowVisible(si->pDlg->GetHwnd()) && !IsIconic(si->pDlg->GetHwnd())) {
+ if (si->pDlg != nullptr && db_get_b(0, CHAT_MODULE, "ToggleVisibility", 0) == 1 && !cli.pfnGetEvent(hContact, 0) && IsWindowVisible(si->pDlg->GetHwnd()) && !IsIconic(si->pDlg->GetHwnd())) {
PostMessage(si->pDlg->GetHwnd(), GC_CLOSEWINDOW, 0, 0);
return 1;
}
@@ -230,7 +230,7 @@ MCONTACT FindRoom(const char *pszModule, const wchar_t *pszRoom) continue;
ptrW roomid(db_get_wsa(hContact, pszModule, "ChatRoomID"));
- if (roomid != NULL && !mir_wstrcmpi(roomid, pszRoom))
+ if (roomid != nullptr && !mir_wstrcmpi(roomid, pszRoom))
return hContact;
}
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 59e7bb27cc..2fa68a3f90 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -319,9 +319,9 @@ LRESULT SM_SendMessage(const wchar_t *pszID, const char *pszModule, UINT msg, WP continue;
if (si->pDlg) {
- LRESULT i = SendMessage(si->pDlg->GetHwnd(), msg, wParam, lParam);
+ LRESULT res = SendMessage(si->pDlg->GetHwnd(), msg, wParam, lParam);
if (pszID)
- return i;
+ return res;
}
if (pszID)
return 0;
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index 782a34b82c..ecbbdd5699 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -71,8 +71,8 @@ static FontOptionsList fontOptionsList[] = static void LoadColors()
{
- g_Settings->crUserListBGColor = db_get_dw(NULL, CHAT_MODULE, "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
- g_Settings->crUserListSelectedBGColor = db_get_dw(NULL, CHAT_MODULE, "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
+ g_Settings->crUserListBGColor = db_get_dw(0, CHAT_MODULE, "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crUserListSelectedBGColor = db_get_dw(0, CHAT_MODULE, "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
}
void LoadLogFonts(void)
@@ -81,11 +81,11 @@ void LoadLogFonts(void) LoadMsgDlgFont(i, &chatApi.aFonts[i].lf, &chatApi.aFonts[i].color);
LoadColors();
- if (chatApi.hListBkgBrush != NULL)
+ if (chatApi.hListBkgBrush != nullptr)
DeleteObject(chatApi.hListBkgBrush);
chatApi.hListBkgBrush = CreateSolidBrush(g_Settings->crUserListBGColor);
- if (chatApi.hListSelectedBkgBrush != NULL)
+ if (chatApi.hListSelectedBkgBrush != nullptr)
DeleteObject(chatApi.hListSelectedBkgBrush);
chatApi.hListSelectedBkgBrush = CreateSolidBrush(g_Settings->crUserListSelectedBGColor);
}
@@ -98,30 +98,30 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) if (colour) {
mir_snprintf(str, "Font%dCol", i);
- *colour = db_get_dw(NULL, CHATFONT_MODULE, str, FO.defColour);
+ *colour = db_get_dw(0, CHATFONT_MODULE, str, FO.defColour);
}
if (lf) {
mir_snprintf(str, "Font%dSize", i);
- lf->lfHeight = (char)db_get_b(NULL, CHATFONT_MODULE, str, FO.defSize);
+ lf->lfHeight = (char)db_get_b(0, CHATFONT_MODULE, str, FO.defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, "Font%dSty", i);
- style = db_get_b(NULL, CHATFONT_MODULE, str, FO.defStyle);
+ style = db_get_b(0, CHATFONT_MODULE, str, FO.defStyle);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = 0;
lf->lfStrikeOut = 0;
mir_snprintf(str, "Font%dSet", i);
- lf->lfCharSet = db_get_b(NULL, CHATFONT_MODULE, str, FO.defCharset);
+ lf->lfCharSet = db_get_b(0, CHATFONT_MODULE, str, FO.defCharset);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "Font%d", i);
- ptrW tszFace(db_get_wsa(NULL, CHATFONT_MODULE, str));
- if (tszFace == NULL)
+ ptrW tszFace(db_get_wsa(0, CHATFONT_MODULE, str));
+ if (tszFace == nullptr)
mir_wstrcpy(lf->lfFaceName, FO.szDefFace);
else
wcsncpy_s(lf->lfFaceName, tszFace, _TRUNCATE);
@@ -192,7 +192,7 @@ HICON LoadIconEx(char* pszIcoLibName, bool big) static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefault)
{
DBVARIANT dbv;
- if (!db_get_ws(NULL, CHAT_MODULE, pszSetting, &dbv)) {
+ if (!db_get_ws(0, CHAT_MODULE, pszSetting, &dbv)) {
replaceStrW(*ppPointer, dbv.ptszVal);
db_free(&dbv);
}
@@ -204,33 +204,33 @@ static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefau void LoadGlobalSettings(void)
{
g_Settings->LogIconSize = 10;
- g_Settings->bLogLimitNames = db_get_b(NULL, CHAT_MODULE, "LogLimitNames", 1) != 0;
- g_Settings->bShowTime = db_get_b(NULL, CHAT_MODULE, "ShowTimeStamp", 1) != 0;
- g_Settings->bSoundsFocus = db_get_b(NULL, CHAT_MODULE, "SoundsFocus", 0) != 0;
- g_Settings->bShowTimeIfChanged = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTimeStampIfChanged", 0) != 0;
- g_Settings->bTimeStampEventColour = (BOOL)db_get_b(NULL, CHAT_MODULE, "TimeStampEventColour", 0) != 0;
- g_Settings->iEventLimit = db_get_w(NULL, CHAT_MODULE, "LogLimit", 100);
- g_Settings->dwIconFlags = db_get_dw(NULL, CHAT_MODULE, "IconFlags", 0x0000);
- g_Settings->dwTrayIconFlags = db_get_dw(NULL, CHAT_MODULE, "TrayIconFlags", 0x1000);
- g_Settings->dwPopupFlags = db_get_dw(NULL, CHAT_MODULE, "PopupFlags", 0x0000);
- g_Settings->LoggingLimit = db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100);
- g_Settings->bLoggingEnabled = (BOOL)db_get_b(NULL, CHAT_MODULE, "LoggingEnabled", 0) != 0;
- g_Settings->bFlashWindow = (BOOL)db_get_b(NULL, CHAT_MODULE, "FlashWindow", 0) != 0;
- g_Settings->bFlashWindowHighlight = (BOOL)db_get_b(NULL, CHAT_MODULE, "FlashWindowHighlight", false) != 0;
- g_Settings->bHighlightEnabled = (BOOL)db_get_b(NULL, CHAT_MODULE, "HighlightEnabled", 1) != 0;
- g_Settings->crLogBackground = db_get_dw(NULL, CHAT_MODULE, "ColorLogBG", GetSysColor(COLOR_WINDOW));
- g_Settings->crUserListColor = db_get_dw(NULL, CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0));
- g_Settings->crUserListHeadingsColor = db_get_dw(NULL, CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170));
- g_Settings->bStripFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "StripFormatting", 0) != 0;
- g_Settings->bTrayIconInactiveOnly = (BOOL)db_get_b(NULL, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0;
- g_Settings->bPopupInactiveOnly = (BOOL)db_get_b(NULL, CHAT_MODULE, "PopupInactiveOnly", 1) != 0;
- g_Settings->bAddColonToAutoComplete = (BOOL)db_get_b(NULL, CHAT_MODULE, "AddColonToAutoComplete", 1) != 0;
- g_Settings->iPopupStyle = db_get_b(NULL, CHAT_MODULE, "PopupStyle", 1);
- g_Settings->iPopupTimeout = db_get_w(NULL, CHAT_MODULE, "PopupTimeout", 3);
- g_Settings->crPUBkgColour = db_get_dw(NULL, CHAT_MODULE, "PopupColorBG", GetSysColor(COLOR_WINDOW));
- g_Settings->crPUTextColour = db_get_dw(NULL, CHAT_MODULE, "PopupColorText", 0);
- g_Settings->bShowContactStatus = db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0) != 0;
- g_Settings->bContactStatusFirst = db_get_b(NULL, CHAT_MODULE, "ContactStatusFirst", 0) != 0;
+ g_Settings->bLogLimitNames = db_get_b(0, CHAT_MODULE, "LogLimitNames", 1) != 0;
+ g_Settings->bShowTime = db_get_b(0, CHAT_MODULE, "ShowTimeStamp", 1) != 0;
+ g_Settings->bSoundsFocus = db_get_b(0, CHAT_MODULE, "SoundsFocus", 0) != 0;
+ g_Settings->bShowTimeIfChanged = db_get_b(0, CHAT_MODULE, "ShowTimeStampIfChanged", 0) != 0;
+ g_Settings->bTimeStampEventColour = db_get_b(0, CHAT_MODULE, "TimeStampEventColour", 0) != 0;
+ g_Settings->iEventLimit = db_get_w(0, CHAT_MODULE, "LogLimit", 100);
+ g_Settings->dwIconFlags = db_get_dw(0, CHAT_MODULE, "IconFlags", 0x0000);
+ g_Settings->dwTrayIconFlags = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", 0x1000);
+ g_Settings->dwPopupFlags = db_get_dw(0, CHAT_MODULE, "PopupFlags", 0x0000);
+ g_Settings->LoggingLimit = db_get_w(0, CHAT_MODULE, "LoggingLimit", 100);
+ g_Settings->bLoggingEnabled = db_get_b(0, CHAT_MODULE, "LoggingEnabled", 0) != 0;
+ g_Settings->bFlashWindow = db_get_b(0, CHAT_MODULE, "FlashWindow", 0) != 0;
+ g_Settings->bFlashWindowHighlight = db_get_b(0, CHAT_MODULE, "FlashWindowHighlight", false) != 0;
+ g_Settings->bHighlightEnabled = db_get_b(0, CHAT_MODULE, "HighlightEnabled", 1) != 0;
+ g_Settings->crLogBackground = db_get_dw(0, CHAT_MODULE, "ColorLogBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crUserListColor = db_get_dw(0, CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0));
+ g_Settings->crUserListHeadingsColor = db_get_dw(0, CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170));
+ g_Settings->bStripFormat = db_get_b(0, CHAT_MODULE, "StripFormatting", 0) != 0;
+ g_Settings->bTrayIconInactiveOnly = db_get_b(0, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0;
+ g_Settings->bPopupInactiveOnly = db_get_b(0, CHAT_MODULE, "PopupInactiveOnly", 1) != 0;
+ g_Settings->bAddColonToAutoComplete = db_get_b(0, CHAT_MODULE, "AddColonToAutoComplete", 1) != 0;
+ g_Settings->iPopupStyle = db_get_b(0, CHAT_MODULE, "PopupStyle", 1);
+ g_Settings->iPopupTimeout = db_get_w(0, CHAT_MODULE, "PopupTimeout", 3);
+ g_Settings->crPUBkgColour = db_get_dw(0, CHAT_MODULE, "PopupColorBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crPUTextColour = db_get_dw(0, CHAT_MODULE, "PopupColorText", 0);
+ g_Settings->bShowContactStatus = db_get_b(0, CHAT_MODULE, "ShowContactStatus", 0) != 0;
+ g_Settings->bContactStatusFirst = db_get_b(0, CHAT_MODULE, "ContactStatusFirst", 0) != 0;
LoadColors();
@@ -244,17 +244,17 @@ void LoadGlobalSettings(void) InitSetting(&g_Settings->pszHighlightWords, "HighlightWords", L"%m");
InitSetting(&g_Settings->pszLogDir, "LogDirectory", L"%miranda_logpath%\\%proto%\\%userid%.log");
- g_Settings->bLogIndentEnabled = db_get_b(NULL, CHAT_MODULE, "LogIndentEnabled", 1) != 0;
+ g_Settings->bLogIndentEnabled = db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0;
LOGFONT lf;
if (g_Settings->UserListFont)
DeleteObject(g_Settings->UserListFont);
- LoadMsgDlgFont(18, &lf, NULL);
+ LoadMsgDlgFont(18, &lf, nullptr);
g_Settings->UserListFont = CreateFontIndirect(&lf);
if (g_Settings->UserListHeadingsFont)
DeleteObject(g_Settings->UserListHeadingsFont);
- LoadMsgDlgFont(19, &lf, NULL);
+ LoadMsgDlgFont(19, &lf, nullptr);
g_Settings->UserListHeadingsFont = CreateFontIndirect(&lf);
SetIndentSize();
@@ -262,7 +262,7 @@ void LoadGlobalSettings(void) static void FreeGlobalSettings(void)
{
- if (g_Settings == NULL)
+ if (g_Settings == nullptr)
return;
mir_free(g_Settings->pszTimeStamp);
@@ -283,9 +283,9 @@ void SetIndentSize() {
if (g_Settings->bShowTime) {
LOGFONT lf;
- LoadMsgDlgFont(0, &lf, NULL);
+ LoadMsgDlgFont(0, &lf, nullptr);
HFONT hFont = CreateFontIndirect(&lf);
- int iText = GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(NULL)), hFont, TRUE);
+ int iText = GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(nullptr)), hFont, TRUE);
DeleteObject(hFont);
g_Settings->LogTextIndent = iText * 12 / 10;
}
@@ -297,13 +297,13 @@ int GetTextPixelSize(wchar_t* pszText, HFONT hFont, BOOL bWidth) if (!pszText || !hFont)
return 0;
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);
RECT rc = { 0 };
DrawText(hdc, pszText, -1, &rc, DT_CALCRECT);
SelectObject(hdc, hOldFont);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
return bWidth ? rc.right - rc.left : rc.bottom - rc.top;
}
@@ -312,16 +312,16 @@ int OptionsInit(void) LoadLogFonts();
LOGFONT lf;
- LoadMsgDlgFont(18, &lf, NULL);
+ LoadMsgDlgFont(18, &lf, nullptr);
mir_wstrcpy(lf.lfFaceName, L"MS Shell Dlg");
lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0;
lf.lfHeight = -17;
lf.lfWeight = FW_BOLD;
g_Settings->NameFont = CreateFontIndirect(&lf);
- g_Settings->UserListFont = NULL;
- g_Settings->UserListHeadingsFont = NULL;
- g_Settings->iWidth = db_get_dw(NULL, CHAT_MODULE, "roomwidth", -1);
- g_Settings->iHeight = db_get_dw(NULL, CHAT_MODULE, "roomheight", -1);
+ g_Settings->UserListFont = nullptr;
+ g_Settings->UserListHeadingsFont = nullptr;
+ g_Settings->iWidth = db_get_dw(0, CHAT_MODULE, "roomwidth", -1);
+ g_Settings->iHeight = db_get_dw(0, CHAT_MODULE, "roomheight", -1);
SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message"));
SkinAddNewSoundEx("ChatHighlight", LPGEN("Group chats"), LPGEN("Message is highlighted"));
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 0257297ead..80016c07dd 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -40,8 +40,8 @@ wchar_t* RemoveFormatting(const wchar_t *pszWord) {
static wchar_t szTemp[10000];
- if (pszWord == NULL)
- return NULL;
+ if (pszWord == nullptr)
+ return nullptr;
wchar_t *d = szTemp;
size_t cbLen = mir_wstrlen(pszWord);
@@ -184,7 +184,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa pd.lchIcon = LoadIconEx("window", FALSE);
PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName);
- mir_snwprintf(pd.lptzContactName, L"%s - %s", (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(pd.lptzContactName, L"%s - %s", (pa == nullptr) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0));
mir_wstrncpy(pd.lptzText, TranslateW(szBuf), _countof(pd.lptzText));
pd.iSeconds = g_Settings->iPopupTimeout;
@@ -273,7 +273,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (!gce || !si || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
- BOOL bInactive = si->pDlg == NULL || GetForegroundWindow() != si->pDlg->GetHwnd();
+ BOOL bInactive = si->pDlg == nullptr || GetForegroundWindow() != si->pDlg->GetHwnd();
int iEvent = gce->pDest->iType;
@@ -383,9 +383,9 @@ void CheckColorsInModule(const char *pszModule) MODULEINFO *pMod = chatApi.MM_FindModule(pszModule);
int i = 0;
COLORREF crFG;
- COLORREF crBG = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ COLORREF crBG = (COLORREF)db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- LoadMsgDlgFont(17, NULL, &crFG);
+ LoadMsgDlgFont(17, nullptr, &crFG);
if (!pMod)
return;
@@ -408,7 +408,7 @@ const wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2) if (!s2[k + 1])
return s1 + i;
- return NULL;
+ return nullptr;
}
static wchar_t szTrimString[] = L":,.!?;\'>)";
@@ -418,7 +418,7 @@ bool IsHighlighted(SESSION_INFO *si, GCEVENT *gce) if (!g_Settings->bHighlightEnabled || !g_Settings->pszHighlightWords || !gce || !si || !si->pMe)
return FALSE;
- if (gce->ptszText == NULL)
+ if (gce->ptszText == nullptr)
return FALSE;
wchar_t *buf = RemoveFormatting(NEWWSTR_ALLOCA(gce->ptszText));
@@ -471,11 +471,11 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) mir_wstrncpy(szTime, chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
FILE *hFile = _wfopen(si->pszLogFileName, L"ab+");
- if (hFile == NULL)
+ if (hFile == nullptr)
return FALSE;
wchar_t szTemp[512], szTemp2[512];
- wchar_t* pszNick = NULL;
+ wchar_t* pszNick = nullptr;
if (bFileJustCreated)
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
if (gce->ptszNick) {
@@ -708,8 +708,8 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) rva[9].key.w = L"weekday";
rva[9].value.w = mir_wstrdup(chatApi.MakeTimeStamp(L"%A", tTime));
// end of array
- rva[10].key.w = NULL;
- rva[10].value.w = NULL;
+ rva[10].key.w = nullptr;
+ rva[10].value.w = nullptr;
wchar_t tszTemp[MAX_PATH], *ptszVarPath;
if (g_Settings->pszLogDir[mir_wstrlen(g_Settings->pszLogDir) - 1] == '\\') {
@@ -743,8 +743,8 @@ wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *parentdat)
{
static int currentHovered = -1;
- static HWND hwndToolTip = NULL;
- static HWND oldParent = NULL;
+ static HWND hwndToolTip = nullptr;
+ static HWND oldParent = nullptr;
if (hoveredItem == currentHovered)
return;
@@ -754,7 +754,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa if (oldParent != hwnd && hwndToolTip) {
SendMessage(hwndToolTip, TTM_DELTOOL, 0, 0);
DestroyWindow(hwndToolTip);
- hwndToolTip = NULL;
+ hwndToolTip = nullptr;
}
if (hoveredItem == -1) {
@@ -765,10 +765,10 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa bool bNewTip = false;
if (!hwndToolTip) {
bNewTip = true;
- hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
+ hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hwnd, NULL, g_hInst, NULL);
+ hwnd, nullptr, g_hInst, nullptr);
}
RECT clientRect;
@@ -787,7 +787,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa if (ui1) {
if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
wchar_t *p = (wchar_t*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID);
- if (p != NULL) {
+ if (p != nullptr) {
wcsncpy_s(tszBuf, p, _TRUNCATE);
mir_free(p);
}
@@ -802,7 +802,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa }
SendMessage(hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
- SendMessage(hwndToolTip, TTM_ACTIVATE, (ti.lpszText != NULL), 0);
+ SendMessage(hwndToolTip, TTM_ACTIVATE, (ti.lpszText != nullptr), 0);
SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, 400);
}
@@ -886,7 +886,7 @@ MIR_APP_DLL(void) Chat_HoverMouse(SESSION_INFO *si, HWND hwnd, LPARAM lParam, bo si->bHasToolTip = false;
}
}
- else ProcessNickListHovering(hwnd, -1, NULL);
+ else ProcessNickListHovering(hwnd, -1, nullptr);
}
}
}
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 9d8f0a394d..77cd4f3e54 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -71,7 +71,7 @@ extern bool g_bGroupsLocked; static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
- if (hContact == NULL) {
+ if (hContact == 0) {
if (!strcmp(cws->szModule, "CListGroups")) {
if (g_bGroupsLocked)
Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
@@ -99,19 +99,19 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) }
else {
char *szProto = GetContactProto(hContact);
- if (szProto != NULL) {
+ if (szProto != nullptr) {
if (!strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p"))
Clist_Broadcast(INTM_PROTOCHANGED, hContact, lParam);
// something is being written to a protocol module
if (!strcmp(szProto, cws->szModule)) {
// was a unique setting key written?
- char *id = (char *)CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR)id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting))
+ char *id = (char *)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ if ((INT_PTR)id != CALLSERVICE_NOTFOUND && id != nullptr && !strcmp(id, cws->szSetting))
Clist_Broadcast(INTM_PROTOCHANGED, hContact, lParam);
}
}
- if (szProto == NULL || strcmp(szProto, cws->szModule))
+ if (szProto == nullptr || strcmp(szProto, cws->szModule))
return 0;
if (!strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail")
|| !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN"))
@@ -137,7 +137,7 @@ static int ClcAccountsChanged(WPARAM, LPARAM) for (i = 0, cnt = 0; i < accounts.getCount(); i++) {
if (Proto_IsAccountEnabled(accounts[i])) {
cli.clcProto[cnt].szProto = accounts[i]->szModuleName;
- cli.clcProto[cnt].dwStatus = CallProtoServiceInt(NULL, accounts[i]->szModuleName, PS_GETSTATUS, 0, 0);
+ cli.clcProto[cnt].dwStatus = CallProtoServiceInt(0, accounts[i]->szModuleName, PS_GETSTATUS, 0, 0);
++cnt;
}
}
@@ -182,19 +182,19 @@ static int ClcIconsChanged(WPARAM, LPARAM) static INT_PTR SetInfoTipHoverTime(WPARAM wParam, LPARAM)
{
- db_set_w(NULL, "CLC", "InfoTipHoverTime", (WORD)wParam);
+ db_set_w(0, "CLC", "InfoTipHoverTime", (WORD)wParam);
Clist_Broadcast(INTM_SETINFOTIPHOVERTIME, wParam, 0);
return 0;
}
static INT_PTR GetInfoTipHoverTime(WPARAM, LPARAM)
{
- return db_get_w(NULL, "CLC", "InfoTipHoverTime", 750);
+ return db_get_w(0, "CLC", "InfoTipHoverTime", 750);
}
static void SortClcByTimer(HWND hwnd)
{
- SetTimer(hwnd, TIMERID_DELAYEDRESORTCLC, 200, NULL);
+ SetTimer(hwnd, TIMERID_DELAYEDRESORTCLC, 200, nullptr);
}
int LoadCLCModule(void)
@@ -229,7 +229,7 @@ void UnloadClcModule() return;
mir_free(cli.clcProto);
- WindowList_Destroy(hClcWindowList); hClcWindowList = NULL;
+ WindowList_Destroy(hClcWindowList); hClcWindowList = nullptr;
FreeDisplayNameCache();
@@ -253,9 +253,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam switch (uMsg) {
case WM_CREATE:
- WindowList_Add(hClcWindowList, hwnd, NULL);
+ WindowList_Add(hClcWindowList, hwnd, 0);
cli.pfnRegisterFileDropping(hwnd);
- if (dat == NULL) {
+ if (dat == nullptr) {
dat = new ClcData();
SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat);
}
@@ -271,12 +271,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam dat->iInsertionMark = -1;
dat->insertionMarkHitHeight = 5;
dat->iHotTrack = -1;
- dat->infoTipTimeout = db_get_w(NULL, "CLC", "InfoTipHoverTime", 750);
+ dat->infoTipTimeout = db_get_w(0, "CLC", "InfoTipHoverTime", 750);
dat->extraColumnSpacing = 20;
dat->bNeedsResort = true;
cli.pfnLoadClcOptions(hwnd, dat, TRUE);
if (!IsWindowVisible(hwnd))
- SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL);
+ SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, nullptr);
else {
cli.pfnRebuildEntireList(hwnd, dat);
NMCLISTCONTROL nm;
@@ -302,7 +302,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
case WM_THEMECHANGED:
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case WM_SIZE:
@@ -322,8 +322,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam int depth = GetDeviceCaps(hdc, BITSPIXEL);
if (depth < 16)
depth = 16;
- HBITMAP hBmp = CreateBitmap(rc.right, rc.bottom, 1, depth, NULL);
- HBITMAP hBmpMask = CreateBitmap(rc.right, rc.bottom, 1, 1, NULL);
+ HBITMAP hBmp = CreateBitmap(rc.right, rc.bottom, 1, depth, nullptr);
+ HBITMAP hBmpMask = CreateBitmap(rc.right, rc.bottom, 1, 1, nullptr);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
HBRUSH hBrush = CreateSolidBrush(dat->bUseWindowsColours ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour);
@@ -355,13 +355,13 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (msg->message == WM_KEYDOWN) {
if (msg->wParam == VK_TAB)
return 0;
- if (msg->wParam == VK_ESCAPE && dat->hwndRenameEdit == NULL && dat->szQuickSearch[0] == 0)
+ if (msg->wParam == VK_ESCAPE && dat->hwndRenameEdit == nullptr && dat->szQuickSearch[0] == 0)
return 0;
}
if (msg->message == WM_CHAR) {
if (msg->wParam == '\t')
return 0;
- if (msg->wParam == 27 && dat->hwndRenameEdit == NULL && dat->szQuickSearch[0] == 0)
+ if (msg->wParam == 27 && dat->hwndRenameEdit == nullptr && dat->szQuickSearch[0] == 0)
return 0;
}
}
@@ -372,7 +372,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam KillTimer(hwnd, TIMERID_RENAME);
case WM_SETFOCUS:
case WM_ENABLE:
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case WM_GETFONT:
@@ -385,10 +385,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam int groupId = atoi(dbcws->szSetting) + 1;
int i, eq;
//check name of group and ignore message if just being expanded/collapsed
- if (Clist_FindItem(hwnd, dat, groupId | HCONTACT_ISGROUP, &contact, &group, NULL)) {
+ if (Clist_FindItem(hwnd, dat, groupId | HCONTACT_ISGROUP, &contact, &group, nullptr)) {
CMStringW szFullName(contact->szText);
while (group->parent) {
- ClcContact *cc = NULL;
+ ClcContact *cc = nullptr;
for (i = 0; i < group->parent->cl.getCount(); i++) {
cc = group->parent->cl[i];
if (cc->group == group)
@@ -436,7 +436,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN)
break;
if (dbcws->value.type == DBVT_DELETED || dbcws->value.bVal == 0) {
- if (Clist_FindItem(hwnd, dat, wParam, NULL, NULL, NULL))
+ if (Clist_FindItem(hwnd, dat, wParam, nullptr, nullptr, nullptr))
break;
cli.pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
cli.pfnNotifyNewContact(hwnd, wParam);
@@ -452,7 +452,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam {
WORD iExtraImage[EXTRA_ICON_COUNT];
BYTE flags = 0;
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
memset(iExtraImage, 0xFF, sizeof(iExtraImage));
else {
memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
@@ -462,7 +462,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b(wParam, "CList", "Hidden", 0)) {
NMCLISTCONTROL nm;
cli.pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) {
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) {
memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
contact->flags |= CONTACTF_CHECKED;
@@ -476,17 +476,17 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam dat->bNeedsResort = true;
}
}
- SetTimer(hwnd, TIMERID_REBUILDAFTER, 1, NULL);
+ SetTimer(hwnd, TIMERID_REBUILDAFTER, 1, nullptr);
break;
case INTM_ICONCHANGED:
{
WORD status;
- MCONTACT hSelItem = NULL;
- ClcContact *selcontact = NULL;
+ MCONTACT hSelItem = 0;
+ ClcContact *selcontact = nullptr;
char *szProto = GetContactProto(wParam);
- if (szProto == NULL)
+ if (szProto == nullptr)
status = ID_STATUS_OFFLINE;
else
status = db_get_w(wParam, szProto, "Status", ID_STATUS_OFFLINE);
@@ -496,14 +496,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam int shouldShow = (style & CLS_SHOWHIDDEN || !db_get_b(wParam, "CList", "Hidden", 0))
&& (!cli.pfnIsHiddenMode(dat, status) || cli.pfnGetContactIcon(wParam) != lParam);
- contact = NULL;
- group = NULL;
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, NULL)) {
+ contact = nullptr;
+ group = nullptr;
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, nullptr)) {
if (shouldShow && db_is_contact(wParam)) {
- if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
+ if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1)
hSelItem = Clist_ContactToHItem(selcontact);
cli.pfnAddContactToTree(hwnd, dat, wParam, (style & CLS_CONTACTLIST) == 0, 0);
- Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL);
+ Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr);
if (contact) {
contact->iImage = (WORD)lParam;
cli.pfnNotifyNewContact(hwnd, wParam);
@@ -515,7 +515,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (contact->iImage == (WORD)lParam)
break;
if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
- if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
+ if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) != -1)
hSelItem = Clist_ContactToHItem(selcontact);
cli.pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0);
}
@@ -530,7 +530,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam }
if (hSelItem) {
ClcGroup *selgroup;
- if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
+ if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, nullptr))
dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
else
dat->selection = -1;
@@ -540,7 +540,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
case INTM_NAMECHANGED:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
mir_wstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), _countof(contact->szText));
@@ -549,7 +549,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
case INTM_PROTOCHANGED:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
contact->proto = GetContactProto(wParam);
@@ -559,7 +559,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
case INTM_NOTONLISTCHANGED:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
if (contact->type == CLCIT_CONTACT) {
@@ -568,18 +568,18 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam contact->flags &= ~CONTACTF_NOTONLIST;
else
contact->flags |= CONTACTF_NOTONLIST;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
break;
case INTM_INVALIDATE:
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case INTM_APPARENTMODECHANGED:
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) {
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) {
char *szProto = GetContactProto(wParam);
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
WORD apparentMode = db_get_w(wParam, szProto, "ApparentMode", 0);
@@ -590,7 +590,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam contact->flags |= CONTACTF_VISTO;
else if (apparentMode)
contact->flags |= CONTACTF_VISTO | CONTACTF_INVISTO;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
break;
@@ -599,20 +599,20 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
case INTM_IDLECHANGED:
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL)) {
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) {
char *szProto = GetContactProto(wParam);
- if (szProto == NULL)
+ if (szProto == nullptr)
break;
contact->flags &= ~CONTACTF_IDLE;
if (db_get_dw(wParam, szProto, "IdleTS", 0))
contact->flags |= CONTACTF_IDLE;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
break;
case WM_PRINTCLIENT:
- cli.pfnPaintClc(hwnd, dat, (HDC)wParam, NULL);
+ cli.pfnPaintClc(hwnd, dat, (HDC)wParam, nullptr);
break;
case WM_NCPAINT:
@@ -621,7 +621,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam HRGN hClientRgn;
ClientToScreen(hwnd, &ptTopLeft);
hClientRgn = CreateRectRgn(0, 0, 1, 1);
- CombineRgn(hClientRgn, (HRGN)wParam, NULL, RGN_COPY);
+ CombineRgn(hClientRgn, (HRGN)wParam, nullptr, RGN_COPY);
OffsetRgn(hClientRgn, -ptTopLeft.x, -ptTopLeft.y);
InvalidateRgn(hwnd, hClientRgn, FALSE);
DeleteObject(hClientRgn);
@@ -741,7 +741,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1;
if (dat->selection < 0)
dat->selection = 0;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
UpdateWindow(hwnd);
return 0;
@@ -761,7 +761,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
else if (wParam == ' ' && dat->szQuickSearch[0] == '\0' && GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CHECKBOXES) {
NMCLISTCONTROL nm;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) == -1)
+ if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
break;
if (contact->type != CLCIT_CONTACT)
break;
@@ -769,7 +769,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (contact->type == CLCIT_GROUP)
cli.pfnSetGroupChildCheckboxes(contact->group, contact->flags & CONTACTF_CHECKED);
cli.pfnRecalculateGroupCheckboxes(hwnd, dat);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
nm.hdr.code = CLN_CHECKCHANGED;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
@@ -801,11 +801,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam dat->szQuickSearch[mir_wstrlen(dat->szQuickSearch) - 1] = '\0';
cli.pfnSaveStateAndRebuildList(hwnd, dat);
}
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
}
else
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case WM_SYSKEYDOWN:
@@ -814,7 +814,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam KillTimer(hwnd, TIMERID_INFOTIP);
KillTimer(hwnd, TIMERID_RENAME);
dat->iHotTrack = -1;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
ReleaseCapture();
if (wParam == VK_F10 && GetKeyState(VK_SHIFT) & 0x8000)
break;
@@ -846,7 +846,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam it.rcItem.left = 0;
it.rcItem.right = clRect.right;
- hit = cli.pfnHitTest(hwnd, dat, it.ptCursor.x, it.ptCursor.y, &contact, NULL, NULL);
+ hit = cli.pfnHitTest(hwnd, dat, it.ptCursor.x, it.ptCursor.y, &contact, nullptr, nullptr);
if (hit == -1)
break;
if (contact->type != CLCIT_GROUP && contact->type != CLCIT_CONTACT)
@@ -870,14 +870,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case TIMERID_REBUILDAFTER:
KillTimer(hwnd, TIMERID_REBUILDAFTER);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
cli.pfnSaveStateAndRebuildList(hwnd, dat);
cli.bAutoRebuild = false;
break;
case TIMERID_DELAYEDRESORTCLC:
KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnRecalcScrollBar(hwnd, dat);
break;
@@ -921,7 +921,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (dat->selection == -1)
dat->selection = cli.pfnGetRowsPriorTo(&dat->list, contact->group, -1);
}
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
UpdateWindow(hwnd);
break;
}
@@ -932,7 +932,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (contact->type == CLCIT_GROUP)
cli.pfnSetGroupChildCheckboxes(contact->group, contact->flags & CONTACTF_CHECKED);
cli.pfnRecalculateGroupCheckboxes(hwnd, dat);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
nm.hdr.code = CLN_CHECKCHANGED;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
@@ -947,7 +947,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.flags = 0;
if (hit == -1)
- nm.hItem = NULL;
+ nm.hItem = nullptr;
else
nm.hItem = Clist_ContactToItemHandle(contact, &nm.flags);
nm.iColumn = hitFlags & CLCHT_ONITEMEXTRA ? HIBYTE(HIWORD(hitFlags)) : -1;
@@ -957,7 +957,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (hitFlags & (CLCHT_ONITEMCHECK | CLCHT_ONITEMEXTRA))
break;
dat->selection = hit;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
if (dat->selection != -1)
cli.pfnEnsureVisible(hwnd, dat, hit, 0);
UpdateWindow(hwnd);
@@ -972,11 +972,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case WM_MOUSEMOVE:
if (dat->iDragItem == -1) {
int iOldHotTrack = dat->iHotTrack;
- if (dat->hwndRenameEdit != NULL)
+ if (dat->hwndRenameEdit != nullptr)
break;
if (GetKeyState(VK_MENU) & 0x8000 || GetKeyState(VK_F10) & 0x8000)
break;
- dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, NULL);
+ dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), nullptr, nullptr, nullptr);
if (iOldHotTrack != dat->iHotTrack) {
if (iOldHotTrack == -1)
SetCapture(hwnd);
@@ -989,10 +989,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam cli.pfnHideInfoTip(hwnd, dat);
}
KillTimer(hwnd, TIMERID_INFOTIP);
- if (wParam == 0 && dat->hInfoTipItem == NULL) {
+ if (wParam == 0 && dat->hInfoTipItem == 0) {
dat->ptInfoTip.x = (short)LOWORD(lParam);
dat->ptInfoTip.y = (short)HIWORD(lParam);
- SetTimer(hwnd, TIMERID_INFOTIP, dat->infoTipTimeout, NULL);
+ SetTimer(hwnd, TIMERID_INFOTIP, dat->infoTipTimeout, nullptr);
}
break;
}
@@ -1009,15 +1009,15 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
- HCURSOR hNewCursor = LoadCursor(NULL, IDC_NO);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ HCURSOR hNewCursor = LoadCursor(nullptr, IDC_NO);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
if (dat->dragAutoScrolling) {
KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL);
dat->dragAutoScrolling = 0;
}
int target = cli.pfnGetDropTargetInformation(hwnd, dat, pt);
if (dat->dragStage & DRAGSTAGEF_OUTSIDE && target != DROPTARGET_OUTSIDE) {
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, NULL);
+ cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
NMCLISTCONTROL nm;
nm.hdr.code = CLN_DRAGSTOP;
@@ -1048,13 +1048,13 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam dat->dragAutoScrolling = -1;
else
dat->dragAutoScrolling = 1;
- SetTimer(hwnd, TIMERID_DRAGAUTOSCROLL, dat->scrollTime, NULL);
+ SetTimer(hwnd, TIMERID_DRAGAUTOSCROLL, dat->scrollTime, nullptr);
}
SendMessage(hwnd, WM_TIMER, TIMERID_DRAGAUTOSCROLL, 0);
}
dat->dragStage |= DRAGSTAGEF_OUTSIDE;
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, NULL);
+ cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
NMCLISTCONTROL nm;
nm.hdr.code = CLN_DRAGGING;
@@ -1068,7 +1068,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam break;
default:
- cli.pfnGetRowByIndex(dat, dat->iDragItem, NULL, &group);
+ cli.pfnGetRowByIndex(dat, dat->iDragItem, nullptr, &group);
if (group->parent)
hNewCursor = LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER));
break;
@@ -1083,14 +1083,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam SetCursor((HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR));
if (dat->exStyle & CLS_EX_TRACKSELECT) {
- dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, NULL);
+ dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), nullptr, nullptr, nullptr);
if (dat->iHotTrack == -1)
ReleaseCapture();
}
else ReleaseCapture();
KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL);
if (dat->dragStage == (DRAGSTAGE_NOTMOVED | DRAGSTAGEF_MAYBERENAME))
- SetTimer(hwnd, TIMERID_RENAME, GetDoubleClickTime(), NULL);
+ SetTimer(hwnd, TIMERID_RENAME, GetDoubleClickTime(), nullptr);
else if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) {
POINT pt = { LOWORD(lParam), HIWORD(lParam) };
int target = cli.pfnGetDropTargetInformation(hwnd, dat, pt);
@@ -1102,20 +1102,20 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case DROPTARGET_ONGROUP:
{
ClcContact *contactn, *contacto;
- cli.pfnGetRowByIndex(dat, dat->selection, &contactn, NULL);
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contacto, NULL);
+ cli.pfnGetRowByIndex(dat, dat->selection, &contactn, nullptr);
+ cli.pfnGetRowByIndex(dat, dat->iDragItem, &contacto, nullptr);
if (contacto->type == CLCIT_CONTACT) //dropee is a contact
Clist_ContactChangeGroup(contacto->hContact, contactn->groupId);
else if (contacto->type == CLCIT_GROUP) { //dropee is a group
wchar_t szNewName[120];
- mir_snwprintf(szNewName, L"%s\\%s", Clist_GroupGetName(contactn->groupId, NULL), contacto->szText);
+ mir_snwprintf(szNewName, L"%s\\%s", Clist_GroupGetName(contactn->groupId, nullptr), contacto->szText);
Clist_GroupRename(contacto->groupId, szNewName);
}
}
break;
case DROPTARGET_INSERTION:
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, NULL);
+ cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
{
ClcContact *destcontact;
ClcGroup *destgroup;
@@ -1129,7 +1129,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam }
break;
case DROPTARGET_OUTSIDE:
- cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, NULL);
+ cli.pfnGetRowByIndex(dat, dat->iDragItem, &contact, nullptr);
{
NMCLISTCONTROL nm;
nm.hdr.code = CLN_DROPPED;
@@ -1155,7 +1155,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam }
}
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
dat->iDragItem = -1;
dat->iInsertionMark = -1;
break;
@@ -1167,8 +1167,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam KillTimer(hwnd, TIMERID_RENAME);
KillTimer(hwnd, TIMERID_INFOTIP);
- dat->selection = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, NULL, &hitFlags);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ dat->selection = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, nullptr, &hitFlags);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
if (dat->selection != -1)
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL)))
@@ -1194,7 +1194,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam {
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (pt.x == -1 && pt.y == -1) {
- dat->selection = cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
+ dat->selection = cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr);
if (dat->selection != -1)
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
pt.x = dat->iconXSpace + 15;
@@ -1203,9 +1203,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam }
else {
ScreenToClient(hwnd, &pt);
- dat->selection = cli.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, NULL, &hitFlags);
+ dat->selection = cli.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, nullptr, &hitFlags);
}
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
if (dat->selection != -1)
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
UpdateWindow(hwnd);
@@ -1220,7 +1220,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam return 0;
ClientToScreen(hwnd, &pt);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(hMenu);
}
else //call parent for new group/hide offline menu
@@ -1235,7 +1235,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam return Menu_DrawItem(lParam);
case WM_COMMAND:
- hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
+ hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr);
if (hit == -1)
break;
@@ -1274,7 +1274,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (dat->himlHighlight) {
ImageList_Destroy(dat->himlHighlight);
- dat->himlHighlight = NULL;
+ dat->himlHighlight = nullptr;
}
if (dat->hwndRenameEdit)
DestroyWindow(dat->hwndRenameEdit);
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp index 288c0f6cd0..0f7620e6e9 100644 --- a/src/mir_app/src/clcfiledrop.cpp +++ b/src/mir_app/src/clcfiledrop.cpp @@ -42,7 +42,7 @@ struct CDropTarget : IDropTarget }
static dropTarget;
-static HWND hwndCurrentDrag = NULL;
+static HWND hwndCurrentDrag = nullptr;
static int originalSelection;
HRESULT CDropTarget::QueryInterface(REFIID riid, LPVOID * ppvObj)
@@ -52,7 +52,7 @@ HRESULT CDropTarget::QueryInterface(REFIID riid, LPVOID * ppvObj) AddRef();
return S_OK;
}
- *ppvObj = NULL;
+ *ppvObj = nullptr;
return E_NOINTERFACE;
}
@@ -74,19 +74,19 @@ static MCONTACT HContactFromPoint(HWND hwnd, ClcData *dat, int x, int y, int *hi {
DWORD hitFlags;
ClcContact *contact;
- int hit = cli.pfnHitTest(hwnd, dat, x, y, &contact, NULL, &hitFlags);
+ int hit = cli.pfnHitTest(hwnd, dat, x, y, &contact, nullptr, &hitFlags);
if (hit == -1 || !(hitFlags & (CLCHT_ONITEMLABEL | CLCHT_ONITEMICON)) || contact->type != CLCIT_CONTACT)
- return NULL;
+ return 0;
char *szProto = GetContactProto(contact->hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return 0;
- DWORD protoCaps = CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ DWORD protoCaps = CallProtoServiceInt(0,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (!(protoCaps & PF1_FILESEND))
- return NULL;
+ return 0;
if (ID_STATUS_OFFLINE == db_get_w(contact->hContact, szProto, "Status", ID_STATUS_OFFLINE))
- return NULL;
+ return 0;
if (hitLine)
*hitLine = hit;
return contact->hContact;
@@ -103,7 +103,7 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec pDropTargetHelper->DragOver((POINT*)&pt, *pdwEffect);
*pdwEffect = 0;
- if (hwndCurrentDrag == NULL) {
+ if (hwndCurrentDrag == nullptr) {
*pdwEffect = DROPEFFECT_NONE;
return S_OK;
}
@@ -119,7 +119,7 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec cli.pfnScrollTo(hwndCurrentDrag, dat, dat->yScroll + (shortPt.y < dat->dragAutoScrollHeight ? -1 : 1) * dat->rowHeight * 2, 0);
}
hContact = HContactFromPoint(hwndCurrentDrag, dat, shortPt.x, shortPt.y, &hit);
- if (hContact == NULL) {
+ if (hContact == 0) {
hit = -1;
*pdwEffect |= DROPEFFECT_NONE;
}
@@ -128,7 +128,7 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec if (dat->selection != hit) {
dat->selection = hit;
- cli.pfnInvalidateRect(hwndCurrentDrag, NULL, FALSE);
+ cli.pfnInvalidateRect(hwndCurrentDrag, nullptr, FALSE);
if (pDropTargetHelper) pDropTargetHelper->Show(FALSE);
UpdateWindow(hwndCurrentDrag);
if (pDropTargetHelper) pDropTargetHelper->Show(TRUE);
@@ -166,16 +166,16 @@ HRESULT CDropTarget::DragLeave(void) ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
dat->bShowSelAlways = false;
dat->selection = originalSelection;
- cli.pfnInvalidateRect(hwndCurrentDrag, NULL, FALSE);
+ cli.pfnInvalidateRect(hwndCurrentDrag, nullptr, FALSE);
}
- hwndCurrentDrag = NULL;
+ hwndCurrentDrag = nullptr;
return S_OK;
}
static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t *szFilename)
{
*pppFiles = (wchar_t **) mir_realloc(*pppFiles, (++*totalCount + 1) * sizeof(wchar_t *));
- (*pppFiles)[*totalCount] = NULL;
+ (*pppFiles)[*totalCount] = nullptr;
(*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename);
if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
@@ -199,7 +199,7 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t *s HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt, DWORD * pdwEffect)
{
- FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC fe = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
STGMEDIUM stg;
HDROP hDrop;
POINT shortPt;
@@ -208,7 +208,7 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt pDropTargetHelper->Drop(pDataObj, (POINT*)&pt, *pdwEffect);
*pdwEffect = DROPEFFECT_NONE;
- if (hwndCurrentDrag == NULL || S_OK != pDataObj->GetData(&fe, &stg))
+ if (hwndCurrentDrag == nullptr || S_OK != pDataObj->GetData(&fe, &stg))
return S_OK;
hDrop = (HDROP) stg.hGlobal;
ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
@@ -216,14 +216,14 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt shortPt.x = pt.x;
shortPt.y = pt.y;
ScreenToClient(hwndCurrentDrag, &shortPt);
- MCONTACT hContact = HContactFromPoint(hwndCurrentDrag, dat, shortPt.x, shortPt.y, NULL);
- if (hContact != NULL) {
- wchar_t **ppFiles = NULL;
+ MCONTACT hContact = HContactFromPoint(hwndCurrentDrag, dat, shortPt.x, shortPt.y, nullptr);
+ if (hContact != 0) {
+ wchar_t **ppFiles = nullptr;
wchar_t szFilename[MAX_PATH];
int fileCount, totalCount = 0, i;
- fileCount = DragQueryFile(hDrop, -1, NULL, 0);
- ppFiles = NULL;
+ fileCount = DragQueryFile(hDrop, -1, nullptr, 0);
+ ppFiles = nullptr;
for (i=0; i < fileCount; i++) {
DragQueryFile(hDrop, i, szFilename, _countof(szFilename));
AddToFileList(&ppFiles, &totalCount, szFilename);
@@ -250,16 +250,16 @@ static VOID CALLBACK CreateDropTargetHelperTimerProc(HWND hwnd, UINT, UINT_PTR i {
KillTimer(hwnd, idEvent);
//This is a ludicrously slow function (~200ms) so we delay load it a bit.
- if (S_OK != CoCreateInstance(CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER,
+ if (S_OK != CoCreateInstance(CLSID_DragDropHelper, nullptr, CLSCTX_INPROC_SERVER,
IID_IDropTargetHelper, (LPVOID*)&dropTarget.pDropTargetHelper))
- dropTarget.pDropTargetHelper = NULL;
+ dropTarget.pDropTargetHelper = nullptr;
}
void InitFileDropping(void)
{
// Disabled as this function loads tons of dlls for no apparenet reason
// we will se what the reaction will be
-// SetTimer(NULL, 1, 1000, CreateDropTargetHelperTimerProc);
+// SetTimer(nullptr, 1, 1000, CreateDropTargetHelperTimerProc);
}
void fnRegisterFileDropping(HWND hwnd)
diff --git a/src/mir_app/src/clcidents.cpp b/src/mir_app/src/clcidents.cpp index d4c5c89f61..3aaa8cda9f 100644 --- a/src/mir_app/src/clcidents.cpp +++ b/src/mir_app/src/clcidents.cpp @@ -49,7 +49,7 @@ int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex) group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
group->scanIndex++;
continue;
@@ -84,7 +84,7 @@ ClcContact* fnFindItem(DWORD dwItem, ClcContact *cc) if (IsHContactInfo(dwItem) && cc->type == CLCIT_INFO && cc->hContact == (dwItem & ~HCONTACT_ISINFO))
return cc;
- return NULL;
+ return nullptr;
}
MIR_APP_DLL(bool) Clist_FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible)
@@ -96,7 +96,7 @@ MIR_APP_DLL(bool) Clist_FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcConta group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
nowVisible = 1;
@@ -113,7 +113,7 @@ MIR_APP_DLL(bool) Clist_FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcConta ClcContact *cc = group->cl[group->scanIndex];
ClcContact *res = cli.pfnFindItem(dwItem, cc);
- if (res != NULL) {
+ if (res != nullptr) {
if (isVisible) {
if (!nowVisible)
*isVisible = 0;
@@ -148,8 +148,8 @@ MIR_APP_DLL(bool) Clist_FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcConta }
if (isVisible) *isVisible = FALSE;
- if (contact) *contact = NULL;
- if (subgroup) *subgroup = NULL;
+ if (contact) *contact = nullptr;
+ if (subgroup) *subgroup = nullptr;
return false;
}
@@ -164,7 +164,7 @@ int fnGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
group->scanIndex++;
continue;
@@ -199,7 +199,7 @@ MIR_APP_DLL(DWORD) Clist_ContactToHItem(ClcContact *contact) case CLCIT_INFO:
return contact->hContact | HCONTACT_ISINFO;
}
- return NULL;
+ return 0;
}
MIR_APP_DLL(HANDLE) Clist_ContactToItemHandle(ClcContact *contact, DWORD *nmFlags)
@@ -216,5 +216,5 @@ MIR_APP_DLL(HANDLE) Clist_ContactToItemHandle(ClcContact *contact, DWORD *nmFlag *nmFlags |= CLNF_ISINFO;
return (HANDLE)((UINT_PTR)contact->hContact | HCONTACT_ISINFO);
}
- return NULL;
+ return nullptr;
}
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index b1c3f16576..2137640908 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -48,8 +48,8 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags wchar_t *pNextField = NEWWSTR_ALLOCA(szName); do { wchar_t *pBackslash = wcschr(pNextField, '\\'), *pThisField = pNextField; - if (pBackslash == NULL) { - pNextField = NULL; + if (pBackslash == nullptr) { + pNextField = nullptr; } else { *pBackslash = 0; @@ -65,7 +65,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags continue; compareResult = mir_wstrcmp(pThisField, cc->szText); if (compareResult == 0) { - if (pNextField == NULL && flags != (DWORD)-1) { + if (pNextField == nullptr && flags != (DWORD)-1) { cc->groupId = (WORD)groupId; group = cc->group; group->expanded = (flags & GROUPF_EXPANDED) != 0; @@ -75,7 +75,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags else group = cc->group; break; } - if (pNextField == NULL && cc->groupId == 0) + if (pNextField == nullptr && cc->groupId == 0) break; if (!(dat->exStyle & CLS_EX_SORTGROUPSALPHA) && groupId && cc->groupId > groupId) break; @@ -83,7 +83,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags if (compareResult) { // not found if (groupId == 0) - return NULL; + return nullptr; ClcContact *cc = cli.pfnAddItemToGroup(group, i); cc->type = CLCIT_GROUP; @@ -93,7 +93,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags cc->group->parent = group; group = cc->group; - if (flags == (DWORD)-1 || pNextField != NULL) { + if (flags == (DWORD)-1 || pNextField != nullptr) { group->expanded = 0; group->hideOffline = 0; } @@ -103,7 +103,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags } group->groupId = pNextField ? 0 : groupId; group->totalMembers = 0; - if (flags != (DWORD)-1 && pNextField == NULL && calcTotalMembers) { + if (flags != (DWORD)-1 && pNextField == nullptr && calcTotalMembers) { DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); @@ -120,7 +120,7 @@ void fnFreeContact(ClcContact* p) { if (p->type == CLCIT_GROUP) { cli.pfnFreeGroup(p->group); - delete p->group; p->group = NULL; + delete p->group; p->group = nullptr; } } @@ -182,7 +182,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact char *szProto = GetContactProto(hContact); ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact); - replaceStrW(pce->tszGroup, NULL); + replaceStrW(pce->tszGroup, nullptr); ClcContact *cc = cli.pfnAddItemToGroup(group, index + 1); cc->type = CLCIT_CONTACT; @@ -190,9 +190,9 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact cc->hContact = hContact; cc->proto = szProto; cc->pce = pce; - if (szProto != NULL && !cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE))) + if (szProto != nullptr && !cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE))) cc->flags |= CONTACTF_ONLINE; - WORD apparentMode = szProto != NULL ? db_get_w(hContact, szProto, "ApparentMode", 0) : 0; + WORD apparentMode = szProto != nullptr ? db_get_w(hContact, szProto, "ApparentMode", 0) : 0; if (apparentMode == ID_STATUS_OFFLINE) cc->flags |= CONTACTF_INVISTO; else if (apparentMode == ID_STATUS_ONLINE) @@ -201,7 +201,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact cc->flags |= CONTACTF_VISTO | CONTACTF_INVISTO; if (db_get_b(hContact, "CList", "NotOnList", 0)) cc->flags |= CONTACTF_NOTONLIST; - DWORD idleMode = szProto != NULL ? db_get_dw(hContact, szProto, "IdleTS", 0) : 0; + DWORD idleMode = szProto != nullptr ? db_get_dw(hContact, szProto, "IdleTS", 0) : 0; if (idleMode) cc->flags |= CONTACTF_IDLE; mir_wstrncpy(cc->szText, cli.pfnGetContactDisplayName(hContact, 0), _countof(cc->szText)); @@ -218,25 +218,25 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo if (style & CLS_NOHIDEOFFLINE) checkHideOffline = 0; if (checkHideOffline) - if (szProto != NULL) + if (szProto != nullptr) status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); int i; DWORD groupFlags; ClcGroup *group; ptrW tszGroup(db_get_wsa(hContact, "CList", "Group")); - if (tszGroup == NULL) + if (tszGroup == nullptr) group = &dat->list; else { group = cli.pfnAddGroup(hwnd, dat, tszGroup, (DWORD)-1, 0, 0); - if (group == NULL) { + if (group == nullptr) { if (!(style & CLS_HIDEEMPTYGROUPS)) return; if (checkHideOffline && cli.pfnIsHiddenMode(dat, status)) { for (i = 1;; i++) { wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags); - if (szGroupName == NULL) + if (szGroupName == nullptr) return; if (!mir_wstrcmp(szGroupName, tszGroup)) @@ -247,7 +247,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo } for (i = 1;; i++) { wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags); - if (szGroupName == NULL) + if (szGroupName == nullptr) return; if (!mir_wstrcmp(szGroupName, tszGroup)) @@ -290,7 +290,7 @@ ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, mir_free(group->cl[iContact]); group->cl.remove(iContact); - if ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) && group->cl.getCount() == 0 && group->parent != NULL) + if ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) && group->cl.getCount() == 0 && group->parent != nullptr) for (int i = 0; i < group->parent->cl.getCount(); i++) if (group->parent->cl[i]->type == CLCIT_GROUP && group->parent->cl[i]->groupId == group->groupId) return cli.pfnRemoveItemFromGroup(hwnd, group->parent, group->parent->cl[i], 0); @@ -305,7 +305,7 @@ void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem) ClcGroup *group; ClcContact *contact; - if (!Clist_FindItem(hwnd, dat, hItem, &contact, &group, NULL)) { + if (!Clist_FindItem(hwnd, dat, hItem, &contact, &group, nullptr)) { DBVARIANT dbv; int i, nameOffset; if (!IsHContactContact(hItem)) @@ -346,7 +346,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); dat->list.expanded = 1; - dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", 0) && (style & CLS_USEGROUPS); + dat->list.hideOffline = db_get_b(0, "CLC", "HideOfflineRoot", 0) && (style & CLS_USEGROUPS); dat->list.cl.destroy(); dat->list.totalMembers = 0; dat->selection = -1; @@ -354,27 +354,27 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) for (int i = 1;; i++) { DWORD groupFlags; wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags); - if (szGroupName == NULL) + if (szGroupName == nullptr) break; cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0); } for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - int nHiddenStatus = cli.pfnGetContactHiddenStatus(hContact, NULL, dat); + int nHiddenStatus = cli.pfnGetContactHiddenStatus(hContact, nullptr, dat); if (((style & CLS_SHOWHIDDEN) && nHiddenStatus != -1) || !nHiddenStatus) { ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact); ClcGroup *group; ptrW tszGroupName(db_get_wsa(hContact, "CList", "Group")); - if (tszGroupName == NULL) + if (tszGroupName == nullptr) group = &dat->list; else { group = cli.pfnAddGroup(hwnd, dat, tszGroupName, (DWORD)-1, 0, 0); - if (group == NULL && style & CLS_SHOWHIDDEN) + if (group == nullptr && style & CLS_SHOWHIDDEN) group = &dat->list; } - if (group != NULL) { + if (group != nullptr) { group->totalMembers++; if (dat->bFilterSearch && dat->szQuickSearch[0] != '\0') { @@ -387,7 +387,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) } else if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { char *szProto = GetContactProto(hContact); - if (szProto == NULL) { + if (szProto == nullptr) { if (!cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE) || cli.pfnIsVisibleContact(pce, group)) cli.pfnAddContactToGroup(dat, group, hContact); } @@ -404,7 +404,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -555,15 +555,15 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort) if (dat->bNeedsResort) { MCONTACT hSelItem; ClcContact *selcontact; - if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1) - hSelItem = NULL; + if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, nullptr) == -1) + hSelItem = 0; else hSelItem = Clist_ContactToHItem(selcontact); group->scanIndex = 0; SortGroup(dat, group, useInsertionSort); for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -581,14 +581,14 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort) if (hSelItem) { ClcGroup *selgroup; - if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, nullptr)) dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact)); } cli.pfnRecalcScrollBar(hwnd, dat); } dat->bNeedsResort = false; - cli.pfnInvalidateRect(hwnd, NULL, FALSE); + cli.pfnInvalidateRect(hwnd, nullptr, FALSE); } struct SavedContactState_t @@ -627,7 +627,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -653,7 +653,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) } else if (cc->type == CLCIT_INFO) { SavedInfoState_t *p = new SavedInfoState_t; - p->parentId = (group->parent == NULL) ? -1 : group->groupId; + p->parentId = (group->parent == nullptr) ? -1 : group->groupId; p->contact = *cc; saveInfo.insert(p); } @@ -667,7 +667,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) group->scanIndex = 0; for (;;) { if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) + if ((group = group->parent) == nullptr) break; group->scanIndex++; continue; @@ -680,14 +680,14 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) SavedGroupState_t tmp, *p; tmp.groupId = group->groupId; - if ((p = saveGroup.find(&tmp)) != NULL) + if ((p = saveGroup.find(&tmp)) != nullptr) group->expanded = p->expanded; continue; } else if (cc->type == CLCIT_CONTACT) { SavedContactState_t tmp, *p; tmp.hContact = cc->hContact; - if ((p = saveContact.find(&tmp)) != NULL) { + if ((p = saveContact.find(&tmp)) != nullptr) { memcpy(cc->iExtraImage, p->iExtraImage, sizeof(p->iExtraImage)); if (p->checked) cc->flags |= CONTACTF_CHECKED; @@ -702,7 +702,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat) group = &dat->list; else { ClcContact *contact; - if (!Clist_FindItem(hwnd, dat, saveInfo[i].parentId | HCONTACT_ISGROUP, &contact, NULL, NULL)) + if (!Clist_FindItem(hwnd, dat, saveInfo[i].parentId | HCONTACT_ISGROUP, &contact, nullptr, nullptr)) continue; group = contact->group; } diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index f562c2fb32..0b79ae9e6c 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -44,7 +44,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar {
DWORD groupFlags;
wchar_t *szName = Clist_GroupGetName(wParam, &groupFlags);
- if (szName == NULL)
+ if (szName == nullptr)
break;
cli.pfnAddGroup(hwnd, dat, szName, groupFlags, wParam, 0);
cli.pfnRecalcScrollBar(hwnd, dat);
@@ -55,13 +55,13 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar case CLM_ADDINFOITEMW:
{
CLCINFOITEM *cii = (CLCINFOITEM *)lParam;
- if (cii == NULL || cii->cbSize != sizeof(CLCINFOITEM))
- return NULL;
- if (cii->hParentGroup == NULL)
+ if (cii == nullptr || cii->cbSize != sizeof(CLCINFOITEM))
+ return 0;
+ if (cii->hParentGroup == nullptr)
group = &dat->list;
else {
- if (!Clist_FindItem(hwnd, dat, INT_PTR(cii->hParentGroup) | HCONTACT_ISGROUP, &contact, NULL, NULL))
- return NULL;
+ if (!Clist_FindItem(hwnd, dat, INT_PTR(cii->hParentGroup) | HCONTACT_ISGROUP, &contact, nullptr, nullptr))
+ return 0;
group = contact->group;
}
@@ -96,7 +96,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar break;
case CLM_ENSUREVISIBLE:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, nullptr))
break;
for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
@@ -105,26 +105,26 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar break;
case CLM_EXPAND:
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
if (contact->type == CLCIT_GROUP)
cli.pfnSetGroupExpand(hwnd, dat, contact->group, lParam);
break;
case CLM_FINDCONTACT:
- if (!Clist_FindItem(hwnd, dat, wParam, NULL, NULL, NULL))
- return NULL;
+ if (!Clist_FindItem(hwnd, dat, wParam, nullptr, nullptr, nullptr))
+ return 0;
return wParam;
case CLM_FINDGROUP:
- if (!Clist_FindItem(hwnd, dat, wParam | HCONTACT_ISGROUP, NULL, NULL, NULL))
- return NULL;
+ if (!Clist_FindItem(hwnd, dat, wParam | HCONTACT_ISGROUP, nullptr, nullptr, nullptr))
+ return 0;
return wParam | HCONTACT_ISGROUP;
case CLM_GETBKCOLOR:
return dat->bkColour;
case CLM_GETCHECKMARK:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return 0;
return (contact->flags & CONTACTF_CHECKED) != 0;
@@ -135,7 +135,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar return (LRESULT)dat->hwndRenameEdit;
case CLM_GETEXPAND:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return CLE_INVALID;
if (contact->type != CLCIT_GROUP)
return CLE_INVALID;
@@ -143,7 +143,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar case CLM_SETEXTRASPACE:
dat->extraColumnSpacing = (int)wParam;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
return 0;
case CLM_GETEXTRACOLUMNS:
@@ -151,7 +151,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar case CLM_GETEXTRAIMAGE:
if (LOWORD(lParam) < dat->extraColumnsCount) {
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return contact->iExtraImage[LOWORD(lParam)];
}
return EMPTY_EXTRA_ICON;
@@ -165,7 +165,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar return (LRESULT)dat->fontInfo[wParam].hFont;
case CLM_GETHIDEOFFLINEROOT:
- return db_get_b(NULL, "CLC", "HideOfflineRoot", 0);
+ return db_get_b(0, "CLC", "HideOfflineRoot", 0);
case CLM_GETINDENT:
return dat->groupIndent;
@@ -175,13 +175,13 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar return mir_wstrlen(dat->szQuickSearch);
case CLM_GETITEMTEXT:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return 0;
mir_wstrcpy((wchar_t*)lParam, contact->szText);
return mir_wstrlen(contact->szText);
case CLM_GETITEMTYPE:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return CLCIT_INVALID;
return contact->type;
@@ -192,20 +192,20 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar if (wParam == CLGN_ROOT) {
if (dat->list.cl.getCount())
return Clist_ContactToHItem(dat->list.cl[0]);
- return NULL;
+ return 0;
}
- if (!Clist_FindItem(hwnd, dat, lParam, &contact, &group, NULL))
- return NULL;
+ if (!Clist_FindItem(hwnd, dat, lParam, &contact, &group, nullptr))
+ return 0;
i = group->cl.indexOf(contact);
switch (wParam) {
case CLGN_CHILD:
if (contact->type != CLCIT_GROUP)
- return NULL;
+ return 0;
group = contact->group;
if (group->cl.getCount() == 0)
- return NULL;
+ return 0;
return Clist_ContactToHItem(group->cl[0]);
case CLGN_PARENT:
@@ -214,14 +214,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar case CLGN_NEXT:
do {
if (++i >= group->cl.getCount())
- return NULL;
+ return 0;
} while (group->cl[i]->type == CLCIT_DIVIDER);
return Clist_ContactToHItem(group->cl[i]);
case CLGN_PREVIOUS:
do {
if (--i < 0)
- return NULL;
+ return 0;
} while (group->cl[i]->type == CLCIT_DIVIDER);
return Clist_ContactToHItem(group->cl[i]);
@@ -230,17 +230,17 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar if (group->cl[i]->type == CLCIT_CONTACT)
break;
if (i >= group->cl.getCount())
- return NULL;
+ return 0;
return Clist_ContactToHItem(group->cl[i]);
case CLGN_PREVIOUSCONTACT:
if (i >= group->cl.getCount())
- return NULL;
+ return 0;
for (i--; i >= 0; i--)
if (group->cl[i]->type == CLCIT_CONTACT)
break;
if (i < 0)
- return NULL;
+ return 0;
return Clist_ContactToHItem(group->cl[i]);
case CLGN_NEXTGROUP:
@@ -248,27 +248,27 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar if (group->cl[i]->type == CLCIT_GROUP)
break;
if (i >= group->cl.getCount())
- return NULL;
+ return 0;
return Clist_ContactToHItem(group->cl[i]);
case CLGN_PREVIOUSGROUP:
if (i >= group->cl.getCount())
- return NULL;
+ return 0;
for (i--; i >= 0; i--)
if (group->cl[i]->type == CLCIT_GROUP)
break;
if (i < 0)
- return NULL;
+ return 0;
return Clist_ContactToHItem(group->cl[i]);
}
- return NULL;
+ return 0;
case CLM_GETSCROLLTIME:
return dat->scrollTime;
case CLM_GETSELECTION:
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) == -1)
- return NULL;
+ if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
+ return 0;
return Clist_ContactToHItem(contact);
case CLM_GETTEXTCOLOR:
@@ -279,16 +279,16 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar case CLM_HITTEST:
DWORD hitFlags;
{
- int hit = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, NULL, &hitFlags);
+ int hit = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, nullptr, &hitFlags);
if (wParam)
*(PDWORD)wParam = hitFlags;
if (hit == -1)
- return NULL;
+ return 0;
}
return Clist_ContactToHItem(contact);
case CLM_SELECTITEM:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, &group, nullptr))
break;
for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
@@ -300,33 +300,33 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar case CLM_SETBKBITMAP:
if (dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
- dat->hBmpBackground = NULL;
+ dat->hBmpBackground = nullptr;
}
dat->hBmpBackground = (HBITMAP)lParam;
dat->backgroundBmpUse = wParam;
dat->bkChanged = 1;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETBKCOLOR:
if (dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
- dat->hBmpBackground = NULL;
+ dat->hBmpBackground = nullptr;
}
dat->bkColour = wParam;
dat->bkChanged = 1;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETCHECKMARK:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
return 0;
if (lParam)
contact->flags |= CONTACTF_CHECKED;
else
contact->flags &= ~CONTACTF_CHECKED;
cli.pfnRecalculateGroupCheckboxes(hwnd, dat);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETEXTRACOLUMNS:
@@ -334,23 +334,23 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar return 0;
dat->extraColumnsCount = wParam;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETEXTRAIMAGE:
if (LOWORD(lParam) < dat->extraColumnsCount) {
int bVisible;
- if (Clist_FindItem(hwnd, dat, wParam, &contact, NULL, &bVisible)) {
+ if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, &bVisible)) {
contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam);
if (bVisible)
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
}
}
break;
case CLM_SETEXTRAIMAGELIST:
dat->himlExtraColumns = (HIMAGELIST)lParam;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETFONT:
@@ -370,7 +370,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar ReleaseDC(hwnd, hdc);
}
if (LOWORD(lParam))
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETGREYOUTFLAGS:
@@ -386,7 +386,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar break;
case CLM_SETHIDEOFFLINEROOT:
- db_set_b(NULL, "CLC", "HideOfflineRoot", (BYTE)wParam);
+ db_set_b(0, "CLC", "HideOfflineRoot", (BYTE)wParam);
cli.pfnInitAutoRebuild(hwnd);
break;
@@ -396,16 +396,16 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar break;
case CLM_SETITEMTEXT:
- if (!Clist_FindItem(hwnd, dat, wParam, &contact, NULL, NULL))
+ if (!Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr))
break;
mir_wstrncpy(contact->szText, (wchar_t*)lParam, _countof(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETLEFTMARGIN:
dat->leftMargin = wParam;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
break;
case CLM_SETOFFLINEMODES:
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 6806e84321..5e1bfec607 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -69,8 +69,8 @@ wchar_t* fnGetGroupCountsText(ClcData *dat, ClcContact *contact) int fnHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD * flags)
{
- ClcContact *hitcontact = NULL;
- ClcGroup *hitgroup = NULL;
+ ClcContact *hitcontact = nullptr;
+ ClcGroup *hitgroup = nullptr;
int indent, i;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
@@ -225,10 +225,10 @@ void fnScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth) break;
dat->yScroll = oldy + (desty - oldy) * (int)(nowTick - startTick) / dat->scrollTime;
- if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL)
- ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE);
+ if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == nullptr)
+ ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE);
else
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
previousy = dat->yScroll;
SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
UpdateWindow(hwnd);
@@ -236,10 +236,10 @@ void fnScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth) }
dat->yScroll = desty;
- if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL)
- ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE);
+ if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == nullptr)
+ ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, nullptr, nullptr, nullptr, nullptr, SW_INVALIDATE);
else
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
}
@@ -321,7 +321,7 @@ void fnSetGroupExpand(HWND hwnd, ClcData *dat, ClcGroup *group, int newState) return;
group->expanded = newState != 0;
}
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInvalidateRect(hwnd, nullptr, FALSE);
contentCount = cli.pfnGetGroupContentsCount(group, 1);
groupy = cli.pfnGetRowsPriorTo(&dat->list, group, -1);
if (dat->selection > groupy && dat->selection < groupy + contentCount)
@@ -352,7 +352,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, ClcData *dat) if (dat->selection == -1)
return;
dat->szQuickSearch[0] = 0;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) == -1)
+ if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
return;
if (contact->type == CLCIT_GROUP)
cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1);
@@ -368,7 +368,7 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.getCount()) {
- if ((group = group->parent) == NULL)
+ if ((group = group->parent) == nullptr)
break;
group->scanIndex++;
continue;
@@ -380,7 +380,7 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) if (dat->bFilterSearch) {
wchar_t *lowered_szText = CharLowerW(NEWWSTR_ALLOCA(cc->szText));
wchar_t *lowered_text = CharLowerW(NEWWSTR_ALLOCA(text));
- show = wcsstr(lowered_szText, lowered_text) != NULL;
+ show = wcsstr(lowered_szText, lowered_text) != nullptr;
}
else show = ((prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_wstrcmpi(text, cc->szText)));
@@ -407,22 +407,22 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) void fnEndRename(HWND, ClcData *dat, int save)
{
HWND hwndEdit = dat->hwndRenameEdit;
- if (hwndEdit == NULL)
+ if (hwndEdit == nullptr)
return;
- dat->hwndRenameEdit = NULL;
+ dat->hwndRenameEdit = nullptr;
if (save) {
wchar_t text[120]; text[0] = 0;
GetWindowText(hwndEdit, text, _countof(text));
ClcContact *contact;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) != -1) {
+ if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) != -1) {
if (mir_wstrcmp(contact->szText, text) && !wcsstr(text, L"\\")) {
if (contact->type == CLCIT_GROUP) {
if (contact->group->parent && contact->group->parent->parent) {
wchar_t szFullName[256];
mir_snwprintf(szFullName, L"%s\\%s",
- Clist_GroupGetName(contact->group->parent->groupId, NULL), text);
+ Clist_GroupGetName(contact->group->parent->groupId, nullptr), text);
Clist_GroupRename(contact->groupId, szFullName);
}
else
@@ -449,7 +449,7 @@ void fnDeleteFromContactList(HWND hwnd, ClcData *dat) if (dat->selection == -1)
return;
dat->szQuickSearch[0] = 0;
- if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) == -1)
+ if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) == -1)
return;
switch (contact->type) {
case CLCIT_GROUP:
@@ -508,7 +508,7 @@ void fnBeginRenameSelection(HWND hwnd, ClcData *dat) POINT pt;
cli.pfnCalcEipPosition(dat, contact, group, &pt);
int h = cli.pfnGetRowHeight(dat, dat->selection);
- dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL);
+ dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, nullptr, cli.hInst, nullptr);
mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM)(contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
@@ -541,12 +541,12 @@ int fnGetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt) cli.pfnGetRowByIndex(dat, dat->iDragItem, &movecontact, &movegroup);
if (hit == dat->iDragItem)
return DROPTARGET_ONSELF;
- if (hit == -1 || movecontact == NULL || (hitFlags & CLCHT_ONITEMEXTRA))
+ if (hit == -1 || movecontact == nullptr || (hitFlags & CLCHT_ONITEMEXTRA))
return DROPTARGET_ONNOTHING;
if (movecontact->type == CLCIT_GROUP) {
- ClcContact *bottomcontact = NULL, *topcontact = NULL;
- ClcGroup *topgroup = NULL;
+ ClcContact *bottomcontact = nullptr, *topcontact = nullptr;
+ ClcGroup *topgroup = nullptr;
int topItem = -1, bottomItem = -1;
int ok = 0;
if (pt.y + dat->yScroll < cli.pfnGetRowTopY(dat, hit) + dat->insertionMarkHitHeight) {
@@ -563,7 +563,7 @@ int fnGetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt) bottomItem = hit + 1;
topcontact = contact;
topgroup = group;
- bottomItem = cli.pfnGetRowByIndex(dat, bottomItem, &bottomcontact, NULL);
+ bottomItem = cli.pfnGetRowByIndex(dat, bottomItem, &bottomcontact, nullptr);
ok = 1;
}
if (ok) {
@@ -631,14 +631,14 @@ int fnIsHiddenMode(ClcData *dat, int status) void fnHideInfoTip(HWND, ClcData *dat)
{
- if (dat->hInfoTipItem == NULL)
+ if (dat->hInfoTipItem == 0)
return;
CLCINFOTIP it = { 0 };
it.isGroup = IsHContactGroup(dat->hInfoTipItem);
it.hItem = (HANDLE)(dat->hInfoTipItem & ~HCONTACT_ISGROUP);
it.cbSize = sizeof(it);
- dat->hInfoTipItem = NULL;
+ dat->hInfoTipItem = 0;
NotifyEventHooks(hHideInfoTipEvent, 0, (LPARAM)&it);
}
@@ -698,18 +698,18 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) char idstr[20];
mir_snprintf(idstr, "Font%dName", i);
- ptrW tszFace(db_get_wsa(NULL, "CLC", idstr));
+ ptrW tszFace(db_get_wsa(0, "CLC", idstr));
if (tszFace)
mir_wstrcpy(lf->lfFaceName, tszFace);
mir_snprintf(idstr, "Font%dCol", i);
- *colour = db_get_dw(NULL, "CLC", idstr, *colour);
+ *colour = db_get_dw(0, "CLC", idstr, *colour);
mir_snprintf(idstr, "Font%dSize", i);
- lf->lfHeight = (char)db_get_b(NULL, "CLC", idstr, lf->lfHeight);
+ lf->lfHeight = (char)db_get_b(0, "CLC", idstr, lf->lfHeight);
mir_snprintf(idstr, "Font%dSty", i);
- BYTE style = (BYTE)db_get_b(NULL, "CLC", idstr, (lf->lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD) | (lf->lfItalic ? DBFONTF_ITALIC : 0) | (lf->lfUnderline ? DBFONTF_UNDERLINE : 0));
+ BYTE style = (BYTE)db_get_b(0, "CLC", idstr, (lf->lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD) | (lf->lfItalic ? DBFONTF_ITALIC : 0) | (lf->lfUnderline ? DBFONTF_UNDERLINE : 0));
lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0;
lf->lfWeight = style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = (style & DBFONTF_ITALIC) != 0;
@@ -717,7 +717,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) lf->lfStrikeOut = 0;
mir_snprintf(idstr, "Font%dSet", i);
- lf->lfCharSet = db_get_b(NULL, "CLC", idstr, lf->lfCharSet);
+ lf->lfCharSet = db_get_b(0, "CLC", idstr, lf->lfCharSet);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
@@ -726,31 +726,31 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst)
{
- dat->rowHeight = db_get_b(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
- dat->leftMargin = db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN);
- dat->exStyle = db_get_dw(NULL, "CLC", "ExStyle", cli.pfnGetDefaultExStyle());
- dat->scrollTime = db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME);
- dat->groupIndent = db_get_b(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT);
- dat->gammaCorrection = db_get_b(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT);
- dat->bShowIdle = db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) != 0;
- dat->bNoVScrollbar = db_get_b(NULL, "CLC", "NoVScrollBar", false) != 0;
- dat->bFilterSearch = db_get_b(NULL, "CLC", "FilterSearch", true) != 0;
+ dat->rowHeight = db_get_b(0, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
+ dat->leftMargin = db_get_b(0, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN);
+ dat->exStyle = db_get_dw(0, "CLC", "ExStyle", cli.pfnGetDefaultExStyle());
+ dat->scrollTime = db_get_w(0, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME);
+ dat->groupIndent = db_get_b(0, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT);
+ dat->gammaCorrection = db_get_b(0, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT);
+ dat->bShowIdle = db_get_b(0, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) != 0;
+ dat->bNoVScrollbar = db_get_b(0, "CLC", "NoVScrollBar", false) != 0;
+ dat->bFilterSearch = db_get_b(0, "CLC", "FilterSearch", true) != 0;
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
- dat->greyoutFlags = db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS);
- dat->offlineModes = db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
- dat->selBkColour = db_get_dw(NULL, "CLC", "SelBkColour", CLCDEFAULT_SELBKCOLOUR);
- dat->selTextColour = db_get_dw(NULL, "CLC", "SelTextColour", CLCDEFAULT_SELTEXTCOLOUR);
- dat->hotTextColour = db_get_dw(NULL, "CLC", "HotTextColour", CLCDEFAULT_HOTTEXTCOLOUR);
- dat->quickSearchColour = db_get_dw(NULL, "CLC", "QuickSearchColour", CLCDEFAULT_QUICKSEARCHCOLOUR);
- dat->bUseWindowsColours = db_get_b(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) != 0;
+ dat->greyoutFlags = db_get_dw(0, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS);
+ dat->offlineModes = db_get_dw(0, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
+ dat->selBkColour = db_get_dw(0, "CLC", "SelBkColour", CLCDEFAULT_SELBKCOLOUR);
+ dat->selTextColour = db_get_dw(0, "CLC", "SelTextColour", CLCDEFAULT_SELTEXTCOLOUR);
+ dat->hotTextColour = db_get_dw(0, "CLC", "HotTextColour", CLCDEFAULT_HOTTEXTCOLOUR);
+ dat->quickSearchColour = db_get_dw(0, "CLC", "QuickSearchColour", CLCDEFAULT_QUICKSEARCHCOLOUR);
+ dat->bUseWindowsColours = db_get_b(0, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) != 0;
- if (cli.hwndContactTree != NULL && hwnd != cli.hwndContactTree) {
+ if (cli.hwndContactTree != nullptr && hwnd != cli.hwndContactTree) {
dat->bkChanged = true; // block custom background
dat->bkColour = GetSysColor(COLOR_WINDOW);
if (dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
- dat->hBmpBackground = NULL;
+ dat->hBmpBackground = nullptr;
}
dat->greyoutFlags = 0;
@@ -763,17 +763,17 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst) }
if (!dat->bkChanged) {
- dat->bkColour = db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
+ dat->bkColour = db_get_dw(0, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
if (dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
- dat->hBmpBackground = NULL;
+ dat->hBmpBackground = nullptr;
}
- if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- ptrW tszBitmap(db_get_wsa(NULL, "CLC", "BkBitmap"));
+ if (db_get_b(0, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
+ ptrW tszBitmap(db_get_wsa(0, "CLC", "BkBitmap"));
if (tszBitmap)
dat->hBmpBackground = Bitmap_Load(tszBitmap);
}
- dat->backgroundBmpUse = db_get_w(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
+ dat->backgroundBmpUse = db_get_w(0, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
}
NMHDR hdr;
@@ -796,7 +796,7 @@ void fnRecalculateGroupCheckboxes(HWND, ClcData *dat) for (;;) {
if ((group->scanIndex & GSIF_INDEXMASK) == group->cl.getCount()) {
int check = (group->scanIndex & (GSIF_HASMEMBERS | GSIF_ALLCHECKED)) == (GSIF_HASMEMBERS | GSIF_ALLCHECKED);
- if (group->parent == NULL)
+ if (group->parent == nullptr)
break;
group->parent->scanIndex |= group->scanIndex & GSIF_HASMEMBERS;
group = group->parent;
diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index 5d4a80216d..2045860e9f 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -63,7 +63,7 @@ static int fnIsVisibleContact(ClcCacheEntry*, ClcGroup*) static void fnReloadProtoMenus(void)
{
RebuildMenuOrder();
- if (db_get_b(NULL, "CList", "MoveProtoMenus", TRUE))
+ if (db_get_b(0, "CList", "MoveProtoMenus", TRUE))
BuildProtoMenus();
cli.pfnCluiProtocolStatusChanged(0, 0);
}
diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index 62df8698f9..bcc85e9840 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -57,13 +57,13 @@ int fnGetImlIconIndex(HICON hIcon) static char* GetEventProtocol(int idx)
{
if (!g_cliEvents.getCount() || idx < 0 && idx >= g_cliEvents.getCount())
- return NULL;
+ return nullptr;
CListEvent &ev = g_cliEvents[idx];
- if (ev.hContact != NULL)
+ if (ev.hContact != 0)
return GetContactProto(ev.hContact);
- return (ev.flags & CLEF_PROTOCOLGLOBAL) ? ev.lpszProtocol : NULL;
+ return (ev.flags & CLEF_PROTOCOLGLOBAL) ? ev.lpszProtocol : nullptr;
}
static void ShowOneEventInTray(int idx)
@@ -100,7 +100,7 @@ static void ShowEventsInTray() j = 0;
if (pTrayProtos[j]) // if not already set
ShowOneEventInTray(i); // show it
- pTrayProtos[j] = NULL; // and clear slot
+ pTrayProtos[j] = nullptr; // and clear slot
}
}
@@ -123,8 +123,8 @@ static VOID CALLBACK IconFlashTimer(HWND, UINT, UINT_PTR idEvent, DWORD) }
if (g_cliEvents.getCount() == 0) {
- KillTimer(NULL, idEvent);
- cli.pfnTrayIconSetToBase(NULL);
+ KillTimer(nullptr, idEvent);
+ cli.pfnTrayIconSetToBase(nullptr);
}
iconsOn = !iconsOn;
@@ -132,8 +132,8 @@ static VOID CALLBACK IconFlashTimer(HWND, UINT, UINT_PTR idEvent, DWORD) CListEvent* fnAddEvent(CLISTEVENT *cle)
{
- if (cle == NULL)
- return NULL;
+ if (cle == nullptr)
+ return nullptr;
int i;
if (cle->flags & CLEF_URGENT) {
@@ -155,16 +155,16 @@ CListEvent* fnAddEvent(CLISTEVENT *cle) p->ptszTooltip = mir_a2u(p->pszTooltip); //if no flag defined it handled as unicode
if (g_cliEvents.getCount() == 1) {
char *szProto;
- if (cle->hContact == NULL) {
+ if (cle->hContact == 0) {
if (cle->flags & CLEF_PROTOCOLGLOBAL)
szProto = cle->lpszProtocol;
else
- szProto = NULL;
+ szProto = nullptr;
}
else szProto = GetContactProto(cle->hContact);
iconsOn = 1;
- flashTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "IconFlashTime", 550), IconFlashTimer);
+ flashTimerId = SetTimer(nullptr, 0, db_get_w(0, "CList", "IconFlashTime", 550), IconFlashTimer);
cli.pfnTrayIconUpdateWithImageList(p->imlIconIndex, p->ptszTooltip, szProto);
}
cli.pfnChangeContactIcon(cle->hContact, p->imlIconIndex);
@@ -203,19 +203,19 @@ int fnRemoveEvent(MCONTACT hContact, MEVENT dbEvent) else if (g_cliEvents[i].flags & CLEF_PROTOCOLGLOBAL)
szEventProto = (char*)g_cliEvents[i].lpszProtocol;
else
- szEventProto = NULL;
+ szEventProto = nullptr;
if (szEventProto && szProto && !mir_strcmp(szEventProto, szProto))
nSameProto++;
}
if (g_cliEvents.getCount() == 0 || nSameProto == 0) {
if (g_cliEvents.getCount() == 0)
- KillTimer(NULL, flashTimerId);
- cli.pfnTrayIconSetToBase(hContact == NULL ? NULL : szProto);
+ KillTimer(nullptr, flashTimerId);
+ cli.pfnTrayIconSetToBase(hContact == 0 ? nullptr : szProto);
}
else {
- if (g_cliEvents[0].hContact == NULL)
- szProto = NULL;
+ if (g_cliEvents[0].hContact == 0)
+ szProto = nullptr;
else
szProto = GetContactProto(g_cliEvents[0].hContact);
cli.pfnTrayIconUpdateWithImageList(iconsOn ? g_cliEvents[0].imlIconIndex : 0, g_cliEvents[0].ptszTooltip, szProto);
@@ -228,7 +228,7 @@ CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx) {
if (hContact == INVALID_CONTACT_ID) {
if (idx >= g_cliEvents.getCount())
- return NULL;
+ return nullptr;
return &g_cliEvents[idx];
}
@@ -236,7 +236,7 @@ CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx) if (g_cliEvents[i].hContact == hContact)
if (idx-- == 0)
return &g_cliEvents[i];
- return NULL;
+ return nullptr;
}
int fnEventsProcessContactDoubleClick(MCONTACT hContact)
@@ -244,7 +244,7 @@ int fnEventsProcessContactDoubleClick(MCONTACT hContact) for (int i = 0; i < g_cliEvents.getCount(); i++) {
if (g_cliEvents[i].hContact == hContact) {
MEVENT hDbEvent = g_cliEvents[i].hDbEvent;
- CallService(g_cliEvents[i].pszService, NULL, (LPARAM)&g_cliEvents[i]);
+ CallService(g_cliEvents[i].pszService, 0, (LPARAM)&g_cliEvents[i]);
cli.pfnRemoveEvent(hContact, hDbEvent);
return 0;
}
@@ -264,7 +264,7 @@ int fnEventsProcessTrayDoubleClick(int index) mir_cslockfull lck(trayLockCS);
if (cli.trayIconCount > 1 && index > 0) {
int i;
- char *szProto = NULL;
+ char *szProto = nullptr;
for (i = 0; i < cli.trayIconCount; i++) {
if (cli.trayIcon[i].id == index) {
szProto = cli.trayIcon[i].szProto;
@@ -275,7 +275,7 @@ int fnEventsProcessTrayDoubleClick(int index) }
if (szProto) {
for (i = 0; i < g_cliEvents.getCount(); i++) {
- char *eventProto = NULL;
+ char *eventProto = nullptr;
if (g_cliEvents[i].hContact)
eventProto = GetContactProto(g_cliEvents[i].hContact);
if (!eventProto)
@@ -291,7 +291,7 @@ int fnEventsProcessTrayDoubleClick(int index) if (i == g_cliEvents.getCount()) {
if (click_in_first_icon) {
for (i = 0; i < g_cliEvents.getCount(); i++) {
- char *eventProto = NULL;
+ char *eventProto = nullptr;
if (g_cliEvents[i].hContact)
eventProto = GetContactProto(g_cliEvents[i].hContact);
if (!eventProto)
@@ -339,7 +339,7 @@ static int RemoveEventsForContact(WPARAM wParam, LPARAM) static int CListEventSettingsChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
- if (hContact == NULL && cws && cws->szModule && cws->szSetting && strcmp(cws->szModule, "CList") == 0) {
+ if (hContact == 0 && cws && cws->szModule && cws->szSetting && strcmp(cws->szModule, "CList") == 0) {
if (strcmp(cws->szSetting, "DisableTrayFlash") == 0)
disableTrayFlash = (int)cws->value.bVal;
else if (strcmp(cws->szSetting, "NoIconBlink") == 0)
@@ -354,8 +354,8 @@ int InitCListEvents(void) {
cli.events = &g_cliEvents;
- disableTrayFlash = db_get_b(NULL, "CList", "DisableTrayFlash", 0);
- disableIconFlash = db_get_b(NULL, "CList", "NoIconBlink", 0);
+ disableTrayFlash = db_get_b(0, "CList", "DisableTrayFlash", 0);
+ disableIconFlash = db_get_b(0, "CList", "NoIconBlink", 0);
HookEvent(ME_DB_CONTACT_DELETED, RemoveEventsForContact);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, CListEventSettingsChanged);
return 0;
@@ -364,9 +364,9 @@ int InitCListEvents(void) void UninitCListEvents(void)
{
if (g_cliEvents.getCount())
- KillTimer(NULL, flashTimerId);
+ KillTimer(nullptr, flashTimerId);
g_cliEvents.destroy();
- if (imlIcon != NULL)
+ if (imlIcon != nullptr)
mir_free(imlIcon);
}
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index e70b985e07..5cc2d0f297 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -43,7 +43,7 @@ struct CGroupInternal {
char idstr[33];
itoa(groupId, idstr, 10);
- db_set_ws(NULL, "CListGroups", idstr, groupName);
+ db_set_ws(0, "CListGroups", idstr, groupName);
}
};
@@ -108,8 +108,8 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName) const wchar_t *grpName = ptszName ? ptszName : TranslateT("New group");
if (hParent) {
CGroupInternal *tmp = arByIds.find(hParent-1);
- if (tmp == NULL)
- return NULL;
+ if (tmp == nullptr)
+ return 0;
mir_snwprintf(newBaseName, L"%s\\%s", tmp->groupName+1, grpName);
}
@@ -135,7 +135,7 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName) Clist_GroupAdded(newId + 1);
- CLISTGROUPCHANGE grpChg = { sizeof(grpChg), NULL, newName };
+ CLISTGROUPCHANGE grpChg = { sizeof(grpChg), nullptr, newName };
NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg);
return newId + 1;
@@ -145,9 +145,9 @@ MIR_APP_DLL(MGROUP) Clist_GroupCreate(MGROUP hParent, LPCTSTR ptszGroupName) {
// no name specified. just create a new group with a default name
if (ptszGroupName == 0)
- return CreateGroupInternal(hParent, NULL);
+ return CreateGroupInternal(hParent, nullptr);
- if (ptszGroupName == NULL || ptszGroupName[0] == '\0' || ptszGroupName[0] == '\\')
+ if (ptszGroupName == nullptr || ptszGroupName[0] == '\0' || ptszGroupName[0] == '\\')
return 0;
wchar_t *tszName = NEWWSTR_ALLOCA(ptszGroupName);
@@ -166,10 +166,10 @@ MIR_APP_DLL(MGROUP) Clist_GroupCreate(MGROUP hParent, LPCTSTR ptszGroupName) MIR_APP_DLL(wchar_t*) Clist_GroupGetName(MGROUP hGroup, DWORD *pdwFlags)
{
CGroupInternal *p = arByIds.find(hGroup-1);
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
- if (pdwFlags != NULL)
+ if (pdwFlags != nullptr)
*pdwFlags = p->groupName[0] & ~1;
return p->groupName+1;
}
@@ -180,17 +180,17 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) {
// get the name
CGroupInternal *pGroup = arByIds.find(hGroup-1);
- if (pGroup == NULL)
+ if (pGroup == nullptr)
return 1;
- if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) {
+ if (db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) {
wchar_t szQuestion[256 + 100];
mir_snwprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), pGroup->groupName+1);
if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return 1;
}
- SetCursor(LoadCursor(NULL, IDC_WAIT));
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
// must remove setting from all child contacts too
// children are demoted to the next group up, not deleted.
@@ -208,7 +208,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) if (mir_wstrcmp(tszGroupName, pGroup->groupName+1))
continue;
- CLISTGROUPCHANGE grpChg = { sizeof(grpChg), NULL, NULL };
+ CLISTGROUPCHANGE grpChg = { sizeof(grpChg), nullptr, nullptr };
grpChg.pszOldName = pGroup->groupName+1;
if (szNewParent[0]) {
db_set_ws(hContact, "CList", "Group", szNewParent);
@@ -216,7 +216,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) }
else {
db_unset(hContact, "CList", "Group");
- grpChg.pszNewName = NULL;
+ grpChg.pszNewName = nullptr;
}
NotifyEventHooks(hGroupChangeEvent, hContact, (LPARAM)&grpChg);
@@ -234,7 +234,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) char idstr[33];
_itoa(arByIds.getCount(), idstr, 10);
- db_unset(NULL, "CListGroups", idstr);
+ db_unset(0, "CListGroups", idstr);
// rename subgroups
wchar_t szNewName[256];
@@ -242,7 +242,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) for (int i = 0; i < arByIds.getCount(); i++) {
CGroupInternal *p = arByIds[i];
- if (!wcsncmp(pGroup->groupName+1, p->groupName+1, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == NULL) {
+ if (!wcsncmp(pGroup->groupName+1, p->groupName+1, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == nullptr) {
if (szNewParent[0])
mir_snwprintf(szNewName, L"%s\\%s", szNewParent, p->groupName + len + 2);
else
@@ -251,10 +251,10 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup) }
}
- SetCursor(LoadCursor(NULL, IDC_ARROW));
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
cli.pfnLoadContactTree();
- const CLISTGROUPCHANGE grpChg = { sizeof(grpChg), pGroup->groupName+1, NULL };
+ const CLISTGROUPCHANGE grpChg = { sizeof(grpChg), pGroup->groupName+1, nullptr };
NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg);
delete(pGroup);
@@ -270,7 +270,7 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) hGroup--;
CGroupInternal *pGroup = arByIds.find(hGroup);
- if (pGroup == NULL)
+ if (pGroup == nullptr)
return 0;
// shuffle list of groups up to fill gap
@@ -283,7 +283,7 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) else {
hGroupBefore--;
CGroupInternal *pDest = arByIds.find(hGroupBefore);
- if (pDest == NULL)
+ if (pDest == nullptr)
return 0;
if (hGroup < hGroupBefore) {
@@ -321,12 +321,12 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move)
{
if (GroupNameExists(szName, groupId)) {
- MessageBox(NULL, TranslateT("You already have a group with that name. Please enter a unique name for the group."), TranslateT("Rename group"), MB_ICONERROR | MB_OK);
+ MessageBox(nullptr, TranslateT("You already have a group with that name. Please enter a unique name for the group."), TranslateT("Rename group"), MB_ICONERROR | MB_OK);
return 1;
}
CGroupInternal *pGroup = arByIds.find(groupId);
- if (pGroup == NULL)
+ if (pGroup == nullptr)
return 0;
// do the change
@@ -357,7 +357,7 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) continue;
CGroupInternal *p = arByIds[i];
- if (!wcsncmp(p->groupName+1, oldName, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == NULL) {
+ if (!wcsncmp(p->groupName+1, oldName, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == nullptr) {
wchar_t szNewName[256];
mir_snwprintf(szNewName, L"%s\\%s", szName, p->groupName + len + 2);
RenameGroupWithMove(i, szNewName, 0); // luckily, child groups will never need reordering
@@ -368,7 +368,7 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) if (move) {
wcsncpy_s(str, szName, _TRUNCATE);
wchar_t *pszLastBackslash = wcsrchr(str, '\\');
- if (pszLastBackslash != NULL) {
+ if (pszLastBackslash != nullptr) {
*pszLastBackslash = '\0';
for (int i = 0; i < arByIds.getCount(); i++) {
CGroupInternal *p = arByIds[i];
@@ -396,7 +396,7 @@ MIR_APP_DLL(int) Clist_GroupRename(MGROUP hGroup, const wchar_t *ptszNewName) MIR_APP_DLL(int) Clist_GroupSetExpanded(MGROUP hGroup, int iNewState)
{
CGroupInternal *pGroup = arByIds.find(hGroup-1);
- if (pGroup == NULL)
+ if (pGroup == nullptr)
return 1;
if (iNewState)
@@ -412,7 +412,7 @@ MIR_APP_DLL(int) Clist_GroupSetExpanded(MGROUP hGroup, int iNewState) MIR_APP_DLL(int) Clist_GroupSetFlags(MGROUP hGroup, LPARAM iNewFlags)
{
CGroupInternal *pGroup = arByIds.find(hGroup-1);
- if (pGroup == NULL)
+ if (pGroup == nullptr)
return 1;
int flags = LOWORD(iNewFlags) & HIWORD(iNewFlags);
@@ -430,7 +430,7 @@ MIR_APP_DLL(int) Clist_GroupSetFlags(MGROUP hGroup, LPARAM iNewFlags) MIR_APP_DLL(HMENU) Clist_GroupBuildMenu()
{
if (arByIds.getCount() == 0)
- return NULL;
+ return nullptr;
int nextMenuId = 100;
@@ -445,9 +445,9 @@ MIR_APP_DLL(HMENU) Clist_GroupBuildMenu() wchar_t szThisField[128], szThisMenuItem[128];
do {
const wchar_t *pBackslash = wcschr(pNextField, '\\');
- if (pBackslash == NULL) {
+ if (pBackslash == nullptr) {
mir_wstrncpy(szThisField, pNextField, _countof(szThisField));
- pNextField = NULL;
+ pNextField = nullptr;
}
else {
mir_wstrncpy(szThisField, pNextField, min(_countof(szThisField), pBackslash - pNextField + 1));
@@ -462,13 +462,13 @@ MIR_APP_DLL(HMENU) Clist_GroupBuildMenu() GetMenuItemInfo(hThisMenu, menuId, TRUE, &mii);
compareResult = mir_wstrcmp(szThisField, szThisMenuItem);
if (compareResult == 0) {
- if (pNextField == NULL) {
+ if (pNextField == nullptr) {
mii.fMask = MIIM_DATA;
mii.dwItemData = i + 1;
SetMenuItemInfo(hThisMenu, menuId, TRUE, &mii);
}
else {
- if (mii.hSubMenu == NULL) {
+ if (mii.hSubMenu == nullptr) {
mii.fMask = MIIM_SUBMENU;
mii.hSubMenu = CreateMenu();
SetMenuItemInfo(hThisMenu, menuId, TRUE, &mii);
@@ -516,8 +516,8 @@ int InitGroupServices(void) for (int i = 0;; i++) {
char str[32];
_itoa(i, str, 10);
- ptrW tszGroup(db_get_wsa(NULL, "CListGroups", str));
- if (tszGroup == NULL)
+ ptrW tszGroup(db_get_wsa(0, "CListGroups", str));
+ if (tszGroup == nullptr)
break;
CGroupInternal *p = new CGroupInternal(i, tszGroup);
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 4bb17a81f4..1fcc7bf937 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -105,7 +105,7 @@ wchar_t* fnGetStatusModeDescription(int mode, int flags) mir_snwprintf(szMode, (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateW(connFmt), mode - ID_STATUS_CONNECTING + 1);
return szMode;
}
- return NULL;
+ return nullptr;
}
return (flags & GSMDF_UNTRANSLATED) ? descr : TranslateW(descr);
@@ -120,7 +120,7 @@ static int ProtocolAck(WPARAM, LPARAM lParam) cli.pfnCluiProtocolStatusChanged(lParam, ack->szModule);
if ((INT_PTR)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) {
- DWORD caps = (DWORD)CallProtoServiceInt(NULL, ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0);
+ DWORD caps = (DWORD)CallProtoServiceInt(0, ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_SERVERCLIST) {
for (MCONTACT hContact = db_find_first(ack->szModule); hContact; ) {
MCONTACT hNext = db_find_next(hContact, ack->szModule);
@@ -150,7 +150,7 @@ int fnIconFromStatusMode(const char *szProto, int status, MCONTACT) if (index == _countof(statusModeList))
index = 0;
- if (szProto == NULL)
+ if (szProto == nullptr)
return index + 1;
for (i = 0; i < protoIconIndex.getCount(); i++) {
if (mir_strcmp(szProto, protoIconIndex[i].szProto) == 0)
@@ -163,7 +163,7 @@ int fnGetContactIcon(MCONTACT hContact) {
char *szProto = GetContactProto(hContact);
return cli.pfnIconFromStatusMode(szProto,
- szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact);
+ szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact);
}
static void AddProtoIconIndex(PROTOACCOUNT *pa)
@@ -234,11 +234,11 @@ MIR_APP_DLL(void) Clist_ContactDoubleClicked(MCONTACT hContact) // Otherwise try to execute the default action
TIntMenuObject *pmo = GetMenuObjbyId(hContactMenuObject);
- if (pmo != NULL) {
+ if (pmo != nullptr) {
NotifyEventHooks(hPreBuildContactMenuEvent, hContact, 0);
TMO_IntMenuItem *pimi = Menu_GetDefaultItem(pmo->m_items.first);
- if (pimi != NULL)
+ if (pimi != nullptr)
Menu_ProcessCommand(pimi, hContact);
}
}
@@ -258,7 +258,7 @@ static int CListIconsChanged(WPARAM, LPARAM) for (int j = 0; j < _countof(statusModeList); j++)
ImageList_ReplaceIcon_IconLibLoaded(hCListImages, protoIconIndex[i].iIconBase + j, Skin_LoadProtoIcon(protoIconIndex[i].szProto, statusModeList[j]));
cli.pfnTrayIconIconsChanged();
- cli.pfnInvalidateRect(cli.hwndContactList, NULL, TRUE);
+ cli.pfnInvalidateRect(cli.hwndContactList, nullptr, TRUE);
return 0;
}
@@ -278,7 +278,7 @@ int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) BOOL bPartiallyCovered = FALSE;
HWND hAux = 0;
- if (hWnd == NULL) {
+ if (hWnd == nullptr) {
SetLastError(0x00000006); //Wrong handle
return -1;
}
@@ -314,9 +314,9 @@ int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) for (j = rc.left; j < rc.right; j += (width / iStepX)) {
pt.x = j;
hAux = WindowFromPoint(pt);
- while (GetParent(hAux) != NULL)
+ while (GetParent(hAux) != nullptr)
hAux = GetParent(hAux);
- if (hAux != hWnd && hAux != NULL) //There's another window!
+ if (hAux != hWnd && hAux != nullptr) //There's another window!
bPartiallyCovered = TRUE;
else
iNotCoveredDots++; //Let's count the not covered dots.
@@ -344,7 +344,7 @@ int fnShowHide() switch (iVisibleState) {
case GWVS_PARTIALLY_COVERED:
//If we don't want to bring it to top, we can use a simple break. This goes against readability ;-) but the comment explains it.
- if (!db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
+ if (!db_get_b(0, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
break;
case GWVS_COVERED: //Fall through (and we're already falling)
case GWVS_HIDDEN:
@@ -359,13 +359,13 @@ int fnShowHide() if (bShow == TRUE) {
ShowWindow(cli.hwndContactList, SW_RESTORE);
- if (!db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
+ if (!db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
SetWindowPos(cli.hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
else
SetWindowPos(cli.hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetForegroundWindow(cli.hwndContactList);
- db_set_b(NULL, "CList", "State", SETTING_STATE_NORMAL);
+ db_set_b(0, "CList", "State", SETTING_STATE_NORMAL);
// this forces the window onto the visible screen
RECT rcWindow;
@@ -374,17 +374,17 @@ int fnShowHide() MoveWindow(cli.hwndContactList, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
}
else { // It needs to be hidden
- if (db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ||
- db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
+ if (db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ||
+ db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
ShowWindow(cli.hwndContactList, SW_HIDE);
- db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN);
+ db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN);
}
else {
ShowWindow(cli.hwndContactList, SW_MINIMIZE);
- db_set_b(NULL, "CList", "State", SETTING_STATE_MINIMIZED);
+ db_set_b(0, "CList", "State", SETTING_STATE_MINIMIZED);
}
- if (db_get_b(NULL, "CList", "DisableWorkingSet", 1))
+ if (db_get_b(0, "CList", "DisableWorkingSet", 1))
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
}
return 0;
@@ -402,9 +402,9 @@ void fnChangeContactIcon(MCONTACT hContact, int iIcon) MIR_APP_DLL(int) Clist_ContactCompare(MCONTACT hContact1, MCONTACT hContact2)
{
ClcData *dat = (ClcData*)GetWindowLongPtr(cli.hwndContactTree, 0);
- if (dat != NULL) {
+ if (dat != nullptr) {
ClcContact *p1, *p2;
- if (Clist_FindItem(cli.hwndContactTree, dat, hContact1, &p1, NULL, NULL) && Clist_FindItem(cli.hwndContactTree, dat, hContact2, &p2, NULL, NULL))
+ if (Clist_FindItem(cli.hwndContactTree, dat, hContact1, &p1, nullptr, nullptr) && Clist_FindItem(cli.hwndContactTree, dat, hContact2, &p2, nullptr, nullptr))
return cli.pfnCompareContacts(p1, p2);
}
@@ -450,7 +450,7 @@ void UnloadContactListModule() return;
// remove transitory contacts
- for (MCONTACT hContact = db_find_first(); hContact != NULL; ) {
+ for (MCONTACT hContact = db_find_first(); hContact != 0; ) {
MCONTACT hNext = db_find_next(hContact);
if (db_get_b(hContact, "CList", "NotOnList", 0))
db_delete_contact(hContact);
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 43f5a1cfe4..cdb46f855f 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -41,12 +41,12 @@ void FreeDisplayNameCache(void) ClcCacheEntry* fnCreateCacheItem(MCONTACT hContact)
{
- if (hContact == NULL)
- return NULL;
+ if (hContact == 0)
+ return nullptr;
ClcCacheEntry *p = (ClcCacheEntry*)mir_calloc(sizeof(ClcCacheEntry));
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return nullptr;
p->hContact = hContact;
return p;
@@ -54,9 +54,9 @@ ClcCacheEntry* fnCreateCacheItem(MCONTACT hContact) void fnCheckCacheItem(ClcCacheEntry *p)
{
- if (p->tszGroup == NULL) {
+ if (p->tszGroup == nullptr) {
p->tszGroup = db_get_wsa(p->hContact, "CList", "Group");
- if (p->tszGroup == NULL)
+ if (p->tszGroup == nullptr)
p->tszGroup = mir_wstrdup(L"");
}
@@ -66,8 +66,8 @@ void fnCheckCacheItem(ClcCacheEntry *p) void fnFreeCacheItem(ClcCacheEntry *p)
{
- replaceStrW(p->tszName, NULL);
- replaceStrW(p->tszGroup, NULL);
+ replaceStrW(p->tszName, nullptr);
+ replaceStrW(p->tszGroup, nullptr);
p->bIsHidden = -1;
}
@@ -76,7 +76,7 @@ ClcCacheEntry* fnGetCacheEntry(MCONTACT hContact) ClcCacheEntry *p;
int idx = clistCache.getIndex((ClcCacheEntry*)&hContact);
if (idx == -1) {
- if ((p = cli.pfnCreateCacheItem(hContact)) != NULL) {
+ if ((p = cli.pfnCreateCacheItem(hContact)) != nullptr) {
clistCache.insert(p);
cli.pfnInvalidateDisplayNameCacheEntry(hContact);
}
@@ -102,10 +102,10 @@ void fnInvalidateDisplayNameCacheEntry(MCONTACT hContact) wchar_t* fnGetContactDisplayName(MCONTACT hContact, int mode)
{
- if (hContact == NULL)
+ if (hContact == 0)
return TranslateT("(Unknown contact)");
- ClcCacheEntry *cacheEntry = NULL;
+ ClcCacheEntry *cacheEntry = nullptr;
if (mode & GCDNF_NOCACHE)
mode &= ~GCDNF_NOCACHE;
else if (mode != GCDNF_NOMYHANDLE) {
@@ -115,8 +115,8 @@ wchar_t* fnGetContactDisplayName(MCONTACT hContact, int mode) }
ptrW tszDisplayName(Contact_GetInfo((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY, hContact));
- if (tszDisplayName != NULL) {
- if (cacheEntry != NULL)
+ if (tszDisplayName != nullptr) {
+ if (cacheEntry != nullptr)
replaceStrW(cacheEntry->tszName, tszDisplayName);
return tszDisplayName.detach();
}
@@ -124,12 +124,12 @@ wchar_t* fnGetContactDisplayName(MCONTACT hContact, int mode) ProtoChainSend(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
wchar_t *buffer = TranslateT("(Unknown contact)");
- return (cacheEntry == NULL) ? mir_wstrdup(buffer) : buffer;
+ return (cacheEntry == nullptr) ? mir_wstrdup(buffer) : buffer;
}
int ContactAdded(WPARAM hContact, LPARAM)
{
- cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), ID_STATUS_OFFLINE, NULL));
+ cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), ID_STATUS_OFFLINE, 0));
return 0;
}
@@ -155,7 +155,7 @@ static void Dbwcs2tstr(DBCONTACTWRITESETTING *cws, wchar_t* &pStr) switch (cws->value.type) {
case -1:
case DBVT_DELETED:
- pStr = NULL;
+ pStr = nullptr;
break;
case DBVT_UTF8:
@@ -175,7 +175,7 @@ static void Dbwcs2tstr(DBCONTACTWRITESETTING *cws, wchar_t* &pStr) int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
// Early exit
- if (hContact == NULL)
+ if (hContact == 0)
return 0;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
@@ -183,7 +183,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (!mir_strcmp(cws->szModule, szProto)) {
if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact);
- replaceStrW(pdnce->tszName, NULL);
+ replaceStrW(pdnce->tszName, nullptr);
cli.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Status")) {
@@ -194,11 +194,11 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) else if (!strcmp(cws->szModule, "CList")) {
if (!strcmp(cws->szSetting, "Hidden")) {
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0)
- cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
+ cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
}
else if (!strcmp(cws->szSetting, "MyHandle")) {
ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact);
- replaceStrW(pdnce->tszName, NULL);
+ replaceStrW(pdnce->tszName, nullptr);
cli.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Group")) {
@@ -209,11 +209,11 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) else if (!strcmp(cws->szModule, "Protocol")) {
if (!strcmp(cws->szSetting, "p")) {
if (cws->value.type == DBVT_DELETED)
- szProto = NULL;
+ szProto = nullptr;
else
szProto = cws->value.pszVal;
cli.pfnChangeContactIcon(hContact,
- cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
+ cli.pfnIconFromStatusMode(szProto, szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
}
}
return 0;
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 9ab92535b4..9fdc689108 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -37,7 +37,7 @@ mir_cs trayLockCS; static bool hasTips()
{
- return ServiceExists("mToolTip/ShowTip") && db_get_b(NULL, "Tipper", "TrayTip", 1);
+ return ServiceExists("mToolTip/ShowTip") && db_get_b(0, "Tipper", "TrayTip", 1);
}
#define initcheck if (!fTrayInited) return
@@ -46,16 +46,16 @@ static bool fTrayInited; static wchar_t* sttGetXStatus(const char *szProto)
{
- if (CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
+ if (CallProtoServiceInt(0, szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
wchar_t tszStatus[512];
CUSTOM_STATUS cs = { sizeof(cs) };
cs.flags = CSSF_MASK_MESSAGE | CSSF_UNICODE;
cs.ptszMessage = tszStatus;
- if (CallProtoServiceInt(NULL, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
+ if (CallProtoServiceInt(0, szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0)
return mir_wstrdup(tszStatus);
}
- return NULL;
+ return nullptr;
}
static HICON lastTaskBarIcon;
@@ -69,14 +69,14 @@ static void SetTaskBarIcon(const HICON hIcon, const wchar_t *szNewTip) wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto)
{
- initcheck NULL;
+ initcheck nullptr;
mir_cslock lck(trayLockCS);
wchar_t *szSeparator = L"\n";
- if (szProto == NULL) {
+ if (szProto == nullptr) {
if (accounts.getCount() == 0)
- return NULL;
+ return nullptr;
if (accounts.getCount() == 1)
return cli.pfnTrayIconMakeTooltip(szPrefix, accounts[0]->szModuleName);
@@ -84,7 +84,7 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto) CMStringW tszTip;
if (szPrefix && szPrefix[0]) {
- if (!db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
+ if (!db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
wcsncpy_s(cli.szTip, MAX_TIP_SIZE, szPrefix, _TRUNCATE);
return cli.szTip;
}
@@ -100,7 +100,7 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto) if (!cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
- wchar_t *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
+ wchar_t *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
if (!szStatus)
continue;
@@ -110,7 +110,7 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto) tszTip.AppendFormat(L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
ptrW ProtoXStatus(sttGetXStatus(pa->szModuleName));
- if (ProtoXStatus != NULL) {
+ if (ProtoXStatus != nullptr) {
if (!tszTip.IsEmpty())
tszTip.AppendChar('\n');
tszTip.AppendFormat(L"%-24.24s\n", ProtoXStatus);
@@ -123,13 +123,13 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto) }
else {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- if (pa != NULL) {
+ if (pa != nullptr) {
ptrW ProtoXStatus(sttGetXStatus(szProto));
- wchar_t *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0), 0);
+ wchar_t *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(0, szProto, PS_GETSTATUS, 0, 0), 0);
if (szPrefix && szPrefix[0]) {
- if (db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
+ if (db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
if (hasTips()) {
- if (ProtoXStatus != NULL)
+ if (ProtoXStatus != nullptr)
mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
else
mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s", szPrefix, szSeparator, pa->tszAccountName, szStatus);
@@ -140,7 +140,7 @@ wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto) }
else {
if (hasTips()) {
- if (ProtoXStatus != NULL)
+ if (ProtoXStatus != nullptr)
mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s\n%-24.24s", pa->tszAccountName, szStatus, ProtoXStatus);
else
mir_snwprintf(cli.szTip, MAX_TIP_SIZE, L"<b>%-12.12s</b>\t%s", pa->tszAccountName, szStatus);
@@ -166,7 +166,7 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s trayIconInfo_t &p = cli.trayIcon[i];
p.id = TRAYICON_ID_BASE + i;
p.szProto = (char*)szProto;
- p.hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, szIconProto ? szIconProto : p.szProto, status);
+ p.hBaseIcon = cli.pfnGetIconFromStatusMode(0, szIconProto ? szIconProto : p.szProto, status);
NOTIFYICONDATA nid = { NOTIFYICONDATA_V2_SIZE };
nid.hWnd = hwnd;
@@ -178,7 +178,7 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s if (cli.shellVersion >= 5)
nid.uFlags |= NIF_INFO;
- cli.pfnTrayIconMakeTooltip(NULL, p.szProto);
+ cli.pfnTrayIconMakeTooltip(nullptr, p.szProto);
if (!hasTips())
mir_wstrncpy(nid.szTip, cli.szTip, _countof(nid.szTip));
replaceStrW(p.ptszToolTip, cli.szTip);
@@ -205,14 +205,14 @@ void fnTrayIconRemove(HWND hwnd, const char *szProto) Shell_NotifyIcon(NIM_DELETE, &nid);
DestroyIcon(pii->hBaseIcon);
- mir_free(pii->ptszToolTip); pii->ptszToolTip = NULL;
+ mir_free(pii->ptszToolTip); pii->ptszToolTip = nullptr;
pii->id = 0;
break;
}
}
if (cli.trayIconCount == 1)
- SetTaskBarIcon(NULL, NULL);
+ SetTaskBarIcon(nullptr, nullptr);
}
int fnTrayIconInit(HWND hwnd)
@@ -225,7 +225,7 @@ int fnTrayIconInit(HWND hwnd) int averageMode = cli.pfnGetAverageMode(&netProtoCount);
if (cli.cycleTimerId) {
- KillTimer(NULL, cli.cycleTimerId);
+ KillTimer(nullptr, cli.cycleTimerId);
cli.cycleTimerId = 0;
}
@@ -234,39 +234,39 @@ int fnTrayIconInit(HWND hwnd) if (netProtoCount) {
cli.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * accounts.getCount());
- int trayIconSetting = db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT);
+ int trayIconSetting = db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT);
if (trayIconSetting == SETTING_TRAYICON_SINGLE) {
DBVARIANT dbv = { DBVT_DELETED };
char *szProto;
- if (!db_get_s(NULL, "CList", "PrimaryStatus", &dbv) && (averageMode < 0 || db_get_b(NULL, "CList", "AlwaysPrimary", 0)))
+ if (!db_get_s(0, "CList", "PrimaryStatus", &dbv) && (averageMode < 0 || db_get_b(0, "CList", "AlwaysPrimary", 0)))
szProto = dbv.pszVal;
else
- szProto = NULL;
+ szProto = nullptr;
- cli.pfnTrayIconAdd(hwnd, NULL, szProto, szProto ? CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
+ cli.pfnTrayIconAdd(hwnd, nullptr, szProto, szProto ? CallProtoServiceInt(0, szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
db_free(&dbv);
}
- else if (trayIconSetting == SETTING_TRAYICON_MULTI && (averageMode < 0 || db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) {
+ else if (trayIconSetting == SETTING_TRAYICON_MULTI && (averageMode < 0 || db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) {
cli.trayIconCount = netProtoCount;
for (int i = 0; i < accounts.getCount(); i++) {
int j = cli.pfnGetAccountIndexByPos(i);
if (j >= 0) {
PROTOACCOUNT *pa = accounts[j];
if (cli.pfnGetProtocolVisibility(pa->szModuleName))
- cli.pfnTrayIconAdd(hwnd, pa->szModuleName, NULL, CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0));
+ cli.pfnTrayIconAdd(hwnd, pa->szModuleName, nullptr, CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0));
}
}
}
else {
- cli.pfnTrayIconAdd(hwnd, NULL, NULL, averageMode);
+ cli.pfnTrayIconAdd(hwnd, nullptr, nullptr, averageMode);
if (trayIconSetting == SETTING_TRAYICON_CYCLE && averageMode < 0)
- cli.cycleTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc);
+ cli.cycleTimerId = SetTimer(nullptr, 0, db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc);
}
}
else {
cli.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t));
- cli.pfnTrayIconAdd(hwnd, NULL, NULL, CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
+ cli.pfnTrayIconAdd(hwnd, nullptr, nullptr, CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
}
return 0;
@@ -278,7 +278,7 @@ int fnTrayIconDestroy(HWND hwnd) mir_cslock lck(trayLockCS);
if (cli.trayIconCount == 1)
- SetTaskBarIcon(NULL, NULL);
+ SetTaskBarIcon(nullptr, nullptr);
NOTIFYICONDATA nid = { NOTIFYICONDATA_V2_SIZE };
nid.hWnd = hwnd;
@@ -291,7 +291,7 @@ int fnTrayIconDestroy(HWND hwnd) mir_free(cli.trayIcon[i].ptszToolTip);
}
mir_free(cli.trayIcon);
- cli.trayIcon = NULL;
+ cli.trayIcon = nullptr;
cli.trayIconCount = 0;
return 0;
}
@@ -307,7 +307,7 @@ void fnTrayIconTaskbarCreated(HWND hwnd) static VOID CALLBACK RefreshTimerProc(HWND, UINT, UINT_PTR, DWORD)
{
if (RefreshTimerId) {
- KillTimer(NULL, RefreshTimerId);
+ KillTimer(nullptr, RefreshTimerId);
RefreshTimerId = 0;
}
for (int i = 0; i < accounts.getCount(); i++)
@@ -343,7 +343,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPref if (cli.trayIconCount == 1)
SetTaskBarIcon(hNewIcon, cli.szTip);
else
- SetTaskBarIcon(NULL, NULL);
+ SetTaskBarIcon(nullptr, nullptr);
cli.trayIcon[i].isBase = isBase;
return i;
@@ -365,19 +365,19 @@ int fnTrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPref if (cli.trayIconCount == 1)
SetTaskBarIcon(hNewIcon, cli.szTip);
else
- SetTaskBarIcon(NULL, NULL);
+ SetTaskBarIcon(nullptr, nullptr);
cli.trayIcon[i].isBase = isBase;
- if (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) {
- DWORD time1 = db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 200;
- DWORD time2 = db_get_w(NULL, "CList", "IconFlashTime", 550) + 1000;
+ if (db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) {
+ DWORD time1 = db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 200;
+ DWORD time2 = db_get_w(0, "CList", "IconFlashTime", 550) + 1000;
DWORD time = max(max(2000, time1), time2);
if (RefreshTimerId)
- KillTimer(NULL, RefreshTimerId);
+ KillTimer(nullptr, RefreshTimerId);
// if unknown base was changed - than show preffered proto icon for 2 sec
// and reset it to original one after timeout
- RefreshTimerId = SetTimer(NULL, 0, time, RefreshTimerProc);
+ RefreshTimerId = SetTimer(nullptr, 0, time, RefreshTimerProc);
}
return i;
}
@@ -407,9 +407,9 @@ int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto) return i;
}
if ((cli.pfnGetProtocolVisibility(szPreferredProto)) &&
- (cli.pfnGetAverageMode(NULL) == -1) &&
- (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) &&
- !(db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)))
+ (cli.pfnGetAverageMode(nullptr) == -1) &&
+ (db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) &&
+ !(db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)))
goto LBL_Error;
}
@@ -447,17 +447,17 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) if (i) {
DestroyIcon(cli.trayIcon[0].hBaseIcon);
- cli.trayIcon[0].hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, accounts[cli.cycleStep]->szModuleName,
- CallProtoServiceInt(NULL, accounts[cli.cycleStep]->szModuleName, PS_GETSTATUS, 0, 0));
+ cli.trayIcon[0].hBaseIcon = cli.pfnGetIconFromStatusMode(0, accounts[cli.cycleStep]->szModuleName,
+ CallProtoServiceInt(0, accounts[cli.cycleStep]->szModuleName, PS_GETSTATUS, 0, 0));
if (cli.trayIcon[0].isBase)
- cli.pfnTrayIconUpdate(cli.trayIcon[0].hBaseIcon, NULL, NULL, 1);
+ cli.pfnTrayIconUpdate(cli.trayIcon[0].hBaseIcon, nullptr, nullptr, 1);
}
}
void fnTrayIconUpdateBase(const char *szChangedProto)
{
initcheck;
- if (szChangedProto == NULL) return;
+ if (szChangedProto == nullptr) return;
if (!cli.pfnGetProtocolVisibility(szChangedProto)) return;
int netProtoCount;
@@ -465,7 +465,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) int averageMode = cli.pfnGetAverageMode(&netProtoCount);
if (cli.cycleTimerId) {
- KillTimer(NULL, cli.cycleTimerId);
+ KillTimer(nullptr, cli.cycleTimerId);
cli.cycleTimerId = 0;
}
@@ -475,25 +475,25 @@ void fnTrayIconUpdateBase(const char *szChangedProto) int changed = cli.pfnTrayCalcChanged(szChangedProto, averageMode, netProtoCount);
if (changed != -1 && cli.trayIcon[changed].isBase)
- cli.pfnTrayIconUpdate(cli.trayIcon[changed].hBaseIcon, NULL, cli.trayIcon[changed].szProto, 1);
+ cli.pfnTrayIconUpdate(cli.trayIcon[changed].hBaseIcon, nullptr, cli.trayIcon[changed].szProto, 1);
}
int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount)
{
if (netProtoCount == 0)
- return cli.pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(NULL, averageMode, NULL), ILD_NORMAL), NULL);
+ return cli.pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(nullptr, averageMode, 0), ILD_NORMAL), nullptr);
- int trayIconSetting = db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT);
+ int trayIconSetting = db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT);
if (averageMode > 0) {
if (trayIconSetting != SETTING_TRAYICON_MULTI)
- return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL);
+ return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, nullptr, averageMode), nullptr);
- if (db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
- return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoServiceInt(NULL, szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
+ if (db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
+ return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, szChangedProto, CallProtoServiceInt(0, szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
- if (cli.trayIcon == NULL || cli.trayIcon[0].szProto == NULL)
- return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL);
+ if (cli.trayIcon == nullptr || cli.trayIcon[0].szProto == nullptr)
+ return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, nullptr, averageMode), nullptr);
cli.pfnTrayIconDestroy(cli.hwndContactList);
cli.pfnTrayIconInit(cli.hwndContactList);
@@ -501,16 +501,14 @@ int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoC else {
switch (trayIconSetting) {
case SETTING_TRAYICON_CYCLE:
- cli.cycleTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc);
- return cli.pfnTrayIconSetBaseInfo(ImageList_GetIcon
- (hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoServiceInt(NULL, szChangedProto, PS_GETSTATUS, 0, 0), NULL),
- ILD_NORMAL), NULL);
+ cli.cycleTimerId = SetTimer(nullptr, 0, db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc);
+ return cli.pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoServiceInt(0, szChangedProto, PS_GETSTATUS, 0, 0), 0), ILD_NORMAL), nullptr);
case SETTING_TRAYICON_MULTI:
if (!cli.trayIcon)
- cli.pfnTrayIconRemove(NULL, NULL);
- else if ((cli.trayIconCount > 1 || netProtoCount == 1) || db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
- return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoServiceInt(NULL, szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
+ cli.pfnTrayIconRemove(nullptr, nullptr);
+ else if ((cli.trayIconCount > 1 || netProtoCount == 1) || db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
+ return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, szChangedProto, CallProtoServiceInt(0, szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
else {
cli.pfnTrayIconDestroy(cli.hwndContactList);
cli.pfnTrayIconInit(cli.hwndContactList);
@@ -518,10 +516,8 @@ int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoC break;
case SETTING_TRAYICON_SINGLE:
- ptrA szProto(db_get_sa(NULL, "CList", "PrimaryStatus"));
- return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szProto, szProto ?
- CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0) :
- CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto);
+ ptrA szProto(db_get_sa(0, "CList", "PrimaryStatus"));
+ return cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(0, szProto, szProto ? CallProtoServiceInt(0, szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto);
}
}
@@ -539,7 +535,7 @@ void fnTrayIconSetToBase(char *szPreferredProto) continue;
if (mir_strcmp(cli.trayIcon[i].szProto, szPreferredProto))
continue;
- cli.pfnTrayIconUpdate(cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
+ cli.pfnTrayIconUpdate(cli.trayIcon[i].hBaseIcon, nullptr, szPreferredProto, 1);
return;
}
@@ -547,7 +543,7 @@ void fnTrayIconSetToBase(char *szPreferredProto) for (i = 0; i < cli.trayIconCount; i++) {
if (cli.trayIcon[i].id == 0)
continue;
- cli.pfnTrayIconUpdate(cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
+ cli.pfnTrayIconUpdate(cli.trayIcon[i].hBaseIcon, nullptr, szPreferredProto, 1);
return;
}
}
@@ -580,10 +576,10 @@ int fnTrayIconPauseAutoHide(WPARAM, LPARAM) initcheck 0;
mir_cslock lck(trayLockCS);
- if (db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
+ if (db_get_b(0, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
if (GetActiveWindow() != cli.hwndContactList) {
- KillTimer(NULL, autoHideTimerId);
- autoHideTimerId = SetTimer(NULL, 0, 1000 * db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
+ KillTimer(nullptr, autoHideTimerId);
+ autoHideTimerId = SetTimer(nullptr, 0, 1000 * db_get_w(0, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
}
}
return 0;
@@ -655,11 +651,11 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) break;
case WM_ACTIVATE:
- if (db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
+ if (db_get_b(0, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
if (LOWORD(msg->wParam) == WA_INACTIVE)
- autoHideTimerId = SetTimer(NULL, 0, 1000 * db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
+ autoHideTimerId = SetTimer(nullptr, 0, 1000 * db_get_w(0, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
else
- KillTimer(NULL, autoHideTimerId);
+ KillTimer(nullptr, autoHideTimerId);
}
break;
@@ -676,7 +672,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) if (msg->lParam == WM_MBUTTONUP)
cli.pfnShowHide();
- else if (msg->lParam == (db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
+ else if (msg->lParam == (db_get_b(0, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
POINT pt;
HMENU hMenu = Menu_GetStatusMenu();
@@ -707,7 +703,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) SetForegroundWindow(msg->hwnd);
SetFocus(msg->hwnd);
GetCursorPos(&pt);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, nullptr);
}
else if (cli.pfnEventsProcessTrayDoubleClick(msg->wParam))
cli.pfnShowHide();
@@ -720,7 +716,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) POINT pt;
GetCursorPos(&pt);
cli.bTrayMenuOnScreen = TRUE;
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, nullptr);
Menu_DestroyNestedMenu(hMenu);
PostMessage(msg->hwnd, WM_NULL, 0, 0);
}
@@ -752,7 +748,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) return TRUE;
}
else if (msg->message == WM_TASKBARBUTTONCREATED) {
- SetTaskBarIcon(lastTaskBarIcon, NULL);
+ SetTaskBarIcon(lastTaskBarIcon, nullptr);
*((LRESULT*)lParam) = 0;
return TRUE;
}
@@ -766,13 +762,13 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) static int sttGetIcon(const char *szProto)
{
- if (szProto == NULL)
+ if (szProto == nullptr)
return cli.trayIcon[0].id;
UINT iconId = 0;
for (int j = 0; j < cli.trayIconCount; j++) {
- if (cli.trayIcon[j].szProto != NULL) {
+ if (cli.trayIcon[j].szProto != nullptr) {
if (!mir_strcmp(szProto, cli.trayIcon[j].szProto)) {
iconId = cli.trayIcon[j].id;
break;
@@ -789,9 +785,9 @@ static int sttGetIcon(const char *szProto) MIR_APP_DLL(int) Clist_TrayNotifyA(const char *szProto, const char *szInfoTitle, const char *szInfo, DWORD dwInfoFlags, UINT uTimeout)
{
- if (szInfo == NULL || szInfoTitle == NULL)
+ if (szInfo == nullptr || szInfoTitle == nullptr)
return 1;
- if (cli.trayIcon == NULL)
+ if (cli.trayIcon == nullptr)
return 2;
NOTIFYICONDATAA nid = { 0 };
@@ -808,9 +804,9 @@ MIR_APP_DLL(int) Clist_TrayNotifyA(const char *szProto, const char *szInfoTitle, MIR_APP_DLL(int) Clist_TrayNotifyW(const char *szProto, const wchar_t *wszInfoTitle, const wchar_t *wszInfo, DWORD dwInfoFlags, UINT uTimeout)
{
- if (wszInfo == NULL || wszInfoTitle == NULL)
+ if (wszInfo == nullptr || wszInfoTitle == nullptr)
return 1;
- if (cli.trayIcon == NULL)
+ if (cli.trayIcon == nullptr)
return 2;
NOTIFYICONDATAW nid = { 0 };
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 7e5eef8816..1cc94ed1ec 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -51,10 +51,10 @@ static CluiOpts cluiopt = { 0 }; void fnLoadCluiGlobalOpts()
{
- cluiopt.showsbar = db_get_b(NULL, "CLUI", "ShowSBar", 1);
- cluiopt.showgrip = db_get_b(NULL, "CLUI", "ShowGrip", 1);
- cluiopt.transparent = db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT);
- cluiopt.alpha = db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT);
+ cluiopt.showsbar = db_get_b(0, "CLUI", "ShowSBar", 1);
+ cluiopt.showgrip = db_get_b(0, "CLUI", "ShowGrip", 1);
+ cluiopt.transparent = db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT);
+ cluiopt.alpha = db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT);
}
static int CluiModulesLoaded(WPARAM, LPARAM)
@@ -76,7 +76,7 @@ static int CluiModulesLoaded(WPARAM, LPARAM) static void DisconnectAll()
{
for (int i = 0; i < accounts.getCount(); i++)
- CallProtoServiceInt(NULL, accounts[i]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
+ CallProtoServiceInt(0, accounts[i]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
}
static int CluiIconsChanged(WPARAM, LPARAM)
@@ -166,7 +166,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) //see notes about deleting contacts on PF1_SERVERCLIST servers in m_protosvc.h
UINT_PTR action;
- if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) && !(GetKeyState(VK_SHIFT) & 0x8000))
+ if (db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) && !(GetKeyState(VK_SHIFT) & 0x8000))
// Ask user for confirmation, and if the contact should be archived (hidden, not deleted)
action = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND)lParam, AskForConfirmationDlgProc, wParam);
else
@@ -179,15 +179,15 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) case IDYES: // Delete contact
char *szProto = GetContactProto(wParam);
- if (szProto != NULL) {
+ if (szProto != nullptr) {
// Check if protocol uses server side lists
- DWORD caps = CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ DWORD caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_SERVERCLIST) {
- int status = CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0);
+ int status = CallProtoServiceInt(0, szProto, PS_GETSTATUS, 0, 0);
if (status == ID_STATUS_OFFLINE || IsStatusConnecting(status)) {
// Set a flag so we remember to delete the contact when the protocol goes online the next time
db_set_b(wParam, "CList", "Delete", 1);
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."),
TranslateT("Delete contact"), MB_ICONINFORMATION | MB_OK);
return 0;
@@ -208,7 +208,7 @@ static INT_PTR MenuItem_AddContactToList(WPARAM hContact, LPARAM) acs.hContact = hContact;
acs.handleType = HANDLE_CONTACT;
acs.szProto = "";
- CallService(MS_ADDCONTACT_SHOW, NULL, (LPARAM)&acs);
+ CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
return 0;
}
@@ -256,24 +256,24 @@ int LoadCLUIModule(void) wndclass.lpfnWndProc = cli.pfnContactListControlWndProc;
wndclass.cbWndExtra = sizeof(void *);
wndclass.hInstance = cli.hInst;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.lpszClassName = CLISTCONTROL_CLASSW;
RegisterClassEx(&wndclass);
memset(&wndclass, 0, sizeof(wndclass));
wndclass.cbSize = sizeof(wndclass);
- wndclass.style = CS_HREDRAW | CS_VREDRAW | ((db_get_b(NULL, "CList", "WindowShadow", 0) == 1) ? CS_DROPSHADOW : 0);
+ wndclass.style = CS_HREDRAW | CS_VREDRAW | ((db_get_b(0, "CList", "WindowShadow", 0) == 1) ? CS_DROPSHADOW : 0);
wndclass.lpfnWndProc = ContactListWndProc;
wndclass.hInstance = cli.hInst;
wndclass.hIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
wndclass.lpszMenuName = MAKEINTRESOURCE(IDR_CLISTMENU);
wndclass.lpszClassName = _T(MIRANDACLASS);
wndclass.hIconSm = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
RegisterClassEx(&wndclass);
- if (db_get_ws(NULL, "CList", "TitleText", &dbv))
+ if (db_get_ws(0, "CList", "TitleText", &dbv))
mir_wstrncpy(titleText, _T(MIRANDANAME), _countof(titleText));
else {
mir_wstrncpy(titleText, dbv.ptszVal, _countof(titleText));
@@ -281,25 +281,25 @@ int LoadCLUIModule(void) }
RECT pos;
- pos.left = (int)db_get_dw(NULL, "CList", "x", 700);
- pos.top = (int)db_get_dw(NULL, "CList", "y", 221);
- pos.right = pos.left + (int)db_get_dw(NULL, "CList", "Width", 150);
- pos.bottom = pos.top + (int)db_get_dw(NULL, "CList", "Height", 310);
+ pos.left = (int)db_get_dw(0, "CList", "x", 700);
+ pos.top = (int)db_get_dw(0, "CList", "y", 221);
+ pos.right = pos.left + (int)db_get_dw(0, "CList", "Width", 150);
+ pos.bottom = pos.top + (int)db_get_dw(0, "CList", "Height", 310);
Utils_AssertInsideScreen(&pos);
cli.hwndContactList = CreateWindowEx(
- (db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW),
+ (db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW),
_T(MIRANDACLASS),
titleText,
WS_POPUPWINDOW | WS_THICKFRAME | WS_CLIPCHILDREN |
- (db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? WS_CAPTION | WS_SYSMENU |
- (db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? 0 : WS_MINIMIZEBOX) : 0),
+ (db_get_b(0, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? WS_CAPTION | WS_SYSMENU |
+ (db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? 0 : WS_MINIMIZEBOX) : 0),
pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top,
- NULL, NULL, cli.hInst, NULL);
+ nullptr, nullptr, cli.hInst, nullptr);
- if (db_get_b(NULL, "CList", "OnDesktop", 0)) {
- HWND hProgMan = FindWindow(L"Progman", NULL);
+ if (db_get_b(0, "CList", "OnDesktop", 0)) {
+ HWND hProgMan = FindWindow(L"Progman", nullptr);
if (IsWindow(hProgMan))
SetParent(cli.hwndContactList, hProgMan);
}
@@ -308,16 +308,16 @@ int LoadCLUIModule(void) PostMessage(cli.hwndContactList, M_RESTORESTATUS, 0, 0);
- int state = db_get_b(NULL, "CList", "State", SETTING_STATE_NORMAL);
+ int state = db_get_b(0, "CList", "State", SETTING_STATE_NORMAL);
cli.hMenuMain = GetMenu(cli.hwndContactList);
- if (!db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
- SetMenu(cli.hwndContactList, NULL);
+ if (!db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
+ SetMenu(cli.hwndContactList, nullptr);
if (state == SETTING_STATE_NORMAL)
ShowWindow(cli.hwndContactList, SW_SHOW);
else if (state == SETTING_STATE_MINIMIZED)
ShowWindow(cli.hwndContactList, SW_SHOWMINIMIZED);
SetWindowPos(cli.hwndContactList,
- db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
+ db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
CMenuItem mi;
@@ -379,10 +379,10 @@ void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon) } //if
/* draw the icon */
if (eventIcon != 0) {
- DrawState(dis->hDC, NULL, NULL, (LPARAM)eventIcon, 0, 2, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
- DrawState(dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, 4 + g_IconWidth, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
+ DrawState(dis->hDC, nullptr, nullptr, (LPARAM)eventIcon, 0, 2, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
+ DrawState(dis->hDC, nullptr, nullptr, (LPARAM)hIcon, 0, 4 + g_IconWidth, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
}
- else DrawState(dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, (dis->rcItem.right + dis->rcItem.left - g_IconWidth) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
+ else DrawState(dis->hDC, nullptr, nullptr, (LPARAM)hIcon, 0, (dis->rcItem.right + dis->rcItem.left - g_IconWidth) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
}
else {
/* non-flat menus, flush the DC with a normal menu colour */
@@ -393,10 +393,10 @@ void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon) DrawEdge(dis->hDC, &dis->rcItem, BDR_SUNKENOUTER, BF_RECT);
if (eventIcon != 0) {
- DrawState(dis->hDC, NULL, NULL, (LPARAM)eventIcon, 0, 2, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
- DrawState(dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, 4 + g_IconWidth, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
+ DrawState(dis->hDC, nullptr, nullptr, (LPARAM)eventIcon, 0, 2, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
+ DrawState(dis->hDC, nullptr, nullptr, (LPARAM)hIcon, 0, 4 + g_IconWidth, (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
}
- else DrawState(dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, (dis->rcItem.right + dis->rcItem.left - g_IconWidth) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
+ else DrawState(dis->hDC, nullptr, nullptr, (LPARAM)hIcon, 0, (dis->rcItem.right + dis->rcItem.left - g_IconWidth) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), (dis->rcItem.bottom + dis->rcItem.top - g_IconHeight) / 2 + (dis->itemState & ODS_SELECTED ? 1 : 0), 0, 0, DST_ICON | (dis->itemState & ODS_INACTIVE ? DSS_DISABLED : DSS_NORMAL));
}
DestroyIcon(hIcon);
@@ -443,7 +443,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int flags = WS_CHILD | CCS_BOTTOM;
flags |= cluiopt.showsbar ? WS_VISIBLE : 0;
flags |= cluiopt.showgrip ? SBARS_SIZEGRIP : 0;
- cli.hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, hwnd, NULL, cli.hInst, NULL);
+ cli.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, cli.hInst, nullptr);
}
cli.pfnCluiProtocolStatusChanged(0, 0);
@@ -461,17 +461,17 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM cli.hwndContactTree = CreateWindow(CLISTCONTROL_CLASSW, L"",
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
| CLS_CONTACTLIST
- | (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0)
- | (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0)
- | (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0),
- 0, 0, 0, 0, hwnd, NULL, cli.hInst, NULL);
+ | (db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0)
+ | (db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0)
+ | (db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0),
+ 0, 0, 0, 0, hwnd, nullptr, cli.hInst, nullptr);
SendMessage(hwnd, WM_SIZE, 0, 0);
break;
case M_RESTORESTATUS:
#ifndef _DEBUG
{
- int nStatus = db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE);
+ int nStatus = db_get_w(0, "CList", "Status", ID_STATUS_OFFLINE);
if (nStatus != ID_STATUS_OFFLINE) CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0);
}
#endif
@@ -507,22 +507,22 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rect, rcStatus;
GetClientRect(hwnd, &rect);
if (cluiopt.showsbar) {
- SetWindowPos(cli.hwndStatus, NULL, 0, rect.bottom - 20, rect.right - rect.left, 20, SWP_NOZORDER);
+ SetWindowPos(cli.hwndStatus, nullptr, 0, rect.bottom - 20, rect.right - rect.left, 20, SWP_NOZORDER);
GetWindowRect(cli.hwndStatus, &rcStatus);
cli.pfnCluiProtocolStatusChanged(0, 0);
}
else
rcStatus.top = rcStatus.bottom = 0;
- SetWindowPos(cli.hwndContactTree, NULL, 0, 0, rect.right, rect.bottom - (rcStatus.bottom - rcStatus.top), SWP_NOZORDER);
+ SetWindowPos(cli.hwndContactTree, nullptr, 0, 0, rect.right, rect.bottom - (rcStatus.bottom - rcStatus.top), SWP_NOZORDER);
}
if (wParam == SIZE_MINIMIZED) {
- if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) || db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
+ if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) || db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
ShowWindow(hwnd, SW_HIDE);
- db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN);
+ db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN);
}
- else db_set_b(NULL, "CList", "State", SETTING_STATE_MINIMIZED);
+ else db_set_b(0, "CList", "State", SETTING_STATE_MINIMIZED);
- if (db_get_b(NULL, "CList", "DisableWorkingSet", 1))
+ if (db_get_b(0, "CList", "DisableWorkingSet", 1))
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
}
// drop thru
@@ -533,11 +533,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //if docked, dont remember pos (except for width)
if (!Clist_IsDocked()) {
- db_set_dw(NULL, "CList", "Height", (DWORD)(rc.bottom - rc.top));
- db_set_dw(NULL, "CList", "x", (DWORD)rc.left);
- db_set_dw(NULL, "CList", "y", (DWORD)rc.top);
+ db_set_dw(0, "CList", "Height", (DWORD)(rc.bottom - rc.top));
+ db_set_dw(0, "CList", "x", (DWORD)rc.left);
+ db_set_dw(0, "CList", "y", (DWORD)rc.top);
}
- db_set_dw(NULL, "CList", "Width", (DWORD)(rc.right - rc.left));
+ db_set_dw(0, "CList", "Width", (DWORD)(rc.right - rc.left));
}
return FALSE;
@@ -550,7 +550,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if ((HWND)wParam != hwnd)
if (cluiopt.transparent)
if (transparentFocus)
- SetTimer(hwnd, TM_AUTOALPHA, 250, NULL);
+ SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr);
}
else {
if (cluiopt.transparent) {
@@ -566,7 +566,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (!transparentFocus && GetForegroundWindow() != hwnd) {
SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)cluiopt.alpha, LWA_ALPHA);
transparentFocus = 1;
- SetTimer(hwnd, TM_AUTOALPHA, 250, NULL);
+ SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr);
}
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -577,7 +577,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM result = DefWindowProc(hwnd, WM_NCHITTEST, wParam, lParam);
if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT ||
result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT)
- if (db_get_b(NULL, "CLUI", "AutoSize", 0))
+ if (db_get_b(0, "CLUI", "AutoSize", 0))
return HTCLIENT;
return result;
}
@@ -603,7 +603,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (transparentFocus)
SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)cluiopt.alpha, LWA_ALPHA);
else
- SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
+ SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(0, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
}
if (!transparentFocus)
KillTimer(hwnd, TM_AUTOALPHA);
@@ -615,7 +615,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
if (noRecurse)
break;
- if (!db_get_b(NULL, "CLUI", "FadeInOut", 0))
+ if (!db_get_b(0, "CLUI", "FadeInOut", 0))
break;
if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LAYERED) {
DWORD thisTick, startTick;
@@ -667,11 +667,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case SC_MINIMIZE:
case SC_CLOSE:
if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
- db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
+ db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
ShowWindow(hwnd, SW_HIDE);
- db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN);
+ db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN);
- if (db_get_b(NULL, "CList", "DisableWorkingSet", 1))
+ if (db_get_b(0, "CList", "DisableWorkingSet", 1))
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
return 0;
@@ -780,12 +780,12 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case CLN_NEWCONTACT:
- if (nmc != NULL)
+ if (nmc != nullptr)
cli.pfnSetAllExtraIcons((UINT_PTR)nmc->hItem);
return TRUE;
case CLN_LISTREBUILT:
- cli.pfnSetAllExtraIcons(NULL);
+ cli.pfnSetAllExtraIcons(0);
return FALSE;
case NM_KEYDOWN:
@@ -796,11 +796,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rcWindow, rcTree, rcWorkArea;
int maxHeight, newHeight;
- if (!db_get_b(NULL, "CLUI", "AutoSize", 0))
+ if (!db_get_b(0, "CLUI", "AutoSize", 0))
break;
if (Clist_IsDocked())
break;
- maxHeight = db_get_b(NULL, "CLUI", "MaxSizeHeight", 75);
+ maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", 75);
GetWindowRect(hwnd, &rcWindow);
GetWindowRect(cli.hwndContactTree, &rcTree);
@@ -814,7 +814,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM newHeight = max(nmc->pt.y, 9) + 1 + (rcWindow.bottom - rcWindow.top) - (rcTree.bottom - rcTree.top);
if (newHeight > (rcWorkArea.bottom - rcWorkArea.top) * maxHeight / 100)
newHeight = (rcWorkArea.bottom - rcWorkArea.top) * maxHeight / 100;
- if (db_get_b(NULL, "CLUI", "AutoSizeUpward", 0)) {
+ if (db_get_b(0, "CLUI", "AutoSizeUpward", 0)) {
rcWindow.top = rcWindow.bottom - newHeight;
if (rcWindow.top < rcWorkArea.top)
rcWindow.top = rcWorkArea.top;
@@ -844,7 +844,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if ((hitFlags & (CLCHT_NOWHERE | CLCHT_INLEFTMARGIN | CLCHT_BELOWITEMS)) == 0)
break;
- if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
+ if (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
POINT pt = nmc->pt;
ClientToScreen(cli.hwndContactTree, &pt);
return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
@@ -886,7 +886,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM pt.x = rc.left;
pt.y = rc.top;
ClientToScreen(cli.hwndStatus, &pt);
- TrackPopupMenu(hMenu, TPM_BOTTOMALIGN | TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_BOTTOMALIGN | TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, nullptr);
}
}
return FALSE;
@@ -924,18 +924,18 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
if (PtInRect(&rc, pt)) {
HMENU hMenu = Menu_BuildGroupMenu();
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, hwnd, nullptr);
Menu_DestroyNestedMenu(hMenu);
return 0;
}
GetWindowRect(cli.hwndStatus, &rc);
if (PtInRect(&rc, pt)) {
HMENU hMenu;
- if (db_get_b(NULL, "CLUI", "SBarRightClk", 0))
+ if (db_get_b(0, "CLUI", "SBarRightClk", 0))
hMenu = Menu_GetMainMenu();
else
hMenu = Menu_GetStatusMenu();
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, nullptr);
return 0;
}
}
@@ -954,23 +954,23 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == cli.hwndStatus) {
char *szProto = (char *)dis->itemData;
- if (szProto == NULL) return 0;
+ if (szProto == nullptr) return 0;
int status, x;
SIZE textSize;
- BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1);
- status = CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0);
+ BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1);
+ status = CallProtoServiceInt(0, szProto, PS_GETSTATUS, 0, 0);
SetBkMode(dis->hDC, TRANSPARENT);
x = dis->rcItem.left;
if (showOpts & 1) {
HICON hIcon = Skin_LoadProtoIcon(szProto, status);
DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon,
- g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL);
+ g_IconWidth, g_IconHeight, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(hIcon);
if (Proto_IsAccountLocked(Proto_GetAccount(szProto))) {
hIcon = Skin_LoadIcon(SKINICON_OTHER_STATUS_LOCKED);
- if (hIcon != NULL) {
+ if (hIcon != nullptr) {
DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon,
- g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL);
+ g_IconWidth, g_IconHeight, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(hIcon);
}
@@ -982,7 +982,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (showOpts & 2) {
PROTOACCOUNT *pa;
wchar_t tszName[64];
- if ((pa = Proto_GetAccount(szProto)) != NULL)
+ if ((pa = Proto_GetAccount(szProto)) != nullptr)
mir_snwprintf(tszName, L"%s ", pa->tszAccountName);
else
tszName[0] = 0;
@@ -1002,7 +1002,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else if (dis->CtlType == ODT_MENU) {
if (dis->itemData == MENU_MIRANDAMENU) {
HICON hIcon = Skin_LoadIcon(SKINICON_OTHER_MAINMENU);
- fnDrawMenuItem(dis, CopyIcon(hIcon), NULL);
+ fnDrawMenuItem(dis, CopyIcon(hIcon), nullptr);
IcoLib_ReleaseIcon(hIcon);
return TRUE;
}
@@ -1023,11 +1023,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //if docked, dont remember pos (except for width)
if (!Clist_IsDocked()) {
- db_set_dw(NULL, "CList", "Height", (DWORD)(rc.bottom - rc.top));
- db_set_dw(NULL, "CList", "x", (DWORD)rc.left);
- db_set_dw(NULL, "CList", "y", (DWORD)rc.top);
+ db_set_dw(0, "CList", "Height", (DWORD)(rc.bottom - rc.top));
+ db_set_dw(0, "CList", "x", (DWORD)rc.left);
+ db_set_dw(0, "CList", "y", (DWORD)rc.top);
}
- db_set_dw(NULL, "CList", "Width", (DWORD)(rc.right - rc.left));
+ db_set_dw(0, "CList", "Width", (DWORD)(rc.right - rc.left));
}
RemoveMenu(cli.hMenuMain, 0, MF_BYPOSITION);
@@ -1035,7 +1035,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (cli.hwndStatus) {
DestroyWindow(cli.hwndStatus);
- cli.hwndStatus = NULL;
+ cli.hwndStatus = nullptr;
}
// Disconnect all protocols
diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp index 7f4ac5ec1d..1989188407 100644 --- a/src/mir_app/src/cluiservices.cpp +++ b/src/mir_app/src/cluiservices.cpp @@ -41,31 +41,31 @@ EXTERN_C MIR_APP_DLL(void) Clist_GroupAdded(MGROUP hGroup) EXTERN_C MIR_APP_DLL(void) Clist_EndRebuild(void)
{
- if (cli.hwndContactTree == NULL)
+ if (cli.hwndContactTree == nullptr)
return;
bool bRebuild = false;
LONG_PTR dwStyle = GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE);
// CLC does this automatically, but we need to force it if hideoffline or hideempty has changed
- if ((db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) == 0) != ((dwStyle & CLS_HIDEOFFLINE) == 0)) {
- if (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT))
+ if ((db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) == 0) != ((dwStyle & CLS_HIDEOFFLINE) == 0)) {
+ if (db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT))
dwStyle |= CLS_HIDEOFFLINE;
else
dwStyle &= ~CLS_HIDEOFFLINE;
bRebuild = true;
}
- if ((db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) == 0) != ((dwStyle & CLS_HIDEEMPTYGROUPS) == 0)) {
- if (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT))
+ if ((db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) == 0) != ((dwStyle & CLS_HIDEEMPTYGROUPS) == 0)) {
+ if (db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT))
dwStyle |= CLS_HIDEEMPTYGROUPS;
else
dwStyle &= ~CLS_HIDEEMPTYGROUPS;
bRebuild = true;
}
- if ((db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) == 0) != ((dwStyle & CLS_USEGROUPS) == 0)) {
- if (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
+ if ((db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) == 0) != ((dwStyle & CLS_USEGROUPS) == 0)) {
+ if (db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
dwStyle |= CLS_USEGROUPS;
else
dwStyle &= ~CLS_USEGROUPS;
@@ -93,18 +93,18 @@ void fnCluiProtocolStatusChanged(int, const char*) SendMessage(cli.hwndStatus, SB_GETBORDERS, 0, (LPARAM)&borders);
int *partWidths = (int*)alloca(cli.menuProtoCount * sizeof(int));
- if (db_get_b(NULL, "CLUI", "EqualSections", 0)) {
+ if (db_get_b(0, "CLUI", "EqualSections", 0)) {
RECT rc;
GetClientRect(cli.hwndStatus, &rc);
- rc.right -= borders[0] * 2 + (db_get_b(NULL, "CLUI", "ShowGrip", 1) ? GetSystemMetrics(SM_CXVSCROLL) : 0);
+ rc.right -= borders[0] * 2 + (db_get_b(0, "CLUI", "ShowGrip", 1) ? GetSystemMetrics(SM_CXVSCROLL) : 0);
for (int i = 0; i < cli.menuProtoCount; i++)
partWidths[i] = (i + 1) * rc.right / cli.menuProtoCount - (borders[2] >> 1);
}
else {
SIZE textSize;
- BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1);
+ BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1);
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendMessage(cli.hwndStatus, WM_GETFONT, 0, 0));
for (int i = 0; i < cli.menuProtoCount; i++) { //count down since built in ones tend to go at the end
int x = 2;
@@ -125,7 +125,7 @@ void fnCluiProtocolStatusChanged(int, const char*) x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
- wchar_t* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
+ wchar_t* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(0, cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
GetTextExtentPoint32(hdc, modeDescr, (int)mir_wstrlen(modeDescr), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
@@ -133,7 +133,7 @@ void fnCluiProtocolStatusChanged(int, const char*) partWidths[i] = (i ? partWidths[i - 1] : 0) + x + 2;
}
SelectObject(hdc, hFont);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
}
partWidths[cli.menuProtoCount - 1] = -1;
@@ -141,7 +141,7 @@ void fnCluiProtocolStatusChanged(int, const char*) SendMessage(cli.hwndStatus, SB_SETPARTS, cli.menuProtoCount, (LPARAM)partWidths);
int flags = SBT_OWNERDRAW;
- if (db_get_b(NULL, "CLUI", "SBarBevel", 1) == 0)
+ if (db_get_b(0, "CLUI", "SBarBevel", 1) == 0)
flags |= SBT_NOBORDERS;
for (int i = 0; i < cli.menuProtoCount; i++)
diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp index 942ef2ff8e..aa6fd06cb1 100644 --- a/src/mir_app/src/colorchooser.cpp +++ b/src/mir_app/src/colorchooser.cpp @@ -110,8 +110,8 @@ public: m_yPosition -= height;
m_text.SetText(m_bForeground ? TranslateT("Text color") : TranslateT("Background color"));
- SetWindowPos(m_text.GetHwnd(), NULL, 0, 0, width, 20, 0);
- SetWindowPos(m_hwnd, NULL, m_xPosition, m_yPosition, width, height, SWP_SHOWWINDOW);
+ SetWindowPos(m_text.GetHwnd(), nullptr, 0, 0, width, 20, 0);
+ SetWindowPos(m_hwnd, nullptr, m_xPosition, m_yPosition, width, height, SWP_SHOWWINDOW);
}
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
@@ -130,7 +130,7 @@ public: break;
case WM_LBUTTONUP:
- if (iCurrentHotTrack >= 0 && iCurrentHotTrack < m_pModule->nColorCount && m_hwndTarget != NULL) {
+ if (iCurrentHotTrack >= 0 && iCurrentHotTrack < m_pModule->nColorCount && m_hwndTarget != nullptr) {
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = 0;
diff --git a/src/mir_app/src/contact.cpp b/src/mir_app/src/contact.cpp index 685ee57530..a09a5a08f9 100644 --- a/src/mir_app/src/contact.cpp +++ b/src/mir_app/src/contact.cpp @@ -30,14 +30,14 @@ extern HANDLE hGroupChangeEvent; static int GetContactStatus(MCONTACT hContact) { char *szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) return ID_STATUS_OFFLINE; return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); } void fnLoadContactTree(void) { - int hideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); + int hideOffline = db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { int status = GetContactStatus(hContact); if ((!hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0)) @@ -46,14 +46,14 @@ void fnLoadContactTree(void) Clist_EndRebuild(); } -MIR_APP_DLL(int) Clist_ContactChangeGroup(MCONTACT hContact, MGROUP hGroup)
+MIR_APP_DLL(int) Clist_ContactChangeGroup(MCONTACT hContact, MGROUP hGroup) { - CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, NULL }; + CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), nullptr, nullptr }; - if (hGroup == NULL) + if (hGroup == 0) db_unset(hContact, "CList", "Group"); else { - grpChg.pszNewName = Clist_GroupGetName(hGroup, NULL); + grpChg.pszNewName = Clist_GroupGetName(hGroup, nullptr); db_set_ws(hContact, "CList", "Group", grpChg.pszNewName); } @@ -64,12 +64,12 @@ MIR_APP_DLL(int) Clist_ContactChangeGroup(MCONTACT hContact, MGROUP hGroup) int fnSetHideOffline(int iValue) { if (iValue == -1) // invert the current value - iValue = !db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); + iValue = !db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); switch (iValue) { case 0: case 1: - db_set_b(NULL, "CList", "HideOffline", iValue); + db_set_b(0, "CList", "HideOffline", iValue); break; default: diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index c61be3a3bd..2c6c4b3020 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -69,7 +69,7 @@ static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szPro }
if (db_get(hContact, szProto, szSetting, &dbv))
- return NULL;
+ return nullptr;
wchar_t buf[40];
switch (dbv.type) {
@@ -82,18 +82,18 @@ static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szPro }
db_free(&dbv);
- return NULL;
+ return nullptr;
}
MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *szProto)
{
- if (hContact == NULL && szProto == NULL)
- return NULL;
+ if (hContact == 0 && szProto == nullptr)
+ return nullptr;
- if (szProto == NULL)
+ if (szProto == nullptr)
szProto = Proto_GetBaseAccountName(hContact);
- if (szProto == NULL)
- return NULL;
+ if (szProto == nullptr)
+ return nullptr;
char *uid;
wchar_t *res;
@@ -132,7 +132,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s case CNF_CUSTOMNICK:
{
const char* saveProto = szProto; szProto = "CList";
- if (hContact != NULL && !ProcessDatabaseValueDefault(hContact, szProto, "MyHandle")) {
+ if (hContact != 0 && !ProcessDatabaseValueDefault(hContact, szProto, "MyHandle")) {
szProto = saveProto;
return 0;
}
@@ -167,7 +167,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s if (!GetDatabaseString(hContact, szProto, "LastName", &dbv2)) {
size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2;
WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len);
- if (buf != NULL)
+ if (buf != nullptr)
mir_wstrcat(mir_wstrcat(mir_wstrcpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal);
db_free(&dbv);
db_free(&dbv2);
@@ -204,8 +204,8 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s switch (nameOrder[i]) {
case 0: // custom name
// make sure we aren't in CNF_DISPLAYNC mode
- // don't get custom name for NULL contact
- if (hContact != NULL && type == CNF_DISPLAY && (res = ProcessDatabaseValueDefault(hContact, "CList", "MyHandle")) != NULL)
+ // don't get custom name for nullptr contact
+ if (hContact != 0 && type == CNF_DISPLAY && (res = ProcessDatabaseValueDefault(hContact, "CList", "MyHandle")) != nullptr)
return res;
break;
@@ -249,7 +249,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s if (!GetDatabaseString(hContact, szProto, nameOrder[i] == 6 ? "LastName" : "FirstName", &dbv2)) {
size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2;
WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len);
- if (buf != NULL)
+ if (buf != nullptr)
mir_wstrcat(mir_wstrcat(mir_wstrcpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal);
db_free(&dbv);
@@ -282,7 +282,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s break;
}
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -304,7 +304,7 @@ public: virtual void OnInitDialog()
{
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
for (int i = 0; i < _countof(nameOrderDescr); i++) {
@@ -319,13 +319,13 @@ public: TVITEMEX tvi;
tvi.hItem = m_nameOrder.GetRoot();
int i = 0;
- while (tvi.hItem != NULL) {
+ while (tvi.hItem != nullptr) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
m_nameOrder.GetItem(&tvi);
nameOrder[i++] = (BYTE)tvi.lParam;
tvi.hItem = m_nameOrder.GetNextSibling(tvi.hItem);
}
- db_set_blob(NULL, "Contact", "NameOrder", nameOrder, _countof(nameOrderDescr));
+ db_set_blob(0, "Contact", "NameOrder", nameOrder, _countof(nameOrderDescr));
cli.pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID);
}
@@ -355,7 +355,7 @@ int LoadContactsModule(void) nameOrder[i] = i;
DBVARIANT dbv;
- if (!db_get(NULL, "Contact", "NameOrder", &dbv)) {
+ if (!db_get(0, "Contact", "NameOrder", &dbv)) {
memcpy(nameOrder, dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
}
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp index 941378ed5b..d888003e12 100644 --- a/src/mir_app/src/database.cpp +++ b/src/mir_app/src/database.cpp @@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "profilemanager.h"
-MIDatabase *currDb = NULL;
-DATABASELINK *currDblink = NULL;
+MIDatabase *currDb = nullptr;
+DATABASELINK *currDblink = nullptr;
// contains the location of mirandaboot.ini
bool g_bDbCreated;
@@ -40,7 +40,7 @@ bool fileExist(const wchar_t *fname) return false;
FILE *fp = _wfopen(fname, L"r+");
- bool res = (fp != NULL);
+ bool res = (fp != nullptr);
if (fp) fclose(fp);
return res;
}
@@ -48,7 +48,7 @@ bool fileExist(const wchar_t *fname) static void fillProfileName(const wchar_t* ptszFileName)
{
const wchar_t* p = wcsrchr(ptszFileName, '\\');
- if (p == NULL)
+ if (p == nullptr)
p = ptszFileName;
else
p++;
@@ -168,13 +168,13 @@ static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_ void getProfileCmdLine(wchar_t *szProfile, size_t cch)
{
LPCTSTR ptszProfileName = CmdLine_GetOption(L"profile");
- if (ptszProfileName != NULL)
+ if (ptszProfileName != nullptr)
loadProfileByShortName(ptszProfileName, szProfile, cch);
}
void getProfileDefault(wchar_t *szProfile, size_t cch)
{
- if (g_defaultProfile != NULL) {
+ if (g_defaultProfile != nullptr) {
loadProfileByShortName(g_defaultProfile, szProfile, cch);
mir_free(g_defaultProfile);
}
@@ -206,14 +206,14 @@ static void moveProfileDirProfiles(wchar_t *profiledir, BOOL isRootDir = TRUE) mir_snwprintf(buf,
TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s\nBecause profile with this name already exists. Please resolve the issue manually."),
path, path2);
- MessageBox(NULL, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
+ MessageBox(nullptr, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
}
else if (MoveFile(path, path2) == 0) {
wchar_t buf[512];
mir_snwprintf(buf,
TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s automatically\nMost likely this is due to insufficient privileges. Please move profile manually."),
path, path2);
- MessageBox(NULL, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
+ MessageBox(nullptr, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
mir_free(profile);
break;
}
@@ -256,7 +256,7 @@ static int getProfile1(wchar_t *szProfile, size_t cch, wchar_t *profiledir, BOOL if (_waccess(newProfile, 0) != 0)
continue;
- switch (touchDatabase(newProfile, NULL)) {
+ switch (touchDatabase(newProfile, nullptr)) {
case 0:
case EGROKPRF_OBSOLETE:
if (++found == 1 && bNoDefaultProfile)
@@ -306,7 +306,7 @@ static int getProfile(wchar_t *szProfile, size_t cch) getProfileDefault(szProfile, cch);
if (IsInsideRootDir(g_profileDir, true)) {
- MessageBox(NULL,
+ MessageBox(nullptr,
TranslateT("Profile cannot be placed into Miranda root folder.\nPlease move Miranda profile to some other location."),
LPGENW("Miranda NG"), MB_ICONERROR | MB_OK);
return 0;
@@ -338,7 +338,7 @@ LBL_Show: // carefully converts a file name from wchar_t* to char*
char* makeFileName(const wchar_t* tszOriginalName)
{
- char *szResult = NULL;
+ char *szResult = nullptr;
char *szFileName = mir_u2a(tszOriginalName);
wchar_t *tszFileName = mir_a2u(szFileName);
if (mir_wstrcmp(tszOriginalName, tszFileName)) {
@@ -374,7 +374,7 @@ int touchDatabase(const wchar_t *tszProfile, DATABASELINK **dblink) }
if (dblink)
- *dblink = NULL;
+ *dblink = nullptr;
return EGROKPRF_CANTREAD;
}
@@ -405,7 +405,7 @@ int tryOpenDatabase(const wchar_t *tszProfile) // try to load database
MIDatabase *pDb = p->Load(tszProfile, FALSE);
- if (pDb == NULL)
+ if (pDb == nullptr)
return EGROKPRF_CANTREAD;
fillProfileName(tszProfile);
@@ -430,7 +430,7 @@ static int tryCreateDatabase(const wchar_t *ptszProfile) if (err == ERROR_SUCCESS) {
g_bDbCreated = true;
MIDatabase *pDb = p->Load(tszProfile, FALSE);
- if (pDb == NULL) // driver was found but smth went wrong
+ if (pDb == nullptr) // driver was found but smth went wrong
return EGROKPRF_CANTREAD;
fillProfileName(tszProfile);
@@ -495,7 +495,7 @@ int LoadDatabaseModule(void) ptszFileName = (ptszFileName) ? ptszFileName + 1 : szProfile;
if (arDbPlugins.getCount() == 0) {
- MessageBox(NULL,
+ MessageBox(nullptr,
CMStringW(FORMAT, TranslateW(tszNoDrivers), ptszFileName),
TranslateT("No profile support installed!"), MB_OK | MB_ICONERROR);
return 1;
@@ -513,7 +513,7 @@ int LoadDatabaseModule(void) // there were no suitable driver installed
if (rc == -1) {
- MessageBox(NULL,
+ MessageBox(nullptr,
CMStringW(FORMAT, TranslateW(tszNoSuitableDriver), ptszFileName),
TranslateT("Miranda can't open that profile"), MB_OK | MB_ICONERROR);
}
@@ -521,12 +521,12 @@ int LoadDatabaseModule(void) // if there were drivers but they all failed cos the file is locked, try and find the miranda which locked it
if (fileExist(szProfile)) {
// file isn't locked, just no driver could open it.
- MessageBox(NULL,
+ MessageBox(nullptr,
CMStringW(FORMAT, TranslateW(tszUnknownFormat), ptszFileName),
TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR);
}
else if (!FindMirandaForProfile(szProfile)) {
- retry = IDRETRY == MessageBox(NULL,
+ retry = IDRETRY == MessageBox(nullptr,
CMStringW(FORMAT, TranslateW(tszProfileLocked), ptszFileName),
TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR);
}
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index dac49009ce..8491a2d296 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -52,7 +52,7 @@ void UnloadEventsModule() MIR_APP_DLL(int) DbEvent_RegisterType(DBEVENTTYPEDESCR *et)
{
- if (et == NULL || et->cbSize != sizeof(DBEVENTTYPEDESCR))
+ if (et == nullptr || et->cbSize != sizeof(DBEVENTTYPEDESCR))
return -1;
if (eventTypes.getIndex(et) != -1)
@@ -102,7 +102,7 @@ static wchar_t* getEventString(DBEVENTINFO *dbei, LPSTR &buf) static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatype)
{
- if (dbei == NULL || dbei->szModule == NULL)
+ if (dbei == nullptr || dbei->szModule == nullptr)
return 0;
DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
@@ -140,11 +140,11 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
ptrW tszReason(dbei->getString(blob.get_reason()));
- text.Format(TranslateT("Authorization request from %s%s: %s"),
- (tszNick == NULL) ? cli.pfnGetContactDisplayName(blob.get_contact(), 0) : tszNick, nick, tszReason);
+ text.Format(TranslateT("Authorization request from %s%s: %s"),
+ (tszNick == nullptr) ? cli.pfnGetContactDisplayName(blob.get_contact(), 0) : tszNick, nick.c_str(), tszReason);
}
else text.Format(TranslateT("You were added by %s%s"),
- (tszNick == NULL) ? cli.pfnGetContactDisplayName(blob.get_contact(), 0) : tszNick, nick);
+ (tszNick == nullptr) ? cli.pfnGetContactDisplayName(blob.get_contact(), 0) : tszNick, nick.c_str());
return (datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
}
@@ -184,7 +184,7 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp str[dbei->cbBlob] = 0;
if (dbei->flags & DBEF_UTF) {
- WCHAR *msg = NULL;
+ WCHAR *msg = nullptr;
Utf8DecodeCP(str, codepage, &msg);
if (msg)
return (INT_PTR)msg;
@@ -196,7 +196,7 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp if (datatype == DBVT_ASCIIZ) {
char *msg = mir_strdup((char*)dbei->pBlob);
if (dbei->flags & DBEF_UTF)
- Utf8DecodeCP(msg, codepage, NULL);
+ Utf8DecodeCP(msg, codepage, nullptr);
return (INT_PTR)msg;
}
@@ -224,7 +224,7 @@ MIR_APP_DLL(HICON) DbEvent_GetIcon(DBEVENTINFO *dbei, int flags) return icon;
}
- HICON icon = NULL;
+ HICON icon = nullptr;
if (et && et->eventIcon)
icon = IcoLib_GetIconByHandle(et->eventIcon);
if (!icon) {
diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp index 50ea08cf04..0da55d9be6 100644 --- a/src/mir_app/src/db_ini.cpp +++ b/src/mir_app/src/db_ini.cpp @@ -75,14 +75,14 @@ void CInstallIniDlg::OnInitDialog() pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before changes that are known to be unsafe.");
else if (!mir_wstrcmpi(szSecurity, L"none"))
pszSecurityInfo = LPGENW("Security systems to prevent malicious changes have been disabled. You will receive no further warnings.");
- else pszSecurityInfo = NULL;
+ else pszSecurityInfo = nullptr;
if (pszSecurityInfo) m_securityInfo.SetText(TranslateW(pszSecurityInfo));
}
void CInstallIniDlg::ViewIni_OnClick(CCtrlBase*)
{
ptrW szPath(m_iniName.GetText());
- ShellExecute(m_hwnd, L"open", szPath, NULL, NULL, SW_SHOW);
+ ShellExecute(m_hwnd, L"open", szPath, nullptr, nullptr, SW_SHOW);
}
void CInstallIniDlg::NoToAll_OnClick(CCtrlBase*)
@@ -99,7 +99,7 @@ static bool IsInSpaceSeparatedList(const char *szWord, const char *szList) for (szItem = szList;;) {
szEnd = strchr(szItem, ' ');
- if (szEnd == NULL)
+ if (szEnd == nullptr)
return !mir_strcmp(szItem, szWord);
if (size_t(szEnd - szItem) == wordLen)
@@ -270,7 +270,7 @@ struct SettingsList {
char *name;
SettingsList *next;
-} *setting_items = NULL;
+} *setting_items = nullptr;
int SettingsEnumProc(const char *szSetting, LPARAM)
{
@@ -314,7 +314,7 @@ static int EnumSettingsForDeletion(const char *szSetting, LPARAM param) static void ProcessIniFile(wchar_t* szIniPath, char *szSafeSections, char *szUnsafeSections, int secur, bool secFN)
{
FILE *fp = _wfopen(szIniPath, L"rt");
- if (fp == NULL)
+ if (fp == nullptr)
return;
bool warnThisSection = false;
@@ -322,7 +322,7 @@ static void ProcessIniFile(wchar_t* szIniPath, char *szSafeSections, char *szUns while (!feof(fp)) {
char szLine[2048];
- if (fgets(szLine, sizeof(szLine), fp) == NULL)
+ if (fgets(szLine, sizeof(szLine), fp) == nullptr)
break;
LBL_NewLine:
size_t lineLength = mir_strlen(szLine);
@@ -334,7 +334,7 @@ LBL_NewLine: if (szLine[0] == '[') {
char *szEnd = strchr(szLine + 1, ']');
- if (szEnd == NULL)
+ if (szEnd == nullptr)
continue;
if (szLine[1] == '!')
@@ -362,11 +362,11 @@ LBL_NewLine: }
if (szLine[1] == '?') {
mir_strncpy(szSection, szLine + 2, min(sizeof(szSection), (int)(szEnd - szLine - 1)));
- db_enum_settings(NULL, SettingsEnumProc, szSection);
+ db_enum_settings(0, SettingsEnumProc, szSection);
while (setting_items) {
SettingsList *next = setting_items->next;
- db_unset(NULL, szSection, setting_items->name);
+ db_unset(0, szSection, setting_items->name);
mir_free(setting_items->name);
mir_free(setting_items);
@@ -380,7 +380,7 @@ LBL_NewLine: continue;
char *szValue = strchr(szLine, '=');
- if (szValue == NULL)
+ if (szValue == nullptr)
continue;
char szName[128];
@@ -408,15 +408,15 @@ LBL_NewLine: switch (szValue[0]) {
case 'b':
case 'B':
- db_set_b(NULL, szSection, szName, (BYTE)strtol(szValue + 1, NULL, 0));
+ db_set_b(0, szSection, szName, (BYTE)strtol(szValue + 1, nullptr, 0));
break;
case 'w':
case 'W':
- db_set_w(NULL, szSection, szName, (WORD)strtol(szValue + 1, NULL, 0));
+ db_set_w(0, szSection, szName, (WORD)strtol(szValue + 1, nullptr, 0));
break;
case 'd':
case 'D':
- db_set_dw(NULL, szSection, szName, (DWORD)strtoul(szValue + 1, NULL, 0));
+ db_set_dw(0, szSection, szName, (DWORD)strtoul(szValue + 1, nullptr, 0));
break;
case 'l':
case 'L':
@@ -424,22 +424,22 @@ LBL_NewLine: if (szValue[1] == '*') {
LIST<char> arSettings(1);
ESFDParam param = { &arSettings, szName };
- db_enum_settings(NULL, EnumSettingsForDeletion, szSection, ¶m);
+ db_enum_settings(0, EnumSettingsForDeletion, szSection, ¶m);
while (arSettings.getCount()) {
- db_unset(NULL, szSection, arSettings[0]);
+ db_unset(0, szSection, arSettings[0]);
mir_free(arSettings[0]);
arSettings.remove(0);
}
}
- db_unset(NULL, szSection, szName);
+ db_unset(0, szSection, szName);
break;
case 'e':
case 'E':
ConvertBackslashes(szValue + 1, Langpack_GetDefaultCodePage());
case 's':
case 'S':
- db_set_s(NULL, szSection, szName, szValue + 1);
+ db_set_s(0, szSection, szName, szValue + 1);
break;
case 'g':
case 'G':
@@ -456,26 +456,26 @@ LBL_NewLine: }
case 'u':
case 'U':
- db_set_utf(NULL, szSection, szName, szValue + 1);
+ db_set_utf(0, szSection, szName, szValue + 1);
break;
case 'm':
case 'M':
{
CMStringA memo(szValue + 1);
memo.Append("\r\n");
- while (fgets(szLine, sizeof(szLine), fp) != NULL) {
+ while (fgets(szLine, sizeof(szLine), fp) != nullptr) {
switch (szLine[0]) {
case 0: case '\r': case '\n': case ' ': case '\t':
break;
default:
- db_set_utf(NULL, szSection, szName, memo);
+ db_set_utf(0, szSection, szName, memo);
goto LBL_NewLine;
}
memo.Append(rtrim(szLine + 1));
memo.Append("\r\n");
}
- db_set_utf(NULL, szSection, szName, memo);
+ db_set_utf(0, szSection, szName, memo);
}
break;
case 'n':
@@ -493,14 +493,14 @@ LBL_NewLine: break;
pszValue = pszEnd;
}
- db_set_blob(NULL, szSection, szName, buf, len);
+ db_set_blob(0, szSection, szName, buf, len);
mir_free(buf);
}
break;
default:
wchar_t buf[250];
mir_snwprintf(buf, TranslateT("Invalid setting type for '%s'. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), _A2T(szName));
- MessageBox(NULL, buf, TranslateT("Install database settings"), MB_ICONWARNING | MB_OK);
+ MessageBox(nullptr, buf, TranslateT("Install database settings"), MB_ICONWARNING | MB_OK);
break;
}
}
@@ -542,7 +542,7 @@ static void DoAutoExec(void) return;
wchar_t *str2 = wcsrchr(szFindPath, '\\');
- if (str2 == NULL)
+ if (str2 == nullptr)
szFindPath[0] = 0;
else
str2[1] = 0;
diff --git a/src/mir_app/src/db_intf.cpp b/src/mir_app/src/db_intf.cpp index 45d5015888..cf35491ddf 100644 --- a/src/mir_app/src/db_intf.cpp +++ b/src/mir_app/src/db_intf.cpp @@ -31,7 +31,7 @@ LIST<DATABASELINK> arDbPlugins(5); MIR_APP_DLL(void) RegisterDatabasePlugin(DATABASELINK *pDescr)
{
- if (pDescr != NULL)
+ if (pDescr != nullptr)
arDbPlugins.insert(pDescr);
}
@@ -43,20 +43,20 @@ MIR_APP_DLL(DATABASELINK*) FindDatabasePlugin(const wchar_t *ptszFileName) return arDbPlugins[i];
}
- return NULL;
+ return nullptr;
}
MIR_APP_DLL(void) InitDbInstance(MIDatabase *pDatabase)
{
- if (pDatabase != NULL)
+ if (pDatabase != nullptr)
pDatabase->m_cache = new MDatabaseCache(pDatabase->GetContactSize());
}
MIR_APP_DLL(void) DestroyDbInstance(MIDatabase *pDatabase)
{
- if (pDatabase != NULL) {
+ if (pDatabase != nullptr) {
MDatabaseCache *pCache = (MDatabaseCache*)pDatabase->m_cache;
- pDatabase->m_cache = NULL;
+ pDatabase->m_cache = nullptr;
delete pCache;
}
}
diff --git a/src/mir_app/src/descbutton.cpp b/src/mir_app/src/descbutton.cpp index 066dc30ff3..52027d6676 100644 --- a/src/mir_app/src/descbutton.cpp +++ b/src/mir_app/src/descbutton.cpp @@ -72,7 +72,7 @@ int LoadDescButtonModule() wc.cbSize = sizeof(wc);
wc.lpszClassName = MIRANDADESCBUTTONCLASS;
wc.lpfnWndProc = MDescButtonWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_HAND);
+ wc.hCursor = LoadCursor(nullptr, IDC_HAND);
wc.cbWndExtra = sizeof(MDescButtonCtrl *);
wc.hbrBackground = 0; //GetStockObject(WHITE_BRUSH);
wc.style = CS_GLOBALCLASS | CS_SAVEBITS;
@@ -221,7 +221,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (msg) {
case WM_NCCREATE:
dat = (MDescButtonCtrl*)mir_alloc(sizeof(MDescButtonCtrl));
- if (dat == NULL)
+ if (dat == nullptr)
return FALSE;
memset(dat, 0, sizeof(MDescButtonCtrl));
@@ -252,13 +252,13 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara tme.hwndTrack = hwndDlg;
_TrackMouseEvent(&tme);
dat->bMouseInside = TRUE;
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
}
return 0;
case WM_MOUSELEAVE:
dat->bMouseInside = FALSE;
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
return 0;
case WM_LBUTTONUP:
@@ -269,7 +269,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara return 1;
case WM_NCPAINT:
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
break;
case WM_PAINT:
@@ -283,7 +283,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara dat->lpzTitle = mir_wstrdup((WCHAR *)lParam);
else
dat->lpzTitle = mir_a2u((char *)lParam);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
return TRUE;
case DBCM_SETDESCRIPTION:
@@ -293,7 +293,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara dat->lpzDescription = mir_wstrdup((WCHAR *)lParam);
else
dat->lpzDescription = mir_a2u((char *)lParam);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
return TRUE;
case DBCM_SETICON:
@@ -308,7 +308,7 @@ static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wPara dat->bSharedIcon = FALSE;
dat->hIcon = CopyIcon((HICON)lParam);
}
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
return TRUE;
case WM_DESTROY:
diff --git a/src/mir_app/src/dll_sniffer.cpp b/src/mir_app/src/dll_sniffer.cpp index af3c9e413c..78bcb555a6 100644 --- a/src/mir_app/src/dll_sniffer.cpp +++ b/src/mir_app/src/dll_sniffer.cpp @@ -31,20 +31,20 @@ static IMAGE_SECTION_HEADER *getSectionByRVA(IMAGE_SECTION_HEADER *pISH, int nSe if (pIDD->VirtualAddress >= pISH->VirtualAddress && pIDD->VirtualAddress + pIDD->Size <= pISH->VirtualAddress + pISH->SizeOfRawData )
return pISH;
- return NULL;
+ return nullptr;
}
MUUID* GetPluginInterfaces(const wchar_t* ptszFileName, bool& bIsPlugin)
{
bIsPlugin = false;
- HANDLE hFile = CreateFile( ptszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
+ HANDLE hFile = CreateFile( ptszFileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr );
if (hFile == INVALID_HANDLE_VALUE)
- return NULL;
+ return nullptr;
- MUUID* pResult = NULL;
- BYTE* ptr = NULL;
- HANDLE hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL );
+ MUUID* pResult = nullptr;
+ BYTE* ptr = nullptr;
+ HANDLE hMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, 0, nullptr );
__try {
__try {
@@ -59,7 +59,7 @@ MUUID* GetPluginInterfaces(const wchar_t* ptszFileName, bool& bIsPlugin) __leave;
ptr = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
- if (ptr == NULL)
+ if (ptr == nullptr)
__leave;
PIMAGE_NT_HEADERS pINTH = { 0 };
@@ -111,7 +111,7 @@ MUUID* GetPluginInterfaces(const wchar_t* ptszFileName, bool& bIsPlugin) WORD *ptrOrdRVA = (WORD*)&pSecStart[pED->AddressOfNameOrdinals];
DWORD *ptrFuncList = (DWORD*)&pSecStart[pED->AddressOfFunctions];
- MUUID* pIds = NULL;
+ MUUID* pIds = nullptr;
bool bHasLoad = false, bHasUnload = false, bHasInfo = false, bHasMuuids = false;
for (size_t i=0; i < pED->NumberOfNames; i++, ptrRVA++, ptrOrdRVA++) {
char *szName = (char*)&pSecStart[*ptrRVA];
diff --git a/src/mir_app/src/encrypt.cpp b/src/mir_app/src/encrypt.cpp index 05421e1fa7..6e8d2996af 100644 --- a/src/mir_app/src/encrypt.cpp +++ b/src/mir_app/src/encrypt.cpp @@ -35,7 +35,7 @@ static LIST<CRYPTO_PROVIDER> arProviders(5, CompareFunc); static INT_PTR srvRegister(WPARAM wParam, LPARAM lParam)
{
CRYPTO_PROVIDER *p = (CRYPTO_PROVIDER*)lParam;
- if (p == NULL || p->dwSize != sizeof(CRYPTO_PROVIDER))
+ if (p == nullptr || p->dwSize != sizeof(CRYPTO_PROVIDER))
return 1;
CRYPTO_PROVIDER *pNew = new CRYPTO_PROVIDER(*p);
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp index a3c8db0827..3dbfdbd4c6 100644 --- a/src/mir_app/src/enterstring.cpp +++ b/src/mir_app/src/enterstring.cpp @@ -57,8 +57,8 @@ static void ComboLoadRecentStrings(HWND hwndDlg, EnterStringFormParam *pForm) for (int i = 0; i < pForm->recentCount; i++) {
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "%s%d", pForm->szDataPrefix, i);
- ptrW tszRecent(db_get_wsa(NULL, pForm->szModuleName, setting));
- if (tszRecent != NULL)
+ ptrW tszRecent(db_get_wsa(0, pForm->szModuleName, setting));
+ if (tszRecent != nullptr)
SendDlgItemMessage(hwndDlg, pForm->idcControl, CB_ADDSTRING, 0, tszRecent);
}
@@ -80,11 +80,11 @@ static void ComboAddRecentString(HWND hwndDlg, EnterStringFormParam *pForm) if ((id = SendDlgItemMessage(hwndDlg, pForm->idcControl, CB_FINDSTRING, (WPARAM)-1, (LPARAM)L"")) != CB_ERR)
SendDlgItemMessage(hwndDlg, pForm->idcControl, CB_DELETESTRING, id, 0);
- id = db_get_b(NULL, pForm->szModuleName, pForm->szDataPrefix, 0);
+ id = db_get_b(0, pForm->szModuleName, pForm->szDataPrefix, 0);
char setting[MAXMODULELABELLENGTH];
mir_snprintf(setting, "%s%d", pForm->szDataPrefix, id);
- db_set_ws(NULL, pForm->szModuleName, setting, string);
- db_set_b(NULL, pForm->szModuleName, pForm->szDataPrefix, (id + 1) % pForm->idcControl);
+ db_set_ws(0, pForm->szModuleName, setting, string);
+ db_set_b(0, pForm->szModuleName, pForm->szDataPrefix, (id + 1) % pForm->idcControl);
}
static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -110,7 +110,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa params->idcControl = IDC_TXT_MULTILINE;
params->height = 0;
rc.bottom += (rc.bottom - rc.top) * 2;
- SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION);
+ SetWindowPos(hwndDlg, nullptr, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION);
break;
case ESF_COMBO:
@@ -126,7 +126,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SendDlgItemMessage(hwndDlg, IDC_TXT_RICHEDIT, EM_SETEVENTMASK, 0, ENM_LINK);
params->height = 0;
rc.bottom += (rc.bottom - rc.top) * 2;
- SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION);
+ SetWindowPos(hwndDlg, nullptr, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION);
break;
}
}
@@ -135,12 +135,12 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SetDlgItemText(hwndDlg, params->idcControl, params->ptszInitVal);
if (params->szDataPrefix)
- Utils_RestoreWindowPosition(hwndDlg, NULL, params->szModuleName, params->szDataPrefix);
+ Utils_RestoreWindowPosition(hwndDlg, 0, params->szModuleName, params->szDataPrefix);
- SetTimer(hwndDlg, 1000, 50, NULL);
+ SetTimer(hwndDlg, 1000, 50, nullptr);
if (params->timeout > 0) {
- SetTimer(hwndDlg, 1001, 1000, NULL);
+ SetTimer(hwndDlg, 1001, 1000, nullptr);
wchar_t buf[128];
mir_snwprintf(buf, TranslateT("OK (%d)"), params->timeout);
SetDlgItemText(hwndDlg, IDOK, buf);
@@ -223,7 +223,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa case IDCANCEL:
if (params->szDataPrefix)
- Utils_SaveWindowPosition(hwndDlg, NULL, params->szModuleName, params->szDataPrefix);
+ Utils_SaveWindowPosition(hwndDlg, 0, params->szModuleName, params->szDataPrefix);
EndDialog(hwndDlg, 0);
break;
@@ -237,7 +237,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa if ((params->type == ESF_COMBO) && params->szDataPrefix && params->recentCount)
ComboAddRecentString(hwndDlg, params);
if (params->szDataPrefix)
- Utils_SaveWindowPosition(hwndDlg, NULL, params->szModuleName, params->szDataPrefix);
+ Utils_SaveWindowPosition(hwndDlg, 0, params->szModuleName, params->szDataPrefix);
EndDialog(hwndDlg, 1);
break;
@@ -250,7 +250,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa INT_PTR __cdecl svcEnterString(WPARAM, LPARAM lParam)
{
ENTER_STRING *pForm = (ENTER_STRING*)lParam;
- if (pForm == NULL || pForm->cbSize != sizeof(ENTER_STRING))
+ if (pForm == nullptr || pForm->cbSize != sizeof(ENTER_STRING))
return FALSE;
EnterStringFormParam param;
diff --git a/src/mir_app/src/extracticon.cpp b/src/mir_app/src/extracticon.cpp index c9e4363866..20557326cb 100644 --- a/src/mir_app/src/extracticon.cpp +++ b/src/mir_app/src/extracticon.cpp @@ -62,14 +62,14 @@ void* _RelativeVirtualAddresstoPtr(IMAGE_DOS_HEADER *pDosHeader, DWORD rva) return (LPBYTE)pDosHeader + cSection->PointerToRawData + (rva - cSection->VirtualAddress);
}
- return NULL;
+ return nullptr;
}
void* _GetResourceTable(IMAGE_DOS_HEADER* pDosHeader)
{
IMAGE_NT_HEADERS *pPE = (IMAGE_NT_HEADERS*)((BYTE*)pDosHeader + pDosHeader->e_lfanew);
if (pPE->Signature != IMAGE_NT_SIGNATURE || pPE->FileHeader.SizeOfOptionalHeader < 2)
- return NULL;
+ return nullptr;
// The DataDirectory is an array of 16 structures.
// Each array entry has a predefined meaning for what it refers to.
@@ -86,7 +86,7 @@ void* _GetResourceTable(IMAGE_DOS_HEADER* pDosHeader) break;
}
- return NULL;
+ return nullptr;
}
IMAGE_RESOURCE_DIRECTORY_ENTRY* _FindResourceBase(void *prt, DWORD resType, int *pCount)
@@ -104,7 +104,7 @@ IMAGE_RESOURCE_DIRECTORY_ENTRY* _FindResourceBase(void *prt, DWORD resType, int break;
if (i == count)
- return NULL;
+ return nullptr;
pDir = (IMAGE_RESOURCE_DIRECTORY*)((LPBYTE)prt + (pRes[i].OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY));
count = pDir->NumberOfIdEntries + pDir->NumberOfNamedEntries;
@@ -132,7 +132,7 @@ void* _FindResource(IMAGE_DOS_HEADER *pDosHeader, void *prt, int resIndex, DWORD else index = resIndex;
if (index >= count)
- return NULL;
+ return nullptr;
if (pRes[index].OffsetToData & IMAGE_RESOURCE_DATA_IS_DIRECTORY) {
IMAGE_RESOURCE_DIRECTORY* pDir;
@@ -142,7 +142,7 @@ void* _FindResource(IMAGE_DOS_HEADER *pDosHeader, void *prt, int resIndex, DWORD }
if (pRes[index].OffsetToData & IMAGE_RESOURCE_DATA_IS_DIRECTORY)
- return NULL;
+ return nullptr;
IMAGE_RESOURCE_DATA_ENTRY *pEntry = (IMAGE_RESOURCE_DATA_ENTRY*)((LPBYTE)prt + pRes[index].OffsetToData);
*pcbSize = pEntry->Size;
@@ -152,14 +152,14 @@ void* _FindResource(IMAGE_DOS_HEADER *pDosHeader, void *prt, int resIndex, DWORD UINT _ExtractFromExe(HANDLE hFile, int iconIndex, int cxIconSize, int cyIconSize, HICON *phicon, UINT flags)
{
int retval = 0;
- DWORD fileLen = GetFileSize(hFile, NULL);
+ DWORD fileLen = GetFileSize(hFile, nullptr);
- HANDLE pFile = NULL, hFileMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- if (hFileMap == NULL)
+ HANDLE pFile = nullptr, hFileMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, 0, nullptr);
+ if (hFileMap == nullptr)
goto cleanup;
pFile = MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, 0);
- if (pFile == NULL)
+ if (pFile == nullptr)
goto cleanup;
IMAGE_DOS_HEADER *pDosHeader = (IMAGE_DOS_HEADER*)(void*)pFile;
@@ -209,7 +209,7 @@ UINT _ExtractFromICO(LPCTSTR pFileName, int iconIndex, int cxIcon, int cyIcon, H return 1;
flags |= LR_LOADFROMFILE;
- HICON hicon = (HICON)LoadImage(NULL, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags);
+ HICON hicon = (HICON)LoadImage(nullptr, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags);
if (!hicon)
return 0;
@@ -221,23 +221,23 @@ UINT _ExtractIconEx(LPCTSTR lpszFile, int iconIndex, int cxIcon, int cyIcon, HIC {
UINT res = 0;
if (cxIcon == g_iIconX && cyIcon == g_iIconY)
- res = ExtractIconEx(lpszFile, iconIndex, phicon, NULL, 1);
+ res = ExtractIconEx(lpszFile, iconIndex, phicon, nullptr, 1);
else if (cxIcon == g_iIconSX && cyIcon == g_iIconSY)
- res = ExtractIconEx(lpszFile, iconIndex, NULL, phicon, 1);
+ res = ExtractIconEx(lpszFile, iconIndex, nullptr, phicon, 1);
else if (cxIcon == 0 || cyIcon == 0)
- res = ExtractIconEx(lpszFile, iconIndex, NULL, phicon, 1);
+ res = ExtractIconEx(lpszFile, iconIndex, nullptr, phicon, 1);
// check if the api succeded, if not try our method too
if (res)
return res;
- HANDLE hFile = CreateFile(lpszFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ HANDLE hFile = CreateFile(lpszFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (hFile == INVALID_HANDLE_VALUE)
return 0;
// failed to read file signature
DWORD read = 0;
WORD magic[6];
- if (!ReadFile(hFile, &magic, sizeof(magic), &read, NULL) || (read != sizeof(magic))) {
+ if (!ReadFile(hFile, &magic, sizeof(magic), &read, nullptr) || (read != sizeof(magic))) {
CloseHandle(hFile);
return 0;
}
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp index acd8b32eac..f701d94064 100644 --- a/src/mir_app/src/extraicons.cpp +++ b/src/mir_app/src/extraicons.cpp @@ -96,7 +96,7 @@ ExtraIcon* GetExtraIcon(HANDLE id) {
int i = (INT_PTR)id;
if (i < 1 || i > extraIconsByHandle.getCount())
- return NULL;
+ return nullptr;
return extraIconsByHandle[i-1];
}
@@ -108,7 +108,7 @@ ExtraIcon* GetExtraIconBySlot(int slot) if (extra->getSlot() == slot)
return extra;
}
- return NULL;
+ return nullptr;
}
BaseExtraIcon* GetExtraIconByName(const char *name)
@@ -118,16 +118,16 @@ BaseExtraIcon* GetExtraIconByName(const char *name) if (mir_strcmp(name, extra->getName()) == 0)
return extra;
}
- return NULL;
+ return nullptr;
}
static void LoadGroups(LIST<ExtraIconGroup> &groups)
{
- int count = db_get_w(NULL, MODULE_NAME "Groups", "Count", 0);
+ int count = db_get_w(0, MODULE_NAME "Groups", "Count", 0);
for (int i=0; i < count; i++) {
char setting[512];
mir_snprintf(setting, "%d_count", i);
- unsigned int items = db_get_w(NULL, MODULE_NAME "Groups", setting, 0);
+ unsigned int items = db_get_w(0, MODULE_NAME "Groups", setting, 0);
if (items < 1)
continue;
@@ -136,12 +136,12 @@ static void LoadGroups(LIST<ExtraIconGroup> &groups) for (unsigned int j = 0; j < items; j++) {
mir_snprintf(setting, "%d_%d", i, j);
- ptrA szIconName(db_get_sa(NULL, MODULE_NAME "Groups", setting));
+ ptrA szIconName(db_get_sa(0, MODULE_NAME "Groups", setting));
if (IsEmpty(szIconName))
continue;
BaseExtraIcon *extra = GetExtraIconByName(szIconName);
- if (extra == NULL)
+ if (extra == nullptr)
continue;
group->m_items.insert(extra);
@@ -167,7 +167,7 @@ static ExtraIconGroup* IsInGroup(LIST<ExtraIconGroup> &groups, BaseExtraIcon *ex return group;
}
}
- return NULL;
+ return nullptr;
}
void RebuildListsBasedOnGroups(LIST<ExtraIconGroup> &groups)
@@ -241,7 +241,7 @@ int ClistExtraListRebuild(WPARAM, LPARAM) int ClistExtraImageApply(WPARAM hContact, LPARAM)
{
- if (hContact == NULL)
+ if (hContact == 0)
return 0;
clistApplyAlreadyCalled = TRUE;
@@ -254,7 +254,7 @@ int ClistExtraImageApply(WPARAM hContact, LPARAM) int ClistExtraClick(WPARAM hContact, LPARAM lParam)
{
- if (hContact == NULL)
+ if (hContact == 0)
return 0;
int clistSlot = (int)lParam;
@@ -289,7 +289,7 @@ MIR_APP_DLL(HANDLE) ExtraIcon_AddIcon(HICON hIcon) void fnReloadExtraIcons()
{
- SendMessage(cli.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(NULL,"CLUI","ExtraColumnSpace",18), 0);
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(0,"CLUI","ExtraColumnSpace",18), 0);
SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, 0);
if (hExtraImageList)
@@ -315,7 +315,7 @@ void fnSetAllExtraIcons(MCONTACT hContact) SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
- if (hContact == NULL)
+ if (hContact == 0)
hContact = db_find_first();
for (; hContact; hContact = db_find_next(hContact)) {
@@ -324,7 +324,7 @@ void fnSetAllExtraIcons(MCONTACT hContact) break;
}
- cli.pfnInvalidateRect(cli.hwndContactTree, NULL, FALSE);
+ cli.pfnInvalidateRect(cli.hwndContactTree, nullptr, FALSE);
}
///////////////////////////////////////////////////////////////////////////////
@@ -334,15 +334,15 @@ static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags, int {
char setting[512];
mir_snprintf(setting, "Position_%s", name);
- extra->setPosition(db_get_w(NULL, MODULE_NAME, setting, 1000));
+ extra->setPosition(db_get_w(0, MODULE_NAME, setting, 1000));
mir_snprintf(setting, "Slot_%s", name);
- int slot = db_get_w(NULL, MODULE_NAME, setting, -100);
+ int slot = db_get_w(0, MODULE_NAME, setting, -100);
if (slot == EMPTY_EXTRA_ICON)
slot = -1;
else if (slot == -100) {
if (flags & EIF_DISABLED_BY_DEFAULT) {
- db_set_w(NULL, MODULE_NAME, setting, EMPTY_EXTRA_ICON);
+ db_set_w(0, MODULE_NAME, setting, EMPTY_EXTRA_ICON);
slot = -1;
}
else slot = 1;
@@ -358,7 +358,7 @@ static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags, int LoadGroups(groups);
ExtraIconGroup *group = IsInGroup(groups, extra);
- if (group != NULL)
+ if (group != nullptr)
RebuildListsBasedOnGroups(groups);
else {
for (int i = 0; i < groups.getCount(); i++)
@@ -367,7 +367,7 @@ static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags, int extraIconsBySlot.insert(extra);
}
- if (slot >= 0 || group != NULL) {
+ if (slot >= 0 || group != nullptr) {
if (clistRebuildAlreadyCalled)
extra->rebuildIcons();
@@ -394,18 +394,18 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const if (IsEmpty(name) || IsEmpty(description))
return 0;
- if (ApplyIcon == NULL || RebuildIcons == NULL)
+ if (ApplyIcon == nullptr || RebuildIcons == nullptr)
return 0;
// no way to merge
- if (GetExtraIconByName(name) != NULL)
+ if (GetExtraIconByName(name) != nullptr)
return 0;
ptrW tszDesc(mir_a2u(description));
wchar_t *desc = TranslateW_LP(tszDesc, _hLang);
int id = registeredExtraIcons.getCount() + 1;
- BaseExtraIcon *extra = new CallbackExtraIcon(id, name, desc, descIcon == NULL ? "" : descIcon, RebuildIcons, ApplyIcon, OnClick, onClickParam);
+ BaseExtraIcon *extra = new CallbackExtraIcon(id, name, desc, descIcon == nullptr ? "" : descIcon, RebuildIcons, ApplyIcon, OnClick, onClickParam);
EI_PostCreate(extra, name, flags, _hLang);
return (HANDLE)id;
}
@@ -420,7 +420,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch wchar_t *desc = TranslateW_LP(tszDesc, _hLang);
BaseExtraIcon *extra = GetExtraIconByName(name);
- if (extra != NULL) {
+ if (extra != nullptr) {
if (extra->getType() != EXTRAICON_TYPE_ICOLIB)
return 0;
@@ -435,7 +435,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch if (!IsEmpty(descIcon))
extra->setDescIcon(descIcon);
- if (OnClick != NULL)
+ if (OnClick != nullptr)
extra->setOnClick(OnClick, onClickParam);
if (extra->getSlot() > 0) {
@@ -449,7 +449,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch }
int id = registeredExtraIcons.getCount() + 1;
- extra = new IcolibExtraIcon(id, name, desc, descIcon == NULL ? "" : descIcon, OnClick, onClickParam);
+ extra = new IcolibExtraIcon(id, name, desc, descIcon == nullptr ? "" : descIcon, OnClick, onClickParam);
EI_PostCreate(extra, name, flags, _hLang);
return (HANDLE)id;
}
@@ -458,11 +458,11 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch MIR_APP_DLL(int) ExtraIcon_SetIcon(HANDLE hExtraIcon, MCONTACT hContact, HANDLE hImage)
{
- if (hExtraIcon == NULL || hContact == NULL)
+ if (hExtraIcon == nullptr || hContact == 0)
return -1;
ExtraIcon *extra = GetExtraIcon(hExtraIcon);
- if (extra == NULL)
+ if (extra == nullptr)
return -1;
return extra->setIcon((INT_PTR)hExtraIcon, hContact, hImage);
@@ -470,11 +470,11 @@ MIR_APP_DLL(int) ExtraIcon_SetIcon(HANDLE hExtraIcon, MCONTACT hContact, HANDLE MIR_APP_DLL(int) ExtraIcon_SetIconByName(HANDLE hExtraIcon, MCONTACT hContact, const char *icoName)
{
- if (hExtraIcon == NULL || hContact == NULL)
+ if (hExtraIcon == nullptr || hContact == 0)
return -1;
ExtraIcon *extra = GetExtraIcon(hExtraIcon);
- if (extra == NULL)
+ if (extra == nullptr)
return -1;
return extra->setIconByName((INT_PTR)hExtraIcon, hContact, icoName);
@@ -482,14 +482,14 @@ MIR_APP_DLL(int) ExtraIcon_SetIconByName(HANDLE hExtraIcon, MCONTACT hContact, c MIR_APP_DLL(int) ExtraIcon_Clear(HANDLE hExtraIcon, MCONTACT hContact)
{
- if (hExtraIcon == NULL || hContact == NULL)
+ if (hExtraIcon == nullptr || hContact == 0)
return -1;
ExtraIcon *extra = GetExtraIcon(hExtraIcon);
- if (extra == NULL)
+ if (extra == nullptr)
return -1;
- return extra->setIcon((INT_PTR)hExtraIcon, hContact, NULL);
+ return extra->setIcon((INT_PTR)hExtraIcon, hContact, nullptr);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/extraicons.h b/src/mir_app/src/extraicons.h index 64ce02c28d..3796a3e96b 100644 --- a/src/mir_app/src/extraicons.h +++ b/src/mir_app/src/extraicons.h @@ -47,7 +47,7 @@ void fnSetAllExtraIcons(MCONTACT hContact); static inline BOOL IsEmpty(const char *str)
{
- return str == NULL || str[0] == 0;
+ return str == nullptr || str[0] == 0;
}
#endif // __COMMONS_H__
diff --git a/src/mir_app/src/filter.cpp b/src/mir_app/src/filter.cpp index 7e24525e21..93544fd63c 100644 --- a/src/mir_app/src/filter.cpp +++ b/src/mir_app/src/filter.cpp @@ -32,7 +32,7 @@ void AddFilterString(const PageHash key, wchar_t *data) if (ContainsFilterString(key, data)) return;
CPageKeywords * values = filterStrings[key];
- if (values == NULL) {
+ if (values == nullptr) {
values = new CPageKeywords(key);
filterStrings.insert(values);
}
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 1400b1c9eb..e5af7a106a 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -30,9 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HM_SEARCHACK (WM_USER+10) #define M_SETGROUPVISIBILITIES (WM_USER+11) -static HWND hwndFindAdd = NULL; +static HWND hwndFindAdd = nullptr; static HANDLE hHookModulesLoaded = 0; -static HGENMENU hMainMenuItem = NULL; +static HGENMENU hMainMenuItem = nullptr; static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam); static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) @@ -136,7 +136,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) /* draw everything before the pivot */ int x = *pivot; while (x > (-height)) { - MoveToEx(hMemDC, x + height2, 0, NULL); + MoveToEx(hMemDC, x + height2, 0, nullptr); LineTo(hMemDC, x - height2, height); x -= 12; } @@ -144,7 +144,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) /* draw everything after the pivot */ x = *pivot; while (x < width + height) { - MoveToEx(hMemDC, x + height2, 0, NULL); + MoveToEx(hMemDC, x + height2, 0, nullptr); LineTo(hMemDC, x - height2, height); x += 12; } @@ -157,9 +157,9 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) DeleteObject(SelectObject(hMemDC, hPen)); /* cap the top and bottom */ hPen = (HPEN)SelectObject(hMemDC, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE))); - MoveToEx(hMemDC, 0, 0, NULL); + MoveToEx(hMemDC, 0, 0, nullptr); LineTo(hMemDC, width, 0); - MoveToEx(hMemDC, 0, height - 1, NULL); + MoveToEx(hMemDC, 0, height - 1, nullptr); LineTo(hMemDC, width, height - 1); /* select in the old pen and delete the new pen */ DeleteObject(SelectObject(hMemDC, hPen)); @@ -181,7 +181,7 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) static void StartThrobber(HWND hwndDlg, FindAddDlgData *dat) { dat->throbbing = 1; - SetTimer(hwndDlg, TIMERID_THROBBER, 25, NULL); + SetTimer(hwndDlg, TIMERID_THROBBER, 25, nullptr); } static void StopThrobber(HWND hwndDlg, FindAddDlgData *dat) @@ -189,7 +189,7 @@ static void StopThrobber(HWND hwndDlg, FindAddDlgData *dat) KillTimer(hwndDlg, TIMERID_THROBBER); dat->throbbing = 0; dat->pivot = 0; - InvalidateRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), nullptr, FALSE); } static LRESULT CALLBACK AdvancedSearchDlgSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -215,27 +215,27 @@ static LRESULT CALLBACK AdvancedSearchDlgSubclassProc(HWND hwndDlg, UINT msg, WP static void ShowAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat) { char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); - if (szProto == NULL) + if (szProto == nullptr) return; - if (dat->hwndAdvSearch == NULL) { + if (dat->hwndAdvSearch == nullptr) { RECT rc; - dat->hwndAdvSearch = (HWND)CallProtoServiceInt(NULL, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg); - if (dat->hwndAdvSearch != NULL) + dat->hwndAdvSearch = (HWND)CallProtoServiceInt(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg); + if (dat->hwndAdvSearch != nullptr) mir_subclassWindow(dat->hwndAdvSearch, AdvancedSearchDlgSubclassProc); GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULTS), &rc); SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } AnimateWindow(dat->hwndAdvSearch, 150, AW_ACTIVATE | AW_SLIDE | AW_HOR_POSITIVE); - RedrawWindow(dat->hwndAdvSearch, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(dat->hwndAdvSearch, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); CheckDlgButton(hwndDlg, IDC_ADVANCED, BST_CHECKED); } static void ReposTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) { - if (dat->hwndTinySearch == NULL) + if (dat->hwndTinySearch == nullptr) return; RECT rc; @@ -252,11 +252,11 @@ static void ReposTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) { char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); - if (szProto == NULL) + if (szProto == nullptr) return; - if (dat->hwndTinySearch == NULL) { - dat->hwndTinySearch = (HWND)CallProtoServiceInt(NULL, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/); + if (dat->hwndTinySearch == nullptr) { + dat->hwndTinySearch = (HWND)CallProtoServiceInt(0, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/); if (dat->hwndTinySearch) ReposTinySearchDlg(hwndDlg, dat); else @@ -267,7 +267,7 @@ static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) static void HideAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat) { - if (dat->hwndAdvSearch == NULL) + if (dat->hwndAdvSearch == nullptr) return; AnimateWindow(dat->hwndAdvSearch, 150, AW_HIDE | AW_BLEND); @@ -293,7 +293,7 @@ static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl) static void SetListItemText(HWND hwndList, int idx, int col, wchar_t *szText) { - if (szText == NULL || *szText == 0) + if (szText == nullptr || *szText == 0) szText = TranslateT("<not specified>"); ListView_SetItemText(hwndList, idx, col, szText); @@ -363,8 +363,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 1 | SBT_OWNERDRAW, 0); SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); - wchar_t *szProto = NULL; - ptrW tszLast(db_get_wsa(NULL, "FindAdd", "LastSearched")); + wchar_t *szProto = nullptr; + ptrW tszLast(db_get_wsa(0, "FindAdd", "LastSearched")); if (tszLast) szProto = NEWWSTR_ALLOCA(tszLast); @@ -373,7 +373,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!Proto_IsAccountEnabled(accounts[i])) continue; - DWORD caps = (DWORD)CallProtoServiceInt(NULL, accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD caps = (DWORD)CallProtoServiceInt(0, accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (caps & PF1_ANYSEARCH) netProtoCount++; } @@ -401,7 +401,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!Proto_IsAccountEnabled(pa)) continue; - DWORD caps = (DWORD)CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD caps = (DWORD)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (!(caps & PF1_ANYSEARCH)) continue; @@ -410,7 +410,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (textSize.cx > cbwidth) cbwidth = textSize.cx; - HICON hIcon = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); + HICON hIcon = (HICON)CallProtoServiceInt(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon(dat->himlComboIcons, hIcon); DestroyIcon(hIcon); cbei.lParam = (LPARAM)pa->szModuleName; @@ -428,7 +428,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_SETCURSEL, index, 0); SendMessage(hwndDlg, M_SETGROUPVISIBILITIES, 0, 0); - Utils_RestoreWindowPosition(hwndDlg, NULL, "FindAdd", ""); + Utils_RestoreWindowPosition(hwndDlg, 0, "FindAdd", ""); } return TRUE; @@ -472,18 +472,18 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); if (szProto == (char *)CB_ERR) break; - if (szProto == NULL) { + if (szProto == nullptr) { for (int i = 0; i < accounts.getCount(); i++) { PROTOACCOUNT *pa = accounts[i]; if (Proto_IsAccountEnabled(pa)) { - DWORD protoCaps = (DWORD)CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD protoCaps = (DWORD)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1; if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1; } } } else { - DWORD protoCaps = (DWORD)CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD protoCaps = (DWORD)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_BASICSEARCH) dat->showProtoId = 1; if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1; if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1; @@ -493,7 +493,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (protoCaps & PF1_USERIDISEMAIL && dat->showProtoId) { dat->showProtoId = 0; dat->showEmail = 1; } if (dat->showProtoId) { - char *szUniqueId = (char*)CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); + char *szUniqueId = (char*)CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0); if (szUniqueId) SetDlgItemTextA(hwndDlg, IDC_BYPROTOID, szUniqueId); else @@ -510,7 +510,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP ShowTinySearchDlg(hwndDlg, dat); else if (dat->hwndTinySearch) { DestroyWindow(dat->hwndTinySearch); - dat->hwndTinySearch = NULL; + dat->hwndTinySearch = nullptr; } #define en(id, t) ShowWindow( GetDlgItem(hwndDlg, IDC_##id), dat->show##t?SW_SHOW:SW_HIDE) @@ -610,11 +610,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP HideAdvancedSearchDlg(hwndDlg, dat); if (dat->hwndAdvSearch) { DestroyWindow(dat->hwndAdvSearch); - dat->hwndAdvSearch = NULL; + dat->hwndAdvSearch = nullptr; } if (dat->hwndTinySearch) { DestroyWindow(dat->hwndTinySearch); - dat->hwndTinySearch = NULL; + dat->hwndTinySearch = nullptr; } SendMessage(hwndDlg, M_SETGROUPVISIBILITIES, 0, 0); } @@ -672,8 +672,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP HideAdvancedSearchDlg(hwndDlg, dat); if (dat->searchCount) { //cancel search SetDlgItemText(hwndDlg, IDOK, TranslateT("&Search")); - if (dat->hResultHook) { UnhookEvent(dat->hResultHook); dat->hResultHook = NULL; } - if (dat->search) { mir_free(dat->search); dat->search = NULL; } + if (dat->hResultHook) { UnhookEvent(dat->hResultHook); dat->hResultHook = nullptr; } + if (dat->search) { mir_free(dat->search); dat->search = nullptr; } dat->searchCount = 0; StopThrobber(hwndDlg, dat); SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat); @@ -681,7 +681,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { char *szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); if (dat->search) - mir_free(dat->search), dat->search = NULL; + mir_free(dat->search), dat->search = nullptr; dat->searchCount = 0; dat->hResultHook = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_SEARCHACK); if (IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) @@ -719,7 +719,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYNAME, PF1_SEARCHBYNAME, &psbn); } else if (IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) { - if (dat->hwndAdvSearch == NULL) + if (dat->hwndAdvSearch == nullptr) MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK); else BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYADVANCED, PF1_EXTSEARCHUI, dat->hwndAdvSearch); @@ -728,7 +728,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->searchCount == 0) { if (dat->hResultHook) { UnhookEvent(dat->hResultHook); - dat->hResultHook = NULL; + dat->hResultHook = nullptr; } break; } @@ -819,7 +819,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP int i; for (i = 0; i < dat->searchCount; i++) - if (dat->search[i].hProcess == ack->hProcess && dat->search[i].hProcess != NULL && !mir_strcmp(dat->search[i].szProto, ack->szModule)) break; + if (dat->search[i].hProcess == ack->hProcess && dat->search[i].hProcess != nullptr && !mir_strcmp(dat->search[i].szProto, ack->szModule)) break; if (i == dat->searchCount) break; @@ -828,9 +828,9 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP memmove(dat->search + i, dat->search + i + 1, sizeof(struct ProtoSearchInfo)*(dat->searchCount - i)); if (dat->searchCount == 0) { mir_free(dat->search); - dat->search = NULL; + dat->search = nullptr; UnhookEvent(dat->hResultHook); - dat->hResultHook = NULL; + dat->hResultHook = nullptr; SetDlgItemText(hwndDlg, IDOK, TranslateT("&Search")); StopThrobber(hwndDlg, dat); } @@ -876,7 +876,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP lvi.lParam = (LPARAM)lsr; for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) { char *szComboProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); - if (szComboProto == NULL) continue; + if (szComboProto == nullptr) continue; if (!mir_strcmp(szComboProto, ack->szModule)) { COMBOBOXEXITEM cbei = { 0 }; cbei.mask = CBEIF_IMAGE; @@ -916,7 +916,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP lvi.lParam = (LPARAM)lsr; for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) { char *szComboProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); - if (szComboProto == NULL) continue; + if (szComboProto == nullptr) continue; if (!mir_strcmp(szComboProto, ack->szModule)) { COMBOBOXEXITEM cbei = { 0 }; cbei.mask = CBEIF_IMAGE; @@ -945,29 +945,29 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DESTROY: int len = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0); wchar_t *szProto = (wchar_t*)alloca(sizeof(wchar_t)*(len + 1)); - if (szProto != NULL) { + if (szProto != nullptr) { *szProto = '\0'; SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), (LPARAM)szProto); - db_set_ws(NULL, "FindAdd", "LastSearched", szProto); + db_set_ws(0, "FindAdd", "LastSearched", szProto); } SaveColumnSizes(hwndList); - if (dat->hResultHook != NULL) + if (dat->hResultHook != nullptr) UnhookEvent(dat->hResultHook); FreeSearchResults(hwndList); ImageList_Destroy(dat->himlComboIcons); mir_free(dat->search); if (dat->hwndAdvSearch) { DestroyWindow(dat->hwndAdvSearch); - dat->hwndAdvSearch = NULL; + dat->hwndAdvSearch = nullptr; } if (dat->hwndTinySearch) { DestroyWindow(dat->hwndTinySearch); - dat->hwndTinySearch = NULL; + dat->hwndTinySearch = nullptr; } mir_free(dat); Window_FreeIcon_IcoLib(hwndDlg); - Utils_SaveWindowPosition(hwndDlg, NULL, "FindAdd", ""); + Utils_SaveWindowPosition(hwndDlg, 0, "FindAdd", ""); break; } return FALSE; @@ -994,12 +994,12 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM) if (!Proto_IsAccountEnabled(pa)) continue; - int protoCaps = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + int protoCaps = CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_ANYSEARCH) netProtoCount++; } if (netProtoCount > 0) - hwndFindAdd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_FINDADD), NULL, DlgProcFindAdd); + hwndFindAdd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_FINDADD), nullptr, DlgProcFindAdd); } return 0; } @@ -1008,7 +1008,7 @@ int FindAddPreShutdown(WPARAM, LPARAM) { if (IsWindow(hwndFindAdd)) DestroyWindow(hwndFindAdd); - hwndFindAdd = NULL; + hwndFindAdd = nullptr; return 0; } @@ -1037,7 +1037,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) // Make sure we have some networks to search on. for (int i = 0; i < accounts.getCount(); i++) { PROTOACCOUNT *pa = accounts[i]; - int protoCaps = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + int protoCaps = CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_ANYSEARCH) netProtoCount++; } diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index 0c12d8be37..aedc4229d0 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -35,8 +35,8 @@ struct TMO_IntMenuItem; struct TMO_LinkedList
{
TMO_IntMenuItem
- *first, // first element of submenu, or NULL
- *last; // last element of submenu, or NULL
+ *first, // first element of submenu, or nullptr
+ *last; // last element of submenu, or nullptr
void insert(TMO_IntMenuItem*);
void remove(TMO_IntMenuItem*);
diff --git a/src/mir_app/src/headerbar.cpp b/src/mir_app/src/headerbar.cpp index 11d02a4bca..37518d8658 100644 --- a/src/mir_app/src/headerbar.cpp +++ b/src/mir_app/src/headerbar.cpp @@ -74,7 +74,7 @@ int LoadHeaderbarModule() wc.cbSize = sizeof(wc);
wc.lpszClassName = L"MHeaderbarCtrl";
wc.lpfnWndProc = MHeaderbarWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(MHeaderbarCtrl*);
wc.style = CS_GLOBALCLASS|CS_SAVEBITS;
RegisterClassEx(&wc);
@@ -149,7 +149,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit) bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
+ HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, nullptr, nullptr, 0);
HBITMAP hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
@@ -187,7 +187,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit) DrawIcon(tempDC, 10, iTopSpace, mit->hIcon);
else {
HICON hIcon = (HICON)SendMessage(GetParent(hwndDlg), WM_GETICON, ICON_BIG, 0);
- if (hIcon == NULL)
+ if (hIcon == nullptr)
hIcon = (HICON)SendMessage(GetParent(hwndDlg), WM_GETICON, ICON_SMALL, 0);
DrawIcon(tempDC, 10, iTopSpace, hIcon);
}
@@ -245,7 +245,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit) for (int i = 0; i < mit->nControlsToRedraw; i++) {
GetWindowRect(mit->controlsToRedraw[i], &temprc);
- MapWindowPoints(NULL, hwndDlg, (LPPOINT)&temprc, 2);
+ MapWindowPoints(nullptr, hwndDlg, (LPPOINT)&temprc, 2);
HRGN hRgnTmp = CreateRectRgnIndirect(&temprc);
CombineRgn(hRgn, hRgn, hRgnTmp, RGN_DIFF);
DeleteObject(hRgnTmp);
@@ -256,7 +256,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit) BitBlt(hdc, mit->rc.left, mit->rc.top, mit->width, mit->height, tempDC, 0, 0, SRCCOPY);
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
SelectObject(tempDC, hOldBmp);
DeleteObject(hBmp);
@@ -283,7 +283,7 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam RECT rcWnd; GetWindowRect(hwndDlg, &rcWnd);
itc->controlsToRedraw = 0;
itc->nControlsToRedraw = 0;
- for (HWND hChild = FindWindowEx(hParent, NULL, NULL, NULL); hChild; hChild = FindWindowEx(hParent, hChild, NULL, NULL)) {
+ for (HWND hChild = FindWindowEx(hParent, nullptr, nullptr, nullptr); hChild; hChild = FindWindowEx(hParent, hChild, nullptr, nullptr)) {
if (hChild != hwndDlg) {
RECT rcChild; GetWindowRect(hChild, &rcChild);
RECT rc;
@@ -321,7 +321,7 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_SETICON:
if (wParam < 3) {
itc->hIcon = (HICON)lParam;
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
}
break;
@@ -329,7 +329,7 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam return 1;
case WM_NCPAINT:
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
break;
case WM_PAINT:
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp index 284291b07b..07fa9512cf 100644 --- a/src/mir_app/src/hotkey_opts.cpp +++ b/src/mir_app/src/hotkey_opts.cpp @@ -262,7 +262,7 @@ static void sttOptionsDeleteHotkey(HWND hwndList, int idx, THotkeyItem *item) static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { wchar_t title1[256] = { 0 }, title2[256] = { 0 }; - THotkeyItem *item1 = NULL, *item2 = NULL; + THotkeyItem *item1 = nullptr, *item2 = nullptr; LVITEM lvi = { 0 }; int res; @@ -294,7 +294,7 @@ static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lP return res; return 1; } - /* item1 != NULL && item2 != NULL */ + /* item1 != nullptr && item2 != nullptr */ if (res = mir_wstrcmp(item1->getSection(), item2->getSection())) return res; if (res = mir_wstrcmp(item1->getDescr(), item2->getDescr())) return res; @@ -309,8 +309,8 @@ static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item) mir_snprintf(buf, "mir_hotkey_%d_%d", g_pid, g_hkid++); THotkeyItem *newItem = (THotkeyItem *)mir_alloc(sizeof(THotkeyItem)); - newItem->pszName = NULL; - newItem->pszService = item->pszService ? mir_strdup(item->pszService) : NULL; + newItem->pszName = nullptr; + newItem->pszService = item->pszService ? mir_strdup(item->pszService) : nullptr; newItem->pwszSection = mir_wstrdup(item->pwszSection); newItem->pwszDescription = mir_wstrdup(item->pwszDescription); newItem->lParam = item->lParam; @@ -332,7 +332,7 @@ static void sttOptionsAddHotkey(HWND hwndList, THotkeyItem *item) ListView_SortItemsEx(hwndList, sttOptionsSortList, (LPARAM)hwndList); SendMessage(hwndList, WM_SETREDRAW, TRUE, 0); - RedrawWindow(hwndList, NULL, NULL, RDW_INVALIDATE); + RedrawWindow(hwndList, nullptr, nullptr, RDW_INVALIDATE); item->OptChanged = TRUE; } @@ -356,10 +356,10 @@ static void sttOptionsSaveItem(THotkeyItem *item) item->type = item->OptType; item->Enabled = item->OptEnabled; - db_set_w(NULL, DBMODULENAME, item->pszName, item->Hotkey); - db_set_b(NULL, DBMODULENAME "Off", item->pszName, (BYTE)!item->Enabled); + db_set_w(0, DBMODULENAME, item->pszName, item->Hotkey); + db_set_b(0, DBMODULENAME "Off", item->pszName, (BYTE)!item->Enabled); if (item->type != HKT_MANUAL) - db_set_b(NULL, DBMODULENAME "Types", item->pszName, (BYTE)item->type); + db_set_b(0, DBMODULENAME "Types", item->pszName, (BYTE)item->type); item->nSubHotkeys = 0; for (i = 0; i < hotkeys.getCount(); i++) { @@ -369,16 +369,16 @@ static void sttOptionsSaveItem(THotkeyItem *item) subItem->type = subItem->OptType; mir_snprintf(buf, "%s$%d", item->pszName, item->nSubHotkeys); - db_set_w(NULL, DBMODULENAME, buf, subItem->Hotkey); + db_set_w(0, DBMODULENAME, buf, subItem->Hotkey); if (subItem->type != HKT_MANUAL) - db_set_b(NULL, DBMODULENAME "Types", buf, (BYTE)subItem->type); + db_set_b(0, DBMODULENAME "Types", buf, (BYTE)subItem->type); ++item->nSubHotkeys; } } mir_snprintf(buf, "%s$count", item->pszName); - db_set_dw(NULL, DBMODULENAME, buf, item->nSubHotkeys); + db_set_dw(0, DBMODULENAME, buf, item->nSubHotkeys); } static void sttBuildHotkeyList(HWND hwndList) @@ -440,10 +440,10 @@ static void sttOptionsStartEdit(HWND hwndDlg, HWND hwndHotkey) SetWindowPos(hwndHotkey, HWND_BOTTOM, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); SetWindowPos(GetDlgItem(hwndDlg, IDC_HOTKEY), HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW); - RedrawWindow(GetDlgItem(hwndDlg, IDC_HOTKEY), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(hwndDlg, IDC_HOTKEY), nullptr, nullptr, RDW_INVALIDATE); SetFocus(GetDlgItem(hwndDlg, IDC_HOTKEY)); - RedrawWindow(GetDlgItem(hwndDlg, IDC_HOTKEY), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(hwndDlg, IDC_HOTKEY), nullptr, nullptr, RDW_INVALIDATE); } } @@ -515,7 +515,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, currentLanguage = LOWORD(GetKeyboardLayout(0)); sttBuildHotkeyList(hwndHotkey); } - SetTimer(hwndDlg, 1024, 1000, NULL); + SetTimer(hwndDlg, 1024, 1000, nullptr); initialized = TRUE; { /* load group states */ @@ -539,7 +539,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, szSetting = mir_u2a(lvi.pszText); ListView_SetCheckState(hwndHotkey, lvi.iItem, - db_get_b(NULL, DBMODULENAME "UI", szSetting, TRUE)); + db_get_b(0, DBMODULENAME "UI", szSetting, TRUE)); mir_free(szSetting); } @@ -668,7 +668,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, HWND hwndList = (HWND)wParam; POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; LVITEM lvi = { 0 }; - THotkeyItem *item = NULL; + THotkeyItem *item = nullptr; lvi.iItem = ListView_GetNextItem(hwndHotkey, -1, LVNI_SELECTED); if (lvi.iItem < 0) return FALSE; @@ -696,7 +696,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_CHANGE, TranslateT("Modify")); SetMenuItemInfo(hMenu, (UINT_PTR)MI_CHANGE, FALSE, &mii); if (item->type != HKT_MANUAL) { - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hMenu, MF_STRING | ((item->OptType == HKT_GLOBAL) ? MF_CHECKED : 0), (UINT_PTR)MI_SYSTEM, TranslateT("System scope")); @@ -704,17 +704,17 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, ((item->OptType == HKT_LOCAL) ? MF_CHECKED : 0), (UINT_PTR)MI_LOCAL, TranslateT("Miranda scope")); } - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); if (!item->rootHotkey) AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_ADD, TranslateT("Add binding")); else AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_REMOVE, TranslateT("Remove")); if (item->Hotkey != item->OptHotkey) { - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hMenu, MF_STRING, (UINT_PTR)MI_REVERT, TranslateT("Undo")); } - switch (TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { + switch (TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr)) { case MI_CHANGE: sttOptionsStartEdit(hwndDlg, hwndHotkey); break; @@ -796,7 +796,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, switch (lpnmhdr->code) { case NM_CLICK: { - THotkeyItem *item = NULL; + THotkeyItem *item = nullptr; LPNMITEMACTIVATE lpnmia = (LPNMITEMACTIVATE)lParam; LVHITTESTINFO lvhti = { 0 }; LVITEM lvi = { 0 }; @@ -1004,7 +1004,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, { int count = ListView_GetItemCount(hwndHotkey); - g_hwndHkOptions = NULL; + g_hwndHkOptions = nullptr; KillTimer(hwndDlg, 1024); @@ -1022,7 +1022,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, lvi.iSubItem = 1; ListView_GetItem(hwndHotkey, &lvi); - db_set_b(NULL, DBMODULENAME "UI", _T2A(lvi.pszText), ListView_GetCheckState(hwndHotkey, lvi.iItem)); + db_set_b(0, DBMODULENAME "UI", _T2A(lvi.pszText), ListView_GetCheckState(hwndHotkey, lvi.iItem)); } } } diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index 34e1d4c6ac..d621a4565d 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -42,11 +42,11 @@ static int sttCompareHotkeys(const THotkeyItem *p1, const THotkeyItem *p2) LIST<THotkeyItem> hotkeys(10, sttCompareHotkeys);
DWORD g_pid = 0, g_hkid = 1;
-HWND g_hwndHotkeyHost = NULL, g_hwndHkOptions = NULL;
+HWND g_hwndHotkeyHost = nullptr, g_hwndHkOptions = nullptr;
HANDLE hEvChanged = 0;
static BOOL bModuleInitialized = FALSE;
-static HHOOK hhkKeyboard = NULL;
+static HHOOK hhkKeyboard = nullptr;
WORD GetHotkeyValue(INT_PTR idHotkey)
{
@@ -148,7 +148,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) p->hLangpack = (int)wParam;
p->allowSubHotkeys = TRUE;
- p->rootHotkey = NULL;
+ p->rootHotkey = nullptr;
p->nSubHotkeys = 0;
if (p->rootHotkey = hotkeys.find(p)) {
@@ -169,14 +169,14 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) }
else {
p->pszName = mir_strdup(desc->pszName);
- p->Enabled = !db_get_b(NULL, DBMODULENAME "Off", p->pszName, 0);
+ p->Enabled = !db_get_b(0, DBMODULENAME "Off", p->pszName, 0);
}
p->pszService = desc->pszService ? mir_strdup(desc->pszService) : 0;
p->DefHotkey = desc->DefHotKey & ~HKF_MIRANDA_LOCAL;
- p->Hotkey = db_get_w(NULL, DBMODULENAME, p->pszName, p->DefHotkey);
+ p->Hotkey = db_get_w(0, DBMODULENAME, p->pszName, p->DefHotkey);
p->type = p->pszService ?
- (THotkeyType)db_get_b(NULL, DBMODULENAME "Types", p->pszName,
+ (THotkeyType)db_get_b(0, DBMODULENAME "Types", p->pszName,
(desc->DefHotKey & HKF_MIRANDA_LOCAL) ? HKT_LOCAL : HKT_GLOBAL) : HKT_MANUAL;
p->lParam = desc->lParam;
@@ -197,10 +197,10 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) /* try to load alternatives from db */
int count, i;
mir_snprintf(buf, "%s$count", p->pszName);
- count = (int)db_get_dw(NULL, DBMODULENAME, buf, -1);
+ count = (int)db_get_dw(0, DBMODULENAME, buf, -1);
for (i = 0; i < count; i++) {
mir_snprintf(buf, "%s$%d", p->pszName, i);
- if (!db_get_w(NULL, DBMODULENAME, buf, 0))
+ if (!db_get_w(0, DBMODULENAME, buf, 0))
continue;
svcHotkeyRegister(wParam, lParam);
@@ -209,7 +209,7 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam) }
else {
mir_free(p->pszName);
- p->pszName = NULL;
+ p->pszName = nullptr;
}
return p->idHotkey;
@@ -353,20 +353,20 @@ int LoadSkinHotkeys(void) wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hInstance = g_hInst;
- wcl.hIcon = NULL;
- wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcl.hIcon = nullptr;
+ wcl.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
- wcl.lpszMenuName = NULL;
+ wcl.lpszMenuName = nullptr;
wcl.lpszClassName = L"MirandaHotkeyHostWnd";
- wcl.hIconSm = NULL;
+ wcl.hIconSm = nullptr;
RegisterClassEx(&wcl);
g_pid = GetCurrentProcessId();
- g_hwndHotkeyHost = CreateWindow(L"MirandaHotkeyHostWnd", NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInst, NULL);
+ g_hwndHotkeyHost = CreateWindow(L"MirandaHotkeyHostWnd", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInst, nullptr);
SetWindowPos(g_hwndHotkeyHost, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW);
- hhkKeyboard = SetWindowsHookEx(WH_KEYBOARD, sttKeyboardProc, NULL, hMainThreadId);
+ hhkKeyboard = SetWindowsHookEx(WH_KEYBOARD, sttKeyboardProc, nullptr, hMainThreadId);
hEvChanged = CreateHookableEvent(ME_HOTKEYS_CHANGED);
@@ -383,15 +383,15 @@ int LoadSkinHotkeys(void) mir_snprintf(szSetting, "HK%s", oldSettings[i]);
WORD key;
- if ((key = db_get_w(NULL, "Clist", szSetting, 0))) {
- db_unset(NULL, "Clist", szSetting);
- db_set_w(NULL, DBMODULENAME, newSettings[i], key);
+ if ((key = db_get_w(0, "Clist", szSetting, 0))) {
+ db_unset(0, "Clist", szSetting);
+ db_set_w(0, DBMODULENAME, newSettings[i], key);
}
mir_snprintf(szSetting, "HKEn%s", oldSettings[i]);
- if ((key = db_get_b(NULL, "Clist", szSetting, 0))) {
- db_unset(NULL, "Clist", szSetting);
- db_set_b(NULL, DBMODULENAME "Off", newSettings[i], (BYTE)(key == 0));
+ if ((key = db_get_b(0, "Clist", szSetting, 0))) {
+ db_unset(0, "Clist", szSetting);
+ db_set_b(0, DBMODULENAME "Off", newSettings[i], (BYTE)(key == 0));
}
}
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index ae6eb9dea0..1ed64d9ba9 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -30,7 +30,7 @@ static BOOL bModuleInitialized = FALSE; static volatile LONG iStaticCount = 1;
HANDLE hIcons2ChangedEvent, hIconsChangedEvent;
-HICON hIconBlank = NULL;
+HICON hIconBlank = nullptr;
int iconEventActive = 0;
@@ -66,9 +66,9 @@ LIST<IcolibItem> iconList(20, sttCompareIcons); void __fastcall SafeDestroyIcon(HICON &hIcon)
{
- if (hIcon != NULL) {
+ if (hIcon != nullptr) {
DestroyIcon(hIcon);
- hIcon = NULL;
+ hIcon = nullptr;
}
}
@@ -77,7 +77,7 @@ void __fastcall SafeDestroyIcon(HICON &hIcon) static IconSourceFile* IconSourceFile_Get(const wchar_t *file, bool isPath)
{
if (!file)
- return NULL;
+ return nullptr;
IconSourceFile key;
if (isPath)
@@ -86,7 +86,7 @@ static IconSourceFile* IconSourceFile_Get(const wchar_t *file, bool isPath) wcsncpy_s(key.file, file, _TRUNCATE);
IconSourceFile *p = iconSourceFileList.find(&key);
- if (p != NULL) {
+ if (p != nullptr) {
p->ref_count++;
return p;
}
@@ -102,7 +102,7 @@ static IconSourceFile* IconSourceFile_Get(const wchar_t *file, bool isPath) static int IconSourceFile_Release(IconSourceFile *pItem)
{
- if (pItem == NULL || !pItem->ref_count)
+ if (pItem == nullptr || !pItem->ref_count)
return 1;
if (--pItem->ref_count <= 0) {
@@ -178,7 +178,7 @@ static int InternalGetDIB(HBITMAP bitmap, HPALETTE palette, void *bitmapInfo, vo oldPal = SelectPalette(DC, palette, FALSE);
RealizePalette(DC);
}
- else oldPal = NULL;
+ else oldPal = nullptr;
int result = GetDIBits(DC, bitmap, 0, ((BITMAPINFOHEADER*)bitmapInfo)->biHeight, Bits, (BITMAPINFO*)bitmapInfo, DIB_RGB_COLORS) == 0;
@@ -271,7 +271,7 @@ int IconSourceItem::getIconData(HICON hIcon) int IconSourceItem::releaseIcon()
{
- if (this == NULL || icon_ref_count == 0)
+ if (this == nullptr || icon_ref_count == 0)
return 1; // Failure
icon_ref_count--;
@@ -314,7 +314,7 @@ int IconSourceItem::compare(const IconSourceItem *p1, const IconSourceItem *p2) IconSourceItem* GetIconSourceItem(const wchar_t *file, int indx, int cxIcon, int cyIcon)
{
if (!file)
- return NULL;
+ return nullptr;
IconSourceFile *r_file = IconSourceFile_Get(file, true);
IconSourceItemKey key = { r_file, indx, cxIcon, cyIcon };
@@ -333,7 +333,7 @@ IconSourceItem* GetIconSourceItem(const wchar_t *file, int indx, int cxIcon, int IconSourceItem* GetIconSourceItemFromPath(const wchar_t *path, int cxIcon, int cyIcon)
{
if (!path)
- return NULL;
+ return nullptr;
wchar_t file[MAX_PATH];
mir_wstrncpy(file, path, _countof(file));
@@ -362,7 +362,7 @@ IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon) int IconSourceItem::release()
{
- if (this == NULL || ref_count <= 0)
+ if (this == nullptr || ref_count <= 0)
return 1;
ref_count--;
@@ -382,7 +382,7 @@ int IconSourceItem::release() static SectionItem* IcoLib_AddSection(wchar_t *sectionName, BOOL create_new)
{
if (!sectionName)
- return NULL;
+ return nullptr;
int indx;
if ((indx = sectionList.getIndex((SectionItem*)§ionName)) != -1)
@@ -396,7 +396,7 @@ static SectionItem* IcoLib_AddSection(wchar_t *sectionName, BOOL create_new) return newItem;
}
- return NULL;
+ return nullptr;
}
static void IcoLib_RemoveSection(SectionItem *section)
@@ -420,13 +420,13 @@ IcolibItem* IcoLib_FindIcon(const char *pszIconName) IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
{
- if (hIcon == NULL)
- return NULL;
+ if (hIcon == nullptr)
+ return nullptr;
for (int i = 0; i < iconList.getCount(); i++) {
IcolibItem *p = iconList[i];
if ((void*)p == hIcon) {
- big = (p->source_small == NULL);
+ big = (p->source_small == nullptr);
return p;
}
if (p->source_small && p->source_small->icon == hIcon) {
@@ -439,7 +439,7 @@ IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big) }
}
- return NULL;
+ return nullptr;
}
void IcolibItem::clear()
@@ -450,12 +450,12 @@ void IcolibItem::clear() if (section) {
if (!--section->ref_count)
IcoLib_RemoveSection(section);
- section = NULL;
+ section = nullptr;
}
IconSourceFile_Release(default_file);
- source_small->release(); source_small = NULL;
- source_big->release(); source_big = NULL;
- default_icon->release(); default_icon = NULL;
+ source_small->release(); source_small = nullptr;
+ source_big->release(); source_big = nullptr;
+ default_icon->release(); default_icon = nullptr;
SafeDestroyIcon(temp_icon);
}
@@ -515,7 +515,7 @@ MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int _hLang) item->default_icon = CreateStaticIconSourceItem(cx, cy);
if (item->default_icon->getIconData(sid->hDefaultIcon)) {
item->default_icon->release();
- item->default_icon = NULL;
+ item->default_icon = nullptr;
}
}
}
@@ -531,7 +531,7 @@ MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int _hLang) static int ReleaseIconInternal(IcolibItem *item, bool big)
{
- if (item == NULL)
+ if (item == nullptr)
return 1;
IconSourceItem *source = big && !item->cx ? item->source_big : item->source_small;
@@ -548,7 +548,7 @@ static int ReleaseIconInternal(IcolibItem *item, bool big) MIR_APP_DLL(int) IcoLib_ReleaseIcon(HICON hIcon, bool big)
{
- if (hIcon == NULL)
+ if (hIcon == nullptr)
return 1;
mir_cslock lck(csIconList);
@@ -561,7 +561,7 @@ MIR_APP_DLL(int) IcoLib_ReleaseIcon(HICON hIcon, bool big) MIR_APP_DLL(int) IcoLib_Release(const char *szIconName, bool big)
{
- if (szIconName == NULL)
+ if (szIconName == nullptr)
return 1;
mir_cslock lck(csIconList);
@@ -614,7 +614,7 @@ MIR_APP_DLL(void) KillModuleIcons(int _hLang) HICON IconItem_GetDefaultIcon(IcolibItem *item, bool big)
{
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
if (item->default_icon && !big) {
item->source_small->release();
@@ -661,14 +661,14 @@ HICON IconItem_GetDefaultIcon(IcolibItem *item, bool big) HICON IconItem_GetIcon(HANDLE hIcoLib, bool big)
{
IcolibItem *item = (IcolibItem*)hIcoLib;
- if (item == NULL)
- return NULL;
+ if (item == nullptr)
+ return nullptr;
big = big && !item->cx;
IconSourceItem* &source = big ? item->source_big : item->source_small;
- if (source == NULL) {
- ptrW tszCustomPath(db_get_wsa(NULL, "SkinIcons", item->name));
- if (tszCustomPath != NULL) {
+ if (source == nullptr) {
+ ptrW tszCustomPath(db_get_wsa(0, "SkinIcons", item->name));
+ if (tszCustomPath != nullptr) {
wchar_t tszFullPath[MAX_PATH];
PathToAbsoluteW(tszCustomPath, tszFullPath);
int cx = item->cx ? item->cx : (big ? g_iIconX : g_iIconSX);
@@ -677,7 +677,7 @@ HICON IconItem_GetIcon(HANDLE hIcoLib, bool big) }
}
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
if (source)
hIcon = source->getIcon();
@@ -693,8 +693,8 @@ HICON IconItem_GetIcon(HANDLE hIcoLib, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_GetIcon
// lParam: pszIconName
-// wParam: PLOADIMAGEPARAM or NULL.
-// if wParam == NULL, default is used:
+// wParam: PLOADIMAGEPARAM or nullptr.
+// if wParam == nullptr, default is used:
// uType = IMAGE_ICON
// cx/cyDesired = GetSystemMetrics(SM_CX/CYSMICON)
// fuLoad = 0
@@ -706,7 +706,7 @@ MIR_APP_DLL(HICON) IcoLib_GetIcon(const char* pszIconName, bool big) mir_cslock lck(csIconList);
IcolibItem *item = IcoLib_FindIcon(pszIconName);
- return (item) ? IconItem_GetIcon(item, big) : NULL;
+ return (item) ? IconItem_GetIcon(item, big) : nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -716,7 +716,7 @@ MIR_APP_DLL(HICON) IcoLib_GetIcon(const char* pszIconName, bool big) MIR_APP_DLL(HANDLE) IcoLib_GetIconHandle(const char *pszIconName)
{
if (!pszIconName)
- return NULL;
+ return nullptr;
mir_cslock lck(csIconList);
return IcoLib_FindIcon(pszIconName);
@@ -729,8 +729,8 @@ MIR_APP_DLL(HANDLE) IcoLib_GetIconHandle(const char *pszIconName) MIR_APP_DLL(HICON) IcoLib_GetIconByHandle(HANDLE hItem, bool big)
{
- if (hItem == NULL)
- return NULL;
+ if (hItem == nullptr)
+ return nullptr;
mir_cslock lck(csIconList);
IcolibItem *pi = (IcolibItem*)hItem;
@@ -742,7 +742,7 @@ MIR_APP_DLL(HICON) IcoLib_GetIconByHandle(HANDLE hItem, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_IsManaged
-// lParam: NULL
+// lParam: nullptr
// wParam: HICON
MIR_APP_DLL(HANDLE) IcoLib_IsManaged(HICON hIcon)
@@ -755,7 +755,7 @@ MIR_APP_DLL(HANDLE) IcoLib_IsManaged(HICON hIcon) /////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_AddRef
-// lParam: NULL
+// lParam: nullptr
// wParam: HICON
MIR_APP_DLL(int) IcoLib_AddRef(HICON hIcon)
diff --git a/src/mir_app/src/iconheader.cpp b/src/mir_app/src/iconheader.cpp index 202682ec34..173ab650eb 100644 --- a/src/mir_app/src/iconheader.cpp +++ b/src/mir_app/src/iconheader.cpp @@ -165,7 +165,7 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, int iconTop = iTopSpace + 5;
int textTop = iconTop + 32 + 3;
- HFONT hFntSave = NULL;
+ HFONT hFntSave = nullptr;
if (dat->nSelectedIdx == i) {
LOGFONT lf;
@@ -181,9 +181,9 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, rc.bottom = iTopSpace + dat->itemHeight;
HANDLE hTheme = OpenThemeData(hwnd, L"ListView");
if (dat->nHotIdx == i || GetFocus() == hwnd)
- DrawThemeBackground(hTheme, hdc, LVP_LISTITEM, LISS_HOTSELECTED, &rc, NULL);
+ DrawThemeBackground(hTheme, hdc, LVP_LISTITEM, LISS_HOTSELECTED, &rc, nullptr);
else
- DrawThemeBackground(hTheme, hdc, LVP_LISTITEM, LISS_SELECTED, &rc, NULL);
+ DrawThemeBackground(hTheme, hdc, LVP_LISTITEM, LISS_SELECTED, &rc, nullptr);
CloseThemeData(hTheme);
}
@@ -200,9 +200,9 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, rc.top = iTopSpace;
rc.right = itemX + dat->itemWidth;
rc.bottom = iTopSpace + dat->itemHeight;
- SetWindowTheme(hwnd, L"explorer", NULL);
+ SetWindowTheme(hwnd, L"explorer", nullptr);
HANDLE hTheme = OpenThemeData(hwnd, L"ListView");
- DrawThemeBackground(hTheme, hdc, LVP_LISTITEM, LISS_HOT, &rc, NULL);
+ DrawThemeBackground(hTheme, hdc, LVP_LISTITEM, LISS_HOT, &rc, nullptr);
CloseThemeData(hTheme);
}
else {
@@ -249,7 +249,7 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit) bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
+ HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, nullptr, nullptr, 0);
HBITMAP hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
@@ -356,20 +356,20 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if (idx >= itc->pList.getCount())
itc->nHotIdx = idx;
}
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
return 0;
case WM_MOUSELEAVE:
itc->bMouseInside = FALSE;
itc->nHotIdx = -1;
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
return 0;
case WM_LBUTTONUP:
if ((itc->nHotIdx >= 0) && (itc->nHotIdx != itc->nSelectedIdx)) {
itc->nSelectedIdx = itc->nHotIdx;
SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
SendMessage(GetParent(hwndDlg), WM_COMMAND,
MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED),
itc->nSelectedIdx);
@@ -378,7 +378,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case WM_SETFOCUS:
case WM_KILLFOCUS:
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
break;
case WM_MOUSEACTIVATE:
@@ -419,7 +419,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if ((newIdx >= 0) && (newIdx < itc->pList.getCount()) && (newIdx != itc->nSelectedIdx)) {
itc->nSelectedIdx = newIdx;
SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
SendMessage(GetParent(hwndDlg), WM_COMMAND,
MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGEDKBD),
itc->nSelectedIdx);
@@ -431,7 +431,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L return 1;
case WM_NCPAINT:
- InvalidateRect(hwndDlg, NULL, FALSE);
+ InvalidateRect(hwndDlg, nullptr, FALSE);
break;
case WM_PAINT:
@@ -441,7 +441,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case ITCM_SETBACKGROUND:
itc->hBkgBmp = (HBITMAP)lParam;
if (!itc->hBkgDC)
- itc->hBkgDC = CreateCompatibleDC(NULL);
+ itc->hBkgDC = CreateCompatibleDC(nullptr);
itc->hBkgOldBmp = (HBITMAP)SelectObject(itc->hBkgDC, itc->hBkgBmp);
{
BITMAPINFO bmp;
@@ -475,7 +475,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L itc->itemWidth = (itc->width - 2 * ITC_BORDER_SIZE) / itc->pList.getCount();
itc->itemHeight = itc->height - 2 * ITC_BORDER_SIZE - 2;
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
}
return TRUE;
@@ -483,7 +483,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if ((int)wParam >= 0 && (int)wParam < itc->pList.getCount()) {
itc->nSelectedIdx = wParam;
SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE);
SendMessage(GetParent(hwndDlg), WM_COMMAND,
MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED),
itc->nSelectedIdx);
@@ -518,7 +518,7 @@ int LoadIcoTabsModule() wc.cbSize = sizeof(wc);
wc.lpszClassName = MIRANDAICOTABCLASS;
wc.lpfnWndProc = MIcoTabWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(MIcoTabCtrl*);
wc.style = CS_GLOBALCLASS;
RegisterClassEx(&wc);
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index d0ac03d01b..789065dcc5 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -33,12 +33,12 @@ static DWORD GetMask(MCONTACT hContact) {
DWORD mask = db_get_dw(hContact, "Ignore", "Mask1", (DWORD)-1);
if (mask == (DWORD)-1) {
- if (hContact == NULL) mask = 0;
+ if (hContact == 0) mask = 0;
else {
if (db_get_b(hContact, "CList", "Hidden", 0) || db_get_b(hContact, "CList", "NotOnList", 0))
- mask = db_get_dw(NULL, "Ignore", "Mask1", 0);
+ mask = db_get_dw(0, "Ignore", "Mask1", 0);
else
- mask = db_get_dw(NULL, "Ignore", "Default1", 0);
+ mask = db_get_dw(0, "Ignore", "Default1", 0);
}
}
return mask;
@@ -178,8 +178,8 @@ static void SetAllContactIcons(HWND hwndList) DWORD proto1Caps, proto4Caps;
char *szProto = GetContactProto(hContact);
if (szProto) {
- proto1Caps = CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- proto4Caps = CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ proto1Caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ proto4Caps = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0);
}
else proto1Caps = proto4Caps = 0;
InitialiseItem(hwndList, hContact, hItem, proto1Caps, proto4Caps);
@@ -235,11 +235,11 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM cii.pszText = TranslateT("** Unknown contacts **");
hItemUnknown = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
- InitialiseItem(GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemUnknown, 0xFFFFFFFF, 0xFFFFFFFF);
+ InitialiseItem(GetDlgItem(hwndDlg, IDC_LIST), 0, hItemUnknown, 0xFFFFFFFF, 0xFFFFFFFF);
}
SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
return TRUE;
case WM_SETFOCUS:
@@ -255,7 +255,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
//fall through
case CLN_CONTACTMOVED:
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
break;
case CLN_OPTIONSCHANGED:
ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
@@ -270,7 +270,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM DWORD hitFlags;
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA))
+ if (hItem == nullptr || !(hitFlags & CLCHT_ONITEMEXTRA))
break;
if (nm->iColumn == IGNOREEVENT_MAX) { // ignore all
@@ -289,7 +289,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM iImage = 0;
SetIconsForColumn(GetDlgItem(hwndDlg, IDC_LIST), hItem, hItemAll, nm->iColumn, iImage);
}
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -306,8 +306,8 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM db_set_b(hContact, "CList", "Hidden", 1);
}
- SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemAll, "Default1");
- SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemUnknown, "Mask1");
+ SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), 0, hItemAll, "Default1");
+ SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), 0, hItemUnknown, "Mask1");
return TRUE;
}
}
@@ -407,7 +407,7 @@ static INT_PTR IgnoreRecvAuth(WPARAM wParam, LPARAM lParam) static int IgnoreAddedNotify(WPARAM, LPARAM lParam)
{
DBEVENTINFO *dbei = (DBEVENTINFO*)lParam;
- if (dbei && dbei->eventType == EVENTTYPE_ADDED && dbei->pBlob != NULL) {
+ if (dbei && dbei->eventType == EVENTTYPE_ADDED && dbei->pBlob != nullptr) {
MCONTACT hContact = DbGetAuthEventContact(dbei);
if (db_is_contact(hContact) && IsIgnored(hContact, IGNOREEVENT_YOUWEREADDED))
return 1;
diff --git a/src/mir_app/src/imgconv.cpp b/src/mir_app/src/imgconv.cpp index e671016f81..954fd1ec3e 100644 --- a/src/mir_app/src/imgconv.cpp +++ b/src/mir_app/src/imgconv.cpp @@ -36,8 +36,8 @@ HBITMAP ConvertIconToBitmap(HIMAGELIST hIml, int iconId) bmi.bmiHeader.biWidth = g_iIconSX;
bmi.bmiHeader.biHeight = g_iIconSY;
- HDC hdc = CreateCompatibleDC(NULL);
- HBITMAP hbmp = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
+ HDC hdc = CreateCompatibleDC(nullptr);
+ HBITMAP hbmp = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, nullptr, nullptr, 0);
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdc, hbmp);
BLENDFUNCTION bfAlpha = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 7b7ec1f273..99905b3767 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -91,7 +91,7 @@ void CLangpackDlg::OnInitDialog() void CLangpackDlg::LoadLangpacks()
{
- ptrW langpack(db_get_wsa(NULL, "Langpack", "Current"));
+ ptrW langpack(db_get_wsa(0, "Langpack", "Current"));
wchar_t tszFullPath[MAX_PATH];
PathToAbsoluteW(L"\\Languages\\langpack_*.txt", tszFullPath);
@@ -130,11 +130,11 @@ void CLangpackDlg::LoadLangpacks() DWORD v = Miranda_GetVersion();
pack.szLastModifiedUsing.Format("%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF));
- if (GetModuleFileName(NULL, pack.tszFullPath, _countof(pack.tszFullPath))) {
+ if (GetModuleFileName(nullptr, pack.tszFullPath, _countof(pack.tszFullPath))) {
mir_wstrcpy(pack.tszFileName, L"default");
HANDLE hFile = CreateFile(pack.tszFileName, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (hFile != INVALID_HANDLE_VALUE) {
- GetFileTime(hFile, NULL, NULL, &pack.ftFileDate);
+ GetFileTime(hFile, nullptr, nullptr, &pack.ftFileDate);
CloseHandle(hFile);
}
}
@@ -193,7 +193,7 @@ void CLangpackDlg::DisplayPackInfo(const LANGPACK_INFO *pack) SYSTEMTIME stFileDate;
wchar_t szDate[128]; szDate[0] = 0;
if (FileTimeToSystemTime(&pack->ftFileDate, &stFileDate))
- GetDateFormat(Langpack_GetDefaultLocale(), DATE_SHORTDATE, &stFileDate, NULL, szDate, _countof(szDate));
+ GetDateFormat(Langpack_GetDefaultLocale(), DATE_SHORTDATE, &stFileDate, nullptr, szDate, _countof(szDate));
m_date.SetText(szDate);
m_lastModUsing.SetText(ptrW(mir_utf8decodeW(pack->szLastModifiedUsing)));
@@ -240,7 +240,7 @@ void CLangpackDlg::OnApply() for (int i = 0; i < count; i++) {
LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetItemData(i);
if (i == idx) {
- db_set_ws(NULL, "Langpack", "Current", pack->tszFileName);
+ db_set_ws(0, "Langpack", "Current", pack->tszFileName);
mir_wstrcpy(tszPath, pack->tszFullPath);
pack->flags |= LPF_ENABLED;
}
diff --git a/src/mir_app/src/mdatabasecache.cpp b/src/mir_app/src/mdatabasecache.cpp index 376eebbf0b..c4b9e8d946 100644 --- a/src/mir_app/src/mdatabasecache.cpp +++ b/src/mir_app/src/mdatabasecache.cpp @@ -41,8 +41,8 @@ MDatabaseCache::MDatabaseCache(size_t _size) : m_lSettings(100, stringCompare),
m_lContacts(50, NumericKeySortT),
m_lGlobalSettings(50, compareGlobals),
- m_lastSetting(NULL),
- m_lastVL(NULL)
+ m_lastSetting(nullptr),
+ m_lastVL(nullptr)
{
m_hCacheHeap = HeapCreate(0, 0, 0);
}
@@ -77,7 +77,7 @@ DBCachedContact* MDatabaseCache::GetCachedContact(MCONTACT contactID) mir_cslock lck(m_cs);
int index = m_lContacts.getIndex((DBCachedContact*)&contactID);
- return (index == -1) ? NULL : m_lContacts[index];
+ return (index == -1) ? nullptr : m_lContacts[index];
}
DBCachedContact* MDatabaseCache::GetFirstContact()
@@ -91,7 +91,7 @@ DBCachedContact* MDatabaseCache::GetNextContact(MCONTACT contactID) mir_cslock lck(m_cs);
int index = m_lContacts.getIndex((DBCachedContact*)&contactID);
- return (index == -1) ? NULL : m_lContacts[index+1];
+ return (index == -1) ? nullptr : m_lContacts[index+1];
}
void MDatabaseCache::FreeCachedContact(MCONTACT contactID)
@@ -104,7 +104,7 @@ void MDatabaseCache::FreeCachedContact(MCONTACT contactID) DBCachedContact *cc = m_lContacts[index];
DBCachedContactValue* V = cc->first;
- while (V != NULL) {
+ while (V != nullptr) {
DBCachedContactValue* V1 = V->next;
FreeCachedVariant(&V->value);
HeapFree(m_hCacheHeap, 0, V);
@@ -132,7 +132,7 @@ char* MDatabaseCache::GetCachedSetting(const char *szModuleName, const char *szS {
char szFullName[512];
const char *szKey;
- if (szModuleName != NULL) {
+ if (szModuleName != nullptr) {
mir_strcpy(szFullName, szModuleName);
szFullName[moduleNameLen] = '/';
mir_strcpy(szFullName + moduleNameLen + 1, szSettingName);
@@ -154,23 +154,23 @@ char* MDatabaseCache::GetCachedSetting(const char *szModuleName, const char *szS void MDatabaseCache::SetCachedVariant(DBVARIANT* s /* new */, DBVARIANT* d /* cached */)
{
- char* szSave = (d->type == DBVT_UTF8 || d->type == DBVT_ASCIIZ) ? d->pszVal : NULL;
+ char* szSave = (d->type == DBVT_UTF8 || d->type == DBVT_ASCIIZ) ? d->pszVal : nullptr;
memcpy(d, s, sizeof(DBVARIANT));
- if ((s->type == DBVT_UTF8 || s->type == DBVT_ASCIIZ) && s->pszVal != NULL) {
- if (szSave != NULL)
+ if ((s->type == DBVT_UTF8 || s->type == DBVT_ASCIIZ) && s->pszVal != nullptr) {
+ if (szSave != nullptr)
d->pszVal = (char*)HeapReAlloc(m_hCacheHeap, 0, szSave, mir_strlen(s->pszVal) + 1);
else
d->pszVal = (char*)HeapAlloc(m_hCacheHeap, 0, mir_strlen(s->pszVal) + 1);
mir_strcpy(d->pszVal, s->pszVal);
}
- else if (szSave != NULL)
+ else if (szSave != nullptr)
HeapFree(m_hCacheHeap, 0, szSave);
}
void MDatabaseCache::FreeCachedVariant(DBVARIANT* V)
{
- if ((V->type == DBVT_ASCIIZ || V->type == DBVT_UTF8) && V->pszVal != NULL)
+ if ((V->type == DBVT_ASCIIZ || V->type == DBVT_UTF8) && V->pszVal != nullptr)
HeapFree(m_hCacheHeap, 0, V->pszVal);
}
@@ -192,7 +192,7 @@ STDMETHODIMP_(DBVARIANT*) MDatabaseCache::GetCachedValuePtr(MCONTACT contactID, }
else {
if (bAllocate != 1)
- return NULL;
+ return nullptr;
V = (DBCachedGlobalValue*)HeapAlloc(m_hCacheHeap, HEAP_ZERO_MEMORY, sizeof(DBCachedGlobalValue));
V->name = szSetting;
@@ -210,17 +210,17 @@ STDMETHODIMP_(DBVARIANT*) MDatabaseCache::GetCachedValuePtr(MCONTACT contactID, int index = m_lContacts.getIndex(&ccTemp);
if (index == -1)
- return NULL;
+ return nullptr;
m_lastVL = cc = m_lContacts[index];
- for (V = cc->first; V != NULL; V = V->next)
+ for (V = cc->first; V != nullptr; V = V->next)
if (V->name == szSetting)
break;
- if (V == NULL) {
+ if (V == nullptr) {
if (bAllocate != 1)
- return NULL;
+ return nullptr;
V = (DBCachedContactValue *)HeapAlloc(m_hCacheHeap, HEAP_ZERO_MEMORY, sizeof(DBCachedContactValue));
if (cc->last)
@@ -231,15 +231,15 @@ STDMETHODIMP_(DBVARIANT*) MDatabaseCache::GetCachedValuePtr(MCONTACT contactID, V->name = szSetting;
}
else if (bAllocate == -1) {
- m_lastVL = NULL;
+ m_lastVL = nullptr;
FreeCachedVariant(&V->value);
if (cc->first == V) {
cc->first = V->next;
if (cc->last == V)
- cc->last = V->next; // NULL
+ cc->last = V->next; // nullptr
}
else
- for (V1 = cc->first; V1 != NULL; V1 = V1->next)
+ for (V1 = cc->first; V1 != nullptr; V1 = V1->next)
if (V1->next == V) {
V1->next = V->next;
if (cc->last == V)
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 474490553a..6146eacd2b 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -105,7 +105,7 @@ void FreeMenuProtos(void) for (int i = 0; i < cli.menuProtoCount; i++)
mir_free(cli.menuProtos[i].szProto);
mir_free(cli.menuProtos);
- cli.menuProtos = NULL;
+ cli.menuProtos = nullptr;
}
cli.menuProtoCount = 0;
}
@@ -124,10 +124,10 @@ int fnGetAverageMode(int *pNetProtoCount) netProtoCount++;
if (averageMode == 0)
- averageMode = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0);
- else if (averageMode > 0 && averageMode != CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0)) {
+ averageMode = CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0);
+ else if (averageMode > 0 && averageMode != CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0)) {
averageMode = -1;
- if (pNetProtoCount == NULL)
+ if (pNetProtoCount == nullptr)
break;
}
}
@@ -171,7 +171,7 @@ MIR_APP_DLL(HMENU) Menu_GetMainMenu(void) MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi)
{
MainMenuExecParam *mmep = (MainMenuExecParam*)mir_alloc(sizeof(MainMenuExecParam));
- if (mmep == NULL)
+ if (mmep == nullptr)
return 0;
//we need just one parametr.
@@ -179,8 +179,8 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi) mmep->szMenuName = pmi->name.w;
TMO_IntMenuItem *pimi = Menu_AddItem(hMainMenuObject, pmi, mmep);
- if (pimi == NULL)
- return NULL;
+ if (pimi == nullptr)
+ return nullptr;
mmep->pimi = pimi;
@@ -208,7 +208,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi) INT_PTR MainMenuExecService(WPARAM wParam, LPARAM lParam)
{
MainMenuExecParam *mmep = (MainMenuExecParam*)wParam;
- if (mmep != NULL) {
+ if (mmep != nullptr) {
CallService(mmep->szServiceName, mmep->pimi->execParam, lParam);
}
return 1;
@@ -217,7 +217,7 @@ INT_PTR MainMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR FreeOwnerDataMainMenu(WPARAM, LPARAM lParam)
{
MainMenuExecParam *mmep = (MainMenuExecParam*)lParam;
- if (mmep != NULL) {
+ if (mmep != nullptr) {
mir_free(mmep->szServiceName);
mir_free(mmep);
}
@@ -241,17 +241,17 @@ MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(TMO_MenuItem *pmi, const char *psz // owner data
ContactMenuExecParam *cmep = (ContactMenuExecParam*)mir_calloc(sizeof(ContactMenuExecParam));
cmep->szServiceName = mir_strdup(pmi->pszService);
- if (pszProto != NULL)
+ if (pszProto != nullptr)
cmep->pszContactOwner = mir_strdup(pszProto);
// may be need to change how UniqueName is formed?
TMO_IntMenuItem *pimi = Menu_AddItem(hContactMenuObject, pmi, cmep);
- if (pimi == NULL)
- return NULL;
+ if (pimi == nullptr)
+ return nullptr;
cmep->pimi = pimi;
- if (pszProto == NULL)
+ if (pszProto == nullptr)
pszProto = "";
char buf[256];
@@ -280,7 +280,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildContactMenu(MCONTACT hContact) BuildContactParam bcp;
bcp.szProto = szProto;
bcp.isOnList = (db_get_b(hContact, "CList", "NotOnList", 0) == 0);
- bcp.isOnline = (szProto != NULL && ID_STATUS_OFFLINE != db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE));
+ bcp.isOnline = (szProto != nullptr && ID_STATUS_OFFLINE != db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE));
HMENU hMenu = CreatePopupMenu();
Menu_Build(hMenu, hContactMenuObject, (WPARAM)&bcp);
@@ -291,19 +291,19 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildContactMenu(MCONTACT hContact) static INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
{
TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
- if (pcpp == NULL)
+ if (pcpp == nullptr)
return FALSE;
BuildContactParam *bcp = (BuildContactParam*)pcpp->wParam;
- if (bcp == NULL)
+ if (bcp == nullptr)
return FALSE;
ContactMenuExecParam *cmep = (ContactMenuExecParam*)pcpp->MenuItemOwnerData;
- if (cmep == NULL) //this is root...build it
+ if (cmep == nullptr) //this is root...build it
return TRUE;
- if (cmep->pszContactOwner != NULL) {
- if (bcp->szProto == NULL) return FALSE;
+ if (cmep->pszContactOwner != nullptr) {
+ if (bcp->szProto == nullptr) return FALSE;
if (mir_strcmp(cmep->pszContactOwner, bcp->szProto)) return FALSE;
}
@@ -336,7 +336,7 @@ static INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam) static INT_PTR FreeOwnerDataContactMenu(WPARAM, LPARAM lParam)
{
ContactMenuExecParam *cmep = (ContactMenuExecParam*)lParam;
- if (cmep != NULL) {
+ if (cmep != nullptr) {
mir_free(cmep->szServiceName);
mir_free(cmep->pszContactOwner);
mir_free(cmep);
@@ -365,7 +365,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszP TMO_IntMenuItem *pRoot = MO_GetIntMenuItem(pmi->root);
// owner data
- StatusMenuExecParam *smep = NULL;
+ StatusMenuExecParam *smep = nullptr;
if (pmi->pszService) {
smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
smep->custom = TRUE;
@@ -374,14 +374,14 @@ MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszP }
TMO_IntMenuItem *pimi = Menu_AddItem(hStatusMenuObject, pmi, smep);
- if (pimi == NULL)
- return NULL;
+ if (pimi == nullptr)
+ return nullptr;
if (smep)
smep->hMenuItem = pimi;
char buf[MAX_PATH + 64];
- char *p = (pRoot) ? mir_u2a(pRoot->mi.name.w) : NULL;
+ char *p = (pRoot) ? mir_u2a(pRoot->mi.name.w) : nullptr;
mir_snprintf(buf, "%s/%s", (p) ? p : "", pmi->pszService ? pmi->pszService : "");
mir_free(p);
@@ -421,7 +421,7 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* it return inSub;
TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
- if (pimi != NULL) {
+ if (pimi != nullptr) {
if (pimi == id) {
itdat->OwnerMenu = hMenu;
itdat->position = i;
@@ -450,7 +450,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) CUSTOM_STATUS cs = { sizeof(cs) };
cs.flags = CSSF_MASK_STATUS;
cs.status = &XStatus;
- if (CallProtoServiceInt(NULL, smep->szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0)
+ if (CallProtoServiceInt(0, smep->szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0)
XStatus = 0;
char buf[255];
@@ -482,7 +482,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if (pimi->iconId != -1) {
mii.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && IsThemeActive()) {
- if (pimi->hBmp == NULL)
+ if (pimi->hBmp == nullptr)
pimi->hBmp = ConvertIconToBitmap(pimi->parent->m_hMenuIcons, pimi->iconId);
mii.hbmpItem = pimi->hBmp;
}
@@ -498,13 +498,13 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) timiParent->iconId = pimi->iconId;
if (timiParent->hBmp) DeleteObject(timiParent->hBmp);
- timiParent->hBmp = NULL;
+ timiParent->hBmp = nullptr;
}
}
}
}
else if (smep && smep->status && !smep->custom) {
- int curProtoStatus = (smep->szProto) ? CallProtoServiceInt(NULL, smep->szProto, PS_GETSTATUS, 0, 0) : cli.pfnGetAverageMode(NULL);
+ int curProtoStatus = (smep->szProto) ? CallProtoServiceInt(0, smep->szProto, PS_GETSTATUS, 0, 0) : cli.pfnGetAverageMode(nullptr);
if (smep->status == curProtoStatus)
pimi->mi.flags |= CMIF_CHECKED;
else
@@ -521,27 +521,27 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) prot = NEWSTR_ALLOCA(prn);
if (prn) mir_free(prn);
}
- if (Proto_GetAccount(prot) == NULL)
+ if (Proto_GetAccount(prot) == nullptr)
return TRUE;
- if ((curProtoStatus = CallProtoServiceInt(NULL, prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND)
+ if ((curProtoStatus = CallProtoServiceInt(0, prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND)
curProtoStatus = 0;
if (curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE)
pimi->mi.hIcolibItem = Skin_LoadProtoIcon(prot, curProtoStatus);
else {
- pimi->mi.hIcolibItem = (HICON)CallProtoServiceInt(NULL, prot, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
+ pimi->mi.hIcolibItem = (HICON)CallProtoServiceInt(0, prot, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (pimi->mi.hIcolibItem == (HICON)CALLSERVICE_NOTFOUND)
- pimi->mi.hIcolibItem = NULL;
+ pimi->mi.hIcolibItem = nullptr;
else
IconNeedDestroy = TRUE;
}
if (pimi->mi.hIcolibItem) {
- Menu_ModifyItem(pimi, NULL, pimi->mi.hIcolibItem);
+ Menu_ModifyItem(pimi, nullptr, pimi->mi.hIcolibItem);
if (IconNeedDestroy) {
DestroyIcon((HICON)pimi->mi.hIcolibItem);
- pimi->mi.hIcolibItem = NULL;
+ pimi->mi.hIcolibItem = nullptr;
}
else IcoLib_ReleaseIcon((HICON)pimi->mi.hIcolibItem);
}
@@ -553,7 +553,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
{
StatusMenuExecParam *smep = (StatusMenuExecParam*)wParam;
- if (smep == NULL)
+ if (smep == nullptr)
return 0;
if (smep->custom) {
@@ -566,17 +566,17 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) return 0;
}
- if (smep->status == 0 && smep->pimi != NULL && smep->szProto != NULL) {
+ if (smep->status == 0 && smep->pimi != nullptr && smep->szProto != nullptr) {
char *prot = smep->szProto;
char szHumanName[64] = { 0 };
PROTOACCOUNT *acc = Proto_GetAccount(smep->szProto);
bool bIsLocked = !Proto_IsAccountLocked(acc);
- db_set_b(NULL, prot, "LockMainStatus", bIsLocked);
+ db_set_b(0, prot, "LockMainStatus", bIsLocked);
- CallProtoServiceInt(NULL, smep->szProto, PS_GETNAME, _countof(szHumanName), (LPARAM)szHumanName);
+ CallProtoServiceInt(0, smep->szProto, PS_GETNAME, _countof(szHumanName), (LPARAM)szHumanName);
TMO_IntMenuItem *pimi = MO_GetIntMenuItem(smep->pimi);
- if (pimi == NULL)
+ if (pimi == nullptr)
return 0;
TMO_IntMenuItem *root = (TMO_IntMenuItem*)pimi->mi.root;
@@ -597,11 +597,11 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) replaceStrW(root->mi.name.w, ptszName);
if (cli.hwndStatus)
- InvalidateRect(cli.hwndStatus, NULL, TRUE);
+ InvalidateRect(cli.hwndStatus, nullptr, TRUE);
return 0;
}
- if (smep->szProto != NULL) {
+ if (smep->szProto != nullptr) {
Proto_SetStatus(smep->szProto, smep->status);
NotifyEventHooks(hStatusModeChangeEvent, smep->status, (LPARAM)smep->szProto);
return 0;
@@ -625,14 +625,14 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) Proto_SetStatus(pa->szModuleName, cli.currentDesiredStatusMode);
}
NotifyEventHooks(hStatusModeChangeEvent, cli.currentDesiredStatusMode, 0);
- db_set_w(NULL, "CList", "Status", (WORD)cli.currentDesiredStatusMode);
+ db_set_w(0, "CList", "Status", (WORD)cli.currentDesiredStatusMode);
return 1;
}
INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam)
{
StatusMenuExecParam *smep = (StatusMenuExecParam*)lParam;
- if (smep != NULL) {
+ if (smep != nullptr) {
mir_free(smep->szProto);
mir_free(smep->svc);
mir_free(smep);
@@ -649,7 +649,7 @@ MIR_APP_DLL(BOOL) Clist_MenuProcessCommand(int menu_id, int flags, MCONTACT hCon if (flags & MPCF_MAINMENU) {
if (menu_id >= ID_STATUS_OFFLINE && menu_id <= ID_STATUS_OUTTOLUNCH) {
int pos = statustopos(menu_id);
- if (pos != -1 && hStatusMainMenuHandles != NULL)
+ if (pos != -1 && hStatusMainMenuHandles != nullptr)
return Menu_ProcessCommand(hStatusMainMenuHandles[pos], hContact);
}
}
@@ -702,7 +702,7 @@ BOOL FindMenuHanleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* itd return inSub;
TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
- if (pimi != NULL) {
+ if (pimi != nullptr) {
if (pimi == id) {
itdat->OwnerMenu = hMenu;
itdat->position = i;
@@ -736,7 +736,7 @@ int fnGetProtocolVisibility(const char *accName) PROTOACCOUNT *pa = Proto_GetAccount(accName);
if (pa && pa->bIsVisible && Proto_IsAccountEnabled(pa) && pa->ppro) {
PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(pa->szProtoName);
- if (pd == NULL || pd->type != PROTOTYPE_PROTOCOL)
+ if (pd == nullptr || pd->type != PROTOTYPE_PROTOCOL)
return FALSE;
return (pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0));
@@ -752,7 +752,7 @@ int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos) _itoa(Pos, buf, 10);
DBVARIANT dbv;
- if (!db_get_s(NULL, "Protocols", buf, &dbv)) {
+ if (!db_get_s(0, "Protocols", buf, &dbv)) {
for (int p = 0; p < protoCnt; p++) {
if (mir_strcmp(proto[p]->szName, dbv.pszVal) == 0) {
db_free(&dbv);
@@ -777,7 +777,7 @@ int fnGetAccountIndexByPos(int Pos) void RebuildMenuOrder(void)
{
- BYTE bHideStatusMenu = db_get_b(NULL, "CLUI", "DontHideStatusMenu", 0); // cool perversion, though
+ BYTE bHideStatusMenu = db_get_b(0, "CLUI", "DontHideStatusMenu", 0); // cool perversion, though
// clear statusmenu
RecursiveDeleteMenu(hStatusMenu);
@@ -818,7 +818,7 @@ void RebuildMenuOrder(void) CMenuItem mi;
mi.flags = CMIF_UNICODE | CMIF_KEEPUNTRANSLATED;
mi.position = pos++;
- mi.hIcon = ic = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
+ mi.hIcon = ic = (HICON)CallProtoServiceInt(0, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
mir_snwprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
@@ -952,7 +952,7 @@ void RebuildMenuOrder(void) static int sttRebuildHotkeys(WPARAM, LPARAM)
{
for (int j = 0; j < _countof(statusModeList); j++) {
- if (hStatusMainMenuHandles[j] == NULL)
+ if (hStatusMainMenuHandles[j] == nullptr)
continue;
wchar_t buf[256], hotkeyName[100];
@@ -983,10 +983,10 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) ACKDATA *ack = (ACKDATA*)lParam;
if (ack->type != ACKTYPE_STATUS) return 0;
if (ack->result != ACKRESULT_SUCCESS) return 0;
- if (hStatusMainMenuHandles == NULL) return 0;
+ if (hStatusMainMenuHandles == nullptr) return 0;
if (cli.pfnGetProtocolVisibility(ack->szModule) == 0) return 0;
- int overallStatus = cli.pfnGetAverageMode(NULL);
+ int overallStatus = cli.pfnGetAverageMode(nullptr);
if (overallStatus >= ID_STATUS_OFFLINE) {
int pos = statustopos(cli.currentStatusMenuItem);
@@ -996,7 +996,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) // reset all current possible checked statuses
for (int pos2 = 0; pos2 < hStatusMainMenuHandlesCnt; pos2++)
if (pos2 >= 0 && pos2 < hStatusMainMenuHandlesCnt)
- Menu_ModifyItem(hStatusMainMenuHandles[pos2], NULL, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hStatusMainMenuHandles[pos2], nullptr, INVALID_HANDLE_VALUE, 0);
cli.currentStatusMenuItem = overallStatus;
pos = statustopos(cli.currentStatusMenuItem);
@@ -1009,7 +1009,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) pos = 0;
if (pos >= 0 && pos < hStatusMainMenuHandlesCnt)
- Menu_ModifyItem(hStatusMainMenuHandles[pos], NULL, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hStatusMainMenuHandles[pos], nullptr, INVALID_HANDLE_VALUE, 0);
cli.currentStatusMenuItem = 0;
}
@@ -1022,7 +1022,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) if (pos == -1)
pos = 0;
for (pos = 0; pos < _countof(statusModeList); pos++)
- Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], NULL, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], nullptr, INVALID_HANDLE_VALUE, 0);
}
if (ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + _countof(statusModeList)) {
@@ -1049,13 +1049,13 @@ static MenuProto* FindProtocolMenu(const char *proto) if (!mir_strcmpi(cli.menuProtos[0].szProto, proto))
return &cli.menuProtos[0];
- return NULL;
+ return nullptr;
}
HGENMENU fnGetProtocolMenu(const char* proto)
{
MenuProto *mp = FindProtocolMenu(proto);
- return (mp) ? mp->pMenu : NULL;
+ return (mp) ? mp->pMenu : nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1070,10 +1070,10 @@ static INT_PTR HotkeySetStatus(WPARAM, LPARAM lParam) MIR_APP_DLL(HGENMENU) Menu_AddProtoMenuItem(TMO_MenuItem *mi, const char *pszProto)
{
- if (mi == NULL)
- return NULL;
+ if (mi == nullptr)
+ return nullptr;
- if (db_get_b(NULL, "CList", "MoveProtoMenus", TRUE))
+ if (db_get_b(0, "CList", "MoveProtoMenus", TRUE))
return Menu_AddStatusMenuItem(mi, pszProto);
char szService[100];
@@ -1114,10 +1114,10 @@ void InitCustomMenus(void) hMainMenu = CreatePopupMenu();
hStatusMenu = CreatePopupMenu();
- hStatusMainMenuHandles = NULL;
+ hStatusMainMenuHandles = nullptr;
hStatusMainMenuHandlesCnt = 0;
- hStatusMenuHandles = NULL;
+ hStatusMenuHandles = nullptr;
hStatusMenuHandlesCnt = 0;
// new menu sys
@@ -1175,10 +1175,10 @@ void InitCustomMenus(void) void UninitCustomMenus(void)
{
mir_free(hStatusMainMenuHandles);
- hStatusMainMenuHandles = NULL;
+ hStatusMainMenuHandles = nullptr;
mir_free(hStatusMenuHandles);
- hStatusMenuHandles = NULL;
+ hStatusMenuHandles = nullptr;
Menu_RemoveObject(hMainMenuObject);
Menu_RemoveObject(hStatusMenuObject);
diff --git a/src/mir_app/src/menu_frames.cpp b/src/mir_app/src/menu_frames.cpp index fc71270ff6..36a5e48464 100644 --- a/src/mir_app/src/menu_frames.cpp +++ b/src/mir_app/src/menu_frames.cpp @@ -62,7 +62,7 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam) INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
{
FrameMenuExecParam *fmep = (FrameMenuExecParam*)wParam;
- if (fmep == NULL)
+ if (fmep == nullptr)
return -1;
CallService(fmep->szServiceName, lParam, 0);
@@ -72,7 +72,7 @@ INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM)
{
TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
- if (pcpp == NULL)
+ if (pcpp == nullptr)
return FALSE;
TMO_IntMenuItem *pimi = pcpp->MenuItemHandle;
diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp index 5e97a7fc3f..7ad88ae8b0 100644 --- a/src/mir_app/src/menu_groups.cpp +++ b/src/mir_app/src/menu_groups.cpp @@ -55,12 +55,12 @@ MIR_APP_DLL(HMENU) Menu_BuildGroupMenu() MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp)
{
GroupMenuExecParam *mmep = (GroupMenuExecParam*)mir_calloc(sizeof(GroupMenuExecParam));
- if (mmep == NULL)
+ if (mmep == nullptr)
return 0;
// we need just one parametr.
mmep->szServiceName = mir_strdup(pmi->pszService);
- if (gmp != NULL) {
+ if (gmp != nullptr) {
mmep->Param1 = gmp->wParam;
mmep->Param2 = gmp->lParam;
}
@@ -93,7 +93,7 @@ INT_PTR GroupMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam)
{
GroupMenuExecParam *mmep = (GroupMenuExecParam *)lParam;
- if (mmep != NULL) {
+ if (mmep != nullptr) {
mir_free(mmep->szServiceName);
mir_free(mmep);
}
@@ -106,7 +106,7 @@ INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam) static INT_PTR HideGroupsHelper(WPARAM, LPARAM)
{
int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
- db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal);
+ db_set_b(0, "CList", "HideEmptyGroups", (BYTE)newVal);
SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
return newVal;
}
@@ -114,7 +114,7 @@ static INT_PTR HideGroupsHelper(WPARAM, LPARAM) static INT_PTR UseGroupsHelper(WPARAM, LPARAM)
{
int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
- db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal);
+ db_set_b(0, "CList", "UseGroups", (BYTE)newVal);
SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, newVal,0);
return newVal;
}
@@ -141,7 +141,7 @@ static INT_PTR CreateGroupHelper(WPARAM, LPARAM) static int OnBuildGroupMenu(WPARAM, LPARAM)
{
- bool bChecked = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) != 0;
+ bool bChecked = db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) != 0;
Menu_SetChecked(hHideOfflineUsersMenuItem, bChecked);
bChecked = SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) != 0;
@@ -183,12 +183,12 @@ HMENU cliBuildGroupPopupMenu(ClcGroup *group) MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp)
{
SubGroupMenuExecParam *mmep = (SubGroupMenuExecParam*)mir_calloc(sizeof(SubGroupMenuExecParam));
- if (mmep == NULL)
+ if (mmep == nullptr)
return 0;
// we need just one parametr.
mmep->szServiceName = mir_strdup(pmi->pszService);
- if (gmp != NULL) {
+ if (gmp != nullptr) {
mmep->Param1 = gmp->wParam;
mmep->Param2 = gmp->lParam;
}
@@ -238,7 +238,7 @@ static INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam) static INT_PTR FreeOwnerDataSubGroupMenu(WPARAM, LPARAM lParam)
{
SubGroupMenuExecParam *mmep = (SubGroupMenuExecParam *)lParam;
- if (mmep != NULL) {
+ if (mmep != nullptr) {
mir_free(mmep->szServiceName);
mir_free(mmep);
}
@@ -297,7 +297,7 @@ void InitGroupMenus(void) SET_UID(mi, 0xe6269658, 0x69, 0x4094, 0x9b, 0x35, 0x4e, 0x80, 0x29, 0x26, 0xf, 0x8e);
mi.position = 500001;
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
mi.pszService = MS_CLIST_TOGGLEHIDEOFFLINE;
mi.name.a = LPGEN("&Hide offline users");
gmp.wParam = -1;
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index cdf7fd3c12..c4d9380c7a 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -76,12 +76,12 @@ class CGenMenuOptionsPage : public CDlgBase int runtimepos = 100; char pszParent[33]; - if (pParent == NULL) + if (pParent == nullptr) pszParent[0] = 0; else bin2hex(&pParent->pimi->mi.uid, sizeof(MUUID), pszParent); - while (tvi.hItem != NULL) { + while (tvi.hItem != nullptr) { m_menuItems.GetItem(&tvi); MenuItemOptData *iod = (MenuItemOptData*)tvi.lParam; if (TMO_IntMenuItem *pimi = iod->pimi) { @@ -91,20 +91,20 @@ class CGenMenuOptionsPage : public CDlgBase int visible = tvi.iImage != 0; wchar_t *ptszCustomName; - if (iod->name != NULL && iod->defname != NULL && mir_wstrcmp(iod->name, iod->defname) != 0) + if (iod->name != nullptr && iod->defname != nullptr && mir_wstrcmp(iod->name, iod->defname) != 0) ptszCustomName = iod->name; else ptszCustomName = L""; CMStringW tszValue(FORMAT, L"%d;%d;%S;%s", visible, runtimepos, pszParent, ptszCustomName); - db_set_ws(NULL, szModule, menuItemName, tszValue); + db_set_ws(0, szModule, menuItemName, tszValue); if (pimi->mi.flags & CMIF_CUSTOM) - db_set_s(NULL, szModule, CMStringA(FORMAT, "Custom%d", customOrder++), menuItemName); + db_set_s(0, szModule, CMStringA(FORMAT, "Custom%d", customOrder++), menuItemName); } HTREEITEM hChild = m_menuItems.GetChild(tvi.hItem); - if (hChild != NULL) + if (hChild != nullptr) SaveTreeInternal(iod, hChild, szModule); runtimepos += 100; @@ -125,20 +125,20 @@ class CGenMenuOptionsPage : public CDlgBase return; TIntMenuObject *pmo = GetMenuObjbyId(MenuObjectId); - if (pmo == NULL) + if (pmo == nullptr) return; char szModule[256]; mir_snprintf(szModule, "%s_Items", pmo->pszName); - db_delete_module(NULL, szModule); - SaveTreeInternal(NULL, m_menuItems.GetRoot(), szModule); - db_set_b(NULL, szModule, "MenuFormat", 1); + db_delete_module(0, szModule); + SaveTreeInternal(nullptr, m_menuItems.GetRoot(), szModule); + db_set_b(0, szModule, "MenuFormat", 1); } void FreeTreeData() { HTREEITEM hItem = m_menuItems.GetRoot(); - while (hItem != NULL) { + while (hItem != nullptr) { TVITEMEX tvi; tvi.mask = TVIF_HANDLE | TVIF_PARAM; tvi.hItem = hItem; @@ -163,7 +163,7 @@ class CGenMenuOptionsPage : public CDlgBase { LIST<MenuItemOptData> arItems(10, SortMenuItems); - for (TMO_IntMenuItem *p = pFirst; p != NULL; p = p->next) { + for (TMO_IntMenuItem *p = pFirst; p != nullptr; p = p->next) { // filter out items whose presence & position might not be changed if (p->mi.flags & CMIF_SYSTEM) continue; @@ -171,7 +171,7 @@ class CGenMenuOptionsPage : public CDlgBase MenuItemOptData *PD = new MenuItemOptData(); PD->pimi = p; PD->defname = mir_wstrdup(GetMenuItemText(p)); - PD->name = mir_wstrdup((bReread && p->ptszCustomName != NULL) ? p->ptszCustomName : PD->defname); + PD->name = mir_wstrdup((bReread && p->ptszCustomName != nullptr) ? p->ptszCustomName : PD->defname); PD->bShow = (p->mi.flags & CMIF_HIDDEN) == 0; PD->pos = (bReread) ? p->mi.position : p->originalPosition; PD->id = p->iCommand; @@ -204,16 +204,16 @@ class CGenMenuOptionsPage : public CDlgBase tvis.item.lParam = (LPARAM)PD; tvis.item.pszText = PD->name; tvis.item.iImage = tvis.item.iSelectedImage = PD->bShow; - tvis.item.cChildren = PD->pimi->submenu.first != NULL; + tvis.item.cChildren = PD->pimi->submenu.first != nullptr; HTREEITEM hti = m_menuItems.InsertItem(&tvis); if (bIsFirst) { - if (hRoot == NULL) + if (hRoot == nullptr) m_menuItems.SelectItem(hti); bIsFirst = false; } - if (PD->pimi->submenu.first != NULL) { + if (PD->pimi->submenu.first != nullptr) { BuildTreeInternal(pszModule, bReread, PD->pimi->submenu.first, hti); m_menuItems.Expand(hti, TVE_EXPAND); } @@ -227,7 +227,7 @@ class CGenMenuOptionsPage : public CDlgBase FreeTreeData(); TIntMenuObject *pmo = GetMenuObjbyId(MenuObjectId); - if (pmo == NULL || pmo->m_items.first == NULL) + if (pmo == nullptr || pmo->m_items.first == nullptr) return false; char szModule[256]; @@ -239,7 +239,7 @@ class CGenMenuOptionsPage : public CDlgBase m_menuItems.SendMsg(WM_SETREDRAW, FALSE, 0); m_menuItems.DeleteAllItems(); - BuildTreeInternal(szModule, bReread, pmo->m_items.first, NULL); + BuildTreeInternal(szModule, bReread, pmo->m_items.first, nullptr); m_menuItems.SendMsg(WM_SETREDRAW, TRUE, 0); @@ -303,7 +303,7 @@ public: //---- init dialog ------------------------------------------- virtual void OnInitDialog() { - iInitMenuValue = db_get_b(NULL, "CList", "MoveProtoMenus", TRUE); + iInitMenuValue = db_get_b(0, "CList", "MoveProtoMenus", TRUE); HIMAGELIST himlCheckBoxes = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 2, 2); ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK); @@ -331,12 +331,12 @@ public: virtual void OnApply() { bIconsDisabled = m_enableIcons.GetState() == 0; - db_set_b(NULL, "CList", "DisableMenuIcons", bIconsDisabled); + db_set_b(0, "CList", "DisableMenuIcons", bIconsDisabled); SaveTree(); int iNewMenuValue = !m_radio1.GetState(); if (iNewMenuValue != iInitMenuValue) { - db_set_b(NULL, "CList", "MoveProtoMenus", iNewMenuValue); + db_set_b(0, "CList", "MoveProtoMenus", iNewMenuValue); RebuildProtoMenus(); iInitMenuValue = iNewMenuValue; @@ -353,7 +353,7 @@ public: void btnInsSep_Clicked(CCtrlButton*) { HTREEITEM hti = m_menuItems.GetSelection(); - if (hti == NULL) + if (hti == nullptr) return; TVITEMEX tvi = { 0 }; @@ -381,7 +381,7 @@ public: void btnInsMenu_Clicked(CCtrlButton*) { HTREEITEM hti = m_menuItems.GetSelection(); - if (hti == NULL) + if (hti == nullptr) return; TVITEMEX tvi = { 0 }; @@ -397,7 +397,7 @@ public: mi.flags = CMIF_CUSTOM; mi.name.a = LPGEN("New submenu"); mi.position = curData->pos - 1; - TMO_IntMenuItem *pimi = Menu_AddItem(curData->pimi->parent->id, &mi, NULL); + TMO_IntMenuItem *pimi = Menu_AddItem(curData->pimi->parent->id, &mi, nullptr); MenuItemOptData *PD = new MenuItemOptData(); PD->id = -1; @@ -428,7 +428,7 @@ public: void btnDefault_Clicked(CCtrlButton*) { HTREEITEM hti = m_menuItems.GetSelection(); - if (hti == NULL) + if (hti == nullptr) return; TVITEMEX tvi; @@ -452,7 +452,7 @@ public: void btnSet_Clicked(CCtrlButton*) { HTREEITEM hti = m_menuItems.GetSelection(); - if (hti == NULL) + if (hti == nullptr) return; TVITEMEX tvi; @@ -490,7 +490,7 @@ public: m_customName.Enable(false); HTREEITEM hti = m_menuItems.GetSelection(); - if (hti == NULL) + if (hti == nullptr) return; TVITEMEX tvi; @@ -512,7 +512,7 @@ public: m_service.SetTextA(szText); } - m_btnInsMenu.Enable(iod->pimi->mi.root == NULL); + m_btnInsMenu.Enable(iod->pimi->mi.root == nullptr); m_btnDefault.Enable(mir_wstrcmp(iod->name, iod->defname) != 0); m_btnSet.Enable(true); m_customName.Enable(true); @@ -521,7 +521,7 @@ public: void onMenuItemBeginDrag(CCtrlTreeView::TEventInfo *evt) { MenuItemOptData *p = (MenuItemOptData*)evt->nmtv->itemNew.lParam; - if (p->pimi != NULL) + if (p->pimi != nullptr) if (p->pimi->mi.flags & CMIF_UNMOVABLE) evt->nmhdr->code = 0; // reject an attempt to change item's position } diff --git a/src/mir_app/src/menu_tray.cpp b/src/mir_app/src/menu_tray.cpp index 41ec05c228..972d837ea9 100644 --- a/src/mir_app/src/menu_tray.cpp +++ b/src/mir_app/src/menu_tray.cpp @@ -80,7 +80,7 @@ static INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam) static INT_PTR TrayMenuOnAddService(WPARAM wParam, LPARAM lParam)
{
MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
- if (mii == NULL)
+ if (mii == nullptr)
return 0;
if (hTrayMainMenuItemProxy == (HGENMENU)lParam) {
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index bd649dfc32..b054c72631 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -39,8 +39,8 @@ static void DumpMenuItem(TMO_IntMenuItem* pParent, int level = 0) memset(temp, '\t', level);
temp[level] = 0;
- for (TMO_IntMenuItem *pimi = pParent; pimi != NULL; pimi = pimi->next) {
- Netlib_Logf(NULL, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.name.w);
+ for (TMO_IntMenuItem *pimi = pParent; pimi != nullptr; pimi = pimi->next) {
+ Netlib_Logf(nullptr, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.name.w);
TMO_IntMenuItem *submenu = pimi->submenu.first;
if (submenu)
@@ -64,7 +64,7 @@ TIntMenuObject* GetMenuObjbyId(int id) case MO_CONTACT: id = hContactMenuObject; break;
case MO_STATUS: id = hStatusMenuObject; break;
case MO_PROTO:
- if (db_get_b(NULL, "CList", "MoveProtoMenus", true))
+ if (db_get_b(0, "CList", "MoveProtoMenus", true))
id = hStatusMenuObject;
else
id = hMainMenuObject;
@@ -85,11 +85,11 @@ LPTSTR GetMenuItemText(TMO_IntMenuItem *pimi) TMO_IntMenuItem* MO_RecursiveWalkMenu(TMO_IntMenuItem *parent, pfnWalkFunc func, void* param)
{
- if (parent == NULL)
- return NULL;
+ if (parent == nullptr)
+ return nullptr;
TMO_IntMenuItem *pnext;
- for (TMO_IntMenuItem *pimi = parent; pimi != NULL; pimi = pnext) {
+ for (TMO_IntMenuItem *pimi = parent; pimi != nullptr; pimi = pnext) {
TMO_IntMenuItem *submenu = pimi->submenu.first;
pnext = pimi->next;
if (func(pimi, param)) // it can destroy the menu item
@@ -102,7 +102,7 @@ TMO_IntMenuItem* MO_RecursiveWalkMenu(TMO_IntMenuItem *parent, pfnWalkFunc func, }
}
- return NULL;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -113,7 +113,7 @@ MIR_APP_DLL(BOOL) Menu_MeasureItem(LPARAM lParam) return FALSE;
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT*)lParam;
- if (mis == NULL)
+ if (mis == nullptr)
return FALSE;
// prevent win9x from ugly menus displaying when there is no icon
@@ -121,7 +121,7 @@ MIR_APP_DLL(BOOL) Menu_MeasureItem(LPARAM lParam) mis->itemHeight = 0;
TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)mis->itemData);
- if (pimi == NULL)
+ if (pimi == nullptr)
return FALSE;
if (pimi->iconId == -1)
@@ -140,13 +140,13 @@ MIR_APP_DLL(BOOL) Menu_DrawItem(LPARAM lParam) return FALSE;
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT*)lParam;
- if (dis == NULL)
+ if (dis == nullptr)
return FALSE;
mir_cslock lck(csMenuHook);
TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)dis->itemData);
- if (pimi == NULL || pimi->iconId == -1)
+ if (pimi == nullptr || pimi->iconId == -1)
return FALSE;
int y = (dis->rcItem.bottom - dis->rcItem.top - g_iIconSY) / 2 + 1;
@@ -198,10 +198,10 @@ EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(int hMenuObject, int key) mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
- if (pmo == NULL)
+ if (pmo == nullptr)
return FALSE;
- for (TMO_IntMenuItem *pimi = pmo->m_items.first; pimi != NULL; pimi = pimi->next) {
+ for (TMO_IntMenuItem *pimi = pmo->m_items.first; pimi != nullptr; pimi = pimi->next) {
if (pimi->hotKey == 0) continue;
if (HIWORD(pimi->hotKey) != key) continue;
if (!(LOWORD(pimi->hotKey) & MOD_ALT) != !(GetKeyState(VK_MENU) & 0x8000)) continue;
@@ -219,23 +219,23 @@ EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(int hMenuObject, int key) MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(PROTO_INTERFACE *pThis)
{
- if (pThis == NULL)
+ if (pThis == nullptr)
return 0;
- if (db_get_b(NULL, "CList", "MoveProtoMenus", TRUE)) {
- if (pThis->m_hMainMenuItem != NULL) {
+ if (db_get_b(0, "CList", "MoveProtoMenus", TRUE)) {
+ if (pThis->m_hMainMenuItem != nullptr) {
Menu_RemoveItem(pThis->m_hMainMenuItem);
- pThis->m_hMainMenuItem = NULL;
+ pThis->m_hMainMenuItem = nullptr;
}
return cli.pfnGetProtocolMenu(pThis->m_szModuleName);
}
TIntMenuObject *pmo = GetMenuObjbyId(hMainMenuObject);
- if (pmo == NULL)
- return NULL;
+ if (pmo == nullptr)
+ return nullptr;
mir_cslock lck(csMenuHook);
- for (TMO_IntMenuItem *p = pmo->m_items.first; p != NULL; p = p->next)
+ for (TMO_IntMenuItem *p = pmo->m_items.first; p != nullptr; p = p->next)
if (!mir_strcmp(p->pszUniqName, pThis->m_szModuleName))
return p;
@@ -247,11 +247,11 @@ MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(PROTO_INTERFACE *pThis) mi.hIcolibItem = pThis->m_hProtoIcon;
char szUid[33];
- if (db_get_static(NULL, pThis->m_szModuleName, "AM_MenuId", szUid, _countof(szUid))) {
+ if (db_get_static(0, pThis->m_szModuleName, "AM_MenuId", szUid, _countof(szUid))) {
UUID id;
UuidCreate(&id);
bin2hex(&id, sizeof(id), szUid);
- db_set_s(NULL, pThis->m_szModuleName, "AM_MenuId", szUid);
+ db_set_s(0, pThis->m_szModuleName, "AM_MenuId", szUid);
}
hex2bin(szUid, &mi.uid, sizeof(mi.uid));
@@ -267,7 +267,7 @@ MIR_APP_DLL(int) Menu_GetItemInfo(HGENMENU hMenuItem, TMO_MenuItem &pInfo) TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
mir_cslock lck(csMenuHook);
- if (pimi == NULL)
+ if (pimi == nullptr)
return -1;
pInfo = pimi->mi;
@@ -287,11 +287,11 @@ static int FindDefaultItem(TMO_IntMenuItem *pimi, void*) MIR_APP_DLL(HGENMENU) Menu_GetDefaultItem(HGENMENU hMenu)
{
if (!bIsGenMenuInited)
- return NULL;
+ return nullptr;
TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenu);
mir_cslock lck(csMenuHook);
- return (pimi) ? MO_RecursiveWalkMenu(pimi, FindDefaultItem, NULL) : NULL;
+ return (pimi) ? MO_RecursiveWalkMenu(pimi, FindDefaultItem, nullptr) : nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -299,7 +299,7 @@ MIR_APP_DLL(HGENMENU) Menu_GetDefaultItem(HGENMENU hMenu) static void Menu_SetItemFlags(HGENMENU hMenuItem, bool bSet, int mask)
{
TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
- if (pimi == NULL)
+ if (pimi == nullptr)
return;
int flags = pimi->mi.flags;
@@ -341,10 +341,10 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const wchar_t *ptszName, HA mir_cslock lck(csMenuHook);
TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
- if (pimi == NULL)
+ if (pimi == nullptr)
return -1;
- if (ptszName != NULL)
+ if (ptszName != nullptr)
replaceStrW(pimi->mi.name.w, ptszName);
if (iFlags != -1) {
@@ -359,23 +359,23 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const wchar_t *ptszName, HA HANDLE hIcolibItem = IcoLib_IsManaged((HICON)hIcolib);
if (hIcolibItem) {
HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
- if (hIcon != NULL) {
+ if (hIcon != nullptr) {
pimi->hIcolibItem = hIcolibItem;
pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, hIcon);
IcoLib_ReleaseIcon(hIcon);
}
- else pimi->iconId = -1, pimi->hIcolibItem = NULL;
+ else pimi->iconId = -1, pimi->hIcolibItem = nullptr;
}
else {
pimi->mi.hIcon = (HICON)hIcolib;
- if (hIcolib != NULL)
+ if (hIcolib != nullptr)
pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, (HICON)hIcolib);
else
pimi->iconId = -1; //fixme, should remove old icon & shuffle all iconIds
}
if (pimi->hBmp) {
DeleteObject(pimi->hBmp);
- pimi->hBmp = NULL;
+ pimi->hBmp = nullptr;
}
}
@@ -387,11 +387,11 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const wchar_t *ptszName, HA MIR_APP_DLL(void*) Menu_GetItemData(HGENMENU hMenuItem)
{
if (!bIsGenMenuInited)
- return NULL;
+ return nullptr;
mir_cslock lck(csMenuHook);
TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
- return (pimi) ? pimi->pUserData : NULL;
+ return (pimi) ? pimi->pUserData : nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -399,16 +399,16 @@ MIR_APP_DLL(void*) Menu_GetItemData(HGENMENU hMenuItem) TMO_IntMenuItem *MO_GetIntMenuItem(HGENMENU wParam)
{
TMO_IntMenuItem *result = (TMO_IntMenuItem*)wParam;
- if (result == NULL)
- return NULL;
+ if (result == nullptr)
+ return nullptr;
__try {
if (result->signature != MENUITEM_SIGNATURE)
- result = NULL;
+ result = nullptr;
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
- result = NULL;
+ result = nullptr;
}
return result;
@@ -430,7 +430,7 @@ int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam) {
mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(menuID);
- if (pmo == NULL)
+ if (pmo == nullptr)
return -1;
pimi = MO_RecursiveWalkMenu(pmo->m_items.first, FindMenuByCommand, &command);
@@ -464,7 +464,7 @@ MIR_APP_DLL(BOOL) Menu_ProcessCommand(HGENMENU hMenuItem, LPARAM lParam) TMO_IntMenuItem *pimi;
{
mir_cslock lck(csMenuHook);
- if ((pimi = MO_GetIntMenuItem(hMenuItem)) == NULL)
+ if ((pimi = MO_GetIntMenuItem(hMenuItem)) == nullptr)
return false;
}
@@ -484,7 +484,7 @@ MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value) mir_cslock lck(csMenuHook);
TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hItem);
- if (pimi == NULL)
+ if (pimi == nullptr)
return -1;
switch (iOption) {
@@ -517,7 +517,7 @@ MIR_APP_DLL(int) Menu_ConfigureObject(int hMenuObject, int setting, INT_PTR valu mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
- if (pmo != NULL) {
+ if (pmo != nullptr) {
switch (setting) {
case MCO_OPT_ONADD_SERVICE:
replaceStr(pmo->onAddService, (char*)value);
@@ -544,8 +544,8 @@ MIR_APP_DLL(int) Menu_ConfigureObject(int hMenuObject, int setting, INT_PTR valu MIR_APP_DLL(int) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService)
{
- if (szName == NULL || szDisplayName == NULL)
- return NULL;
+ if (szName == nullptr || szDisplayName == nullptr)
+ return 0;
mir_cslock lck(csMenuHook);
@@ -569,7 +569,7 @@ MIR_APP_DLL(int) Menu_RemoveObject(int hMenuObject) mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
- if (pmo == NULL)
+ if (pmo == nullptr)
return -1;
g_menus.remove(pmo);
@@ -591,12 +591,12 @@ MIR_APP_DLL(int) Menu_RemoveItem(HGENMENU hMenuItem) {
mir_cslock lck(csMenuHook);
TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
- if (pimi == NULL)
+ if (pimi == nullptr)
return -1;
if (pimi->submenu.first) {
- MO_RecursiveWalkMenu(pimi->submenu.first, FreeMenuItem, NULL);
- pimi->submenu.first = NULL;
+ MO_RecursiveWalkMenu(pimi->submenu.first, FreeMenuItem, nullptr);
+ pimi->submenu.first = nullptr;
}
pimi->owner->remove(pimi);
@@ -656,7 +656,7 @@ static int GetNextObjectMenuItemId() if (NextObjectMenuItemId >= CLISTMENUIDMAX) {
NextObjectMenuItemId = CLISTMENUIDMIN;
for (int i = 0; i < g_menus.getCount(); i++)
- MO_RecursiveWalkMenu(g_menus[i]->m_items.first, PackMenuItems, NULL);
+ MO_RecursiveWalkMenu(g_menus[i]->m_items.first, PackMenuItems, nullptr);
}
return NextObjectMenuItemId++;
@@ -664,11 +664,11 @@ static int GetNextObjectMenuItemId() /////////////////////////////////////////////////////////////////////////////////////////
// Adds new submenu
-// Returns a handle to the newly created root item or NULL
+// Returns a handle to the newly created root item or nullptr
static int FindRoot(TMO_IntMenuItem *pimi, void *param)
{
- if (pimi->mi.name.w != NULL)
+ if (pimi->mi.name.w != nullptr)
if (pimi->submenu.first && !mir_wstrcmp(pimi->mi.name.w, (wchar_t*)param))
return TRUE;
@@ -679,11 +679,11 @@ MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int pos {
mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
- if (pmo == NULL)
- return NULL;
+ if (pmo == nullptr)
+ return nullptr;
TMO_IntMenuItem *oldroot = MO_RecursiveWalkMenu(pmo->m_items.first, FindRoot, (void*)ptszName);
- if (oldroot != NULL)
+ if (oldroot != nullptr)
return oldroot;
CMenuItem mi;
@@ -692,22 +692,22 @@ MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int pos mi.hLangpack = _hLang;
mi.name.w = (wchar_t*)ptszName;
mi.position = position;
- return Menu_AddItem(hMenuObject, &mi, NULL);
+ return Menu_AddItem(hMenuObject, &mi, nullptr);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Adds new menu item
-// Returns a handle to the newly created item or NULL
+// Returns a handle to the newly created item or nullptr
MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUserData)
{
- if (!bIsGenMenuInited || pmi == NULL)
- return NULL;
+ if (!bIsGenMenuInited || pmi == nullptr)
+ return nullptr;
mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
- if (pmo == NULL)
- return NULL;
+ if (pmo == nullptr)
+ return nullptr;
TMO_IntMenuItem* p = (TMO_IntMenuItem*)mir_calloc(sizeof(TMO_IntMenuItem));
p->parent = pmo;
@@ -724,9 +724,9 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs else
p->mi.name.w = mir_a2u(pmi->name.a);
- if (pmi->hIcon != NULL && !bIconsDisabled) {
+ if (pmi->hIcon != nullptr && !bIconsDisabled) {
HANDLE hIcolibItem = IcoLib_IsManaged(pmi->hIcon);
- if (hIcolibItem != NULL) {
+ if (hIcolibItem != nullptr) {
HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, hIcon);
p->hIcolibItem = hIcolibItem;
@@ -735,7 +735,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs else p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, pmi->hIcon);
}
- TMO_IntMenuItem *pRoot = (p->mi.root != NULL) ? MO_GetIntMenuItem(p->mi.root) : NULL;
+ TMO_IntMenuItem *pRoot = (p->mi.root != nullptr) ? MO_GetIntMenuItem(p->mi.root) : nullptr;
if (pRoot) {
p->owner = &pRoot->submenu;
@@ -772,7 +772,7 @@ static int WhereToPlace(HMENU hMenu, TMO_MenuItem *mi) GetMenuItemInfo(hMenu, i, TRUE, &mii);
if (mii.fType != MFT_SEPARATOR) {
TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
- if (pimi != NULL)
+ if (pimi != nullptr)
if (pimi->mi.position <= mi->position)
return i + 1;
}
@@ -814,13 +814,13 @@ static void InsertSeparator(HMENU hMenu, int uItem) static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *lpmii)
{
TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)lpmii->dwItemData), *p;
- if (pimi == NULL)
+ if (pimi == nullptr)
return;
// check for separator before
if (uItem) {
UINT fType = GetMenuItemTypeData(hMenu, uItem - 1, p);
- if (p != NULL && fType != MFT_SEPARATOR) {
+ if (p != nullptr && fType != MFT_SEPARATOR) {
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) {
// but might be supposed to be after the next one instead
if (!(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR))
@@ -833,7 +833,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l // check for separator after
if (uItem < GetMenuItemCount(hMenu)) {
UINT fType = GetMenuItemTypeData(hMenu, uItem, p);
- if (p != NULL && fType != MFT_SEPARATOR)
+ if (p != nullptr && fType != MFT_SEPARATOR)
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL))
InsertSeparator(hMenu, uItem);
}
@@ -842,7 +842,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l MENUITEMINFO mii = *lpmii;
int count = GetMenuItemCount(hMenu);
- if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL) {
+ if (count != 0 && (count % 33) == 0 && pimi->mi.root != nullptr) {
if (!(mii.fMask & MIIM_FTYPE))
mii.fType = 0;
mii.fMask |= MIIM_FTYPE;
@@ -869,7 +869,7 @@ static int sttReadOldItem(TMO_IntMenuItem *pmi, void *szModule) // check if it visible
mir_snprintf(szSetting, "%s_visible", menuItemName);
- pmi->customVisible = db_get_b(NULL, (char*)szModule, szSetting, 1) != 0;
+ pmi->customVisible = db_get_b(0, (char*)szModule, szSetting, 1) != 0;
if (pmi->customVisible)
pmi->mi.flags &= ~CMIF_HIDDEN;
else
@@ -877,14 +877,14 @@ static int sttReadOldItem(TMO_IntMenuItem *pmi, void *szModule) // mi.name.w
mir_snprintf(szSetting, "%s_name", menuItemName);
- wchar_t *tszCustomName = db_get_wsa(NULL, (char*)szModule, szSetting);
- if (tszCustomName != NULL) {
+ wchar_t *tszCustomName = db_get_wsa(0, (char*)szModule, szSetting);
+ if (tszCustomName != nullptr) {
mir_free(pmi->ptszCustomName);
pmi->ptszCustomName = tszCustomName;
}
mir_snprintf(szSetting, "%s_pos", menuItemName);
- int pos = db_get_dw(NULL, (char*)szModule, szSetting, -1);
+ int pos = db_get_dw(0, (char*)szModule, szSetting, -1);
if (pos == -1) {
if (pmi->submenu.first)
pmi->mi.position = 0;
@@ -900,18 +900,18 @@ static int sttDumpItem(TMO_IntMenuItem *pmi, void *szModule) bin2hex(&pmi->mi.uid, sizeof(pmi->mi.uid), menuItemName);
int bVisible = (pmi->mi.flags & CMIF_HIDDEN) == 0;
- const wchar_t *ptszName = (pmi->ptszCustomName != NULL) ? pmi->ptszCustomName : L"";
+ const wchar_t *ptszName = (pmi->ptszCustomName != nullptr) ? pmi->ptszCustomName : L"";
char szRootUid[33];
- if (pmi->mi.root == NULL)
+ if (pmi->mi.root == nullptr)
szRootUid[0] = 0;
else
bin2hex(&pmi->mi.root->mi.uid, sizeof(MUUID), szRootUid);
CMStringW szNewValue(FORMAT, L"%d;%d;%S;%s", bVisible, pmi->mi.position, szRootUid, ptszName);
- db_set_ws(NULL, (char*)szModule, menuItemName, szNewValue);
+ db_set_ws(0, (char*)szModule, menuItemName, szNewValue);
- Netlib_Logf(NULL, "MENU[%s] => %s, %d, %d", menuItemName, pmi->pszUniqName, bVisible, pmi->mi.position);
+ Netlib_Logf(nullptr, "MENU[%s] => %s, %d, %d", menuItemName, pmi->pszUniqName, bVisible, pmi->mi.position);
}
return 0;
}
@@ -927,20 +927,20 @@ static void CALLBACK sttUpdateMenuService() mir_snprintf(szModule, "%s_Items", pmo->pszName);
// was a menu converted?
- if (db_get_b(NULL, szModule, "MenuFormat", 0) == 0) { // no
+ if (db_get_b(0, szModule, "MenuFormat", 0) == 0) { // no
// read old settings
MO_RecursiveWalkMenu(pmo->m_items.first, sttReadOldItem, szModule);
// wipe out old trash, write new data & compatibility flag
- db_delete_module(NULL, szModule);
- db_set_b(NULL, szModule, "MenuFormat", true);
+ db_delete_module(0, szModule);
+ db_set_b(0, szModule, "MenuFormat", true);
MO_RecursiveWalkMenu(pmo->m_items.first, sttDumpItem, szModule);
}
else { // yes, menu is already converted, simply load its data
for (int j = 0;; j++) {
char szSetting[100];
mir_snprintf(szSetting, "Custom%d", j);
- ptrA szCustomMenu(db_get_sa(NULL, szModule, szSetting));
+ ptrA szCustomMenu(db_get_sa(0, szModule, szSetting));
if (mir_strlen(szCustomMenu) != 32)
break;
@@ -954,7 +954,7 @@ static void CALLBACK sttUpdateMenuService() sscanf(&szCustomMenu[k*2], "%02x", &tmp);
p[k] = tmp;
}
- Menu_AddItem(pmo->id, &mi, NULL);
+ Menu_AddItem(pmo->id, &mi, nullptr);
}
MO_RecursiveWalkMenu(pmo->m_items.first, Menu_LoadFromDatabase, szModule);
@@ -983,8 +983,8 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) bin2hex(&pimi->mi.uid, sizeof(pimi->mi.uid), menuItemName);
TIntMenuObject *pmo = pimi->parent;
- ptrW szValue(db_get_wsa(NULL, (char*)szModule, menuItemName));
- if (szValue == NULL)
+ ptrW szValue(db_get_wsa(0, (char*)szModule, menuItemName));
+ if (szValue == nullptr)
return 0;
wchar_t *ptszToken = szValue, *pDelim = wcschr(szValue, ';');
@@ -1006,7 +1006,7 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) }
ptszToken = pDelim + 1;
- if ((pDelim = wcschr(ptszToken, ';')) == NULL) {
+ if ((pDelim = wcschr(ptszToken, ';')) == nullptr) {
if (i == 2 && *ptszToken != 0)
wcsncpy_s(tszCustomName, ptszToken, _TRUNCATE);
break;
@@ -1020,10 +1020,10 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) else
pimi->mi.flags |= CMIF_HIDDEN;
- replaceStrW(pimi->ptszCustomName, tszCustomName[0] ? tszCustomName : NULL);
+ replaceStrW(pimi->ptszCustomName, tszCustomName[0] ? tszCustomName : nullptr);
MUUID currentUid;
- if (pimi->mi.root == NULL)
+ if (pimi->mi.root == nullptr)
memset(¤tUid, 0, sizeof(currentUid));
else
memcpy(¤tUid, &pimi->mi.root->mi.uid, sizeof(currentUid));
@@ -1032,11 +1032,11 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) TMO_LinkedList *pNew;
if (customRoot != miid_last) {
TMO_IntMenuItem *p = MO_RecursiveWalkMenu(pmo->m_items.first, sttFindMenuItemByUid, &customRoot);
- if (p == NULL)
+ if (p == nullptr)
return 0;
if (p == pimi) { // prevent a loop
- Netlib_Logf(NULL, "MENU: preventing endless loop in %s", menuItemName);
+ Netlib_Logf(nullptr, "MENU: preventing endless loop in %s", menuItemName);
return 0;
}
@@ -1044,7 +1044,7 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) pNew = &p->submenu;
}
else {
- pimi->mi.root = NULL;
+ pimi->mi.root = nullptr;
pNew = &pmo->m_items;
}
@@ -1064,23 +1064,23 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule) static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM wParam, LPARAM lParam)
{
- if (pRootMenu == NULL)
- return NULL;
+ if (pRootMenu == nullptr)
+ return nullptr;
char szModule[256];
TIntMenuObject *pmo = pRootMenu->parent;
mir_snprintf(szModule, "%s_Items", pmo->pszName);
- if (pRootMenu->mi.root == NULL)
+ if (pRootMenu->mi.root == nullptr)
while (GetMenuItemCount(hMenu) > 0)
DeleteMenu(hMenu, 0, MF_BYPOSITION);
- for (TMO_IntMenuItem *pmi = pRootMenu; pmi != NULL; pmi = pmi->next) {
+ for (TMO_IntMenuItem *pmi = pRootMenu; pmi != nullptr; pmi = pmi->next) {
TMO_MenuItem *mi = &pmi->mi;
if (mi->flags & CMIF_HIDDEN)
continue;
- if (pmo->CheckService != NULL) {
+ if (pmo->CheckService != nullptr) {
TCheckProcParam CheckParam;
CheckParam.wParam = wParam;
CheckParam.lParam = lParam;
@@ -1099,7 +1099,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM if (pmi->iconId != -1) {
mii.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && IsThemeActive()) {
- if (pmi->hBmp == NULL)
+ if (pmi->hBmp == nullptr)
pmi->hBmp = ConvertIconToBitmap(pmi->parent->m_hMenuIcons, pmi->iconId);
mii.hbmpItem = pmi->hBmp;
}
@@ -1141,7 +1141,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM }
#endif
- if (pmo->onAddService != NULL)
+ if (pmo->onAddService != nullptr)
if (CallService(pmo->onAddService, (WPARAM)&mii, (LPARAM)pmi) == FALSE)
continue;
@@ -1160,13 +1160,13 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, int hMenuObject, WPARAM wParam, LPARAM lParam)
{
if (!bIsGenMenuInited)
- return NULL;
+ return nullptr;
mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
- if (pmo == NULL)
- return NULL;
+ if (pmo == nullptr)
+ return nullptr;
#if defined(_DEBUG)
// DumpMenuItem(pmo->m_items.first);
@@ -1209,7 +1209,7 @@ int OnIconLibChanges(WPARAM, LPARAM) static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)
{
wchar_t *descr = GetMenuItemText(pmi);
- if (!descr || pmi->hIcolibItem != NULL || pmi->mi.uid == miid_last)
+ if (!descr || pmi->hIcolibItem != nullptr || pmi->mi.uid == miid_last)
return FALSE;
HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
@@ -1226,7 +1226,7 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*) descr = NEWWSTR_ALLOCA(descr);
for (wchar_t *p = descr; *p; p++) {
- if ((p = wcschr(p, '&')) == NULL)
+ if ((p = wcschr(p, '&')) == nullptr)
break;
memmove(p, p + 1, sizeof(wchar_t)*(mir_wstrlen(p + 1) + 1));
@@ -1278,14 +1278,14 @@ static VOID CALLBACK PostRegisterIcons(HWND, UINT, UINT_PTR, DWORD) static int OnModulesLoaded(WPARAM, LPARAM)
{
- posttimerid = SetTimer(NULL, 0, 5, (TIMERPROC)PostRegisterIcons);
+ posttimerid = SetTimer(nullptr, 0, 5, (TIMERPROC)PostRegisterIcons);
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibChanges);
return 0;
}
int InitGenMenu()
{
- bIconsDisabled = db_get_b(NULL, "CList", "DisableMenuIcons", 0) != 0;
+ bIconsDisabled = db_get_b(0, "CList", "DisableMenuIcons", 0) != 0;
bIsGenMenuInited = true;
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
@@ -1311,7 +1311,7 @@ TIntMenuObject::TIntMenuObject() TIntMenuObject::~TIntMenuObject()
{
- MO_RecursiveWalkMenu(m_items.first, FreeMenuItem, NULL);
+ MO_RecursiveWalkMenu(m_items.first, FreeMenuItem, nullptr);
mir_free(FreeService);
mir_free(onAddService);
@@ -1350,14 +1350,14 @@ void TMO_LinkedList::insert(TMO_IntMenuItem *pItem) void TMO_LinkedList::remove(TMO_IntMenuItem *pItem)
{
- TMO_IntMenuItem *pPrev = NULL;
- for (TMO_IntMenuItem *p = first; p != NULL; p = p->next) {
+ TMO_IntMenuItem *pPrev = nullptr;
+ for (TMO_IntMenuItem *p = first; p != nullptr; p = p->next) {
if (p == pItem) {
if (first == pItem) first = pItem->next;
if (last == pItem) last = pPrev;
if (pPrev)
pPrev->next = pItem->next;
- pItem->next = NULL;
+ pItem->next = nullptr;
return;
}
pPrev = p;
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp index ebb98cd1f9..cdfefec5fa 100644 --- a/src/mir_app/src/meta_addto.cpp +++ b/src/mir_app/src/meta_addto.cpp @@ -46,7 +46,7 @@ static int FillList(HWND list, BOOL sort) for (MCONTACT hMetaUser = db_find_first(); hMetaUser; hMetaUser = db_find_next(hMetaUser)) {
// if it's not a MetaContact, go to the next
DBCachedContact *cc = CheckMeta(hMetaUser);
- if (cc == NULL)
+ if (cc == nullptr)
continue;
// get contact display name from clist
@@ -134,7 +134,7 @@ CMetaSelectDlg::CMetaSelectDlg(MCONTACT hContact) void CMetaSelectDlg::OnInitDialog()
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(m_hContact);
- if (cc == NULL)
+ if (cc == nullptr)
{
Close();
return;
diff --git a/src/mir_app/src/meta_api.cpp b/src/mir_app/src/meta_api.cpp index f5642bdf9f..4ae422ded5 100644 --- a/src/mir_app/src/meta_api.cpp +++ b/src/mir_app/src/meta_api.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static INT_PTR MetaAPI_GetMostOnline(WPARAM hMetaContact, LPARAM)
{
DBCachedContact *cc = CheckMeta(hMetaContact);
- return (cc == NULL) ? NULL : Meta_GetMostOnline(cc);
+ return (cc == nullptr) ? 0 : Meta_GetMostOnline(cc);
}
// wParam=(HANDLE)hContact
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 67e593666e..7695ed0b98 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -53,7 +53,7 @@ static void FillContactList(HWND hList) LvItem.iItem = i;
wchar_t *ptszCDN = cli.pfnGetContactDisplayName(g_data.hContact[i], 0);
- if (ptszCDN == NULL)
+ if (ptszCDN == nullptr)
ptszCDN = TranslateT("(Unknown contact)");
LvItem.iSubItem = 0; // clist display name
@@ -96,7 +96,7 @@ static void FillContactList(HWND hList) SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem); // Enter text to SubItems
LvItem.iSubItem = 2; // protocol
- wcsncpy_s(buff, (pa == NULL) ? _A2T(szProto) : pa->tszAccountName, _TRUNCATE);
+ wcsncpy_s(buff, (pa == nullptr) ? _A2T(szProto) : pa->tszAccountName, _TRUNCATE);
ListView_SetItem(hList, &LvItem);
}
else {
@@ -216,7 +216,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara Window_SetIcon_IcoLib(hwndDlg, Meta_GetIconHandle(I_EDIT));
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(lParam);
- if (cc == NULL) {
+ if (cc == nullptr) {
DestroyWindow(hwndDlg);
return FALSE;
}
@@ -271,7 +271,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara case WMU_SETTITLE:
{
wchar_t *ptszCDN = cli.pfnGetContactDisplayName(lParam, 0);
- if (ptszCDN == NULL)
+ if (ptszCDN == nullptr)
ptszCDN = TranslateT("(Unknown contact)");
SetDlgItemText(hwndDlg, IDC_ED_NAME, ptszCDN);
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 674b55a9cd..d4408ea5bd 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -53,11 +53,11 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM) // Create a new metacontact
MCONTACT hMetaContact = db_add_contact();
- if (hMetaContact == NULL)
- return NULL;
+ if (hMetaContact == 0)
+ return 0;
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMetaContact);
- if (cc == NULL)
+ if (cc == nullptr)
return 0;
db_set_dw(hMetaContact, META_PROTO, "NumContacts", 0);
@@ -89,12 +89,12 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM) void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateInfo)
{
- if (ccMeta == NULL)
+ if (ccMeta == nullptr)
return;
// make sure this contact thinks it's part of this metacontact
DBCachedContact *ccSub = currDb->m_cache->GetCachedContact(Meta_GetContactHandle(ccMeta, number));
- if (ccSub != NULL) {
+ if (ccSub != nullptr) {
if (ccSub->parentID == ccMeta->contactID) {
db_unset(ccSub->contactID, "CList", "Hidden");
@@ -133,7 +133,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI mir_snprintf(buffer, "CListName%d", id);
db_unset(ccMeta->contactID, META_PROTO, buffer);
- if (ccSub != NULL) {
+ if (ccSub != nullptr) {
ccSub->parentID = 0;
currDb->MetaDetouchSub(ccMeta, ccMeta->nSubs - 1);
@@ -184,7 +184,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion)
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
- if (cc == NULL)
+ if (cc == nullptr)
return 1;
// The wParam is a metacontact
@@ -203,7 +203,7 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion) db_delete_contact(hContact);
}
else if (cc->IsSub()) {
- if ((cc = currDb->m_cache->GetCachedContact(cc->parentID)) == NULL)
+ if ((cc = currDb->m_cache->GetCachedContact(cc->parentID)) == nullptr)
return 2;
if (cc->nSubs == 1) {
@@ -247,7 +247,7 @@ INT_PTR Meta_Default(WPARAM hSub, LPARAM) int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMeta);
- if (cc == NULL)
+ if (cc == nullptr)
return 0;
Menu_ShowItem(hMenuRoot, false);
diff --git a/src/mir_app/src/meta_options.cpp b/src/mir_app/src/meta_options.cpp index 6776ff16e2..31c7a5b78c 100644 --- a/src/mir_app/src/meta_options.cpp +++ b/src/mir_app/src/meta_options.cpp @@ -28,24 +28,24 @@ MetaOptions options; int Meta_WriteOptions()
{
- db_set_b(NULL, META_PROTO, "LockHandle", options.bLockHandle);
- db_set_b(NULL, META_PROTO, "SuppressStatus", options.bSuppressStatus);
- db_set_w(NULL, META_PROTO, "MenuContactLabel", (WORD)options.menu_contact_label);
- db_set_w(NULL, META_PROTO, "MenuContactFunction", (WORD)options.menu_function);
- db_set_w(NULL, META_PROTO, "CListContactName", (WORD)options.clist_contact_name);
- db_set_dw(NULL, META_PROTO, "SetStatusFromOfflineDelay", (DWORD)(options.set_status_from_offline_delay));
+ db_set_b(0, META_PROTO, "LockHandle", options.bLockHandle);
+ db_set_b(0, META_PROTO, "SuppressStatus", options.bSuppressStatus);
+ db_set_w(0, META_PROTO, "MenuContactLabel", (WORD)options.menu_contact_label);
+ db_set_w(0, META_PROTO, "MenuContactFunction", (WORD)options.menu_function);
+ db_set_w(0, META_PROTO, "CListContactName", (WORD)options.clist_contact_name);
+ db_set_dw(0, META_PROTO, "SetStatusFromOfflineDelay", (DWORD)(options.set_status_from_offline_delay));
return 0;
}
int Meta_ReadOptions()
{
- db_mc_enable(db_get_b(NULL, META_PROTO, "Enabled", true) != 0);
- options.bSuppressStatus = db_get_b(NULL, META_PROTO, "SuppressStatus", true) != 0;
- options.menu_contact_label = (int)db_get_w(NULL, META_PROTO, "MenuContactLabel", DNT_UID);
- options.menu_function = (int)db_get_w(NULL, META_PROTO, "MenuContactFunction", FT_MENU);
- options.clist_contact_name = (int)db_get_w(NULL, META_PROTO, "CListContactName", CNNT_DISPLAYNAME);
- options.set_status_from_offline_delay = (int)db_get_dw(NULL, META_PROTO, "SetStatusFromOfflineDelay", DEFAULT_SET_STATUS_SLEEP_TIME);
- options.bLockHandle = db_get_b(NULL, META_PROTO, "LockHandle", false) != 0;
+ db_mc_enable(db_get_b(0, META_PROTO, "Enabled", true) != 0);
+ options.bSuppressStatus = db_get_b(0, META_PROTO, "SuppressStatus", true) != 0;
+ options.menu_contact_label = (int)db_get_w(0, META_PROTO, "MenuContactLabel", DNT_UID);
+ options.menu_function = (int)db_get_w(0, META_PROTO, "MenuContactFunction", FT_MENU);
+ options.clist_contact_name = (int)db_get_w(0, META_PROTO, "CListContactName", CNNT_DISPLAYNAME);
+ options.set_status_from_offline_delay = (int)db_get_dw(0, META_PROTO, "SetStatusFromOfflineDelay", DEFAULT_SET_STATUS_SLEEP_TIME);
+ options.bLockHandle = db_get_b(0, META_PROTO, "LockHandle", false) != 0;
return 0;
}
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index d3f1827e9f..327136abbb 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -86,7 +86,7 @@ INT_PTR Meta_GetName(WPARAM wParam, LPARAM lParam) {
char *name = (char *)Translate(META_PROTO);
size_t size = min(mir_strlen(name), wParam - 1); // copy only the first size bytes.
- if (strncpy((char *)lParam, name, size) == NULL)
+ if (strncpy((char *)lParam, name, size) == nullptr)
return 1;
((char *)lParam)[size] = '\0';
return 0;
@@ -142,7 +142,7 @@ void CALLBACK SetStatusThread(HWND, UINT, UINT_PTR, DWORD) previousMode = mcStatus;
mcStatus = ID_STATUS_ONLINE;
- ProtoBroadcastAck(META_PROTO, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
+ ProtoBroadcastAck(META_PROTO, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
KillTimer(0, setStatusTimerId);
}
@@ -163,7 +163,7 @@ INT_PTR Meta_SetStatus(WPARAM wParam, LPARAM) else {
previousMode = mcStatus;
mcStatus = (int)wParam;
- ProtoBroadcastAck(META_PROTO, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
+ ProtoBroadcastAck(META_PROTO, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
}
return 0;
}
@@ -202,7 +202,7 @@ static void __cdecl sttFakeAckFail(void *param) INT_PTR Meta_SendNudge(WPARAM wParam, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(wParam);
- if (cc == NULL)
+ if (cc == nullptr)
return 1;
MCONTACT hSubContact = Meta_GetMostOnline(cc);
@@ -225,7 +225,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam) CCSDATA *ccs = (CCSDATA*)lParam;
DBCachedContact *cc = CheckMeta(ccs->hContact);
- if (cc == NULL || cc->nDefault == -1) {
+ if (cc == nullptr || cc->nDefault == -1) {
// This is a simple contact, let through the stack of protocols
// (this should normally not happen, since linked contacts do not appear on the list.)
return Proto_ChainSend(wParam, ccs);
@@ -234,7 +234,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam) MCONTACT hMostOnline = db_mc_getSrmmSub(cc->contactID);
if (!hMostOnline) {
// send failure to notify user of reason
- HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ HANDLE hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
TFakeAckParams *tfap = (TFakeAckParams *)mir_alloc(sizeof(TFakeAckParams));
tfap->hContact = ccs->hContact;
@@ -269,10 +269,10 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam) int Meta_HandleACK(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
- if (ack == NULL)
+ if (ack == nullptr)
return 0;
DBCachedContact *cc = CheckMeta(ack->hContact);
- if (cc == NULL)
+ if (cc == nullptr)
return 0;
if (!mir_strcmp(ack->szModule, META_PROTO))
@@ -329,11 +329,11 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam) return 0;
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
- if (cc == NULL || !cc->IsSub())
+ if (cc == nullptr || !cc->IsSub())
return 0;
DBCachedContact *ccMeta = currDb->m_cache->GetCachedContact(cc->parentID);
- if (ccMeta == NULL || !ccMeta->IsMeta())
+ if (ccMeta == nullptr || !ccMeta->IsMeta())
return 0;
// This contact is attached to a MetaContact.
@@ -375,7 +375,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam) db_set(ccMeta->contactID, META_PROTO, buffer, &dcws->value);
ptrW tszMyhandle(db_get_wsa(hContact, "CList", "MyHandle"));
- if (tszMyhandle == NULL) {
+ if (tszMyhandle == nullptr) {
mir_snprintf(buffer, "CListName%d", contact_number);
db_set(ccMeta->contactID, META_PROTO, buffer, &dcws->value);
}
@@ -455,7 +455,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam) int Meta_ContactDeleted(WPARAM hContact, LPARAM)
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
- if (cc == NULL)
+ if (cc == nullptr)
return 0;
// is a subcontact - update meta contact
@@ -499,7 +499,7 @@ int Meta_ContactDeleted(WPARAM hContact, LPARAM) static INT_PTR Meta_UserIsTyping(WPARAM hMeta, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(hMeta);
- if (cc == NULL)
+ if (cc == nullptr)
return 0;
// forward to sending protocol, if supported
@@ -525,7 +525,7 @@ static INT_PTR Meta_UserIsTyping(WPARAM hMeta, LPARAM lParam) static int Meta_UserInfo(WPARAM, LPARAM hMeta)
{
DBCachedContact *cc = CheckMeta(hMeta);
- if (cc == NULL || cc->nDefault == -1)
+ if (cc == nullptr || cc->nDefault == -1)
return 0;
CallService(MS_USERINFO_SHOWDIALOG, Meta_GetContactHandle(cc, cc->nDefault), 0);
@@ -540,7 +540,7 @@ static int Meta_MessageWindowEvent(WPARAM, LPARAM lParam) MessageWindowEventData *mwed = (MessageWindowEventData*)lParam;
if (mwed->uType == MSG_WINDOW_EVT_OPEN) {
DBCachedContact *cc = currDb->m_cache->GetCachedContact(mwed->hContact);
- if (cc != NULL) {
+ if (cc != nullptr) {
Meta_UpdateSrmmIcon(cc, db_get_w(cc->contactID, META_PROTO, "Status", ID_STATUS_OFFLINE));
if (cc->IsMeta()) {
MetaSrmmData *p = new MetaSrmmData;
@@ -584,7 +584,7 @@ static int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam) return 0;
DBCachedContact *cc = CheckMeta(hMeta);
- if (cc == NULL)
+ if (cc == nullptr)
return 0;
HMENU hMenu = CreatePopupMenu();
@@ -595,10 +595,10 @@ static int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam) mii.fMask = MIIM_ID | MIIM_STATE | MIIM_STRING;
for (int i = 0; i < cc->nSubs; i++) {
char *szProto = GetContactProto(cc->pSubs[i]);
- if (szProto == NULL) continue;
+ if (szProto == nullptr) continue;
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- if (pa == NULL)
+ if (pa == nullptr)
continue;
CMStringW tszNick;
@@ -615,7 +615,7 @@ static int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam) InsertMenuItem(hMenu, i, TRUE, &mii);
}
- UINT res = TrackPopupMenu(hMenu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_BOTTOMALIGN | TPM_LEFTALIGN, sicd->clickLocation.x, sicd->clickLocation.y, 0, cli.hwndContactTree, NULL);
+ UINT res = TrackPopupMenu(hMenu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_BOTTOMALIGN | TPM_LEFTALIGN, sicd->clickLocation.x, sicd->clickLocation.y, 0, cli.hwndContactTree, nullptr);
if (res > 0) {
MCONTACT hChosen = Meta_GetContactHandle(cc, res - 1);
@@ -672,7 +672,7 @@ static VOID CALLBACK sttMenuThread(PVOID param) INT_PTR Meta_ContactMenuFunc(WPARAM hMeta, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(hMeta);
- if (cc == NULL)
+ if (cc == nullptr)
return 0;
MCONTACT hContact = Meta_GetContactHandle(cc, (int)lParam);
@@ -709,7 +709,7 @@ INT_PTR Meta_FileSend(WPARAM, LPARAM lParam) {
CCSDATA *ccs = (CCSDATA*)lParam;
DBCachedContact *cc = CheckMeta(ccs->hContact);
- if (cc == NULL || cc->nDefault == -1)
+ if (cc == nullptr || cc->nDefault == -1)
return 0;
MCONTACT hMostOnline = Meta_GetMostOnlineSupporting(cc, PFLAGNUM_1, PF1_FILESEND);
@@ -727,7 +727,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM, LPARAM lParam) {
CCSDATA *ccs = (CCSDATA*)lParam;
DBCachedContact *cc = CheckMeta(ccs->hContact);
- if (cc == NULL || cc->nDefault == -1)
+ if (cc == nullptr || cc->nDefault == -1)
return 0;
MCONTACT hMostOnline = Meta_GetMostOnlineSupporting(cc, PFLAGNUM_1, PF1_MODEMSGRECV);
@@ -746,7 +746,7 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
DBCachedContact *cc = CheckMeta(pai->hContact);
- if (cc == NULL)
+ if (cc == nullptr)
return GAIR_NOAVATAR;
if (cc->nDefault == -1)
@@ -776,7 +776,7 @@ INT_PTR Meta_GetInfo(WPARAM, LPARAM lParam) // This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
DBCachedContact *cc = CheckMeta(ccs->hContact);
- if (cc == NULL || cc->nDefault == -1)
+ if (cc == nullptr || cc->nDefault == -1)
return 0;
MCONTACT hMostOnline = Meta_GetMostOnlineSupporting(cc, PFLAGNUM_4, PF4_AVATARS);
@@ -810,7 +810,7 @@ INT_PTR Meta_GetInfo(WPARAM, LPARAM lParam) int Meta_CallMostOnline(WPARAM hContact, LPARAM)
{
DBCachedContact *cc = CheckMeta(hContact);
- if (cc == NULL)
+ if (cc == nullptr)
return 0;
Meta_CopyContactNick(cc, db_mc_getSrmmSub(cc->contactID));
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index d15be199ec..1192b28693 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -40,11 +40,11 @@ POINT menuMousePoint; int Meta_SetNick(char *szProto)
{
- ptrW tszNick(Contact_GetInfo(CNF_DISPLAY, NULL, szProto));
- if (tszNick == NULL)
+ ptrW tszNick(Contact_GetInfo(CNF_DISPLAY, 0, szProto));
+ if (tszNick == nullptr)
return 1;
- db_set_ws(NULL, META_PROTO, "Nick", tszNick);
+ db_set_ws(0, META_PROTO, "Nick", tszNick);
return 0;
}
@@ -60,11 +60,11 @@ int Meta_SetNick(char *szProto) BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)
{
DBCachedContact *ccDest = CheckMeta(hMeta), *ccSub = currDb->m_cache->GetCachedContact(hSub);
- if (ccDest == NULL || ccSub == NULL)
+ if (ccDest == nullptr || ccSub == nullptr)
return FALSE;
char *szProto = GetContactProto(hSub);
- if (szProto == NULL) {
+ if (szProto == nullptr) {
MessageBox(0, TranslateT("Could not retrieve contact protocol"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -223,12 +223,12 @@ static int GetStatusPriority(int status) MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigned long capability)
{
- if (cc == NULL || cc->nDefault == -1)
- return NULL;
+ if (cc == nullptr || cc->nDefault == -1)
+ return 0;
// if the default is beyond the end of the list (eek!) return null
if (cc->nDefault >= cc->nSubs)
- return NULL;
+ return 0;
int most_online_status = ID_STATUS_OFFLINE;
MCONTACT most_online_contact = Meta_GetContactHandle(cc, cc->nDefault);
@@ -255,7 +255,7 @@ MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigne MCONTACT hContact = Meta_GetContactHandle(cc, i);
szProto = GetContactProto(hContact);
- if (szProto == NULL || CallProtoService(szProto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // szProto offline or connecting
+ if (szProto == nullptr || CallProtoService(szProto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // szProto offline or connecting
continue;
DWORD caps = CallProtoService(szProto, PS_GETCAPS, pflagnum, 0);
@@ -290,7 +290,7 @@ MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigne DBCachedContact* CheckMeta(MCONTACT hMeta)
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMeta);
- return (cc == NULL || cc->nSubs == -1) ? NULL : cc;
+ return (cc == nullptr || cc->nSubs == -1) ? nullptr : cc;
}
int Meta_GetContactNumber(DBCachedContact *cc, MCONTACT hContact)
@@ -323,11 +323,11 @@ int Meta_HideLinkedContacts(void) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
- if (cc == NULL || cc->parentID == 0)
+ if (cc == nullptr || cc->parentID == 0)
continue;
DBCachedContact *ccMeta = CheckMeta(cc->parentID);
- if (ccMeta == NULL)
+ if (ccMeta == nullptr)
continue;
// get contact number
@@ -427,7 +427,7 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact) return 1;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
+ if (szProto == nullptr)
return 1;
if (options.clist_contact_name == CNNT_NICK) {
@@ -451,7 +451,7 @@ int Meta_SetAllNicks() {
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
DBCachedContact *cc = CheckMeta(hContact);
- if (cc == NULL)
+ if (cc == nullptr)
continue;
MCONTACT most_online = Meta_GetMostOnline(cc);
Meta_CopyContactNick(cc, most_online);
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index 483b84f1e6..400be3145d 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -62,8 +62,8 @@ struct MWaitableObject m_hEvent(hEvent),
m_pFunc(pFunc)
{
- if (hEvent == NULL) {
- m_hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
+ if (hEvent == nullptr) {
+ m_hEvent = CreateEvent(nullptr, TRUE, TRUE, nullptr);
m_bOwnsEvent = true;
}
}
@@ -123,11 +123,11 @@ static void __cdecl compactHeapsThread(void*) } //while
}
-void(*SetIdleCallback) (void) = NULL;
+void(*SetIdleCallback) (void) = nullptr;
static INT_PTR SystemSetIdleCallback(WPARAM, LPARAM lParam)
{
- if (lParam && SetIdleCallback == NULL) {
+ if (lParam && SetIdleCallback == nullptr) {
SetIdleCallback = (void(*)(void))lParam;
return 1;
}
@@ -278,10 +278,10 @@ int WINAPI mir_main(LPTSTR cmdLine) if (bufferedPaintInit)
bufferedPaintInit();
- OleInitialize(NULL);
+ OleInitialize(nullptr);
if (IsWinVer7Plus())
- CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
+ CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
int result = 0;
if (LoadDefaultModules()) {
@@ -317,18 +317,18 @@ int WINAPI mir_main(LPTSTR cmdLine) arWaitableObjects.remove(rc);
}
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
if (msg.message != WM_QUIT) {
HWND h = GetForegroundWindow();
DWORD pid = 0;
checkIdle(&msg);
- if (h != NULL && GetWindowThreadProcessId(h, &pid) && pid == myPid && GetClassLongPtr(h, GCW_ATOM) == 32770)
- if (h != NULL && IsDialogMessage(h, &msg)) /* Wine fix. */
+ if (h != nullptr && GetWindowThreadProcessId(h, &pid) && pid == myPid && GetClassLongPtr(h, GCW_ATOM) == 32770)
+ if (h != nullptr && IsDialogMessage(h, &msg)) /* Wine fix. */
continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
- if (SetIdleCallback != NULL)
+ if (SetIdleCallback != nullptr)
SetIdleCallback();
}
else if (!dying) {
@@ -437,7 +437,7 @@ MIR_APP_DLL(void) Miranda_GetVersionText(char *pDest, size_t cbSize) int LoadSystemModule(void)
{
- hMirandaShutdown = CreateEvent(NULL, TRUE, FALSE, NULL);
+ hMirandaShutdown = CreateEvent(nullptr, TRUE, FALSE, nullptr);
hShutdownEvent = CreateHookableEvent(ME_SYSTEM_SHUTDOWN);
hPreShutdownEvent = CreateHookableEvent(ME_SYSTEM_PRESHUTDOWN);
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index cb64b740d1..d83261e0e1 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -85,7 +85,7 @@ void KillModuleToolbarIcons(int hLangpack); __forceinline char* Utf8DecodeA(const char* src)
{
char* tmp = mir_strdup(src);
- Utf8Decode(tmp, NULL);
+ Utf8Decode(tmp, nullptr);
return tmp;
}
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp index ba409290ee..8ae98410f2 100644 --- a/src/mir_app/src/movetogroup.cpp +++ b/src/mir_app/src/movetogroup.cpp @@ -50,7 +50,7 @@ struct GroupItemSort static wchar_t* PrepareGroupName(wchar_t* str)
{
wchar_t* p = wcschr(str, '&'), *d;
- if (p == NULL)
+ if (p == nullptr)
return mir_wstrdup(str);
d = p = (wchar_t*)mir_alloc(sizeof(wchar_t)*(2 * mir_wstrlen(str) + 1));
@@ -105,7 +105,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) _itoa(i, intname, 10);
DBVARIANT dbv;
- if (db_get_ws(NULL, "CListGroups", intname, &dbv))
+ if (db_get_ws(0, "CListGroups", intname, &dbv))
break;
if (dbv.ptszVal[0])
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index bb7ec14ac6..ed73c8dc2f 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -30,7 +30,7 @@ static BOOL bModuleInitialized = FALSE; HANDLE hConnectionHeaderMutex, hConnectionOpenMutex;
DWORD g_LastConnectionTick;
int connectionTimeout;
-HANDLE hSendEvent = NULL, hRecvEvent = NULL;
+HANDLE hSendEvent = nullptr, hRecvEvent = nullptr;
typedef BOOL (WINAPI *tGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD);
@@ -68,7 +68,7 @@ void NetlibInitializeNestedCS(NetlibNestedCriticalSection *nlncs) {
nlncs->dwOwningThreadId = 0;
nlncs->lockCount = 0;
- nlncs->hMutex = CreateMutex(NULL, FALSE, NULL);
+ nlncs->hMutex = CreateMutex(nullptr, FALSE, nullptr);
}
void NetlibDeleteNestedCS(NetlibNestedCriticalSection *nlncs)
@@ -82,7 +82,7 @@ int NetlibEnterNestedCS(NetlibConnection *nlc, int which) DWORD dwCurrentThreadId = GetCurrentThreadId();
WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
- if (nlc == NULL || nlc->handleType != NLH_CONNECTION) {
+ if (nlc == nullptr || nlc->handleType != NLH_CONNECTION) {
ReleaseMutex(hConnectionHeaderMutex);
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
@@ -115,7 +115,7 @@ void NetlibLeaveNestedCS(NetlibNestedCriticalSection *nlncs) static INT_PTR GetNetlibUserSettingInt(const char *szUserModule, const char *szSetting, int defValue)
{
DBVARIANT dbv;
- if (db_get(NULL, szUserModule, szSetting, &dbv) && db_get(NULL, "Netlib", szSetting, &dbv))
+ if (db_get(0, szUserModule, szSetting, &dbv) && db_get(0, "Netlib", szSetting, &dbv))
return defValue;
if (dbv.type == DBVT_BYTE) return dbv.bVal;
@@ -125,10 +125,10 @@ static INT_PTR GetNetlibUserSettingInt(const char *szUserModule, const char *szS static char* GetNetlibUserSettingString(const char *szUserModule, const char *szSetting)
{
- char *szRet = db_get_sa(NULL, szUserModule, szSetting);
- if (szRet == NULL)
- if ((szRet = db_get_sa(NULL, "Netlib", szSetting)) == NULL)
- return NULL;
+ char *szRet = db_get_sa(0, szUserModule, szSetting);
+ if (szRet == nullptr)
+ if ((szRet = db_get_sa(0, "Netlib", szSetting)) == nullptr)
+ return nullptr;
return szRet;
}
@@ -137,7 +137,7 @@ static char* GetNetlibUserSettingString(const char *szUserModule, const char *sz MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu)
{
- if (nlu == NULL || nlu->szSettingsModule == NULL || (!(nlu->flags & NUF_NOOPTIONS) && nlu->szDescriptiveName.w == NULL)) {
+ if (nlu == nullptr || nlu->szSettingsModule == nullptr || (!(nlu->flags & NUF_NOOPTIONS) && nlu->szDescriptiveName.w == nullptr)) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -160,9 +160,9 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu) if (nlu->szDescriptiveName.w)
thisUser->user.szDescriptiveName.w = (thisUser->user.flags & NUF_UNICODE) ? mir_wstrdup(nlu->szDescriptiveName.w) : mir_a2u(nlu->szDescriptiveName.a);
- if ((thisUser->user.szSettingsModule = mir_strdup(nlu->szSettingsModule)) == NULL
- || (nlu->szDescriptiveName.w && thisUser->user.szDescriptiveName.w == NULL)
- || (nlu->szHttpGatewayUserAgent && (thisUser->user.szHttpGatewayUserAgent = mir_strdup(nlu->szHttpGatewayUserAgent)) == NULL))
+ if ((thisUser->user.szSettingsModule = mir_strdup(nlu->szSettingsModule)) == nullptr
+ || (nlu->szDescriptiveName.w && thisUser->user.szDescriptiveName.w == nullptr)
+ || (nlu->szHttpGatewayUserAgent && (thisUser->user.szHttpGatewayUserAgent = mir_strdup(nlu->szHttpGatewayUserAgent)) == nullptr))
{
mir_free(thisUser);
SetLastError(ERROR_OUTOFMEMORY);
@@ -171,7 +171,7 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu) if (nlu->szHttpGatewayHello)
thisUser->user.szHttpGatewayHello = mir_strdup(nlu->szHttpGatewayHello);
else
- thisUser->user.szHttpGatewayHello = NULL;
+ thisUser->user.szHttpGatewayHello = nullptr;
thisUser->settings.cbSize = sizeof(NETLIBUSERSETTINGS);
thisUser->settings.useProxy = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLUseProxy", 0);
@@ -206,7 +206,7 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu) MIR_APP_DLL(int) Netlib_GetUserSettings(HNETLIBUSER nlu, NETLIBUSERSETTINGS *nlus)
{
- if (GetNetlibHandleType(nlu) != NLH_USER || nlus == NULL || nlus->cbSize != sizeof(NETLIBUSERSETTINGS)) {
+ if (GetNetlibHandleType(nlu) != NLH_USER || nlus == nullptr || nlus->cbSize != sizeof(NETLIBUSERSETTINGS)) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -216,7 +216,7 @@ MIR_APP_DLL(int) Netlib_GetUserSettings(HNETLIBUSER nlu, NETLIBUSERSETTINGS *nlu MIR_APP_DLL(int) Netlib_SetUserSettings(HNETLIBUSER nlu, const NETLIBUSERSETTINGS *nlus)
{
- if (GetNetlibHandleType(nlu) != NLH_USER || nlus == NULL || nlus->cbSize != sizeof(NETLIBUSERSETTINGS)) {
+ if (GetNetlibHandleType(nlu) != NLH_USER || nlus == nullptr || nlus->cbSize != sizeof(NETLIBUSERSETTINGS)) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -235,7 +235,7 @@ void NetlibDoCloseSocket(NetlibConnection *nlc, bool noShutdown) if (!noShutdown)
sslApi.shutdown(nlc->hSsl);
sslApi.sfree(nlc->hSsl);
- nlc->hSsl = NULL;
+ nlc->hSsl = nullptr;
}
closesocket(nlc->s);
nlc->s = INVALID_SOCKET;
@@ -243,7 +243,7 @@ void NetlibDoCloseSocket(NetlibConnection *nlc, bool noShutdown) MIR_APP_DLL(int) Netlib_CloseHandle(HANDLE hNetlib)
{
- if (hNetlib == NULL)
+ if (hNetlib == nullptr)
return 0;
switch (GetNetlibHandleType(hNetlib)) {
@@ -348,7 +348,7 @@ MIR_APP_DLL(UINT_PTR) Netlib_GetSocket(HNETLIBCONN hConnection) MIR_APP_DLL(HNETLIBUSER) Netlib_GetConnNlu(HANDLE hConn)
{
if (GetNetlibHandleType(hConn) != NLH_CONNECTION)
- return NULL;
+ return nullptr;
return ((NetlibConnection*)hConn)->nlu;
}
@@ -384,14 +384,14 @@ MIR_APP_DLL(void) Netlib_Shutdown(HNETLIBCONN h) void UnloadNetlibModule(void)
{
- if (!bModuleInitialized || hConnectionHeaderMutex == NULL) return;
+ if (!bModuleInitialized || hConnectionHeaderMutex == nullptr) return;
NetlibUnloadIeProxy();
NetlibUPnPDestroy();
NetlibLogShutdown();
- DestroyHookableEvent(hRecvEvent); hRecvEvent = NULL;
- DestroyHookableEvent(hSendEvent); hSendEvent = NULL;
+ DestroyHookableEvent(hRecvEvent); hRecvEvent = nullptr;
+ DestroyHookableEvent(hSendEvent); hSendEvent = nullptr;
for (int i = netlibUser.getCount(); i > 0; i--)
Netlib_CloseHandle(netlibUser[i-1]);
@@ -411,7 +411,7 @@ int LoadNetlibModule(void) HookEvent(ME_OPT_INITIALISE, NetlibOptInitialise);
- hConnectionHeaderMutex = CreateMutex(NULL, FALSE, NULL);
+ hConnectionHeaderMutex = CreateMutex(nullptr, FALSE, nullptr);
NetlibLogInit();
connectionTimeout = 0;
@@ -426,7 +426,7 @@ int LoadNetlibModule(void) else if (osvi.dwMajorVersion == 6 && osvi.wServicePackMajor < 2) {
DWORD dwType = 0;
tGetProductInfo pGetProductInfo = (tGetProductInfo) GetProcAddress(GetModuleHandleA("kernel32"), "GetProductInfo");
- if (pGetProductInfo != NULL) pGetProductInfo(6, 0, 0, 0, &dwType);
+ if (pGetProductInfo != nullptr) pGetProductInfo(6, 0, 0, 0, &dwType);
switch(dwType) {
case 0x01: // Vista Ultimate edition have connection limit of 25 / sec - plenty for Miranda
case 0x1c:
@@ -451,14 +451,14 @@ int LoadNetlibModule(void) if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, keyn, 0, KEY_QUERY_VALUE, &hSettings) == ERROR_SUCCESS) {
DWORD tValueLen, enabled;
tValueLen = sizeof(enabled);
- if (RegQueryValueExA(hSettings, valn, NULL, NULL, (BYTE*)&enabled, &tValueLen) == ERROR_SUCCESS && enabled)
+ if (RegQueryValueExA(hSettings, valn, nullptr, nullptr, (BYTE*)&enabled, &tValueLen) == ERROR_SUCCESS && enabled)
connectionTimeout = 150; // if enabled limit is set to 10 / sec
RegCloseKey(hSettings);
}
}
}
- hConnectionOpenMutex = connectionTimeout ? CreateMutex(NULL, FALSE, NULL) : NULL;
+ hConnectionOpenMutex = connectionTimeout ? CreateMutex(nullptr, FALSE, nullptr) : nullptr;
g_LastConnectionTick = GetTickCount();
hRecvEvent = CreateHookableEvent(ME_NETLIB_FASTRECV);
diff --git a/src/mir_app/src/netlibautoproxy.cpp b/src/mir_app/src/netlibautoproxy.cpp index 15fb93b3a2..0172c52e89 100644 --- a/src/mir_app/src/netlibautoproxy.cpp +++ b/src/mir_app/src/netlibautoproxy.cpp @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. DWORD __stdcall ResolveHostName(LPSTR lpszHostName,
LPSTR lpszIPAddress, LPDWORD lpdwIPAddressSize)
{
- if (*lpdwIPAddressSize < 17 || lpszIPAddress == NULL)
+ if (*lpdwIPAddressSize < 17 || lpszIPAddress == nullptr)
{
*lpdwIPAddressSize = 17;
return ERROR_INSUFFICIENT_BUFFER;
@@ -45,7 +45,7 @@ DWORD __stdcall ResolveHostName(LPSTR lpszHostName, if (ip.s_addr == INADDR_NONE)
{
PHOSTENT myhost = gethostbyname(lpszHostName);
- if (myhost != NULL)
+ if (myhost != nullptr)
ip = *(PIN_ADDR)myhost->h_addr;
else
return SOCKET_ERROR;
@@ -107,10 +107,10 @@ static const AutoProxyHelperVtbl OurVtbl = GetIPAddress,
ResolveHostName,
IsInNet,
- NULL,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
};
static AutoProxyHelperFunctions HelperFunctions = { &OurVtbl };
@@ -134,7 +134,7 @@ static void GetFile(char* szUrl, AUTO_PROXY_SCRIPT_BUFFER &buf) nlu.handleType = NLH_USER;
nlu.user.flags = NUF_OUTGOING | NUF_HTTPCONNS;
- nlu.user.szSettingsModule = "(NULL)";
+ nlu.user.szSettingsModule = "(nullptr)";
nlu.toLog = 1;
// initialize the netlib request
@@ -151,7 +151,7 @@ static void GetFile(char* szUrl, AUTO_PROXY_SCRIPT_BUFFER &buf) buf.dwScriptBufferSize = nlhrReply->dataLength + 1;
nlhrReply->dataLength = 0;
- nlhrReply->pData = NULL;
+ nlhrReply->pData = nullptr;
}
Netlib_FreeHttpRequest(nlhrReply);
}
@@ -177,7 +177,7 @@ bool NetlibGetIeProxyConn(NetlibConnection *nlc, bool forceHttps) noHttp = true;
}
- mir_free(nlc->szProxyServer); nlc->szProxyServer = NULL;
+ mir_free(nlc->szProxyServer); nlc->szProxyServer = nullptr;
nlc->wProxyPort = 0;
nlc->proxyType = 0;
@@ -185,7 +185,7 @@ bool NetlibGetIeProxyConn(NetlibConnection *nlc, bool forceHttps) char *m = NEWSTR_ALLOCA(mt);
mir_free(mt);
- if (m == NULL) return false;
+ if (m == nullptr) return false;
// if multiple servers, use the first one
char *c = strchr(m, ';'); if (c) *c = 0;
@@ -250,7 +250,7 @@ static void NetlibInitAutoProxy(void) GetProcAddress(hModJS, "InternetGetProxyInfo");
}
- if (strstr(szAutoUrlStr, "file://") == NULL && strstr(szAutoUrlStr, "://") != NULL)
+ if (strstr(szAutoUrlStr, "file://") == nullptr && strstr(szAutoUrlStr, "://") != nullptr)
{
abuf.dwStructSize = sizeof(abuf);
GetFile(szAutoUrlStr, abuf);
@@ -268,7 +268,7 @@ struct IeProxyParam static void NetlibIeProxyThread(void *arg)
{
IeProxyParam *param = (IeProxyParam*)arg;
- param->szProxy = NULL;
+ param->szProxy = nullptr;
if (!bAutoProxyInit) {
WaitForSingleObject(hIeProxyMutex, INFINITE);
@@ -278,15 +278,15 @@ static void NetlibIeProxyThread(void *arg) BOOL res;
char *loc = strstr(szAutoUrlStr, "file://");
- if (loc || strstr(szAutoUrlStr, "://") == NULL) {
- Netlib_Logf(NULL, "Autoproxy Init file: %s", loc);
+ if (loc || strstr(szAutoUrlStr, "://") == nullptr) {
+ Netlib_Logf(nullptr, "Autoproxy Init file: %s", loc);
loc = loc ? loc + 7 : szAutoUrlStr;
- res = pInternetInitializeAutoProxyDll(0, loc, NULL, NULL /*&HelperFunctions*/, NULL);
+ res = pInternetInitializeAutoProxyDll(0, loc, nullptr, nullptr /*&HelperFunctions*/, nullptr);
}
else {
- Netlib_Logf(NULL, "Autoproxy Init %d", abuf.dwScriptBufferSize);
+ Netlib_Logf(nullptr, "Autoproxy Init %d", abuf.dwScriptBufferSize);
if (abuf.dwScriptBufferSize)
- res = pInternetInitializeAutoProxyDll(0, NULL, NULL, NULL /*&HelperFunctions*/, &abuf);
+ res = pInternetInitializeAutoProxyDll(0, nullptr, nullptr, nullptr /*&HelperFunctions*/, &abuf);
else
res = false;
}
@@ -300,15 +300,15 @@ static void NetlibIeProxyThread(void *arg) param->szHost, (DWORD)mir_strlen(param->szHost), &proxy, &dwProxyLen))
param->szProxy = mir_strdup(lrtrim(proxy));
- Netlib_Logf(NULL, "Autoproxy got response %s, Param: %s %s", param->szProxy, param->szUrl, param->szHost);
- pInternetDeInitializeAutoProxyDll(NULL, 0);
+ Netlib_Logf(nullptr, "Autoproxy got response %s, Param: %s %s", param->szProxy, param->szUrl, param->szHost);
+ pInternetDeInitializeAutoProxyDll(nullptr, 0);
}
- else Netlib_Logf(NULL, "Autoproxy init failed");
+ else Netlib_Logf(nullptr, "Autoproxy init failed");
}
char* NetlibGetIeProxy(char *szUrl)
{
- char *res = NULL;
+ char *res = nullptr;
char* p = strstr(szUrl, "://");
if (p) p += 3; else p = szUrl;
@@ -323,9 +323,9 @@ char* NetlibGetIeProxy(char *szUrl) {
if (mir_strcmp(proxyBypass[i], "<local>") == 0)
{
- if (strchr(szHost, '.') == NULL) return NULL;
+ if (strchr(szHost, '.') == nullptr) return nullptr;
}
- else if (wildcmp(szHost, proxyBypass[i])) return NULL;
+ else if (wildcmp(szHost, proxyBypass[i])) return nullptr;
}
int ind = -1;
@@ -336,7 +336,7 @@ char* NetlibGetIeProxy(char *szUrl) else
ind = szProxyHost[2] ? 2 : (bOneProxy ? 0 : (szProxyHost[1] ? 1 : 2));
- if (ind < 0 || !szProxyHost[ind]) return NULL;
+ if (ind < 0 || !szProxyHost[ind]) return nullptr;
size_t len = mir_strlen(szHost) + 20;
res = (char*)mir_alloc(len);
@@ -345,7 +345,7 @@ char* NetlibGetIeProxy(char *szUrl) }
if (szAutoUrlStr[0]) {
- IeProxyParam param = { szUrl, szHost, NULL };
+ IeProxyParam param = { szUrl, szHost, nullptr };
HANDLE hThread = mir_forkthread(NetlibIeProxyThread, ¶m);
WaitForSingleObject(hThread, INFINITE);
res = param.szProxy;
@@ -364,18 +364,18 @@ void NetlibLoadIeProxy(void) char szHostStr[256] = "", szProxyBypassStr[4096] = "";
tValueLen = sizeof(enabled);
- int tResult = RegQueryValueExA(hSettings, "ProxyEnable", NULL, NULL, (BYTE*)&enabled, &tValueLen);
+ int tResult = RegQueryValueExA(hSettings, "ProxyEnable", nullptr, nullptr, (BYTE*)&enabled, &tValueLen);
bEnabled = enabled && tResult == ERROR_SUCCESS;
tValueLen = _countof(szHostStr);
- tResult = RegQueryValueExA(hSettings, "ProxyServer", NULL, NULL, (BYTE*)szHostStr, &tValueLen);
+ tResult = RegQueryValueExA(hSettings, "ProxyServer", nullptr, nullptr, (BYTE*)szHostStr, &tValueLen);
bEnabled = bEnabled && tResult == ERROR_SUCCESS;
tValueLen = _countof(szAutoUrlStr);
- RegQueryValueExA(hSettings, "AutoConfigUrl", NULL, NULL, (BYTE*)szAutoUrlStr, &tValueLen);
+ RegQueryValueExA(hSettings, "AutoConfigUrl", nullptr, nullptr, (BYTE*)szAutoUrlStr, &tValueLen);
tValueLen = _countof(szProxyBypassStr);
- RegQueryValueExA(hSettings, "ProxyOverride", NULL, NULL, (BYTE*)szProxyBypassStr, &tValueLen);
+ RegQueryValueExA(hSettings, "ProxyOverride", nullptr, nullptr, (BYTE*)szProxyBypassStr, &tValueLen);
RegCloseKey(hSettings);
@@ -411,7 +411,7 @@ void NetlibLoadIeProxy(void) }
if (bOneProxy) break;
}
- if (szProxyEnd == NULL) break;
+ if (szProxyEnd == nullptr) break;
szProxy = szProxyEnd + 1;
}
@@ -424,14 +424,14 @@ void NetlibLoadIeProxy(void) lrtrim(szProxyBypass);
proxyBypass.insert(_strlwr(mir_strdup(szProxyBypass)));
- if (szProxyBypassEnd == NULL) break;
+ if (szProxyBypassEnd == nullptr) break;
szProxyBypass = szProxyBypassEnd + 1;
}
}
if (bEnabled || szAutoUrlStr[0])
- hIeProxyMutex = CreateMutex(NULL, FALSE, NULL);
+ hIeProxyMutex = CreateMutex(nullptr, FALSE, nullptr);
}
void NetlibUnloadIeProxy(void)
diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp index 840429ac1b..4de1225568 100644 --- a/src/mir_app/src/netlibbind.cpp +++ b/src/mir_app/src/netlibbind.cpp @@ -131,7 +131,7 @@ static void NetlibBindAcceptThread(void* param) FD_SET(nlbp->s, &r);
if (nlbp->s6 != INVALID_SOCKET)
FD_SET(nlbp->s6, &r);
- if (select(0, &r, NULL, NULL, NULL) == SOCKET_ERROR) {
+ if (select(0, &r, nullptr, nullptr, nullptr) == SOCKET_ERROR) {
Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread (%p): select failed (%d)", nlbp->s, GetLastError());
break;
}
@@ -155,7 +155,7 @@ static void NetlibBindAcceptThread(void* param) break;
}
}
- else s = NULL;
+ else s = 0;
Netlib_Logf(nlbp->nlu, "New incoming connection on port %u from %s (%p)", nlbp->wPort, ptrA(Netlib_AddressToString(&sin)), s);
@@ -175,7 +175,7 @@ static void NetlibBindAcceptThread(void* param) MIR_APP_DLL(HNETLIBBIND) Netlib_BindPort(HNETLIBUSER nlu, NETLIBBIND *nlb)
{
- if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_INCOMING) || nlb == NULL || nlb->pfnNewConnection == NULL) {
+ if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_INCOMING) || nlb == nullptr || nlb->pfnNewConnection == nullptr) {
SetLastError(ERROR_INVALID_PARAMETER);
return nullptr;
}
@@ -266,15 +266,15 @@ LBL_Error: DWORD extIP;
if (nlu->settings.enableUPnP && NetlibUPnPAddPortMapping(nlb->wPort, "TCP", &nlbp->wExPort, &extIP, true)) {
- Netlib_Logf(NULL, "UPnP port mapping succeeded. Internal Port: %u External Port: %u\n", nlb->wPort, nlbp->wExPort);
+ Netlib_Logf(nullptr, "UPnP port mapping succeeded. Internal Port: %u External Port: %u\n", nlb->wPort, nlbp->wExPort);
nlb->wExPort = nlbp->wExPort;
nlb->dwExternalIP = extIP;
}
else {
if (nlu->settings.enableUPnP)
- Netlib_Logf(NULL, "UPnP port mapping failed. Internal Port: %u\n", nlb->wPort);
+ Netlib_Logf(nullptr, "UPnP port mapping failed. Internal Port: %u\n", nlb->wPort);
else
- Netlib_Logf(NULL, "UPnP disabled. Internal Port: %u\n", nlb->wPort);
+ Netlib_Logf(nullptr, "UPnP disabled. Internal Port: %u\n", nlb->wPort);
nlbp->wExPort = 0;
nlb->wExPort = nlb->wPort;
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index 41ec3aa39d..98e0d8a3ce 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -57,11 +57,11 @@ struct ProxyAuthList : OBJLIST<ProxyAuth> void add(const char *szServer, const char *szMethod)
{
- if (szServer == NULL) return;
+ if (szServer == nullptr) return;
int i = getIndex((ProxyAuth*)&szServer);
if (i >= 0) {
ProxyAuth &rec = (*this)[i];
- if (szMethod == NULL)
+ if (szMethod == nullptr)
remove(i);
else if (_stricmp(rec.szMethod, szMethod)) {
mir_free(rec.szMethod);
@@ -73,8 +73,8 @@ struct ProxyAuthList : OBJLIST<ProxyAuth> const char* find(const char *szServer)
{
- ProxyAuth *rec = szServer ? OBJLIST<ProxyAuth>::find((ProxyAuth*)&szServer) : NULL;
- return rec ? rec->szMethod : NULL;
+ ProxyAuth *rec = szServer ? OBJLIST<ProxyAuth>::find((ProxyAuth*)&szServer) : nullptr;
+ return rec ? rec->szMethod : nullptr;
}
};
@@ -114,14 +114,14 @@ static char* NetlibHttpFindHeader(NETLIBHTTPREQUEST *nlhrReply, const char *hdr) return p.szValue;
}
- return NULL;
+ return nullptr;
}
static char* NetlibHttpFindAuthHeader(NETLIBHTTPREQUEST *nlhrReply, const char *hdr, const char *szProvider)
{
- char *szBasicHdr = NULL;
- char *szNegoHdr = NULL;
- char *szNtlmHdr = NULL;
+ char *szBasicHdr = nullptr;
+ char *szNegoHdr = nullptr;
+ char *szNtlmHdr = nullptr;
for (int i=0; i < nlhrReply->headersCount; i++) {
NETLIBHTTPHEADER &p = nlhrReply->headers[i];
@@ -138,7 +138,7 @@ static char* NetlibHttpFindAuthHeader(NETLIBHTTPREQUEST *nlhrReply, const char * if (szNegoHdr && (!szProvider || !_stricmp(szProvider, "Negotiate"))) return szNegoHdr;
if (szNtlmHdr && (!szProvider || !_stricmp(szProvider, "NTLM"))) return szNtlmHdr;
if (!szProvider || !_stricmp(szProvider, "Basic")) return szBasicHdr;
- return NULL;
+ return nullptr;
}
void NetlibConnFromUrl(const char *szUrl, bool secur, NETLIBOPENCONNECTION &nloc)
@@ -158,17 +158,17 @@ void NetlibConnFromUrl(const char *szUrl, bool secur, NETLIBOPENCONNECTION &nloc char* pcolon = strrchr(szHost, ':');
if (pcolon) {
*pcolon = '\0';
- nloc.wPort = (WORD)strtol(pcolon+1, NULL, 10);
+ nloc.wPort = (WORD)strtol(pcolon+1, nullptr, 10);
}
else nloc.wPort = secur ? 443 : 80;
nloc.flags = (secur ? NLOCF_SSL : 0);
}
-static NetlibConnection* NetlibHttpProcessUrl(NETLIBHTTPREQUEST *nlhr, NetlibUser *nlu, NetlibConnection *nlc, const char *szUrl = NULL)
+static NetlibConnection* NetlibHttpProcessUrl(NETLIBHTTPREQUEST *nlhr, NetlibUser *nlu, NetlibConnection *nlc, const char *szUrl = nullptr)
{
NETLIBOPENCONNECTION nloc;
- if (szUrl == NULL)
+ if (szUrl == nullptr)
NetlibConnFromUrl(nlhr->szUrl, (nlhr->flags & NLHRF_SSL) != 0, nloc);
else
NetlibConnFromUrl(szUrl, false, nloc);
@@ -179,7 +179,7 @@ static NetlibConnection* NetlibHttpProcessUrl(NETLIBHTTPREQUEST *nlhr, NetlibUse else
nlhr->flags &= ~NLHRF_SSL;
- if (nlc != NULL) {
+ if (nlc != nullptr) {
bool httpProxy = !(nloc.flags & NLOCF_SSL) && nlc->proxyType == PROXYTYPE_HTTP;
bool sameHost = mir_strcmp(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort;
@@ -188,7 +188,7 @@ static NetlibConnection* NetlibHttpProcessUrl(NETLIBHTTPREQUEST *nlhr, NetlibUse mir_free((char*)nlc->nloc.szHost);
nlc->nloc = nloc;
- return NetlibDoConnect(nlc) ? nlc : NULL;
+ return NetlibDoConnect(nlc) ? nlc : nullptr;
}
}
else nlc = (NetlibConnection*)Netlib_OpenConnection(nlu, &nloc);
@@ -206,7 +206,7 @@ struct HttpSecurityContext HttpSecurityContext()
{
- m_hNtlmSecurity = NULL; m_szHost = NULL; m_szProvider = NULL;
+ m_hNtlmSecurity = nullptr; m_szHost = nullptr; m_szProvider = nullptr;
}
~HttpSecurityContext() { Destroy(); }
@@ -216,9 +216,9 @@ struct HttpSecurityContext if (!m_hNtlmSecurity) return;
Netlib_DestroySecurityProvider(m_hNtlmSecurity);
- m_hNtlmSecurity = NULL;
- mir_free(m_szHost); m_szHost = NULL;
- mir_free(m_szProvider); m_szProvider = NULL;
+ m_hNtlmSecurity = nullptr;
+ mir_free(m_szHost); m_szHost = nullptr;
+ mir_free(m_szProvider); m_szProvider = nullptr;
}
bool TryBasic(void)
@@ -228,7 +228,7 @@ struct HttpSecurityContext char* Execute(NetlibConnection *nlc, char *szHost, const char *szProvider, const char *szChallenge, unsigned &complete)
{
- char *szAuthHdr = NULL;
+ char *szAuthHdr = nullptr;
bool justCreated = false;
NetlibUser *nlu = nlc->nlu;
@@ -239,7 +239,7 @@ struct HttpSecurityContext Destroy();
}
- if (m_hNtlmSecurity == NULL) {
+ if (m_hNtlmSecurity == nullptr) {
CMStringA szSpnStr;
if (szHost && _stricmp(szProvider, "Basic")) {
unsigned long ip = inet_addr(szHost);
@@ -267,7 +267,7 @@ struct HttpSecurityContext szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity, szChallenge, szLogin, szPassw, true, complete);
if (!szAuthHdr)
- Netlib_Logf(NULL, "Security login %s failed, user: %S pssw: %S", szProvider, szLogin ? szLogin.get() : L"(no user)", szPassw ? L"(exist)" : L"(no psw)");
+ Netlib_Logf(nullptr, "Security login %s failed, user: %S pssw: %S", szProvider, szLogin ? szLogin.get() : L"(no user)", szPassw ? L"(exist)" : L"(no psw)");
else if (justCreated)
proxyAuthList.add(m_szHost, m_szProvider);
}
@@ -292,7 +292,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime, return 0;
buffer[bytesPeeked] = '\0';
- if ((peol = strchr(buffer, '\n')) != NULL)
+ if ((peol = strchr(buffer, '\n')) != nullptr)
break;
if ((int)mir_strlen(buffer) < bytesPeeked) {
@@ -369,16 +369,16 @@ static int SendHttpRequestAndData(NetlibConnection *nlc, CMStringA &httpRequest, MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr)
{
- NETLIBHTTPREQUEST *nlhrReply = NULL;
+ NETLIBHTTPREQUEST *nlhrReply = nullptr;
HttpSecurityContext httpSecurity;
- char *szHost = NULL, *szNewUrl = NULL;
- char *pszProxyAuthHdr = NULL, *pszAuthHdr = NULL;
+ char *szHost = nullptr, *szNewUrl = nullptr;
+ char *pszProxyAuthHdr = nullptr, *pszAuthHdr = nullptr;
int i, doneHostHeader, doneContentLengthHeader, doneProxyAuthHeader, doneAuthHeader;
int bytesSent = 0;
bool lastFirstLineFail = false;
- if (nlhr == NULL || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) || nlhr->szUrl == NULL || nlhr->szUrl[0] == '\0') {
+ if (nlhr == nullptr || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) || nlhr->szUrl == nullptr || nlhr->szUrl[0] == '\0') {
SetLastError(ERROR_INVALID_PARAMETER);
return SOCKET_ERROR;
}
@@ -410,13 +410,13 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr return SOCKET_ERROR;
const char *pszFullUrl = nlhr->szUrl;
- const char *pszUrl = NULL;
+ const char *pszUrl = nullptr;
unsigned complete = false;
int count = 11;
while (--count) {
if (GetNetlibHandleType(nlc) != NLH_CONNECTION) {
- nlc = NULL;
+ nlc = nullptr;
bytesSent = SOCKET_ERROR;
break;
}
@@ -432,15 +432,15 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr bool usingProxy = nlc->proxyType == PROXYTYPE_HTTP && !(nlhr->flags & NLHRF_SSL);
mir_free(szHost);
- szHost = NULL;
+ szHost = nullptr;
const char *ppath, *phost;
phost = strstr(pszUrl, "://");
- if (phost == NULL) phost = pszUrl;
+ if (phost == nullptr) phost = pszUrl;
else phost += 3;
ppath = strchr(phost, '/');
if (ppath == phost)
- phost = NULL;
+ phost = nullptr;
szHost = mir_strdup(phost);
if (ppath && phost)
@@ -470,7 +470,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr }
if (nlc->proxyAuthNeeded && proxyAuthList.getCount()) {
- if (httpSecurity.m_szProvider == NULL && nlc->szProxyServer) {
+ if (httpSecurity.m_szProvider == nullptr && nlc->szProxyServer) {
const char *szAuthMethodNlu = proxyAuthList.find(nlc->szProxyServer);
if (szAuthMethodNlu) {
mir_free(pszProxyAuthHdr);
@@ -491,7 +491,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr else if (!mir_strcmpi(p.szName, "Proxy-Authorization")) doneProxyAuthHeader = 1;
else if (!mir_strcmpi(p.szName, "Authorization")) doneAuthHeader = 1;
else if (!mir_strcmpi(p.szName, "Connection")) continue;
- if (p.szValue == NULL) continue;
+ if (p.szValue == nullptr) continue;
httpRequest.AppendFormat("%s: %s\r\n", p.szName, p.szValue);
}
if (szHost && !doneHostHeader)
@@ -504,7 +504,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr httpRequest.AppendFormat("%s: %s\r\n", "Proxy-Connection", "Keep-Alive");
// Add Sticky Headers
- if (nlu->szStickyHeaders != NULL)
+ if (nlu->szStickyHeaders != nullptr)
httpRequest.AppendFormat("%s\r\n", nlu->szStickyHeaders);
// send it
@@ -518,13 +518,13 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr DWORD fflags = MSG_PEEK | MSG_NODUMP | ((nlhr->flags & NLHRF_NOPROXY) ? MSG_RAW : 0);
DWORD dwTimeOutTime = hdrTimeout < 0 ? -1 : GetTickCount() + hdrTimeout;
- if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &nlhr->resultCode, NULL, NULL)) {
+ if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &nlhr->resultCode, nullptr, nullptr)) {
DWORD err = GetLastError();
Netlib_Logf(nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", err, count);
// connection died while we were waiting
if (GetNetlibHandleType(nlc) != NLH_CONNECTION) {
- nlc = NULL;
+ nlc = nullptr;
break;
}
@@ -551,7 +551,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr nlhrReply = (NETLIBHTTPREQUEST*)Netlib_RecvHttpHeaders(nlc, hflags);
else if (resultCode == 307 || ((resultCode == 301 || resultCode == 302) && (nlhr->flags & NLHRF_REDIRECT))) { // redirect
- pszUrl = NULL;
+ pszUrl = nullptr;
if (nlhr->requestType == REQUEST_HEAD)
nlhrReply = (NETLIBHTTPREQUEST*)Netlib_RecvHttpHeaders(nlc, hflags);
@@ -575,9 +575,9 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr strncpy(nlc->szNewUrl, pszFullUrl, rlen);
mir_strcpy(nlc->szNewUrl + rlen, tmpUrl);
pszFullUrl = nlc->szNewUrl;
- pszUrl = NULL;
+ pszUrl = nullptr;
- if (NetlibHttpProcessUrl(nlhr, nlu, nlc, pszFullUrl) == NULL) {
+ if (NetlibHttpProcessUrl(nlhr, nlu, nlc, pszFullUrl) == nullptr) {
bytesSent = SOCKET_ERROR;
break;
}
@@ -600,9 +600,9 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr else
nlhrReply = NetlibHttpRecv(nlc, hflags, dflags);
- replaceStr(pszAuthHdr, NULL);
+ replaceStr(pszAuthHdr, nullptr);
if (nlhrReply) {
- char *szAuthStr = NULL;
+ char *szAuthStr = nullptr;
if (!complete) {
szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate", httpSecurity.m_szProvider);
if (szAuthStr) {
@@ -612,7 +612,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr }
}
if (complete && httpSecurity.m_hNtlmSecurity)
- szAuthStr = httpSecurity.TryBasic() ? NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate", "Basic") : NULL;
+ szAuthStr = httpSecurity.TryBasic() ? NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate", "Basic") : nullptr;
if (szAuthStr) {
char *szChallenge = strchr(szAuthStr, ' ');
@@ -621,8 +621,8 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr pszAuthHdr = httpSecurity.Execute(nlc, szHost, szAuthStr, szChallenge, complete);
}
}
- if (pszAuthHdr == NULL) {
- proxyAuthList.add(szHost, NULL);
+ if (pszAuthHdr == nullptr) {
+ proxyAuthList.add(szHost, nullptr);
NetlibHttpSetLastErrorUsingHttpResult(resultCode);
bytesSent = SOCKET_ERROR;
break;
@@ -634,9 +634,9 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr else
nlhrReply = NetlibHttpRecv(nlc, hflags, dflags);
- mir_free(pszProxyAuthHdr); pszProxyAuthHdr = NULL;
+ mir_free(pszProxyAuthHdr); pszProxyAuthHdr = nullptr;
if (nlhrReply) {
- char *szAuthStr = NULL;
+ char *szAuthStr = nullptr;
if (!complete) {
szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate", httpSecurity.m_szProvider);
if (szAuthStr) {
@@ -646,7 +646,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr }
}
if (complete && httpSecurity.m_hNtlmSecurity)
- szAuthStr = httpSecurity.TryBasic() ? NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate", "Basic") : NULL;
+ szAuthStr = httpSecurity.TryBasic() ? NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate", "Basic") : nullptr;
if (szAuthStr) {
char *szChallenge = strchr(szAuthStr, ' ');
@@ -655,8 +655,8 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr pszProxyAuthHdr = httpSecurity.Execute(nlc, nlc->szProxyServer, szAuthStr, szChallenge, complete);
}
}
- if (pszProxyAuthHdr == NULL) {
- proxyAuthList.add(nlc->szProxyServer, NULL);
+ if (pszProxyAuthHdr == nullptr) {
+ proxyAuthList.add(nlc->szProxyServer, nullptr);
NetlibHttpSetLastErrorUsingHttpResult(resultCode);
bytesSent = SOCKET_ERROR;
break;
@@ -665,14 +665,14 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr else break;
if (pszProxyAuthHdr && resultCode != 407 && !doneProxyAuthHeader)
- replaceStr(pszProxyAuthHdr, NULL);
+ replaceStr(pszProxyAuthHdr, nullptr);
if (pszAuthHdr && resultCode != 401 && !doneAuthHeader)
- replaceStr(pszAuthHdr, NULL);
+ replaceStr(pszAuthHdr, nullptr);
if (nlhrReply) {
Netlib_FreeHttpRequest(nlhrReply);
- nlhrReply = NULL;
+ nlhrReply = nullptr;
}
}
@@ -694,7 +694,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr MIR_APP_DLL(bool) Netlib_FreeHttpRequest(NETLIBHTTPREQUEST *nlhr)
{
- if (nlhr == NULL || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) || nlhr->requestType != REQUEST_RESPONSE) {
+ if (nlhr == nullptr || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) || nlhr->requestType != REQUEST_RESPONSE) {
SetLastError(ERROR_INVALID_PARAMETER);
return false;
}
@@ -720,7 +720,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, {
NetlibConnection *nlc = (NetlibConnection*)hConnection;
if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
- return NULL;
+ return nullptr;
DWORD dwRequestTimeoutTime = GetTickCount() + HTTPRECVDATATIMEOUT;
NETLIBHTTPREQUEST *nlhr = (NETLIBHTTPREQUEST*)mir_calloc(sizeof(NETLIBHTTPREQUEST));
@@ -732,7 +732,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, flags | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) {
NetlibLeaveNestedCS(&nlc->ncsRecv);
Netlib_FreeHttpRequest(nlhr);
- return NULL;
+ return nullptr;
}
char *buffer = (char*)_alloca(NHRV_BUF_SIZE + 1);
@@ -742,7 +742,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, Netlib_FreeHttpRequest(nlhr);
if (bytesPeeked != SOCKET_ERROR)
SetLastError(ERROR_HANDLE_EOF);
- return NULL;
+ return nullptr;
}
// Make sure all headers arrived
@@ -764,7 +764,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, headersCount = 0;
for (char *pbuffer = (char*)buf.data();; headersCount++) {
char *peol = strchr(pbuffer, '\n');
- if (peol == NULL) break;
+ if (peol == nullptr) break;
if (peol == pbuffer || (peol == (pbuffer + 1) && *pbuffer == '\r')) {
bytesPeeked = peol - (char*)buf.data() + 1;
headersCompleted = true;
@@ -778,7 +778,7 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, if (bytesPeeked <= 0) {
NetlibLeaveNestedCS(&nlc->ncsRecv);
Netlib_FreeHttpRequest(nlhr);
- return NULL;
+ return nullptr;
}
nlhr->headersCount = headersCount;
@@ -787,13 +787,13 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, headersCount = 0;
for (char *pbuffer = buf.data();; headersCount++) {
char *peol = strchr(pbuffer, '\n');
- if (peol == NULL || peol == pbuffer || (peol == (pbuffer+1) && *pbuffer == '\r'))
+ if (peol == nullptr || peol == pbuffer || (peol == (pbuffer+1) && *pbuffer == '\r'))
break;
*peol = 0;
char *pColon = strchr(pbuffer, ':');
- if (pColon == NULL) {
- Netlib_FreeHttpRequest(nlhr); nlhr = NULL;
+ if (pColon == nullptr) {
+ Netlib_FreeHttpRequest(nlhr); nlhr = nullptr;
SetLastError(ERROR_INVALID_DATA);
break;
}
@@ -817,25 +817,25 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER nlu, NETLIBHTTPREQUEST *nlhr)
{
if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) ||
- nlhr == NULL || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) ||
- nlhr->szUrl == NULL || nlhr->szUrl[0] == 0)
+ nlhr == nullptr || nlhr->cbSize != sizeof(NETLIBHTTPREQUEST) ||
+ nlhr->szUrl == nullptr || nlhr->szUrl[0] == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- if (nlhr->nlc != NULL && GetNetlibHandleType(nlhr->nlc) != NLH_CONNECTION)
- nlhr->nlc = NULL;
+ if (nlhr->nlc != nullptr && GetNetlibHandleType(nlhr->nlc) != NLH_CONNECTION)
+ nlhr->nlc = nullptr;
NetlibConnection *nlc = NetlibHttpProcessUrl(nlhr, nlu, (NetlibConnection*)nlhr->nlc);
- if (nlc == NULL)
+ if (nlc == nullptr)
return 0;
NETLIBHTTPREQUEST nlhrSend = *nlhr;
nlhrSend.flags |= NLHRF_SMARTREMOVEHOST;
- bool doneUserAgentHeader = NetlibHttpFindHeader(nlhr, "User-Agent") != NULL;
- bool doneAcceptEncoding = NetlibHttpFindHeader(nlhr, "Accept-Encoding") != NULL;
+ bool doneUserAgentHeader = NetlibHttpFindHeader(nlhr, "User-Agent") != nullptr;
+ bool doneAcceptEncoding = NetlibHttpFindHeader(nlhr, "Accept-Encoding") != nullptr;
if (!doneUserAgentHeader || !doneAcceptEncoding) {
nlhrSend.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER) * (nlhrSend.headersCount + 2));
memcpy(nlhrSend.headers, nlhr->headers, sizeof(NETLIBHTTPHEADER) * nlhr->headersCount);
@@ -890,13 +890,13 @@ MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER nlu, NETLIBHT if (nlhrReply) {
nlhrReply->szUrl = nlc->szNewUrl;
- nlc->szNewUrl = NULL;
+ nlc->szNewUrl = nullptr;
}
- if ((nlhr->flags & NLHRF_PERSISTENT) == 0 || nlhrReply == NULL) {
+ if ((nlhr->flags & NLHRF_PERSISTENT) == 0 || nlhrReply == nullptr) {
Netlib_CloseHandle(nlc);
if (nlhrReply)
- nlhrReply->nlc = NULL;
+ nlhrReply->nlc = nullptr;
}
else nlhrReply->nlc = nlc;
@@ -925,10 +925,10 @@ void NetlibHttpSetLastErrorUsingHttpResult(int result) char* gzip_decode(char *gzip_data, int *len_ptr, int window)
{
- if (*len_ptr == 0) return NULL;
+ if (*len_ptr == 0) return nullptr;
int gzip_len = *len_ptr * 5;
- char* output_data = NULL;
+ char* output_data = nullptr;
int gzip_err;
z_stream zstr;
@@ -956,7 +956,7 @@ char* gzip_decode(char *gzip_data, int *len_ptr, int window) if (gzip_len <= 0) {
mir_free(output_data);
- output_data = NULL;
+ output_data = nullptr;
}
else output_data[gzip_len] = 0;
@@ -977,19 +977,19 @@ static int NetlibHttpRecvChunkHeader(NetlibConnection *nlc, bool first, DWORD fl buf.append(data, recvResult); // add chunk
const char *peol1 = (const char*)memchr(buf.data(), '\n', buf.length());
- if (peol1 == NULL)
+ if (peol1 == nullptr)
continue;
int cbRest = int(peol1 - buf.data()) + 1;
const char *peol2 = first ? peol1 : (const char*)memchr(peol1 + 1, '\n', buf.length() - cbRest);
- if (peol2 == NULL)
+ if (peol2 == nullptr)
continue;
int sz = peol2 - buf.data() + 1;
- int r = strtol(first ? buf.data() : peol1 + 1, NULL, 16);
+ int r = strtol(first ? buf.data() : peol1 + 1, nullptr, 16);
if (r == 0) {
const char *peol3 = strchr(peol2 + 1, '\n');
- if (peol3 == NULL)
+ if (peol3 == nullptr)
continue;
sz = peol3 - buf.data() + 1;
}
@@ -1007,8 +1007,8 @@ NETLIBHTTPREQUEST* NetlibHttpRecv(NetlibConnection *nlc, DWORD hflags, DWORD dfl next:
NETLIBHTTPREQUEST *nlhrReply = Netlib_RecvHttpHeaders(nlc, hflags);
- if (nlhrReply == NULL)
- return NULL;
+ if (nlhrReply == nullptr)
+ return nullptr;
if (nlhrReply->resultCode == 100) {
Netlib_FreeHttpRequest(nlhrReply);
@@ -1046,7 +1046,7 @@ next: chunksz = NetlibHttpRecvChunkHeader(nlc, true, dflags | (cenctype ? MSG_NODUMP : 0));
if (chunksz == SOCKET_ERROR) {
Netlib_FreeHttpRequest(nlhrReply);
- return NULL;
+ return nullptr;
}
dataLen = chunksz;
}
@@ -1063,7 +1063,7 @@ next: if (recvResult == 0) break;
if (recvResult == SOCKET_ERROR) {
Netlib_FreeHttpRequest(nlhrReply);
- return NULL;
+ return nullptr;
}
nlhrReply->dataLength += recvResult;
@@ -1074,10 +1074,10 @@ next: else if ((dataBufferAlloced - nlhrReply->dataLength) < 256) {
dataBufferAlloced += 2048;
nlhrReply->pData = (char*)mir_realloc(nlhrReply->pData, dataBufferAlloced);
- if (nlhrReply->pData == NULL) {
+ if (nlhrReply->pData == nullptr) {
SetLastError(ERROR_OUTOFMEMORY);
Netlib_FreeHttpRequest(nlhrReply);
- return NULL;
+ return nullptr;
}
}
Sleep(10);
@@ -1089,7 +1089,7 @@ next: chunksz = NetlibHttpRecvChunkHeader(nlc, false, dflags | MSG_NODUMP);
if (chunksz == SOCKET_ERROR) {
Netlib_FreeHttpRequest(nlhrReply);
- return NULL;
+ return nullptr;
}
dataLen += chunksz;
dataBufferAlloced += chunksz;
@@ -1110,7 +1110,7 @@ next: if (cenctype) {
int bufsz = nlhrReply->dataLength;
- char* szData = NULL;
+ char* szData = nullptr;
switch (cenctype) {
case 1:
@@ -1138,7 +1138,7 @@ next: }
else if (bufsz == 0) {
mir_free(nlhrReply->pData);
- nlhrReply->pData = NULL;
+ nlhrReply->pData = nullptr;
nlhrReply->dataLength = 0;
}
}
diff --git a/src/mir_app/src/netlibhttpproxy.cpp b/src/mir_app/src/netlibhttpproxy.cpp index 47ceabe978..f2919fccfb 100644 --- a/src/mir_app/src/netlibhttpproxy.cpp +++ b/src/mir_app/src/netlibhttpproxy.cpp @@ -50,7 +50,7 @@ static int HttpGatewayReadSetResult(NetlibConnection *nlc, char *buf, int num, i void HttpGatewayRemovePacket(NetlibConnection *nlc, int pck)
{
mir_cslock lck(nlc->csHttpSequenceNums);
- while (pck-- && nlc->pHttpProxyPacketQueue != NULL) {
+ while (pck-- && nlc->pHttpProxyPacketQueue != nullptr) {
NetlibHTTPProxyPacketQueue *p = nlc->pHttpProxyPacketQueue;
nlc->pHttpProxyPacketQueue = nlc->pHttpProxyPacketQueue->next;
@@ -82,7 +82,7 @@ static bool NetlibHttpGatewaySend(NetlibConnection *nlc, RequestType reqType, co case reqOldGet:
nlhrSend.requestType = REQUEST_GET;
nlhrSend.timeout = -1;
- if ((nlc->nlhpi.flags & NLHPIF_USEGETSEQUENCE) && (nlc->nlhpi.szHttpGetUrl != NULL)) {
+ if ((nlc->nlhpi.flags & NLHPIF_USEGETSEQUENCE) && (nlc->nlhpi.szHttpGetUrl != nullptr)) {
mir_cslock lck(nlc->csHttpSequenceNums);
mir_snprintf(szUrl, "%s%u", nlc->nlhpi.szHttpGetUrl, nlc->nlhpi.firstGetSequence++);
if (nlc->nlhpi.flags & NLHPIF_GETPOSTSAMESEQUENCE)
@@ -94,7 +94,7 @@ static bool NetlibHttpGatewaySend(NetlibConnection *nlc, RequestType reqType, co case reqOldPost:
nlhrSend.requestType = REQUEST_POST;
- if ((nlc->nlhpi.flags & NLHPIF_USEPOSTSEQUENCE) && (nlc->nlhpi.szHttpPostUrl != NULL)) {
+ if ((nlc->nlhpi.flags & NLHPIF_USEPOSTSEQUENCE) && (nlc->nlhpi.szHttpPostUrl != nullptr)) {
mir_snprintf(szUrl, "%s%u", nlc->nlhpi.szHttpPostUrl, nlc->nlhpi.firstPostSequence);
nlhrSend.szUrl = szUrl;
}
@@ -142,7 +142,7 @@ static bool NetlibHttpGatewayStdPost(NetlibConnection *nlc, int &numPackets) {
mir_cslock lck(nlc->csHttpSequenceNums);
- for (p = nlc->pHttpProxyPacketQueue; p != NULL && np < nlc->nlhpi.combinePackets; p = p->next) {
+ for (p = nlc->pHttpProxyPacketQueue; p != nullptr && np < nlc->nlhpi.combinePackets; p = p->next) {
np++;
len += p->dataBufferLen;
}
@@ -180,7 +180,7 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i bool res = NetlibHttpGatewaySend(nlcSend, reqOldPost, buf, len);
if (res) {
NETLIBHTTPREQUEST *nlhrReply = NetlibHttpRecv(nlcSend, flags | MSG_RAW | MSG_DUMPPROXY, MSG_RAW | MSG_DUMPPROXY);
- if (nlhrReply != NULL) {
+ if (nlhrReply != nullptr) {
if (nlhrReply->resultCode != 200) {
NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode);
res = false;
@@ -203,17 +203,17 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i int NetlibHttpGatewayPost(NetlibConnection *nlc, const char *buf, int len, int flags)
{
- if (nlc->nlhpi.szHttpGetUrl != NULL)
+ if (nlc->nlhpi.szHttpGetUrl != nullptr)
return NetlibHttpGatewayOscarPost(nlc, buf, len, flags) ? len : SOCKET_ERROR;
/*
* Gena01 - many changes here, do compare against the other version.
*
* Change #1: simplify to use similar code to GET
- * Change #2: we need to allow to parse POST reply if szHttpGetUrl is NULL
+ * Change #2: we need to allow to parse POST reply if szHttpGetUrl is nullptr
* Change #3: Keep connection open if we need to.
*
- * Impact: NONE! Since currently miranda doesn't allow szHttpGetUrl to be NULL, it will not connect
+ * Impact: NONE! Since currently miranda doesn't allow szHttpGetUrl to be nullptr, it will not connect
* with the new plugins that use this code.
*/
@@ -221,15 +221,15 @@ int NetlibHttpGatewayPost(NetlibConnection *nlc, const char *buf, int len, int f p->dataBuffer = (PBYTE)mir_alloc(len);
memcpy(p->dataBuffer, buf, len);
p->dataBufferLen = len;
- p->next = NULL;
+ p->next = nullptr;
// Now check to see where to insert this in our queue
mir_cslock lck(nlc->csHttpSequenceNums);
- if (nlc->pHttpProxyPacketQueue == NULL)
+ if (nlc->pHttpProxyPacketQueue == nullptr)
nlc->pHttpProxyPacketQueue = p;
else {
NetlibHTTPProxyPacketQueue *t = nlc->pHttpProxyPacketQueue;
- while (t->next != NULL)
+ while (t->next != nullptr)
t = t->next;
t->next = p;
}
@@ -254,12 +254,12 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) return SOCKET_ERROR;
for (int retryCount = 0; retryCount < NETLIBHTTP_RETRYCOUNT;) {
- if (nlc->nlhpi.szHttpGetUrl == NULL && retryCount == 0) {
+ if (nlc->nlhpi.szHttpGetUrl == nullptr && retryCount == 0) {
if (nlc->pollingTimeout == 0) nlc->pollingTimeout = 30;
/* We Need to sleep/wait for the data to send before we do receive */
for (int pollCount = nlc->pollingTimeout; pollCount--;) {
- if (nlc->pHttpProxyPacketQueue != NULL && GetTickCount() - nlc->lastPost > 1000)
+ if (nlc->pHttpProxyPacketQueue != nullptr && GetTickCount() - nlc->lastPost > 1000)
break;
if (nlc->termRequested || (SleepEx(1000, TRUE) && Miranda_IsTerminated()))
@@ -267,14 +267,14 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) }
nlc->lastPost = GetTickCount();
- if (nlc->pHttpProxyPacketQueue == NULL && nlu->user.pfnHttpGatewayWrapSend != NULL)
+ if (nlc->pHttpProxyPacketQueue == nullptr && nlu->user.pfnHttpGatewayWrapSend != nullptr)
if (nlu->user.pfnHttpGatewayWrapSend(nlc, (PBYTE)"", 0, MSG_NOHTTPGATEWAYWRAP) == SOCKET_ERROR)
return SOCKET_ERROR;
}
int numPackets = 0;
if (nlc->nlhpi.szHttpGetUrl) {
- if (!NetlibHttpGatewaySend(nlc, reqOldGet, NULL, 0)) {
+ if (!NetlibHttpGatewaySend(nlc, reqOldGet, nullptr, 0)) {
if (GetLastError() == ERROR_ACCESS_DENIED || nlc->termRequested)
break;
@@ -292,7 +292,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) }
}
NETLIBHTTPREQUEST *nlhrReply = NetlibHttpRecv(nlc, flags | MSG_RAW | MSG_DUMPPROXY, MSG_RAW | MSG_DUMPPROXY);
- if (nlhrReply == NULL)
+ if (nlhrReply == nullptr)
return SOCKET_ERROR;
if (nlu->user.pfnHttpGatewayUnwrapRecv && !(flags & MSG_NOHTTPGATEWAYWRAP))
@@ -353,19 +353,19 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) int NetlibInitHttpConnection(HNETLIBCONN nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
- NETLIBHTTPREQUEST *nlhrReply = NULL;
+ NETLIBHTTPREQUEST *nlhrReply = nullptr;
{
mir_cslock lck(nlc->csHttpSequenceNums);
nlc->nlhpi.firstGetSequence = 1;
nlc->nlhpi.firstPostSequence = 1;
}
- if (nlu->user.szHttpGatewayHello != NULL) {
+ if (nlu->user.szHttpGatewayHello != nullptr) {
nlc->usingHttpGateway = true;
- if (NetlibHttpGatewaySend(nlc, reqHelloGet, NULL, 0))
+ if (NetlibHttpGatewaySend(nlc, reqHelloGet, nullptr, 0))
nlhrReply = NetlibHttpRecv(nlc, MSG_DUMPPROXY | MSG_RAW, MSG_DUMPPROXY | MSG_RAW);
nlc->usingHttpGateway = false;
- if (nlhrReply == NULL) return 0;
+ if (nlhrReply == nullptr) return 0;
if (nlhrReply->resultCode != 200) {
NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode);
@@ -379,7 +379,7 @@ int NetlibInitHttpConnection(HNETLIBCONN nlc, NetlibUser *nlu, NETLIBOPENCONNECT }
Netlib_FreeHttpRequest(nlhrReply);
- if (nlc->nlhpi.szHttpPostUrl == NULL) {
+ if (nlc->nlhpi.szHttpPostUrl == nullptr) {
SetLastError(ERROR_BAD_FORMAT);
return 0;
}
@@ -397,7 +397,7 @@ int NetlibInitHttpConnection(HNETLIBCONN nlc, NetlibUser *nlu, NETLIBOPENCONNECT MIR_APP_DLL(int) Netlib_SetHttpProxyInfo(HNETLIBCONN nlc, const NETLIBHTTPPROXYINFO *nlhpi)
{
- if (GetNetlibHandleType(nlc) != NLH_CONNECTION || nlhpi == NULL || nlhpi->szHttpPostUrl == NULL) {
+ if (GetNetlibHandleType(nlc) != NLH_CONNECTION || nlhpi == nullptr || nlhpi->szHttpPostUrl == nullptr) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp index 0a5a9f1e73..c069f19c34 100644 --- a/src/mir_app/src/netliblog.cpp +++ b/src/mir_app/src/netliblog.cpp @@ -54,17 +54,17 @@ struct LOGMSG static __int64 mirandaStartTime, perfCounterFreq;
static int bIsActive = TRUE;
-static HANDLE hLogEvent = NULL;
-static HANDLE hLogger = NULL;
+static HANDLE hLogEvent = nullptr;
+static HANDLE hLogger = nullptr;
static void InitLog()
{
if (hLogger) {
mir_closeLog(hLogger);
- hLogger = NULL;
+ hLogger = nullptr;
}
- ptrW szBuf(db_get_wsa(NULL, "Netlib", "File"));
+ ptrW szBuf(db_get_wsa(0, "Netlib", "File"));
if (mir_wstrlen(szBuf)) {
logOptions.tszUserFile = szBuf.get();
@@ -73,7 +73,7 @@ static void InitLog() logOptions.tszFile = path;
}
else {
- db_set_ws(NULL, "Netlib", "File", logOptions.tszUserFile = L"%miranda_logpath%\\netlog.txt");
+ db_set_ws(0, "Netlib", "File", logOptions.tszUserFile = L"%miranda_logpath%\\netlog.txt");
logOptions.tszFile = VARSW(logOptions.tszUserFile);
}
@@ -113,9 +113,9 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa CheckDlgButton(hwndDlg, IDC_TOFILE, logOptions.toFile ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(hwndDlg, IDC_FILENAME, logOptions.tszUserFile);
SetDlgItemText(hwndDlg, IDC_PATH, logOptions.tszFile);
- CheckDlgButton(hwndDlg, IDC_SHOWTHISDLGATSTART, db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWTHISDLGATSTART, db_get_b(0, "Netlib", "ShowLogOptsAtStart", 0) ? BST_CHECKED : BST_UNCHECKED);
{
- ptrA szRun(db_get_sa(NULL, "Netlib", "RunAtStart"));
+ ptrA szRun(db_get_sa(0, "Netlib", "RunAtStart"));
if (szRun)
SetDlgItemTextA(hwndDlg, IDC_RUNATSTART, szRun);
@@ -182,7 +182,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa else if (!GetOpenFileName(&ofn))
return 1;
- if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && wcschr(str, ' ') != NULL) {
+ if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && wcschr(str, ' ') != nullptr) {
memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
str[0] = '"';
mir_wstrcat(str, L"\"");
@@ -196,32 +196,32 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa if (str[0]) {
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
- CreateProcess(NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ CreateProcess(nullptr, str, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi);
}
break;
case IDOK:
GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, _countof(str));
- db_set_ws(NULL, "Netlib", "RunAtStart", str);
- db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
+ db_set_ws(0, "Netlib", "RunAtStart", str);
+ db_set_b(0, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
logOptions.tszUserFile = rtrimw(str);
- db_set_ws(NULL, "Netlib", "File", str);
+ db_set_ws(0, "Netlib", "File", str);
GetDlgItemText(hwndDlg, IDC_PATH, str, _countof(str));
logOptions.tszFile = rtrimw(str);
- db_set_b(NULL, "Netlib", "DumpRecv", logOptions.dumpRecv = IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV));
- db_set_b(NULL, "Netlib", "DumpSent", logOptions.dumpSent = IsDlgButtonChecked(hwndDlg, IDC_DUMPSENT));
- db_set_b(NULL, "Netlib", "DumpProxy", logOptions.dumpProxy = IsDlgButtonChecked(hwndDlg, IDC_DUMPPROXY));
- db_set_b(NULL, "Netlib", "DumpSsl", logOptions.dumpSsl = IsDlgButtonChecked(hwndDlg, IDC_DUMPSSL));
- db_set_b(NULL, "Netlib", "TextDumps", logOptions.textDumps = IsDlgButtonChecked(hwndDlg, IDC_TEXTDUMPS));
- db_set_b(NULL, "Netlib", "AutoDetectText", logOptions.autoDetectText = IsDlgButtonChecked(hwndDlg, IDC_AUTODETECTTEXT));
- db_set_b(NULL, "Netlib", "TimeFormat", logOptions.timeFormat = SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_GETCURSEL, 0, 0));
- db_set_b(NULL, "Netlib", "ShowUser", logOptions.showUser = IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
- db_set_b(NULL, "Netlib", "ToOutputDebugString", logOptions.toOutputDebugString = IsDlgButtonChecked(hwndDlg, IDC_TOOUTPUTDEBUGSTRING));
- db_set_b(NULL, "Netlib", "ToFile", logOptions.toFile = IsDlgButtonChecked(hwndDlg, IDC_TOFILE));
+ db_set_b(0, "Netlib", "DumpRecv", logOptions.dumpRecv = IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV));
+ db_set_b(0, "Netlib", "DumpSent", logOptions.dumpSent = IsDlgButtonChecked(hwndDlg, IDC_DUMPSENT));
+ db_set_b(0, "Netlib", "DumpProxy", logOptions.dumpProxy = IsDlgButtonChecked(hwndDlg, IDC_DUMPPROXY));
+ db_set_b(0, "Netlib", "DumpSsl", logOptions.dumpSsl = IsDlgButtonChecked(hwndDlg, IDC_DUMPSSL));
+ db_set_b(0, "Netlib", "TextDumps", logOptions.textDumps = IsDlgButtonChecked(hwndDlg, IDC_TEXTDUMPS));
+ db_set_b(0, "Netlib", "AutoDetectText", logOptions.autoDetectText = IsDlgButtonChecked(hwndDlg, IDC_AUTODETECTTEXT));
+ db_set_b(0, "Netlib", "TimeFormat", logOptions.timeFormat = SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_GETCURSEL, 0, 0));
+ db_set_b(0, "Netlib", "ShowUser", logOptions.showUser = IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
+ db_set_b(0, "Netlib", "ToOutputDebugString", logOptions.toOutputDebugString = IsDlgButtonChecked(hwndDlg, IDC_TOOUTPUTDEBUGSTRING));
+ db_set_b(0, "Netlib", "ToFile", logOptions.toFile = IsDlgButtonChecked(hwndDlg, IDC_TOFILE));
{
HWND hwndFilter = GetDlgItem(logOptions.hwndOpts, IDC_FILTER);
TVITEM tvi = { 0 };
@@ -236,11 +236,11 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa if (tvi.lParam == -1) {
logOptions.toLog = checked;
- db_set_dw(NULL, "Netlib", "NLlog", checked);
+ db_set_dw(0, "Netlib", "NLlog", checked);
}
else if (tvi.lParam < netlibUser.getCount()) {
netlibUser[tvi.lParam]->toLog = checked;
- db_set_dw(NULL, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
+ db_set_dw(0, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
}
tvi.hItem = TreeView_GetNextSibling(hwndFilter, tvi.hItem);
@@ -259,7 +259,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa case WM_DESTROY:
ImageList_Destroy(TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_FILTER), TVSIL_STATE));
- logOptions.hwndOpts = NULL;
+ logOptions.hwndOpts = nullptr;
break;
}
return FALSE;
@@ -267,8 +267,8 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa void NetlibLogShowOptions(void)
{
- if (logOptions.hwndOpts == NULL)
- logOptions.hwndOpts = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_NETLIBLOGOPTS), NULL, LogOptionsDlgProc);
+ if (logOptions.hwndOpts == nullptr)
+ logOptions.hwndOpts = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_NETLIBLOGOPTS), nullptr, LogOptionsDlgProc);
SetForegroundWindow(logOptions.hwndOpts);
}
@@ -285,20 +285,20 @@ int NetlibLog_Worker(NetlibUser *nlu, const char *pszMsg, int flags) DWORD dwOriginalLastError = GetLastError();
- if ((nlu != NULL && GetNetlibHandleType(nlu) != NLH_USER) || pszMsg == NULL) {
+ if ((nlu != nullptr && GetNetlibHandleType(nlu) != NLH_USER) || pszMsg == nullptr) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- /* if the Netlib user handle is NULL, just pretend its not */
- if (!(nlu != NULL ? nlu->toLog : logOptions.toLog))
+ /* if the Netlib user handle is nullptr, just pretend its not */
+ if (!(nlu != nullptr ? nlu->toLog : logOptions.toLog))
return 1;
LARGE_INTEGER liTimeNow;
char szTime[32], szHead[128];
switch (logOptions.timeFormat) {
case TIMEFORMAT_HHMMSS:
- GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, NULL, NULL, szTime, _countof(szTime));
+ GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, nullptr, nullptr, szTime, _countof(szTime));
mir_strcat(szTime, " ");
break;
@@ -324,7 +324,7 @@ int NetlibLog_Worker(NetlibUser *nlu, const char *pszMsg, int flags) if (flags & MSG_NOTITLE)
szHead[0] = 0;
else {
- char *szUser = (logOptions.showUser) ? (nlu == NULL ? NULL : nlu->user.szSettingsModule) : NULL;
+ char *szUser = (logOptions.showUser) ? (nlu == nullptr ? nullptr : nlu->user.szSettingsModule) : nullptr;
if (szUser)
mir_snprintf(szHead, "[%s%04X] [%s] ", szTime, GetCurrentThreadId(), szUser);
else
@@ -356,14 +356,14 @@ MIR_APP_DLL(void) ProtoLogA(PROTO_INTERFACE *pThis, LPCSTR szFormat, va_list arg {
char buf[4096];
int res = _vsnprintf(buf, _countof(buf), szFormat, args);
- NetlibLog_Worker(pThis ? pThis->m_hNetlibUser : NULL, (res != -1) ? buf : CMStringA().FormatV(szFormat, args), 0);
+ NetlibLog_Worker(pThis ? pThis->m_hNetlibUser : nullptr, (res != -1) ? buf : CMStringA().FormatV(szFormat, args), 0);
}
MIR_APP_DLL(void) ProtoLogW(PROTO_INTERFACE *pThis, LPCWSTR wszFormat, va_list args)
{
WCHAR buf[4096];
int res = _vsnwprintf(buf, _countof(buf), wszFormat, args);
- NetlibLog_Worker(pThis ? pThis->m_hNetlibUser : NULL, ptrA(Utf8EncodeW((res != -1) ? buf : CMStringW().FormatV(wszFormat, args))), 0);
+ NetlibLog_Worker(pThis ? pThis->m_hNetlibUser : nullptr, ptrA(Utf8EncodeW((res != -1) ? buf : CMStringW().FormatV(wszFormat, args))), 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -426,7 +426,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla return;
WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
- NetlibUser *nlu = nlc ? nlc->nlu : NULL;
+ NetlibUser *nlu = nlc ? nlc->nlu : nullptr;
int titleLineLen;
if (flags & MSG_NOTITLE)
titleLineLen = 0;
@@ -435,7 +435,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla ReleaseMutex(hConnectionHeaderMutex);
// check filter settings
- if (nlu == NULL) {
+ if (nlu == nullptr) {
if (!logOptions.toLog)
return;
}
@@ -525,35 +525,35 @@ void NetlibLogInit(void) CreateServiceFunction(MS_NETLIB_LOGWIN, ShowOptions);
hLogEvent = CreateHookableEvent(ME_NETLIB_FASTDUMP);
- logOptions.dumpRecv = db_get_b(NULL, "Netlib", "DumpRecv", 1);
- logOptions.dumpSent = db_get_b(NULL, "Netlib", "DumpSent", 1);
- logOptions.dumpProxy = db_get_b(NULL, "Netlib", "DumpProxy", 1);
- logOptions.dumpSsl = db_get_b(NULL, "Netlib", "DumpSsl", 0);
- logOptions.textDumps = db_get_b(NULL, "Netlib", "TextDumps", 1);
- logOptions.autoDetectText = db_get_b(NULL, "Netlib", "AutoDetectText", 1);
- logOptions.timeFormat = db_get_b(NULL, "Netlib", "TimeFormat", TIMEFORMAT_HHMMSS);
- logOptions.showUser = db_get_b(NULL, "Netlib", "ShowUser", 1);
- logOptions.toOutputDebugString = db_get_b(NULL, "Netlib", "ToOutputDebugString", 0);
- logOptions.toFile = db_get_b(NULL, "Netlib", "ToFile", 0);
- logOptions.toLog = db_get_dw(NULL, "Netlib", "NLlog", 1);
+ logOptions.dumpRecv = db_get_b(0, "Netlib", "DumpRecv", 1);
+ logOptions.dumpSent = db_get_b(0, "Netlib", "DumpSent", 1);
+ logOptions.dumpProxy = db_get_b(0, "Netlib", "DumpProxy", 1);
+ logOptions.dumpSsl = db_get_b(0, "Netlib", "DumpSsl", 0);
+ logOptions.textDumps = db_get_b(0, "Netlib", "TextDumps", 1);
+ logOptions.autoDetectText = db_get_b(0, "Netlib", "AutoDetectText", 1);
+ logOptions.timeFormat = db_get_b(0, "Netlib", "TimeFormat", TIMEFORMAT_HHMMSS);
+ logOptions.showUser = db_get_b(0, "Netlib", "ShowUser", 1);
+ logOptions.toOutputDebugString = db_get_b(0, "Netlib", "ToOutputDebugString", 0);
+ logOptions.toFile = db_get_b(0, "Netlib", "ToFile", 0);
+ logOptions.toLog = db_get_dw(0, "Netlib", "NLlog", 1);
InitLog();
- if (db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0))
+ if (db_get_b(0, "Netlib", "ShowLogOptsAtStart", 0))
NetlibLogShowOptions();
- ptrW szBuf(db_get_wsa(NULL, "Netlib", "RunAtStart"));
+ ptrW szBuf(db_get_wsa(0, "Netlib", "RunAtStart"));
if (szBuf) {
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
- CreateProcess(NULL, szBuf, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ CreateProcess(nullptr, szBuf, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi);
}
}
void NetlibLogShutdown(void)
{
bIsActive = FALSE;
- DestroyHookableEvent(hLogEvent); hLogEvent = NULL;
+ DestroyHookableEvent(hLogEvent); hLogEvent = nullptr;
if (IsWindow(logOptions.hwndOpts))
DestroyWindow(logOptions.hwndOpts);
}
diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp index 81bb807767..6d5bbf78a3 100644 --- a/src/mir_app/src/netlibopenconn.cpp +++ b/src/mir_app/src/netlibopenconn.cpp @@ -319,7 +319,7 @@ static bool NetlibInitHttpsConnection(NetlibConnection *nlc, NetlibUser *nlu, NE NETLIBHTTPREQUEST *nlhrReply = NetlibHttpRecv(nlc, MSG_DUMPPROXY | MSG_RAW, MSG_DUMPPROXY | MSG_RAW, true); nlc->usingHttpGateway = false; - if (nlhrReply == NULL) + if (nlhrReply == nullptr) return false; if (nlhrReply->resultCode < 200 || nlhrReply->resultCode >= 300) { @@ -464,7 +464,7 @@ retry: lasterr = ERROR_TIMEOUT; break; } - else if (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2 && nloc->waitcallback != NULL && nloc->waitcallback(&dwTimeout) == 0) { + else if (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2 && nloc->waitcallback != nullptr && nloc->waitcallback(&dwTimeout) == 0) { rc = SOCKET_ERROR; lasterr = ERROR_TIMEOUT; break; @@ -514,7 +514,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) } char szPort[6]; - addrinfo *air = NULL, *ai, hints = { 0 }; + addrinfo *air = nullptr, *ai, hints = { 0 }; hints.ai_family = AF_UNSPEC; @@ -627,7 +627,7 @@ retry: lasterr = ERROR_TIMEOUT; break; } - else if (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2 && nloc->waitcallback != NULL && nloc->waitcallback(&dwTimeout) == 0) { + else if (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2 && nloc->waitcallback != nullptr && nloc->waitcallback(&dwTimeout) == 0) { rc = SOCKET_ERROR; lasterr = ERROR_TIMEOUT; break; @@ -666,7 +666,7 @@ static int NetlibHttpFallbackToDirect(NetlibConnection *nlc, NetlibUser *nlu, NE nlc->proxyAuthNeeded = false; nlc->proxyType = 0; - replaceStr(nlc->szProxyServer, NULL); + replaceStr(nlc->szProxyServer, nullptr); if (!my_connect(nlc, nloc)) { Netlib_Logf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError()); return false; @@ -679,7 +679,7 @@ bool NetlibDoConnect(NetlibConnection *nlc) NETLIBOPENCONNECTION *nloc = &nlc->nloc; NetlibUser *nlu = nlc->nlu; - replaceStr(nlc->szProxyServer, NULL); + replaceStr(nlc->szProxyServer, nullptr); bool usingProxy = false, forceHttps = false; if (nlu->settings.useProxy) { @@ -819,14 +819,14 @@ bool NetlibReconnect(NetlibConnection *nlc) MIR_APP_DLL(HNETLIBCONN) Netlib_OpenConnection(NetlibUser *nlu, const NETLIBOPENCONNECTION *nloc) { - if (nloc == NULL || nloc->cbSize != sizeof(NETLIBOPENCONNECTION) || nloc->szHost == NULL || nloc->wPort == 0) { + if (nloc == nullptr || nloc->cbSize != sizeof(NETLIBOPENCONNECTION) || nloc->szHost == nullptr || nloc->wPort == 0) { SetLastError(ERROR_INVALID_PARAMETER); - return NULL; + return nullptr; } if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING)) - return NULL; + return nullptr; Netlib_Logf(nlu, "Connection request to %s:%d (Flags %x)....", nloc->szHost, nloc->wPort, nloc->flags); @@ -855,28 +855,28 @@ MIR_APP_DLL(HNETLIBCONN) Netlib_OpenConnection(NetlibUser *nlu, const NETLIBOPEN MIR_APP_DLL(int) Netlib_StartSsl(HNETLIBCONN hConnection, const char *szHost) { NetlibConnection *nlc = (NetlibConnection*)hConnection; - if (nlc == NULL) + if (nlc == nullptr) return 0; - if (szHost == NULL) + if (szHost == nullptr) szHost = nlc->nloc.szHost; Netlib_Logf(nlc->nlu, "(%d %s) Starting SSL negotiation", nlc->s, szHost); nlc->hSsl = sslApi.connect(nlc->s, szHost, nlc->nlu->settings.validateSSL); - if (nlc->hSsl == NULL) + if (nlc->hSsl == nullptr) Netlib_Logf(nlc->nlu, "(%d %s) Failure to negotiate SSL connection", nlc->s, szHost); else Netlib_Logf(nlc->nlu, "(%d %s) SSL negotiation successful", nlc->s, szHost); - return nlc->hSsl != NULL; + return nlc->hSsl != nullptr; } NetlibConnection::NetlibConnection() { handleType = NLH_CONNECTION; s = s2 = INVALID_SOCKET; - hOkToCloseEvent = CreateEvent(NULL, TRUE, TRUE, NULL); + hOkToCloseEvent = CreateEvent(nullptr, TRUE, TRUE, nullptr); NetlibInitializeNestedCS(&ncsSend); NetlibInitializeNestedCS(&ncsRecv); } diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp index b233dedfa2..3a37e0b295 100644 --- a/src/mir_app/src/netlibopts.cpp +++ b/src/mir_app/src/netlibopts.cpp @@ -105,7 +105,7 @@ static void CopySettingsStruct(NETLIBUSERSETTINGS *dest, const NETLIBUSERSETTING static void CombineSettingsStrings(char **dest, char **source)
{
- if (*dest != NULL && (*source == NULL || mir_strcmpi(*dest, *source))) { mir_free(*dest); *dest = NULL; }
+ if (*dest != nullptr && (*source == nullptr || mir_strcmpi(*dest, *source))) { mir_free(*dest); *dest = nullptr; }
}
static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest, DWORD *destFlags, NETLIBUSERSETTINGS *source, DWORD sourceFlags)
@@ -201,22 +201,22 @@ static void ChangeSettingStringByEdit(HWND hwndDlg, UINT ctrlId, int iUser, int static void WriteSettingsStructToDb(const char *szSettingsModule, NETLIBUSERSETTINGS *settings, DWORD flags)
{
if (flags & NUF_OUTGOING) {
- db_set_b(NULL, szSettingsModule, "NLValidateSSL", (BYTE)settings->validateSSL);
- db_set_b(NULL, szSettingsModule, "NLUseProxy", (BYTE)settings->useProxy);
- db_set_b(NULL, szSettingsModule, "NLProxyType", (BYTE)settings->proxyType);
- db_set_s(NULL, szSettingsModule, "NLProxyServer", settings->szProxyServer ? settings->szProxyServer : "");
- db_set_w(NULL, szSettingsModule, "NLProxyPort", (WORD)settings->wProxyPort);
- db_set_b(NULL, szSettingsModule, "NLUseProxyAuth", (BYTE)settings->useProxyAuth);
- db_set_s(NULL, szSettingsModule, "NLProxyAuthUser", settings->szProxyAuthUser ? settings->szProxyAuthUser : "");
- db_set_s(NULL, szSettingsModule, "NLProxyAuthPassword", settings->szProxyAuthPassword ? settings->szProxyAuthPassword : "");
- db_set_b(NULL, szSettingsModule, "NLDnsThroughProxy", (BYTE)settings->dnsThroughProxy);
- db_set_b(NULL, szSettingsModule, "NLSpecifyOutgoingPorts", (BYTE)settings->specifyOutgoingPorts);
- db_set_s(NULL, szSettingsModule, "NLOutgoingPorts", settings->szOutgoingPorts ? settings->szOutgoingPorts : "");
+ db_set_b(0, szSettingsModule, "NLValidateSSL", (BYTE)settings->validateSSL);
+ db_set_b(0, szSettingsModule, "NLUseProxy", (BYTE)settings->useProxy);
+ db_set_b(0, szSettingsModule, "NLProxyType", (BYTE)settings->proxyType);
+ db_set_s(0, szSettingsModule, "NLProxyServer", settings->szProxyServer ? settings->szProxyServer : "");
+ db_set_w(0, szSettingsModule, "NLProxyPort", (WORD)settings->wProxyPort);
+ db_set_b(0, szSettingsModule, "NLUseProxyAuth", (BYTE)settings->useProxyAuth);
+ db_set_s(0, szSettingsModule, "NLProxyAuthUser", settings->szProxyAuthUser ? settings->szProxyAuthUser : "");
+ db_set_s(0, szSettingsModule, "NLProxyAuthPassword", settings->szProxyAuthPassword ? settings->szProxyAuthPassword : "");
+ db_set_b(0, szSettingsModule, "NLDnsThroughProxy", (BYTE)settings->dnsThroughProxy);
+ db_set_b(0, szSettingsModule, "NLSpecifyOutgoingPorts", (BYTE)settings->specifyOutgoingPorts);
+ db_set_s(0, szSettingsModule, "NLOutgoingPorts", settings->szOutgoingPorts ? settings->szOutgoingPorts : "");
}
if (flags & NUF_INCOMING) {
- db_set_b(NULL, szSettingsModule, "NLEnableUPnP", (BYTE)settings->enableUPnP);
- db_set_b(NULL, szSettingsModule, "NLSpecifyIncomingPorts", (BYTE)settings->specifyIncomingPorts);
- db_set_s(NULL, szSettingsModule, "NLIncomingPorts", settings->szIncomingPorts ? settings->szIncomingPorts : "");
+ db_set_b(0, szSettingsModule, "NLEnableUPnP", (BYTE)settings->enableUPnP);
+ db_set_b(0, szSettingsModule, "NLSpecifyIncomingPorts", (BYTE)settings->specifyIncomingPorts);
+ db_set_s(0, szSettingsModule, "NLIncomingPorts", settings->szIncomingPorts ? settings->szIncomingPorts : "");
}
}
@@ -227,7 +227,7 @@ void NetlibSaveUserSettingsStruct(const char *szSettingsModule, const NETLIBUSER NetlibUser tUser;
tUser.user.szSettingsModule = (char*)szSettingsModule;
NetlibUser *thisUser = netlibUser.find(&tUser);
- if (thisUser == NULL)
+ if (thisUser == nullptr)
return;
NetlibFreeUserSettingsStruct(&thisUser->settings);
@@ -448,7 +448,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_PROXYPORT:
if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
{
- int newValue = GetDlgItemInt(hwndDlg, LOWORD(wParam), NULL, FALSE);
+ int newValue = GetDlgItemInt(hwndDlg, LOWORD(wParam), nullptr, FALSE);
if (iUser == -1) {
for (int i = 0; i < tempSettings.getCount(); i++) {
NetlibTempSettings *p = tempSettings[i];
diff --git a/src/mir_app/src/netlibpktrecver.cpp b/src/mir_app/src/netlibpktrecver.cpp index abf5b91b0d..a71c48c392 100644 --- a/src/mir_app/src/netlibpktrecver.cpp +++ b/src/mir_app/src/netlibpktrecver.cpp @@ -29,7 +29,7 @@ MIR_APP_DLL(HANDLE) Netlib_CreatePacketReceiver(HNETLIBCONN nlc, int iMaxSize) {
if (GetNetlibHandleType(nlc) != NLH_CONNECTION || iMaxSize == 0) {
SetLastError(ERROR_INVALID_PARAMETER);
- return NULL;
+ return nullptr;
}
NetlibPacketRecver *nlpr = (struct NetlibPacketRecver*)mir_calloc(sizeof(struct NetlibPacketRecver));
@@ -45,7 +45,7 @@ MIR_APP_DLL(HANDLE) Netlib_CreatePacketReceiver(HNETLIBCONN nlc, int iMaxSize) MIR_APP_DLL(int) Netlib_GetMorePackets(HANDLE hReceiver, NETLIBPACKETRECVER *nlprParam)
{
NetlibPacketRecver *nlpr = (NetlibPacketRecver*)hReceiver;
- if (GetNetlibHandleType(nlpr) != NLH_PACKETRECVER || nlprParam == NULL || nlprParam->bytesUsed > nlpr->packetRecver.bytesAvailable) {
+ if (GetNetlibHandleType(nlpr) != NLH_PACKETRECVER || nlprParam == nullptr || nlprParam->bytesUsed > nlpr->packetRecver.bytesAvailable) {
SetLastError(ERROR_INVALID_PARAMETER);
return SOCKET_ERROR;
}
diff --git a/src/mir_app/src/netlibsecurity.cpp b/src/mir_app/src/netlibsecurity.cpp index ab882bfb90..a3f2e663d1 100644 --- a/src/mir_app/src/netlibsecurity.cpp +++ b/src/mir_app/src/netlibsecurity.cpp @@ -66,18 +66,18 @@ static void ReportSecError(SECURITY_STATUS scRet, int line) {
char szMsgBuf[256];
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, _countof(szMsgBuf), NULL);
+ nullptr, scRet, LANG_USER_DEFAULT, szMsgBuf, _countof(szMsgBuf), nullptr);
char *p = strchr(szMsgBuf, 13); if (p) *p = 0;
- Netlib_Logf(NULL, "Security error 0x%x on line %u (%s)", scRet, line, szMsgBuf);
+ Netlib_Logf(nullptr, "Security error 0x%x on line %u (%s)", scRet, line, szMsgBuf);
}
/////////////////////////////////////////////////////////////////////////////////////////
MIR_APP_DLL(HANDLE) Netlib_InitSecurityProvider(const wchar_t *szProvider, const wchar_t *szPrincipal)
{
- HANDLE hSecurity = NULL;
+ HANDLE hSecurity = nullptr;
if (mir_wstrcmpi(szProvider, L"Basic") == 0) {
NtlmHandleType* hNtlm = (NtlmHandleType*)mir_calloc(sizeof(NtlmHandleType));
@@ -115,14 +115,14 @@ MIR_APP_DLL(HANDLE) Netlib_InitSecurityProvider(const wchar_t *szProvider, const MIR_APP_DLL(void) Netlib_DestroySecurityProvider(HANDLE hSecurity)
{
- if (hSecurity == NULL)
+ if (hSecurity == nullptr)
return;
mir_cslock lck(csSec);
if (ntlmCnt != 0) {
NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity;
- if (hNtlm != NULL) {
+ if (hNtlm != nullptr) {
if (SecIsValidHandle(&hNtlm->hClientContext))
DeleteSecurityContext(&hNtlm->hClientContext);
if (SecIsValidHandle(&hNtlm->hClientCredential))
@@ -140,7 +140,7 @@ MIR_APP_DLL(void) Netlib_DestroySecurityProvider(HANDLE hSecurity) char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chlsz)
{
- if (!szChallenge || !szChallenge[0]) return NULL;
+ if (!szChallenge || !szChallenge[0]) return nullptr;
NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity;
unsigned char inDataBuffer[1024];
@@ -157,7 +157,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls SECURITY_STATUS sc = DecryptMessage(&hNtlm->hClientContext, &inBuffersDesc, 0, &qop);
if (sc != SEC_E_OK) {
ReportSecError(sc, __LINE__);
- return NULL;
+ return nullptr;
}
// unsigned char LayerMask = inDataBuffer[0];
@@ -167,7 +167,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls sc = QueryContextAttributes(&hNtlm->hClientContext, SECPKG_ATTR_SIZES, &sizes);
if (sc != SEC_E_OK) {
ReportSecError(sc, __LINE__);
- return NULL;
+ return nullptr;
}
unsigned char *tokenBuffer = (unsigned char*)alloca(sizes.cbSecurityTrailer);
@@ -186,7 +186,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls sc = EncryptMessage(&hNtlm->hClientContext, SECQOP_WRAP_NO_ENCRYPT, &outBuffersDesc, 0);
if (sc != SEC_E_OK) {
ReportSecError(sc, __LINE__);
- return NULL;
+ return nullptr;
}
unsigned i, ressz = 0;
@@ -206,8 +206,8 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const wchar_t *login, const wchar_t *psw, bool http, unsigned &complete)
{
- if (hSecurity == NULL || ntlmCnt == 0)
- return NULL;
+ if (hSecurity == nullptr || ntlmCnt == 0)
+ return nullptr;
SecBufferDesc outputBufferDescriptor, inputBufferDescriptor;
SecBuffer outputSecurityToken, inputSecurityToken;
@@ -219,12 +219,12 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, if (mir_wstrcmpi(hNtlm->szProvider, L"Basic")) {
bool isGSSAPI = mir_wstrcmpi(hNtlm->szProvider, L"GSSAPI") == 0;
wchar_t *szProvider = isGSSAPI ? (wchar_t*)L"Kerberos" : hNtlm->szProvider;
- bool hasChallenge = szChallenge != NULL && szChallenge[0] != '\0';
+ bool hasChallenge = szChallenge != nullptr && szChallenge[0] != '\0';
if (hasChallenge) {
unsigned tokenLen;
BYTE *token = (BYTE*)mir_base64_decode(szChallenge, &tokenLen);
- if (token == NULL)
- return NULL;
+ if (token == nullptr)
+ return nullptr;
if (isGSSAPI && complete)
return CompleteGssapi(hSecurity, token, tokenLen);
@@ -237,7 +237,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, inputSecurityToken.pvBuffer = token;
// try to decode the domain name from the NTLM challenge
- if (login != NULL && login[0] != '\0' && !hNtlm->hasDomain) {
+ if (login != nullptr && login[0] != '\0' && !hNtlm->hasDomain) {
NtlmType2packet* pkt = (NtlmType2packet*)token;
if (!strncmp(pkt->sign, "NTLMSSP", 8) && pkt->type == 2) {
@@ -246,7 +246,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, // Negotiate ANSI? if yes, convert the ANSI name to unicode
if ((pkt->flags & 1) == 0) {
- int bufsz = MultiByteToWideChar(CP_ACP, 0, (char*)domainName, domainLen, NULL, 0);
+ int bufsz = MultiByteToWideChar(CP_ACP, 0, (char*)domainName, domainLen, nullptr, 0);
wchar_t* buf = (wchar_t*)alloca(bufsz * sizeof(wchar_t));
domainLen = MultiByteToWideChar(CP_ACP, 0, (char*)domainName, domainLen, buf, bufsz) - 1;
domainName = buf;
@@ -261,7 +261,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, newLogin[domainLen] = '\\';
mir_wstrcpy(newLogin + domainLen + 1, login);
- char* szChl = NtlmCreateResponseFromChallenge(hSecurity, NULL, newLogin, psw, http, complete);
+ char* szChl = NtlmCreateResponseFromChallenge(hSecurity, nullptr, newLogin, psw, http, complete);
mir_free(szChl);
}
}
@@ -275,22 +275,22 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, SEC_WINNT_AUTH_IDENTITY auth;
- if (login != NULL && login[0] != '\0') {
+ if (login != nullptr && login[0] != '\0') {
memset(&auth, 0, sizeof(auth));
- Netlib_Logf(NULL, "Security login requested, user: %S pssw: %s", login, psw ? "(exist)" : "(no psw)");
+ Netlib_Logf(nullptr, "Security login requested, user: %S pssw: %s", login, psw ? "(exist)" : "(no psw)");
const wchar_t* loginName = login;
const wchar_t* domainName = wcschr(login, '\\');
size_t domainLen = 0;
size_t loginLen = mir_wstrlen(loginName);
- if (domainName != NULL) {
+ if (domainName != nullptr) {
loginName = domainName + 1;
loginLen = mir_wstrlen(loginName);
domainLen = domainName - login;
domainName = login;
}
- else if ((domainName = wcschr(login, '@')) != NULL) {
+ else if ((domainName = wcschr(login, '@')) != nullptr) {
loginName = login;
loginLen = domainName - login;
domainLen = mir_wstrlen(++domainName);
@@ -307,10 +307,10 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, hNtlm->hasDomain = domainLen != 0;
}
- SECURITY_STATUS sc = AcquireCredentialsHandle(NULL, szProvider, SECPKG_CRED_OUTBOUND, NULL, hNtlm->hasDomain ? &auth : NULL, NULL, NULL, &hNtlm->hClientCredential, &tokenExpiration);
+ SECURITY_STATUS sc = AcquireCredentialsHandle(nullptr, szProvider, SECPKG_CRED_OUTBOUND, nullptr, hNtlm->hasDomain ? &auth : nullptr, nullptr, nullptr, &hNtlm->hClientCredential, &tokenExpiration);
if (sc != SEC_E_OK) {
ReportSecError(sc, __LINE__);
- return NULL;
+ return nullptr;
}
}
@@ -322,9 +322,9 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, outputSecurityToken.pvBuffer = alloca(outputSecurityToken.cbBuffer);
SECURITY_STATUS sc = InitializeSecurityContext(&hNtlm->hClientCredential,
- hasChallenge ? &hNtlm->hClientContext : NULL,
+ hasChallenge ? &hNtlm->hClientContext : nullptr,
hNtlm->szPrincipal, isGSSAPI ? ISC_REQ_MUTUAL_AUTH | ISC_REQ_STREAM : 0, 0, SECURITY_NATIVE_DREP,
- hasChallenge ? &inputBufferDescriptor : NULL, 0, &hNtlm->hClientContext,
+ hasChallenge ? &inputBufferDescriptor : nullptr, 0, &hNtlm->hClientContext,
&outputBufferDescriptor, &contextAttributes, &tokenExpiration);
complete = (sc != SEC_I_COMPLETE_AND_CONTINUE && sc != SEC_I_CONTINUE_NEEDED);
@@ -334,22 +334,22 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, if (sc != SEC_E_OK && sc != SEC_I_CONTINUE_NEEDED) {
ReportSecError(sc, __LINE__);
- return NULL;
+ return nullptr;
}
szOutputToken = mir_base64_encode((PBYTE)outputSecurityToken.pvBuffer, outputSecurityToken.cbBuffer);
}
else {
if (!login || !psw)
- return NULL;
+ return nullptr;
CMStringA szAuth(FORMAT, "%S:%S", login, psw);
szOutputToken = mir_base64_encode((BYTE*)szAuth.c_str(), szAuth.GetLength());
complete = true;
}
- if (szOutputToken == NULL)
- return NULL;
+ if (szOutputToken == nullptr)
+ return nullptr;
if (!http)
return szOutputToken;
diff --git a/src/mir_app/src/netlibsock.cpp b/src/mir_app/src/netlibsock.cpp index 7bfbd3c7df..41d63b51d3 100644 --- a/src/mir_app/src/netlibsock.cpp +++ b/src/mir_app/src/netlibsock.cpp @@ -111,7 +111,7 @@ static int ConnectionListToSocketList(const HNETLIBCONN *hConns, fd_set *fd, int MIR_APP_DLL(int) Netlib_Select(NETLIBSELECT *nls)
{
- if (nls == NULL) {
+ if (nls == nullptr) {
SetLastError(ERROR_INVALID_PARAMETER);
return SOCKET_ERROR;
}
@@ -133,12 +133,12 @@ MIR_APP_DLL(int) Netlib_Select(NETLIBSELECT *nls) TIMEVAL tv;
tv.tv_sec = nls->dwTimeout / 1000;
tv.tv_usec = (nls->dwTimeout % 1000) * 1000;
- return select(0, &readfd, &writefd, &exceptfd, nls->dwTimeout == INFINITE ? NULL : &tv);
+ return select(0, &readfd, &writefd, &exceptfd, nls->dwTimeout == INFINITE ? nullptr : &tv);
}
MIR_APP_DLL(int) Netlib_SelectEx(NETLIBSELECTEX *nls)
{
- if (nls == NULL) {
+ if (nls == nullptr) {
SetLastError(ERROR_INVALID_PARAMETER);
return SOCKET_ERROR;
}
@@ -159,33 +159,33 @@ MIR_APP_DLL(int) Netlib_SelectEx(NETLIBSELECTEX *nls) }
ReleaseMutex(hConnectionHeaderMutex);
- int rc = (pending) ? pending : select(0, &readfd, &writefd, &exceptfd, nls->dwTimeout == INFINITE ? NULL : &tv);
+ int rc = (pending) ? pending : select(0, &readfd, &writefd, &exceptfd, nls->dwTimeout == INFINITE ? nullptr : &tv);
WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
/* go thru each passed HCONN array and grab its socket handle, then give it to FD_ISSET()
to see if an event happened for that socket, if it has it will be returned as TRUE (otherwise not)
This happens for read/write/except */
- NetlibConnection *conn = NULL;
+ NetlibConnection *conn = nullptr;
int j;
for (j = 0; j < FD_SETSIZE; j++) {
conn = (NetlibConnection*)nls->hReadConns[j];
- if (conn == NULL || conn == INVALID_HANDLE_VALUE) break;
+ if (conn == nullptr || conn == INVALID_HANDLE_VALUE) break;
if (sslApi.pending(conn->hSsl))
nls->hReadStatus[j] = TRUE;
- if (conn->usingHttpGateway && conn->nlhpi.szHttpGetUrl == NULL && conn->szProxyBuf.IsEmpty())
- nls->hReadStatus[j] = (conn->pHttpProxyPacketQueue != NULL);
+ if (conn->usingHttpGateway && conn->nlhpi.szHttpGetUrl == nullptr && conn->szProxyBuf.IsEmpty())
+ nls->hReadStatus[j] = (conn->pHttpProxyPacketQueue != nullptr);
else
nls->hReadStatus[j] = FD_ISSET(conn->s, &readfd);
}
for (j = 0; j < FD_SETSIZE; j++) {
conn = (NetlibConnection*)nls->hWriteConns[j];
- if (conn == NULL || conn == INVALID_HANDLE_VALUE) break;
+ if (conn == nullptr || conn == INVALID_HANDLE_VALUE) break;
nls->hWriteStatus[j] = FD_ISSET(conn->s, &writefd);
}
for (j = 0; j < FD_SETSIZE; j++) {
conn = (NetlibConnection*)nls->hExceptConns[j];
- if (conn == NULL || conn == INVALID_HANDLE_VALUE) break;
+ if (conn == nullptr || conn == INVALID_HANDLE_VALUE) break;
nls->hExceptStatus[j] = FD_ISSET(conn->s, &exceptfd);
}
ReleaseMutex(hConnectionHeaderMutex);
@@ -199,14 +199,14 @@ MIR_APP_DLL(bool) Netlib_StringToAddress(const char *str, SOCKADDR_INET_M *addr) if (!str) return false;
int len = sizeof(SOCKADDR_INET_M);
- return !WSAStringToAddressA((char*)str, AF_INET6, NULL, (PSOCKADDR)addr, &len);
+ return !WSAStringToAddressA((char*)str, AF_INET6, nullptr, (PSOCKADDR)addr, &len);
}
MIR_APP_DLL(char*) Netlib_AddressToString(sockaddr_in *addr)
{
char saddr[128];
DWORD len = sizeof(saddr);
- if (!WSAAddressToStringA((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len))
+ if (!WSAAddressToStringA((PSOCKADDR)addr, sizeof(*addr), nullptr, saddr, &len))
return mir_strdup(saddr);
if (addr->sin_family == AF_INET) {
@@ -217,7 +217,7 @@ MIR_APP_DLL(char*) Netlib_AddressToString(sockaddr_in *addr) }
return mir_strdup(szIp);
}
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -248,14 +248,14 @@ inline bool IsAddrGlobal(const IN6_ADDR *a) MIR_APP_DLL(NETLIBIPLIST*) Netlib_GetMyIp(bool bGlobalOnly)
{
- addrinfo *air = NULL, *ai, hints = { 0 };
+ addrinfo *air = nullptr, *ai, hints = { 0 };
const char *szMyHost = "";
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_PASSIVE;
- if (GetAddrInfoA(szMyHost, NULL, &hints, &air))
- return NULL;
+ if (GetAddrInfoA(szMyHost, nullptr, &hints, &air))
+ return nullptr;
unsigned n = 0;
for (ai = air; ai; ai = ai->ai_next) {
diff --git a/src/mir_app/src/netlibupnp.cpp b/src/mir_app/src/netlibupnp.cpp index 776b0574f6..e29a2776a4 100644 --- a/src/mir_app/src/netlibupnp.cpp +++ b/src/mir_app/src/netlibupnp.cpp @@ -130,20 +130,20 @@ static bool txtParseParam(char* szData, char* presearch, *param = 0;
- if (presearch != NULL) {
+ if (presearch != nullptr) {
cp1 = strstr(szData, presearch);
- if (cp1 == NULL) return false;
+ if (cp1 == nullptr) return false;
}
else
cp1 = szData;
cp = strstr(cp1, start);
- if (cp == NULL) return false;
+ if (cp == nullptr) return false;
cp += mir_strlen(start);
while (*cp == ' ') ++cp;
cp1 = strstr(cp, finish);
- if (cp1 == NULL) return false;
+ if (cp1 == nullptr) return false;
while (*(cp1-1) == ' ' && cp1 > cp) --cp1;
len = min((size_t)(cp1 - cp), size-1);
@@ -159,23 +159,23 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath) int sz;
phost = strstr(szUrl, "://");
- if (phost == NULL) phost = szUrl;
+ if (phost == nullptr) phost = szUrl;
else phost += 3;
ppath = strchr(phost, '/');
- if (ppath == NULL) ppath = phost + mir_strlen(phost);
+ if (ppath == nullptr) ppath = phost + mir_strlen(phost);
pport = strchr(phost, ':');
- if (pport == NULL) pport = ppath;
+ if (pport == nullptr) pport = ppath;
- if (szHost != NULL) {
+ if (szHost != nullptr) {
sz = pport - phost + 1;
if (sz > 256) sz = 256;
strncpy(szHost, phost, sz);
szHost[sz - 1] = 0;
}
- if (sPort != NULL) {
+ if (sPort != nullptr) {
if (pport < ppath) {
long prt = atol(pport + 1);
*sPort = prt != 0 ? (unsigned short)prt : 80;
@@ -184,7 +184,7 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath) *sPort = 80;
}
- if (szPath != NULL) {
+ if (szPath != nullptr) {
strncpy(szPath, ppath, 256);
szPath[255] = 0;
}
@@ -216,7 +216,7 @@ static void validateSocket(void) FD_SET(sock, &rfd);
bool opened = false;
- switch (select(1, &rfd, NULL, NULL, &tv)) {
+ switch (select(1, &rfd, nullptr, nullptr, &tv)) {
case 0:
opened = true;
break;
@@ -240,7 +240,7 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction const char* szPostHdr = soap_post_hdr;
char* szData = (char*)mir_alloc(4096);
- char* szReq = NULL;
+ char* szReq = nullptr;
parseURL(szUrl, szHost, &sPort, szPath);
@@ -297,7 +297,7 @@ retrycon: enetaddr.sin_addr.s_addr = *(unsigned*)he->h_addr_list[0];
}
- Netlib_Logf(NULL, "UPnP HTTP connection Host: %s Port: %u", szHost, sPort);
+ Netlib_Logf(nullptr, "UPnP HTTP connection Host: %s Port: %u", szHost, sPort);
FD_ZERO(&rfd); FD_ZERO(&wfd); FD_ZERO(&efd);
FD_SET(sock, &rfd); FD_SET(sock, &wfd); FD_SET(sock, &efd);
@@ -315,18 +315,18 @@ retrycon: // Socket connection failed
if (err != WSAEWOULDBLOCK) {
closeRouterConnection();
- Netlib_Logf(NULL, "UPnP connect failed %d", err);
+ Netlib_Logf(nullptr, "UPnP connect failed %d", err);
break;
}
// Wait for socket to connect
else if (select(1, &rfd, &wfd, &efd, &tv) != 1) {
closeRouterConnection();
- Netlib_Logf(NULL, "UPnP connect timeout");
+ Netlib_Logf(nullptr, "UPnP connect timeout");
break;
}
else if (!FD_ISSET(sock, &wfd)) {
closeRouterConnection();
- Netlib_Logf(NULL, "UPnP connect failed");
+ Netlib_Logf(nullptr, "UPnP connect failed");
break;
}
}
@@ -335,10 +335,10 @@ retrycon: }
if (send(sock, szData, sz, 0) != SOCKET_ERROR) {
- char *hdrend = NULL;
+ char *hdrend = nullptr;
int acksz = 0, pktsz = 0;
- if (szActionName == NULL) {
+ if (szActionName == nullptr) {
int len = sizeof(locIP);
getsockname(sock, (SOCKADDR*)&locIP, &len);
if (locIP.sin_addr.S_un.S_addr == 0x0100007f) {
@@ -346,7 +346,7 @@ retrycon: gethostname(szPath, sizeof(szPath));
he = gethostbyname(szPath);
- if (he != NULL)
+ if (he != nullptr)
locIP.sin_addr.S_un.S_addr = *(PDWORD)he->h_addr_list[0];
}
}
@@ -360,9 +360,9 @@ retrycon: FD_SET(sock, &rfd);
// Wait for the next packet
- if (select(1, &rfd, NULL, NULL, &tv) != 1) {
+ if (select(1, &rfd, nullptr, nullptr, &tv) != 1) {
closeRouterConnection();
- Netlib_Logf(NULL, "UPnP recieve timeout");
+ Netlib_Logf(nullptr, "UPnP recieve timeout");
break;
}
@@ -390,10 +390,10 @@ retrycon: szResult[sz] = 0;
// HTTP header found?
- if (hdrend == NULL) {
+ if (hdrend == nullptr) {
// Find HTTP header end
hdrend = strstr(szResult, "\r\n\r\n");
- if (hdrend == NULL) {
+ if (hdrend == nullptr) {
hdrend = strstr(szResult, "\n\n");
if (hdrend) hdrend += 2;
}
@@ -401,19 +401,19 @@ retrycon: else
hdrend += 4;
- if (hdrend != NULL) {
+ if (hdrend != nullptr) {
// Get packet size if provided
- if (txtParseParam(szResult, NULL, "Content-Length:", "\n", szRes, sizeof(szRes)) ||
- txtParseParam(szResult, NULL, "CONTENT-LENGTH:", "\n", szRes, sizeof(szRes))) {
+ if (txtParseParam(szResult, nullptr, "Content-Length:", "\n", szRes, sizeof(szRes)) ||
+ txtParseParam(szResult, nullptr, "CONTENT-LENGTH:", "\n", szRes, sizeof(szRes))) {
// Add size of HTTP header to the packet size to compute full transmission size
pktsz = atol(ltrimp(szRes)) + (hdrend - szResult);
}
// Get encoding type if provided
- else if (txtParseParam(szResult, NULL, "Transfer-Encoding:", "\n", szRes, sizeof(szRes))) {
+ else if (txtParseParam(szResult, nullptr, "Transfer-Encoding:", "\n", szRes, sizeof(szRes))) {
if (_stricmp(lrtrimp(szRes), "Chunked") == 0)
acksz = hdrend - szResult;
}
- if (txtParseParam(szResult, NULL, "Connection:", "\n", szRes, sizeof(szRes))) {
+ if (txtParseParam(szResult, nullptr, "Connection:", "\n", szRes, sizeof(szRes))) {
needClose = (_stricmp(lrtrimp(szRes), "close") == 0);
}
}
@@ -431,11 +431,11 @@ retry: // Parse out chunk size
char* data = szResult + acksz;
char* peol1 = data == hdrend ? data - 1 : strchr(data, '\n');
- if (peol1 != NULL) {
+ if (peol1 != nullptr) {
char *peol2 = strchr(++peol1, '\n');
- if (peol2 != NULL) {
+ if (peol2 != nullptr) {
// Get chunk size
- int chunkBytes = strtol(peol1, NULL, 16);
+ int chunkBytes = strtol(peol1, nullptr, 16);
acksz += chunkBytes;
peol2++;
@@ -458,12 +458,12 @@ retry: goto retrycon;
}
else
- Netlib_Logf(NULL, "UPnP send failed %d", WSAGetLastError());
+ Netlib_Logf(nullptr, "UPnP send failed %d", WSAGetLastError());
}
}
txtParseParam(szResult, "HTTP", " ", " ", szRes, sizeof(szRes));
res = atol(szRes);
- if (szActionName != NULL && res == 405 && szPostHdr == soap_post_hdr)
+ if (szActionName != nullptr && res == 405 && szPostHdr == soap_post_hdr)
szPostHdr = soap_post_hdr_m;
else
break;
@@ -495,12 +495,12 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl) {
char* szData = (char*)mir_alloc(8192);
- gatewayFound = httpTransact(szUrl, szData, 8192, NULL, DeviceGetReq) == 200;
+ gatewayFound = httpTransact(szUrl, szData, 8192, nullptr, DeviceGetReq) == 200;
if (gatewayFound) {
char szTemp[256], *rpth;
size_t ctlLen;
- txtParseParam(szData, NULL, "<URLBase>", "</URLBase>", szTemp, sizeof(szTemp));
+ txtParseParam(szData, nullptr, "<URLBase>", "</URLBase>", szTemp, sizeof(szTemp));
strncpy(szCtlUrl, szTemp[0] ? szTemp : szUrl, sizeof(szCtlUrl));
szCtlUrl[sizeof(szCtlUrl) - 1] = 0;
@@ -509,12 +509,12 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl) // URL combining per RFC 2396
if (szUrl[0] != 0) {
- if (strstr(szUrl, "://") != NULL) // absolute URI
+ if (strstr(szUrl, "://") != nullptr) // absolute URI
rpth = szCtlUrl;
else if (strncmp(szUrl, "//", 2) == 0) // relative URI net_path
{
rpth = strstr(szCtlUrl, "//");
- if (rpth == NULL) rpth = szCtlUrl;
+ if (rpth == nullptr) rpth = szCtlUrl;
}
else if (szUrl[0] == '/') // relative URI abs_path
{
@@ -522,7 +522,7 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl) rpth = rpth ? rpth + 2 : szCtlUrl;
rpth = strchr(rpth, '/');
- if (rpth == NULL) rpth = szCtlUrl + mir_strlen(szCtlUrl);
+ if (rpth == nullptr) rpth = szCtlUrl + mir_strlen(szCtlUrl);
}
else { // relative URI rel_path
size_t ctlCLen = mir_strlen(szCtlUrl);
@@ -550,7 +550,7 @@ static void discoverUPnP(void) char* buf;
int buflen;
unsigned i, j, nip = 0;
- unsigned* ips = NULL;
+ unsigned* ips = nullptr;
static const unsigned any = INADDR_ANY;
static const TIMEVAL tv = { 1, 600000 };
@@ -600,27 +600,27 @@ static void discoverUPnP(void) FD_ZERO(&readfd);
FD_SET(s, &readfd);
- while (select(1, &readfd, NULL, NULL, &tv) >= 1) {
+ while (select(1, &readfd, nullptr, nullptr, &tv) >= 1) {
buflen = recv(s, buf, 1500, 0);
if (buflen != SOCKET_ERROR) {
buf[buflen] = 0;
LongLog(buf);
- if (txtParseParam(buf, NULL, "LOCATION:", "\n", szUrl, sizeof(szUrl)) ||
- txtParseParam(buf, NULL, "Location:", "\n", szUrl, sizeof(szUrl))) {
+ if (txtParseParam(buf, nullptr, "LOCATION:", "\n", szUrl, sizeof(szUrl)) ||
+ txtParseParam(buf, nullptr, "Location:", "\n", szUrl, sizeof(szUrl))) {
char age[30];
char szHostNew[256], szHostExist[256];
lrtrim(szUrl);
- parseURL(szUrl, szHostNew, NULL, NULL);
- parseURL(szCtlUrl, szHostExist, NULL, NULL);
+ parseURL(szUrl, szHostNew, nullptr, nullptr);
+ parseURL(szCtlUrl, szHostExist, nullptr, nullptr);
if (mir_strcmp(szHostNew, szHostExist) == 0) {
gatewayFound = true;
break;
}
- txtParseParam(buf, NULL, "ST:", "\n", szDev, sizeof(szDev));
+ txtParseParam(buf, nullptr, "ST:", "\n", szDev, sizeof(szDev));
txtParseParam(buf, "max-age", " = ", "\n", age, sizeof(age));
expireTime = atoi(lrtrimp(age));
lrtrim(szDev);
@@ -644,10 +644,10 @@ static void discoverUPnP(void) static bool findUPnPGateway(void)
{
- if ((time(NULL) - lastDiscTime) >= expireTime) {
+ if ((time(nullptr) - lastDiscTime) >= expireTime) {
WaitForSingleObject(portListMutex, INFINITE);
- time_t curTime = time(NULL);
+ time_t curTime = time(nullptr);
if ((curTime - lastDiscTime) >= expireTime) {
gatewayFound = false;
@@ -655,7 +655,7 @@ static bool findUPnPGateway(void) discoverUPnP();
lastDiscTime = curTime;
- Netlib_Logf(NULL, "UPnP Gateway detected %d, Control URL: %s", gatewayFound, szCtlUrl);
+ Netlib_Logf(nullptr, "UPnP Gateway detected %d, Control URL: %s", gatewayFound, szCtlUrl);
}
ReleaseMutex(portListMutex);
@@ -682,7 +682,7 @@ bool NetlibUPnPAddPortMapping(WORD intport, char *proto, WORD *extport, DWORD *e mir_snprintf(szData, 4096, add_port_mapping,
*extport, proto, intport, inet_ntoa(locIP.sin_addr));
res = httpTransact(szCtlUrl, szData, 4096, "AddPortMapping", ControlAction);
- txtParseParam(szData, NULL, "<errorCode>", "</errorCode>", szExtIP, sizeof(szExtIP));
+ txtParseParam(szData, nullptr, "<errorCode>", "</errorCode>", szExtIP, sizeof(szExtIP));
} while (search && res == 500 && atol(szExtIP) == 718 && --i);
@@ -730,7 +730,7 @@ void NetlibUPnPDeletePortMapping(WORD extport, char* proto) void NetlibUPnPCleanup(void*)
{
// upnp is disabled globally, no need for a cleanup
- if (db_get_b(NULL, "Netlib", "NLEnableUPnP", 1) == 0)
+ if (db_get_b(0, "Netlib", "NLEnableUPnP", 1) == 0)
return;
{
@@ -803,7 +803,7 @@ void NetlibUPnPInit(void) numportsAlloc = 10;
portList = (WORD*)mir_alloc(sizeof(WORD)*numportsAlloc);
- portListMutex = CreateMutex(NULL, FALSE, NULL);
+ portListMutex = CreateMutex(nullptr, FALSE, nullptr);
}
void NetlibUPnPDestroy(void)
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 23e319b786..ea082f7c3a 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -63,7 +63,7 @@ static BOOL bModuleInitialized = FALSE; wchar_t mirandabootini[MAX_PATH];
static DWORD mirandaVersion;
static int sttFakeID = -100;
-static HANDLE hPluginListHeap = NULL;
+static HANDLE hPluginListHeap = nullptr;
static int askAboutIgnoredPlugins;
static pluginEntry *plugin_freeimg, *plugin_crshdmp, *serviceModePlugin, *plugin_ssl;
@@ -75,7 +75,7 @@ static pluginEntry *plugin_freeimg, *plugin_crshdmp, *serviceModePlugin, *plugin bool hasMuuid(const MUUID* p, const MUUID& uuid)
{
- if (p == NULL)
+ if (p == nullptr)
return false;
for (int i = 0; p[i] != miid_last; i++)
@@ -132,18 +132,18 @@ static bool isPluginBanned(const MUUID& u1) static MuuidReplacement pluginDefault[] =
{
- { MIID_UIUSERINFO, L"stduserinfo", NULL }, // 0
- { MIID_SREMAIL, L"stdemail", NULL }, // 1
- { MIID_SRAUTH, L"stdauth", NULL }, // 2
- { MIID_SRFILE, L"stdfile", NULL }, // 3
- { MIID_UIHELP, L"stdhelp", NULL }, // 4
- { MIID_UIHISTORY, L"stduihist", NULL }, // 5
- { MIID_IDLE, L"stdidle", NULL }, // 6
- { MIID_AUTOAWAY, L"stdautoaway", NULL }, // 7
- { MIID_USERONLINE, L"stduseronline", NULL }, // 8
- { MIID_SRAWAY, L"stdaway", NULL }, // 9
- { MIID_CLIST, L"stdclist", NULL }, // 10
- { MIID_SRMM, L"stdmsg", NULL } // 11
+ { MIID_UIUSERINFO, L"stduserinfo", nullptr }, // 0
+ { MIID_SREMAIL, L"stdemail", nullptr }, // 1
+ { MIID_SRAUTH, L"stdauth", nullptr }, // 2
+ { MIID_SRFILE, L"stdfile", nullptr }, // 3
+ { MIID_UIHELP, L"stdhelp", nullptr }, // 4
+ { MIID_UIHISTORY, L"stduihist", nullptr }, // 5
+ { MIID_IDLE, L"stdidle", nullptr }, // 6
+ { MIID_AUTOAWAY, L"stdautoaway", nullptr }, // 7
+ { MIID_USERONLINE, L"stduseronline", nullptr }, // 8
+ { MIID_SRAWAY, L"stdaway", nullptr }, // 9
+ { MIID_CLIST, L"stdclist", nullptr }, // 10
+ { MIID_SRMM, L"stdmsg", nullptr } // 11
};
int getDefaultPluginIdx(const MUUID &muuid)
@@ -165,8 +165,8 @@ int LoadStdPlugins() return 1;
}
- if (pluginDefault[11].pImpl == NULL)
- MessageBox(NULL, TranslateT("No messaging plugins loaded. Please install/enable one of the messaging plugins, for instance, \"StdMsg.dll\""), L"Miranda NG", MB_OK | MB_ICONWARNING);
+ if (pluginDefault[11].pImpl == nullptr)
+ MessageBox(nullptr, TranslateT("No messaging plugins loaded. Please install/enable one of the messaging plugins, for instance, \"StdMsg.dll\""), L"Miranda NG", MB_OK | MB_ICONWARNING);
return 0;
}
@@ -177,27 +177,27 @@ int LoadStdPlugins() char* GetPluginNameByInstance(HINSTANCE hInstance)
{
if (pluginList.getCount() == 0)
- return NULL;
+ return nullptr;
for (int i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
if (p->bpi.pluginInfo && p->bpi.hInst == hInstance)
return p->bpi.pluginInfo->shortName;
}
- return NULL;
+ return nullptr;
}
MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInstance)
{
if (pluginList.getCount() == 0)
- return NULL;
+ return 0;
for (int i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
if (p->bpi.pluginInfo && p->bpi.hInst == hInstance)
return p->hLangpack;
}
- return NULL;
+ return 0;
}
MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang)
@@ -233,7 +233,7 @@ MIR_APP_DLL(int) IsPluginLoaded(const MUUID &uuid) static bool validInterfaceList(MUUID *piface)
{
- if (piface == NULL)
+ if (piface == nullptr)
return true;
if (miid_last == piface[0])
@@ -244,17 +244,17 @@ static bool validInterfaceList(MUUID *piface) static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi)
{
- if (pi == NULL)
+ if (pi == nullptr)
return FALSE;
- if (bpi->InfoEx == NULL || pi->cbSize != sizeof(PLUGININFOEX))
+ if (bpi->InfoEx == nullptr || pi->cbSize != sizeof(PLUGININFOEX))
return FALSE;
if (!validInterfaceList(bpi->Interfaces) || isPluginBanned(pi->uuid))
return FALSE;
- if (pi->shortName == NULL || pi->description == NULL || pi->author == NULL ||
- pi->authorEmail == NULL || pi->copyright == NULL || pi->homepage == NULL)
+ if (pi->shortName == nullptr || pi->description == nullptr || pi->author == nullptr ||
+ pi->authorEmail == nullptr || pi->copyright == nullptr || pi->homepage == nullptr)
return FALSE;
return TRUE;
@@ -263,7 +263,7 @@ static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi) int checkAPI(wchar_t* plugin, BASIC_PLUGIN_INFO* bpi, DWORD dwMirVer, int checkTypeAPI)
{
HINSTANCE h = LoadLibrary(plugin);
- if (h == NULL)
+ if (h == nullptr)
return 0;
// loaded, check for exports
@@ -279,7 +279,7 @@ LBL_Error: }
bpi->Interfaces = (MUUID*)GetProcAddress(h, "MirandaInterfaces");
- if (bpi->Interfaces == NULL) {
+ if (bpi->Interfaces == nullptr) {
typedef MUUID * (__cdecl * Miranda_Plugin_Interfaces) (void);
Miranda_Plugin_Interfaces pFunc = (Miranda_Plugin_Interfaces)GetProcAddress(h, "MirandaPluginInterfaces");
if (pFunc)
@@ -317,7 +317,7 @@ void Plugin_Uninit(pluginEntry *p) // release the library
HINSTANCE hInst = p->bpi.hInst;
- if (hInst != NULL) {
+ if (hInst != nullptr) {
// we need to kill all resources which belong to that DLL before calling FreeLibrary
KillModuleEventHooks(hInst);
KillModuleServices(hInst);
@@ -328,7 +328,7 @@ void Plugin_Uninit(pluginEntry *p) }
if (p == plugin_crshdmp)
- plugin_crshdmp = NULL;
+ plugin_crshdmp = nullptr;
pluginList.remove(p);
}
@@ -369,7 +369,7 @@ int Plugin_UnloadDyn(pluginEntry *p) if (!(p->pclass & PCLASS_CORE))
for (int i = 0; i < _countof(pluginDefault); i++)
if (pluginDefault[i].pImpl == p)
- pluginDefault[i].pImpl = NULL;
+ pluginDefault[i].pImpl = nullptr;
return TRUE;
}
@@ -378,7 +378,7 @@ int Plugin_UnloadDyn(pluginEntry *p) static int valid_library_name(wchar_t *name)
{
wchar_t *dot = wcsrchr(name, '.');
- if (dot != NULL && mir_wstrcmpi(dot + 1, L"dll") == 0)
+ if (dot != nullptr && mir_wstrcmpi(dot + 1, L"dll") == 0)
if (dot[4] == 0)
return 1;
@@ -389,7 +389,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) {
// get miranda's exe path
wchar_t exe[MAX_PATH];
- GetModuleFileName(NULL, exe, _countof(exe));
+ GetModuleFileName(nullptr, exe, _countof(exe));
wchar_t *p = wcsrchr(exe, '\\'); if (p) *p = 0;
// create the search filter
@@ -478,17 +478,17 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path) void SetPluginOnWhiteList(const wchar_t* pluginname, int allow)
{
- db_set_b(NULL, PLUGINDISABLELIST, _strlwr(_T2A(pluginname)), allow == 0);
+ db_set_b(0, PLUGINDISABLELIST, _strlwr(_T2A(pluginname)), allow == 0);
}
// returns 1 if the plugin should be enabled within this profile, filename is always lower case
int isPluginOnWhiteList(const wchar_t* pluginname)
{
- int rc = db_get_b(NULL, PLUGINDISABLELIST, _strlwr(_T2A(pluginname)), 0);
+ int rc = db_get_b(0, PLUGINDISABLELIST, _strlwr(_T2A(pluginname)), 0);
if (rc != 0 && askAboutIgnoredPlugins) {
wchar_t buf[256];
mir_snwprintf(buf, TranslateT("'%s' is disabled, re-enable?"), pluginname);
- if (MessageBox(NULL, buf, TranslateT("Re-enable Miranda plugin?"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ if (MessageBox(nullptr, buf, TranslateT("Re-enable Miranda plugin?"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
SetPluginOnWhiteList(pluginname, 1);
rc = 0;
}
@@ -500,7 +500,7 @@ int isPluginOnWhiteList(const wchar_t* pluginname) bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
{
wchar_t exe[MAX_PATH], tszFullPath[MAX_PATH];
- GetModuleFileName(NULL, exe, _countof(exe));
+ GetModuleFileName(nullptr, exe, _countof(exe));
wchar_t* slice = wcsrchr(exe, '\\');
if (slice)
*slice = 0;
@@ -552,7 +552,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) }
}
}
- else if (p->bpi.hInst != NULL) {
+ else if (p->bpi.hInst != nullptr) {
RegisterModule(p->bpi.hInst);
p->pclass |= PCLASS_LOADED;
}
@@ -567,17 +567,17 @@ static wchar_t tszCoreErr[] = LPGENW("Core plugin '%s' cannot be loaded or missi bool LoadCorePlugin(MuuidReplacement &mr)
{
wchar_t exe[MAX_PATH], tszPlugName[MAX_PATH];
- GetModuleFileName(NULL, exe, _countof(exe));
+ GetModuleFileName(nullptr, exe, _countof(exe));
wchar_t *p = wcsrchr(exe, '\\'); if (p) *p = 0;
mir_snwprintf(tszPlugName, L"%s.dll", mr.stdplugname);
pluginEntry* pPlug = OpenPlugin(tszPlugName, L"Core", exe);
if (pPlug->pclass & PCLASS_FAILED) {
LBL_Error:
- MessageBox(NULL, CMStringW(FORMAT, TranslateW(tszCoreErr), mr.stdplugname), TranslateT("Fatal error"), MB_OK | MB_ICONSTOP);
+ MessageBox(nullptr, CMStringW(FORMAT, TranslateW(tszCoreErr), mr.stdplugname), TranslateT("Fatal error"), MB_OK | MB_ICONSTOP);
Plugin_UnloadDyn(pPlug);
- mr.pImpl = NULL;
+ mr.pImpl = nullptr;
return false;
}
@@ -640,7 +640,7 @@ static pluginEntry* getCListModule(wchar_t *exe) return stdClist.pImpl;
}
- return NULL;
+ return nullptr;
}
int UnloadPlugin(wchar_t* buf, int bufLen)
@@ -680,7 +680,7 @@ static int LaunchServicePlugin(pluginEntry *p) if (res != CALLSERVICE_NOTFOUND)
return res;
- MessageBox(NULL, TranslateT("Unable to load plugin in service mode!"), p->pluginname, MB_ICONSTOP);
+ MessageBox(nullptr, TranslateT("Unable to load plugin in service mode!"), p->pluginname, MB_ICONSTOP);
Plugin_Uninit(p);
return SERVICE_FAILED;
}
@@ -688,7 +688,7 @@ static int LaunchServicePlugin(pluginEntry *p) int LoadDefaultServiceModePlugin()
{
LPCTSTR param = CmdLine_GetOption(L"svc");
- if (param == NULL || *param == 0)
+ if (param == nullptr || *param == 0)
return SERVICE_CONTINUE;
size_t cbLen = mir_wstrlen(param);
@@ -707,7 +707,7 @@ int LoadDefaultServiceModePlugin() int LoadServiceModePlugin()
{
- return (serviceModePlugin == NULL) ? SERVICE_CONTINUE : LaunchServicePlugin(serviceModePlugin);
+ return (serviceModePlugin == nullptr) ? SERVICE_CONTINUE : LaunchServicePlugin(serviceModePlugin);
}
void EnsureCheckerLoaded(bool bEnable)
@@ -738,7 +738,7 @@ int LoadSslModule(void) {
bool bExtSSLLoaded = false;
- if (plugin_ssl != NULL)
+ if (plugin_ssl != nullptr)
{
if (!TryLoadPlugin(plugin_ssl, false))
{
@@ -749,7 +749,7 @@ int LoadSslModule(void) }
if (!bExtSSLLoaded)
{
- MuuidReplacement stdSsl = { MIID_SSL, L"stdssl", NULL };
+ MuuidReplacement stdSsl = { MIID_SSL, L"stdssl", nullptr };
if (!LoadCorePlugin(stdSsl))
return 1;
}
@@ -778,7 +778,7 @@ int LoadNewPluginsModule(void) {
// make full path to the plugin
wchar_t exe[MAX_PATH], fullPath[MAX_PATH];
- GetModuleFileName(NULL, exe, _countof(exe));
+ GetModuleFileName(nullptr, exe, _countof(exe));
wchar_t *slice = wcsrchr(exe, '\\');
if (slice)
*slice = 0;
@@ -787,12 +787,12 @@ int LoadNewPluginsModule(void) askAboutIgnoredPlugins = (UINT)GetPrivateProfileInt(L"PluginLoader", L"AskAboutIgnoredPlugins", 0, mirandabootini);
// if Crash Dumper is present, load it to provide Crash Reports
- if (plugin_crshdmp != NULL && isPluginOnWhiteList(plugin_crshdmp->pluginname))
+ if (plugin_crshdmp != nullptr && isPluginOnWhiteList(plugin_crshdmp->pluginname))
if (!TryLoadPlugin(plugin_crshdmp, false))
Plugin_Uninit(plugin_crshdmp);
// if freeimage is present, load it to provide the basic core functions
- if (plugin_freeimg != NULL) {
+ if (plugin_freeimg != nullptr) {
BASIC_PLUGIN_INFO bpi;
mir_snwprintf(fullPath, L"%s\\Plugins\\%s", exe, plugin_freeimg->pluginname);
if (checkAPI(fullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
@@ -809,12 +809,12 @@ int LoadNewPluginsModule(void) pluginEntry* clist = getCListModule(exe);
/* the loop above will try and get one clist DLL to work, if all fail then just bail now */
- if (clist == NULL) {
+ if (clist == nullptr) {
// result = 0, no clist_* can be found
if (clistPlugins.getCount())
- MessageBox(NULL, TranslateT("Unable to start any of the installed contact list plugins, I even ignored your preferences for which contact list couldn't load any."), L"Miranda NG", MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("Unable to start any of the installed contact list plugins, I even ignored your preferences for which contact list couldn't load any."), L"Miranda NG", MB_OK | MB_ICONERROR);
else
- MessageBox(NULL, TranslateT("Can't find a contact list plugin! You need StdClist or any other contact list plugin."), L"Miranda NG", MB_OK | MB_ICONERROR);
+ MessageBox(nullptr, TranslateT("Can't find a contact list plugin! You need StdClist or any other contact list plugin."), L"Miranda NG", MB_OK | MB_ICONERROR);
return 1;
}
@@ -843,12 +843,12 @@ static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM) {
pluginEntry *p = OpenPlugin(fd->cFileName, L"Plugins", path);
if (!(p->pclass & PCLASS_FAILED)) {
- if (plugin_freeimg == NULL && mir_wstrcmpi(fd->cFileName, L"advaimg.dll") == 0) {
+ if (plugin_freeimg == nullptr && mir_wstrcmpi(fd->cFileName, L"advaimg.dll") == 0) {
plugin_freeimg = p;
p->pclass |= PCLASS_LAST;
}
- if (plugin_crshdmp == NULL && mir_wstrcmpi(fd->cFileName, L"crashdumper.dll") == 0) {
+ if (plugin_crshdmp == nullptr && mir_wstrcmpi(fd->cFileName, L"crashdumper.dll") == 0) {
plugin_crshdmp = p;
p->pclass |= PCLASS_LAST;
}
@@ -872,7 +872,7 @@ int LoadNewPluginsModuleInfos(void) // look for all *.dll's
enumPlugins(scanPluginsDir, 0, 0);
- MuuidReplacement stdCrypt = { MIID_CRYPTO, L"stdcrypt", NULL };
+ MuuidReplacement stdCrypt = { MIID_CRYPTO, L"stdcrypt", nullptr };
return !LoadCorePlugin(stdCrypt);
}
@@ -882,11 +882,11 @@ int LoadNewPluginsModuleInfos(void) void UnloadDatabase(void)
{
- if (currDb != NULL) {
- db_setCurrent(NULL);
+ if (currDb != nullptr) {
+ db_setCurrent(nullptr);
currDblink->Unload(currDb);
- currDb = NULL;
- currDblink = NULL;
+ currDb = nullptr;
+ currDblink = nullptr;
}
UninitIni();
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index e1a0fa1c97..d3f765f522 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int LangpackOptionsInit(WPARAM, LPARAM);
static HANDLE hOptionsInitEvent;
-static class COptionsDlg *pOptionsDlg = NULL;
+static class COptionsDlg *pOptionsDlg = nullptr;
// Thread for search keywords in dialogs
static BYTE bSearchState = 0; // 0 - not executed; 1 - in progress; 2 - completed;
@@ -112,7 +112,7 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, UINT msg, LPARAM lpFlags) bmi.bmiHeader.biCompression = BI_RGB;
BYTE *pBits;
- HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, (void **)&pBits, NULL, 0);
+ HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, (void **)&pBits, nullptr, 0);
HBITMAP hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
// paint
@@ -138,7 +138,7 @@ static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam switch (msg) {
case WM_CTLCOLOREDIT:
if (!GetPropA((HWND)lParam, "Miranda.AeroRender.Active"))
- RedrawWindow((HWND)lParam, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow((HWND)lParam, nullptr, nullptr, RDW_INVALIDATE);
break;
case WM_ERASEBKGND:
@@ -199,11 +199,11 @@ struct OptionsPageData : public MZeroedObject {
OptionsPageData(const OPTIONSDIALOGPAGE &src)
{
- if (src.hInstance != NULL && src.pszTemplate != NULL)
+ if (src.hInstance != nullptr && src.pszTemplate != nullptr)
pDialog = new COptionPageDialog(src.hInstance, (INT_PTR)src.pszTemplate, src.pfnDlgProc, src.dwInitParam);
else
pDialog = src.pDialog;
- assert(pDialog != NULL);
+ assert(pDialog != nullptr);
flags = src.flags;
hLangpack = src.hLangpack;
@@ -386,15 +386,15 @@ class COptionsDlg : public CDlgBase tvi.mask = TVIF_TEXT;
tvi.pszText = str;
tvi.cchTextMax = _countof(str);
- tvi.hItem = (hParent == NULL) ? m_pageTree.GetRoot() : m_pageTree.GetChild(hParent);
- while (tvi.hItem != NULL) {
+ tvi.hItem = (hParent == nullptr) ? m_pageTree.GetRoot() : m_pageTree.GetChild(hParent);
+ while (tvi.hItem != nullptr) {
m_pageTree.GetItem(&tvi);
if (!mir_wstrcmpi(str, name))
return tvi.hItem;
tvi.hItem = m_pageTree.GetNextSibling(tvi.hItem);
}
- return NULL;
+ return nullptr;
}
void SaveOptionsTreeState()
@@ -405,11 +405,11 @@ class COptionsDlg : public CDlgBase tvi.pszText = str;
tvi.cchTextMax = _countof(str);
tvi.hItem = m_pageTree.GetRoot();
- while (tvi.hItem != NULL) {
+ while (tvi.hItem != nullptr) {
if (m_pageTree.GetItem(&tvi)) {
char buf[130];
mir_snprintf(buf, "%s%S", OPTSTATE_PREFIX, str);
- db_set_b(NULL, "Options", buf, (BYTE)((tvi.state & TVIS_EXPANDED) ? 1 : 0));
+ db_set_b(0, "Options", buf, (BYTE)((tvi.state & TVIS_EXPANDED) ? 1 : 0));
}
tvi.hItem = m_pageTree.GetNextSibling(tvi.hItem);
}
@@ -428,7 +428,7 @@ class COptionsDlg : public CDlgBase HINSTANCE *KnownInstances = (HINSTANCE*)alloca(sizeof(HINSTANCE)*m_arOpd.getCount());
int countKnownInst = 0;
m_keywordFilter.ResetContent();
- m_keywordFilter.AddString(ALL_MODULES_FILTER, NULL);
+ m_keywordFilter.AddString(ALL_MODULES_FILTER, 0);
m_keywordFilter.AddString(CORE_MODULES_FILTER, (LPARAM)g_hInst);
for (int i = 0; i < m_arOpd.getCount(); i++) {
@@ -530,25 +530,25 @@ class COptionsDlg : public CDlgBase m_pageTree.SendMsg(WM_SETREDRAW, FALSE, 0);
- HWND oldWnd = NULL;
- HWND oldTab = NULL;
+ HWND oldWnd = nullptr;
+ HWND oldTab = nullptr;
CMStringW fullTitle;
TVITEMEX tvi;
OptionsPageData *opd = getCurrent();
- if (opd != NULL) {
+ if (opd != nullptr) {
oldWnd = opd->getHwnd();
if (opd->insideTab)
oldTab = GetDlgItem(m_hwnd, IDC_TAB);
}
- m_hCurrentPage = NULL;
+ m_hCurrentPage = nullptr;
- m_pageTree.SelectItem(NULL);
+ m_pageTree.SelectItem(nullptr);
m_pageTree.DeleteAllItems();
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_SORT;
tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
@@ -561,20 +561,20 @@ class COptionsDlg : public CDlgBase wchar_t *ptszTitle = opd->getString(opd->ptszTitle), *useTitle;
wchar_t *ptszTab = TranslateW_LP(opd->ptszTab, opd->hLangpack);
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
useTitle = ptszTitle;
- if (ptszGroup != NULL) {
- tvis.hParent = FindNamedTreeItem(NULL, ptszGroup);
- if (tvis.hParent == NULL) {
+ if (ptszGroup != nullptr) {
+ tvis.hParent = FindNamedTreeItem(nullptr, ptszGroup);
+ if (tvis.hParent == nullptr) {
tvis.item.lParam = -1;
tvis.item.pszText = ptszGroup;
tvis.hParent = m_pageTree.InsertItem(&tvis);
}
}
else {
- tvi.hItem = FindNamedTreeItem(NULL, useTitle);
- if (tvi.hItem != NULL) {
+ tvi.hItem = FindNamedTreeItem(nullptr, useTitle);
+ if (tvi.hItem != nullptr) {
if (i == m_currentPage) m_hCurrentPage = tvi.hItem;
tvi.mask = TVIF_PARAM;
m_pageTree.GetItem(&tvi);
@@ -586,13 +586,13 @@ class COptionsDlg : public CDlgBase }
}
- if (ptszTab != NULL) {
+ if (ptszTab != nullptr) {
HTREEITEM hItem;
- if (tvis.hParent == NULL)
- hItem = FindNamedTreeItem(NULL, useTitle);
+ if (tvis.hParent == nullptr)
+ hItem = FindNamedTreeItem(nullptr, useTitle);
else
hItem = FindNamedTreeItem(tvis.hParent, useTitle);
- if (hItem != NULL) {
+ if (hItem != nullptr) {
if (i == m_currentPage) {
tvi.hItem = hItem;
tvi.mask = TVIF_PARAM;
@@ -616,17 +616,17 @@ class COptionsDlg : public CDlgBase tvi.pszText = str;
tvi.cchTextMax = _countof(str);
tvi.hItem = m_pageTree.GetRoot();
- while (tvi.hItem != NULL) {
+ while (tvi.hItem != nullptr) {
if (m_pageTree.GetItem(&tvi)) {
char buf[130];
mir_snprintf(buf, "%s%S", OPTSTATE_PREFIX, str);
- if (!db_get_b(NULL, "Options", buf, 1))
+ if (!db_get_b(0, "Options", buf, 1))
m_pageTree.Expand(tvi.hItem, TVE_COLLAPSE);
}
tvi.hItem = m_pageTree.GetNextSibling(tvi.hItem);
}
- if (m_hCurrentPage == NULL) {
+ if (m_hCurrentPage == nullptr) {
m_hCurrentPage = m_pageTree.GetRoot();
m_currentPage = -1;
}
@@ -636,7 +636,7 @@ class COptionsDlg : public CDlgBase opd = getCurrent();
if (opd && oldWnd != opd->getHwnd()) {
ShowWindow(oldWnd, SW_HIDE);
- if (oldTab && (opd == NULL || !opd->insideTab))
+ if (oldTab && (opd == nullptr || !opd->insideTab))
ShowWindow(oldTab, SW_HIDE);
}
}
@@ -656,7 +656,7 @@ class COptionsDlg : public CDlgBase {
OptionsPageData *opd = m_arOpd[i];
int pages = 0;
- if (opd->ptszTab != NULL) {
+ if (opd->ptszTab != nullptr) {
// Count tabs to calc position
for (int j = 0; j < m_arOpd.getCount() && pages < 2; j++) {
OptionsPageData* opd2 = m_arOpd[j];
@@ -678,7 +678,7 @@ class COptionsDlg : public CDlgBase for (int i = 0; i < arPages.getCount(); i++) {
OptionsPageData *opd = new OptionsPageData(arPages[i]);
- if (opd->pDialog == NULL) // smth went wrong
+ if (opd->pDialog == nullptr) // smth went wrong
delete opd;
else
m_arOpd.insert(opd);
@@ -709,7 +709,7 @@ class COptionsDlg : public CDlgBase }
OptionsPageData* getCurrent() const
- { return (m_currentPage == -1) ? NULL : m_arOpd[m_currentPage];
+ { return (m_currentPage == -1) ? nullptr : m_arOpd[m_currentPage];
}
public:
@@ -743,7 +743,7 @@ public: if (!ServiceExists(MS_MODERNOPT_SHOW))
ShowWindow(GetDlgItem(m_hwnd, IDC_MODERN), FALSE);
- Utils_RestoreWindowPositionNoSize(m_hwnd, NULL, "Options", "");
+ Utils_RestoreWindowPositionNoSize(m_hwnd, 0, "Options", "");
Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_OTHER_OPTIONS);
m_btnApply.Disable();
@@ -770,11 +770,11 @@ public: m_currentPage = -1;
ptrW lastPage, lastGroup, lastTab;
- if (m_szPage == NULL) {
- lastPage = db_get_wsa(NULL, "Options", "LastPage");
+ if (m_szPage == nullptr) {
+ lastPage = db_get_wsa(0, "Options", "LastPage");
- if (m_szGroup == NULL)
- lastGroup = db_get_wsa(NULL, "Options", "LastGroup");
+ if (m_szGroup == nullptr)
+ lastGroup = db_get_wsa(0, "Options", "LastGroup");
else
lastGroup = mir_wstrdup(m_szGroup);
}
@@ -783,26 +783,26 @@ public: lastGroup = mir_wstrdup(m_szGroup);
}
- if (m_szTab == NULL)
- lastTab = db_get_wsa(NULL, "Options", "LastTab");
+ if (m_szTab == nullptr)
+ lastTab = db_get_wsa(0, "Options", "LastTab");
else
lastTab = mir_wstrdup(m_szTab);
for (int i = 0; i < m_pages.getCount(); i++) {
const OPTIONSDIALOGPAGE &odp = m_pages[i];
OptionsPageData *opd = new OptionsPageData(odp);
- if (opd->pDialog == NULL) // smth went wrong
+ if (opd->pDialog == nullptr) // smth went wrong
delete opd;
else
m_arOpd.insert(opd);
if (!mir_wstrcmp(lastPage, odp.szTitle.w) && !mir_wstrcmp(lastGroup, odp.szGroup.w))
- if ((m_szTab == NULL && m_currentPage == -1) || !mir_wstrcmp(lastTab, odp.szTab.w))
+ if ((m_szTab == nullptr && m_currentPage == -1) || !mir_wstrcmp(lastTab, odp.szTab.w))
m_currentPage = (int)i;
}
GetWindowRect(GetDlgItem(m_hwnd, IDC_STNOPAGE), &m_rcDisplay);
- MapWindowPoints(NULL, m_hwnd, (LPPOINT)&m_rcDisplay, 2);
+ MapWindowPoints(nullptr, m_hwnd, (LPPOINT)&m_rcDisplay, 2);
// Add an item to count in height
TCITEM tie;
@@ -812,7 +812,7 @@ public: TabCtrl_InsertItem(GetDlgItem(m_hwnd, IDC_TAB), 0, &tie);
GetWindowRect(GetDlgItem(m_hwnd, IDC_TAB), &m_rcTab);
- MapWindowPoints(NULL, m_hwnd, (LPPOINT)&m_rcTab, 2);
+ MapWindowPoints(nullptr, m_hwnd, (LPPOINT)&m_rcTab, 2);
TabCtrl_AdjustRect(GetDlgItem(m_hwnd, IDC_TAB), FALSE, &m_rcTab);
FillFilterCombo();
@@ -833,28 +833,28 @@ public: OptionsPageData *opd = getCurrent();
if (opd) {
if (opd->ptszTab)
- db_set_ws(NULL, "Options", "LastTab", opd->ptszTab);
+ db_set_ws(0, "Options", "LastTab", opd->ptszTab);
else
- db_unset(NULL, "Options", "LastTab");
+ db_unset(0, "Options", "LastTab");
if (opd->ptszGroup)
- db_set_ws(NULL, "Options", "LastGroup", opd->ptszGroup);
+ db_set_ws(0, "Options", "LastGroup", opd->ptszGroup);
else
- db_unset(NULL, "Options", "LastGroup");
- db_set_ws(NULL, "Options", "LastPage", opd->ptszTitle);
+ db_unset(0, "Options", "LastGroup");
+ db_set_ws(0, "Options", "LastPage", opd->ptszTitle);
}
else {
- db_unset(NULL, "Options", "LastTab");
- db_unset(NULL, "Options", "LastGroup");
- db_unset(NULL, "Options", "LastPage");
+ db_unset(0, "Options", "LastTab");
+ db_unset(0, "Options", "LastGroup");
+ db_unset(0, "Options", "LastPage");
}
- Utils_SaveWindowPosition(m_hwnd, NULL, "Options", "");
+ Utils_SaveWindowPosition(m_hwnd, 0, "Options", "");
for (int i = 0; i < m_arOpd.getCount(); i++)
delete m_arOpd[i];
DeleteObject(m_hBoldFont);
- pOptionsDlg = NULL;
+ pOptionsDlg = nullptr;
CallService(MS_MODERNOPT_RESTORE, 0, 0);
}
@@ -866,7 +866,7 @@ public: SetFocus(m_pageTree.GetHwnd());
OptionsPageData *opd = getCurrent();
- if (opd != NULL) {
+ if (opd != nullptr) {
pshn.hdr.idFrom = 0;
pshn.lParam = IDC_APPLY;
pshn.hdr.code = PSN_KILLACTIVE;
@@ -878,7 +878,7 @@ public: pshn.hdr.code = PSN_APPLY;
for (int i = 0; i < m_arOpd.getCount(); i++) {
OptionsPageData *p = m_arOpd[i];
- if (p->getHwnd() == NULL || !p->changed) continue;
+ if (p->getHwnd() == nullptr || !p->changed) continue;
p->changed = 0;
pshn.hdr.hwndFrom = p->getHwnd();
if (SendMessage(p->getHwnd(), WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) {
@@ -902,7 +902,7 @@ public: void btnModern_Click(CCtrlButton*)
{
- db_set_b(NULL, "Options", "Expert", 0);
+ db_set_b(0, "Options", "Expert", 0);
SaveOptionsTreeState();
PostMessage(m_hwnd, WM_CLOSE, 0, 0);
CallService(MS_MODERNOPT_SHOW, 0, 0);
@@ -925,7 +925,7 @@ public: pshn.hdr.code = PSN_RESET;
for (int i = 0; i < m_arOpd.getCount(); i++) {
OptionsPageData *p = m_arOpd[i];
- if (p->getHwnd() == NULL || !p->changed)
+ if (p->getHwnd() == nullptr || !p->changed)
continue;
pshn.hdr.hwndFrom = p->getHwnd();
SendMessage(p->getHwnd(), WM_NOTIFY, 0, (LPARAM)&pshn);
@@ -935,7 +935,7 @@ public: void OnChanging(CCtrlTreeView::TEventInfo*)
{
OptionsPageData *opd = getCurrent();
- if (opd && opd->getHwnd() != NULL) {
+ if (opd && opd->getHwnd() != nullptr) {
PSHNOTIFY pshn;
pshn.hdr.code = PSN_KILLACTIVE;
pshn.hdr.hwndFrom = m_arOpd[m_currentPage]->getHwnd();
@@ -961,12 +961,12 @@ public: ShowWindow(GetDlgItem(m_hwnd, IDC_STNOPAGE), SW_HIDE);
OptionsPageData *opd = getCurrent();
- if (opd && opd->getHwnd() != NULL)
+ if (opd && opd->getHwnd() != nullptr)
ShowWindow(opd->getHwnd(), SW_HIDE);
TVITEMEX tvi;
tvi.hItem = m_hCurrentPage = m_pageTree.GetSelection();
- if (tvi.hItem == NULL) {
+ if (tvi.hItem == nullptr) {
ShowWindow(GetDlgItem(m_hwnd, IDC_TAB), SW_HIDE);
return;
}
@@ -977,12 +977,12 @@ public: ShowWindow(GetDlgItem(m_hwnd, IDC_TAB), SW_HIDE);
opd = getCurrent();
- if (opd == NULL) {
+ if (opd == nullptr) {
ShowWindow(GetDlgItem(m_hwnd, IDC_STNOPAGE), SW_SHOW);
return;
}
- if (opd->getHwnd() == NULL)
+ if (opd->getHwnd() == nullptr)
CreateOptionWindowEx(opd);
opd->insideTab = IsInsideTab(m_currentPage);
@@ -1029,7 +1029,7 @@ public: ShowWindow(GetDlgItem(m_hwnd, IDC_STNOPAGE), SW_HIDE);
OptionsPageData *opd = getCurrent();
- if (opd && opd->getHwnd() != NULL)
+ if (opd && opd->getHwnd() != nullptr)
ShowWindow(opd->getHwnd(), SW_HIDE);
TCITEM tie;
@@ -1044,12 +1044,12 @@ public: m_pageTree.SetItem(&tvi);
opd = getCurrent();
- if (opd == NULL) {
+ if (opd == nullptr) {
ShowWindow(GetDlgItem(m_hwnd, IDC_STNOPAGE), SW_SHOW);
return;
}
- if (opd->getHwnd() == NULL)
+ if (opd->getHwnd() == nullptr)
CreateOptionWindowEx(opd);
ShowWindow(opd->getHwnd(), SW_SHOW);
@@ -1090,7 +1090,7 @@ public: return TRUE;
case TCN_SELCHANGING:
- OnChanging(NULL);
+ OnChanging(nullptr);
return TRUE;
case TCN_SELCHANGE:
@@ -1115,16 +1115,16 @@ public: {
ShowWindow(GetHwnd(), SW_RESTORE);
SetForegroundWindow(m_hwnd);
- if (pszPage != NULL) {
- HTREEITEM hItem = NULL;
- if (pszGroup != NULL) {
- hItem = FindNamedTreeItem(NULL, TranslateW_LP(pszGroup, _hLang));
- if (hItem != NULL)
+ if (pszPage != nullptr) {
+ HTREEITEM hItem = nullptr;
+ if (pszGroup != nullptr) {
+ hItem = FindNamedTreeItem(nullptr, TranslateW_LP(pszGroup, _hLang));
+ if (hItem != nullptr)
hItem = FindNamedTreeItem(hItem, TranslateW_LP(pszPage, _hLang));
}
- else hItem = FindNamedTreeItem(NULL, TranslateW_LP(pszPage, _hLang));
+ else hItem = FindNamedTreeItem(nullptr, TranslateW_LP(pszPage, _hLang));
- if (hItem != NULL)
+ if (hItem != nullptr)
m_pageTree.SelectItem(hItem);
}
}
@@ -1132,7 +1132,7 @@ public: void OpenAccountOptions(PROTOACCOUNT *pa)
{
- if (pa->ppro == NULL)
+ if (pa->ppro == nullptr)
return;
OptionsPageList arPages(1);
@@ -1142,13 +1142,13 @@ void OpenAccountOptions(PROTOACCOUNT *pa) wchar_t tszTitle[100];
mir_snwprintf(tszTitle, TranslateT("%s options"), pa->tszAccountName);
- pOptionsDlg = new COptionsDlg(tszTitle, LPGENW("Network"), pa->tszAccountName, NULL, true, arPages);
+ pOptionsDlg = new COptionsDlg(tszTitle, LPGENW("Network"), pa->tszAccountName, nullptr, true, arPages);
pOptionsDlg->Show();
}
static void OpenOptionsNow(int _hLang, const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, bool bSinglePage)
{
- if (pOptionsDlg == NULL) {
+ if (pOptionsDlg == nullptr) {
OptionsPageList arPages(1);
NotifyEventHooks(hOptionsInitEvent, (WPARAM)&arPages, 0);
if (arPages.getCount() == 0)
@@ -1177,14 +1177,14 @@ MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPa MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int _hLangpack)
{
OptionsPageList *pList = (OptionsPageList*)wParam;
- if (odp == NULL || pList == NULL)
+ if (odp == nullptr || pList == nullptr)
return 1;
OptionsPage *dst = new OptionsPage();
memcpy(dst, odp, sizeof(OPTIONSDIALOGPAGE));
dst->hLangpack = _hLangpack;
- if (odp->szTitle.w != NULL) {
+ if (odp->szTitle.w != nullptr) {
if (odp->flags & ODPF_UNICODE)
dst->szTitle.w = mir_wstrdup(odp->szTitle.w);
else {
@@ -1193,7 +1193,7 @@ MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int _hLa }
}
- if (odp->szGroup.w != NULL) {
+ if (odp->szGroup.w != nullptr) {
if (odp->flags & ODPF_UNICODE)
dst->szGroup.w = mir_wstrdup(odp->szGroup.w);
else {
@@ -1202,7 +1202,7 @@ MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int _hLa }
}
- if (odp->szTab.w != NULL) {
+ if (odp->szTab.w != nullptr) {
if (odp->flags & ODPF_UNICODE)
dst->szTab.w = mir_wstrdup(odp->szTab.w);
else {
@@ -1223,7 +1223,7 @@ MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int _hLa static INT_PTR OpenOptionsDialog(WPARAM, LPARAM)
{
if (pOptionsDlg || !ServiceExists(MS_MODERNOPT_SHOW))
- OpenOptionsNow(NULL, NULL, NULL, NULL, false);
+ OpenOptionsNow(0, nullptr, nullptr, nullptr, false);
else
CallService(MS_MODERNOPT_SHOW, 0, 0);
return 0;
@@ -1244,7 +1244,7 @@ static int OptModulesLoaded(WPARAM, LPARAM) int ShutdownOptionsModule(WPARAM, LPARAM)
{
- delete pOptionsDlg; pOptionsDlg = NULL;
+ delete pOptionsDlg; pOptionsDlg = nullptr;
return 0;
}
diff --git a/src/mir_app/src/options_ei.cpp b/src/mir_app/src/options_ei.cpp index ab3214e87b..490c1769b0 100644 --- a/src/mir_app/src/options_ei.cpp +++ b/src/mir_app/src/options_ei.cpp @@ -141,7 +141,7 @@ class CExtraIconOptsDlg : public CDlgBase LIST<_TREEITEM> toRemove(1);
intlist ids;
bool selected = false;
- HTREEITEM hPlace = NULL;
+ HTREEITEM hPlace = nullptr;
// Find items
HTREEITEM hItem = m_tree.GetRoot();
@@ -149,7 +149,7 @@ class CExtraIconOptsDlg : public CDlgBase tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
while (hItem) {
if (m_tree.IsSelected(hItem)) {
- if (hPlace == NULL)
+ if (hPlace == nullptr)
hPlace = hItem;
tvi.hItem = hItem;
@@ -168,7 +168,7 @@ class CExtraIconOptsDlg : public CDlgBase hItem = m_tree.GetNextSibling(hItem);
}
- if (hPlace != NULL) {
+ if (hPlace != nullptr) {
// Add new
HTREEITEM hNew = Tree_AddExtraIconGroup(ids, selected, hPlace);
@@ -187,7 +187,7 @@ class CExtraIconOptsDlg : public CDlgBase void UngroupSelectedItems()
{
HTREEITEM hItem = m_tree.GetSelection();
- if (hItem == NULL)
+ if (hItem == nullptr)
return;
intlist *ids = Tree_GetIDs(hItem);
@@ -224,7 +224,7 @@ class CExtraIconOptsDlg : public CDlgBase TranslateMenu(submenu);
DWORD pos = GetMessagePos();
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_LEFTALIGN, LOWORD(pos), HIWORD(pos), 0, m_hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_LEFTALIGN, LOWORD(pos), HIWORD(pos), 0, m_hwnd, nullptr);
DestroyMenu(menu);
@@ -268,7 +268,7 @@ public: ExtraIcon *extra = registeredExtraIcons[i];
HICON hIcon = IcoLib_GetIcon(extra->getDescIcon());
- if (hIcon == NULL)
+ if (hIcon == nullptr)
ImageList_AddIcon(hImageList, hBlankIcon);
else {
ImageList_AddIcon(hImageList, hIcon);
@@ -292,7 +292,7 @@ public: }
TVSORTCB sort = { 0 };
- sort.hParent = NULL;
+ sort.hParent = nullptr;
sort.lParam = 0;
sort.lpfnCompare = CompareFunc;
m_tree.SortChildrenCB(&sort, 0);
@@ -327,7 +327,7 @@ public: m_tree.GetItem(&tvi);
intlist*ids = (intlist*)tvi.lParam;
- if (ids == NULL || ids->count < 1)
+ if (ids == nullptr || ids->count < 1)
continue; // ???
bool enabled = ((tvi.state & INDEXTOSTATEIMAGEMASK(3)) == INDEXTOSTATEIMAGEMASK(2));
@@ -366,26 +366,26 @@ public: char setting[512];
mir_snprintf(setting, "Position_%s", extra->getName());
- db_set_w(NULL, MODULE_NAME, setting, extra->getPosition());
+ db_set_w(0, MODULE_NAME, setting, extra->getPosition());
mir_snprintf(setting, "Slot_%s", extra->getName());
- db_set_w(NULL, MODULE_NAME, setting, extra->getSlot());
+ db_set_w(0, MODULE_NAME, setting, extra->getSlot());
}
- db_delete_module(NULL, MODULE_NAME "Groups");
- db_set_w(NULL, MODULE_NAME "Groups", "Count", groups.getCount());
+ db_delete_module(0, MODULE_NAME "Groups");
+ db_set_w(0, MODULE_NAME "Groups", "Count", groups.getCount());
for (int k = 0; k < groups.getCount(); k++) {
ExtraIconGroup *group = groups[k];
char setting[512];
mir_snprintf(setting, "%d_count", k);
- db_set_w(NULL, MODULE_NAME "Groups", setting, (WORD)group->m_items.getCount());
+ db_set_w(0, MODULE_NAME "Groups", setting, (WORD)group->m_items.getCount());
for (int j = 0; j < group->m_items.getCount(); j++) {
BaseExtraIcon *extra = group->m_items[j];
mir_snprintf(setting, "%d_%d", k, j);
- db_set_s(NULL, MODULE_NAME "Groups", setting, extra->getName());
+ db_set_s(0, MODULE_NAME "Groups", setting, extra->getName());
}
}
@@ -425,7 +425,7 @@ public: LPNMHDR lpnmhdr = (LPNMHDR)lParam;
if (lpnmhdr->idFrom == IDC_EXTRAORDER && lpnmhdr->code == NM_RCLICK) {
HTREEITEM hSelected = m_tree.GetDropHilight();
- if (hSelected != NULL && !m_tree.IsSelected(hSelected)) {
+ if (hSelected != nullptr && !m_tree.IsSelected(hSelected)) {
m_tree.UnselectAll();
m_tree.SelectItem(hSelected);
}
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index 90385aa850..06d31ee756 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -73,7 +73,7 @@ static __forceinline char *GetEnvironmentVariableX(const char *variable) char result[512];
if (GetEnvironmentVariableA(variable, result, _countof(result)))
return mir_strdup(result);
- return NULL;
+ return nullptr;
}
static __forceinline char *GetProfileDirX(const char*)
@@ -84,9 +84,9 @@ static __forceinline char *GetProfileDirX(const char*) static __forceinline char *SHGetSpecialFolderPathX(int iCSIDL, char*)
{
char result[512];
- if (SHGetSpecialFolderPathA(NULL, result, iCSIDL, FALSE))
+ if (SHGetSpecialFolderPathA(nullptr, result, iCSIDL, FALSE))
return mir_strdup(result);
- return NULL;
+ return nullptr;
}
static __forceinline char *GetModulePathX(const char*, HMODULE hModule)
@@ -104,7 +104,7 @@ static __forceinline char *GetUserNameX(const char*) DWORD size = _countof(result);
if (GetUserNameA(result, &size))
return mir_strdup(result);
- return NULL;
+ return nullptr;
}
static __forceinline char *GetProfileNameX(const char*)
@@ -118,7 +118,7 @@ static __forceinline char* GetPathVarX(const char*, int code) switch(code) {
case 1:
- if (hAvatarFolder != NULL)
+ if (hAvatarFolder != nullptr)
wcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
mir_snwprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
@@ -157,15 +157,15 @@ static __forceinline wchar_t* GetEnvironmentVariableX(const wchar_t *variable) wchar_t result[512];
if (GetEnvironmentVariable(variable, result, _countof(result)))
return mir_wstrdup(result);
- return NULL;
+ return nullptr;
}
static __forceinline wchar_t* SHGetSpecialFolderPathX(int iCSIDL, wchar_t*)
{
wchar_t result[512];
- if (SHGetSpecialFolderPath(NULL, result, iCSIDL, FALSE))
+ if (SHGetSpecialFolderPath(nullptr, result, iCSIDL, FALSE))
return mir_wstrdup(result);
- return NULL;
+ return nullptr;
}
static __forceinline wchar_t* GetProfileDirX(const wchar_t*)
@@ -188,7 +188,7 @@ static __forceinline wchar_t* GetUserNameX(const wchar_t*) DWORD size = _countof(result);
if (GetUserName(result, &size))
return mir_wstrdup(result);
- return NULL;
+ return nullptr;
}
static __forceinline wchar_t* GetProfileNameX(const wchar_t*)
@@ -202,7 +202,7 @@ static __forceinline wchar_t* GetPathVarX(const wchar_t*, int code) switch(code) {
case 1:
- if (hAvatarFolder != NULL)
+ if (hAvatarFolder != nullptr)
wcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
mir_snwprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
@@ -220,7 +220,7 @@ static __forceinline wchar_t* GetPathVarX(const wchar_t*, int code) template<typename XCHAR>
XCHAR *GetInternalVariable(const XCHAR *key, size_t keyLength, MCONTACT hContact)
{
- XCHAR *theValue = NULL;
+ XCHAR *theValue = nullptr;
XCHAR *theKey = (XCHAR *)_alloca(sizeof(XCHAR) * (keyLength + 1));
_xcsncpy(theKey, key, keyLength);
theKey[keyLength] = 0;
@@ -232,7 +232,7 @@ XCHAR *GetInternalVariable(const XCHAR *key, size_t keyLength, MCONTACT hContact theValue = mir_a2x(key, GetContactProto(hContact));
else if (!_xcscmp(theKey, XSTR(key, "accountname"))) {
PROTOACCOUNT *acc = Proto_GetAccount(GetContactProto(hContact));
- if (acc != NULL)
+ if (acc != nullptr)
theValue = mir_a2x(key, _T2A(acc->tszAccountName));
}
else if (!_xcscmp(theKey, XSTR(key, "userid")))
@@ -241,7 +241,7 @@ XCHAR *GetInternalVariable(const XCHAR *key, size_t keyLength, MCONTACT hContact if (!theValue) {
if (!_xcscmp(theKey, XSTR(key, "miranda_path")))
- theValue = GetModulePathX(key, NULL);
+ theValue = GetModulePathX(key, nullptr);
else if (!_xcscmp(theKey, XSTR(key, "appdata")))
theValue = SHGetSpecialFolderPathX(CSIDL_APPDATA, theKey);
else if (!_xcscmp(theKey, XSTR(key, "mydocuments")))
@@ -284,7 +284,7 @@ template<typename XCHAR> XCHAR *ReplaceVariables(const XCHAR *str, MCONTACT hContact, REPLACEVARSARRAY *variables)
{
if (!str)
- return NULL;
+ return nullptr;
const XCHAR *varStart = 0, *p;
size_t length = 0;
@@ -314,7 +314,7 @@ XCHAR *ReplaceVariables(const XCHAR *str, MCONTACT hContact, REPLACEVARSARRAY *v XCHAR *result = (XCHAR *)mir_alloc(sizeof(XCHAR) * (length + 1));
XCHAR *q = result;
- varStart = NULL;
+ varStart = nullptr;
for (p = str; *p; ++p) {
if (*p == '%') {
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 7f9be2dfde..73c980c3cf 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -92,7 +92,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM LVITEM it = { 0 };
// column 1: Checkbox + Enable/disabled icons
it.mask = LVIF_PARAM | LVIF_IMAGE;
- it.iImage = (hInst != NULL) ? 2 : 3;
+ it.iImage = (hInst != nullptr) ? 2 : 3;
bool bNoCheckbox = (dat->flags & STATIC_PLUGIN) != 0;
if (bNoCheckbox || hasMuuid(pi, miid_clist) || hasMuuid(pi, miid_protocol))
it.iImage += 2;
@@ -184,7 +184,7 @@ static void RemoveAllItems(HWND hwnd) static bool LoadPluginDynamically(PluginListItemData *dat)
{
wchar_t exe[MAX_PATH];
- GetModuleFileName(NULL, exe, _countof(exe));
+ GetModuleFileName(nullptr, exe, _countof(exe));
wchar_t *p = wcsrchr(exe, '\\'); if (p) *p = 0;
pluginEntry* pPlug = OpenPlugin(dat->fileName, L"Plugins", exe);
@@ -212,7 +212,7 @@ static bool UnloadPluginDynamically(PluginListItemData *dat) if (!Plugin_UnloadDyn(p))
return false;
- dat->hInst = NULL;
+ dat->hInst = nullptr;
}
return true;
}
@@ -304,7 +304,7 @@ static int CALLBACK SortPlugins(WPARAM i1, LPARAM i2, LPARAM) static wchar_t *latin2t(const char *p)
{
- if (p == NULL)
+ if (p == nullptr)
return mir_wstrdup(L"");
return mir_a2u_cp(p, 1250);
@@ -427,19 +427,19 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ListView_GetItemText(hwndList, hdr->iItem, 2, buf, _countof(buf));
SetDlgItemText(hwndDlg, IDC_PLUGININFOFRAME, sel ? buf : L"");
- ptrW tszAuthor(latin2t(sel ? dat->author : NULL));
+ ptrW tszAuthor(latin2t(sel ? dat->author : nullptr));
SetDlgItemText(hwndDlg, IDC_PLUGINAUTHOR, tszAuthor);
- ptrW tszEmail(latin2t(sel ? dat->authorEmail : NULL));
+ ptrW tszEmail(latin2t(sel ? dat->authorEmail : nullptr));
SetDlgItemText(hwndDlg, IDC_PLUGINEMAIL, tszEmail);
ptrW p(Langpack_PcharToTchar(dat->description));
SetDlgItemText(hwndDlg, IDC_PLUGINLONGINFO, sel ? p.get() : L"");
- ptrW tszCopyright(latin2t(sel ? dat->copyright : NULL));
+ ptrW tszCopyright(latin2t(sel ? dat->copyright : nullptr));
SetDlgItemText(hwndDlg, IDC_PLUGINCPYR, tszCopyright);
- ptrW tszUrl(latin2t(sel ? dat->homepage : NULL));
+ ptrW tszUrl(latin2t(sel ? dat->homepage : nullptr));
SetDlgItemText(hwndDlg, IDC_PLUGINURL, tszUrl);
if (dat->uuid != miid_last) {
@@ -561,7 +561,7 @@ int PluginOptionsInit(WPARAM wParam, LPARAM) void LoadPluginOptions()
{
- bOldMode = db_get_b(NULL, "Options", "OldPluginSettings", false) != 0;
+ bOldMode = db_get_b(0, "Options", "OldPluginSettings", false) != 0;
hevLoadModule = CreateHookableEvent(ME_SYSTEM_MODULELOAD);
hevUnloadModule = CreateHookableEvent(ME_SYSTEM_MODULEUNLOAD);
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h index 89f26a67f1..2695a44cf1 100644 --- a/src/mir_app/src/plugins.h +++ b/src/mir_app/src/plugins.h @@ -15,7 +15,7 @@ typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_InfoEx) (DWORD mirandaVersion); // prototype for clists
typedef int (__cdecl * CList_Initialise) (void);
-// can all be NULL
+// can all be nullptr
struct BASIC_PLUGIN_INFO
{
HINSTANCE hInst;
@@ -23,7 +23,7 @@ struct BASIC_PLUGIN_INFO Miranda_Plugin_Unload Unload;
Miranda_Plugin_InfoEx InfoEx;
CList_Initialise clistlink;
- PLUGININFOEX * pluginInfo; // must be freed if hInst = = NULL then its a copy
+ PLUGININFOEX * pluginInfo; // must be freed if hInst = = nullptr then its a copy
MUUID *Interfaces; // array of supported interfaces
};
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index c6ffd8d052..bade9debb4 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -258,7 +258,7 @@ class CChooseProfileDlg : public CDlgBase wchar_t *p = wcsrchr(profile, '.'); mir_wstrcpy(sizeBuf, L"0 KB"); - if (p != NULL) *p = 0; + if (p != nullptr) *p = 0; LVITEM item = { 0 }; item.mask = LVIF_TEXT | LVIF_IMAGE; @@ -298,7 +298,7 @@ class CChooseProfileDlg : public CDlgBase list.SetItemText(iItem, 2, sizeBuf); - if (dblink != NULL) { + if (dblink != nullptr) { if (bFileLocked) // file locked list.SetItemText(iItem, 1, TranslateT("<In use>")); else @@ -343,7 +343,7 @@ class CChooseProfileDlg : public CDlgBase return; mir_snwprintf(profilef, TranslateT("Are you sure you want to remove profile \"%s\"?"), profile); - if (IDYES != MessageBox(NULL, profilef, L"Miranda NG", MB_YESNO | MB_TASKMODAL | MB_ICONWARNING)) + if (IDYES != MessageBox(nullptr, profilef, L"Miranda NG", MB_YESNO | MB_TASKMODAL | MB_ICONWARNING)) return; mir_snwprintf(profilef, L"%s\\%s%c", m_pd->ptszProfileDir, profile, 0); @@ -421,17 +421,17 @@ class CChooseProfileDlg : public CDlgBase HMENU hMenu = CreatePopupMenu(); if (tvi.iImage < 2) { AppendMenu(hMenu, MF_STRING, 1, TranslateT("Run")); - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); } if (tvi.iImage != 3 && ServiceExists(MS_DB_CHECKPROFILE)) { if (bConvert) AppendMenu(hMenu, MF_STRING, 2, TranslateT("Convert database")); else AppendMenu(hMenu, MF_STRING, 2, TranslateT("Check database")); - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); } AppendMenu(hMenu, MF_STRING, 3, TranslateT("Delete")); - int index = TrackPopupMenu(hMenu, TPM_RETURNCMD, lvht.pt.x, lvht.pt.y, 0, m_hwnd, NULL); + int index = TrackPopupMenu(hMenu, TPM_RETURNCMD, lvht.pt.x, lvht.pt.y, 0, m_hwnd, nullptr); switch (index) { case 1: SendMessage(GetParent(m_hwndParent), WM_COMMAND, IDOK, 0); @@ -498,7 +498,7 @@ public: m_hFileNotify = FindFirstChangeNotification(m_pd->ptszProfileDir, TRUE, FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE); if (m_hFileNotify != INVALID_HANDLE_VALUE) - SetTimer(m_hwnd, 0, 1200, NULL); + SetTimer(m_hwnd, 0, 1200, nullptr); } virtual void OnDestroy() @@ -591,8 +591,8 @@ public: { m_btnOk.OnClick = Callback(this, &CProfileManager::onOk); - m_tab.AddPage(LPGENW("My profiles"), NULL, new CChooseProfileDlg(m_btnOk, m_pd)); - m_tab.AddPage(LPGENW("New profile"), NULL, new CCreateProfileDlg(m_btnOk, m_pd)); + m_tab.AddPage(LPGENW("My profiles"), nullptr, new CChooseProfileDlg(m_btnOk, m_pd)); + m_tab.AddPage(LPGENW("New profile"), nullptr, new CCreateProfileDlg(m_btnOk, m_pd)); } virtual void OnInitDialog() diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp index 028171f91e..f3510b8184 100644 --- a/src/mir_app/src/proto_accs.cpp +++ b/src/mir_app/src/proto_accs.cpp @@ -45,7 +45,7 @@ LIST<PROTOACCOUNT> accounts(10, CompareAccounts); static int EnumDbModules(const char *szModuleName, DWORD, LPARAM)
{
- ptrA szProtoName(db_get_sa(NULL, szModuleName, "AM_BaseProto"));
+ ptrA szProtoName(db_get_sa(0, szModuleName, "AM_BaseProto"));
if (szProtoName) {
if (!Proto_GetAccount(szModuleName)) {
PROTOACCOUNT *pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
@@ -64,18 +64,18 @@ static int EnumDbModules(const char *szModuleName, DWORD, LPARAM) void LoadDbAccounts(void)
{
- int ver = db_get_dw(NULL, "Protocols", "PrVer", -1);
- int count = db_get_dw(NULL, "Protocols", "ProtoCount", 0);
+ int ver = db_get_dw(0, "Protocols", "PrVer", -1);
+ int count = db_get_dw(0, "Protocols", "ProtoCount", 0);
for (int i = 0; i < count; i++) {
char buf[10];
_itoa(i, buf, 10);
- char *szModuleName = db_get_sa(NULL, "Protocols", buf);
- if (szModuleName == NULL)
+ char *szModuleName = db_get_sa(0, "Protocols", buf);
+ if (szModuleName == nullptr)
continue;
PROTOACCOUNT *pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
- if (pa == NULL) {
+ if (pa == nullptr) {
mir_free(szModuleName);
continue;
}
@@ -83,25 +83,25 @@ void LoadDbAccounts(void) pa->szModuleName = szModuleName;
_itoa(OFFSET_VISIBLE + i, buf, 10);
- pa->bIsVisible = db_get_dw(NULL, "Protocols", buf, 1) != 0;
+ pa->bIsVisible = db_get_dw(0, "Protocols", buf, 1) != 0;
_itoa(OFFSET_PROTOPOS + i, buf, 10);
- pa->iOrder = db_get_dw(NULL, "Protocols", buf, 1);
+ pa->iOrder = db_get_dw(0, "Protocols", buf, 1);
if (ver >= 4) {
_itoa(OFFSET_NAME + i, buf, 10);
- pa->tszAccountName = db_get_wsa(NULL, "Protocols", buf);
+ pa->tszAccountName = db_get_wsa(0, "Protocols", buf);
_itoa(OFFSET_ENABLED + i, buf, 10);
- pa->bIsEnabled = db_get_dw(NULL, "Protocols", buf, 1) != 0;
+ pa->bIsEnabled = db_get_dw(0, "Protocols", buf, 1) != 0;
- pa->szProtoName = db_get_sa(NULL, szModuleName, "AM_BaseProto");
+ pa->szProtoName = db_get_sa(0, szModuleName, "AM_BaseProto");
}
else pa->bIsEnabled = true;
if (!pa->szProtoName) {
pa->szProtoName = mir_strdup(szModuleName);
- db_set_s(NULL, szModuleName, "AM_BaseProto", pa->szProtoName);
+ db_set_s(0, szModuleName, "AM_BaseProto", pa->szProtoName);
}
if (!pa->tszAccountName)
@@ -143,8 +143,8 @@ static int enumDB_ProtoProc(const char* szSetting, LPARAM lParam) void WriteDbAccounts()
{
// enum all old settings to delete
- enumDB_ProtoProcParam param = { 0, NULL };
- db_enum_settings(NULL, enumDB_ProtoProc, "Protocols", ¶m);
+ enumDB_ProtoProcParam param = { 0, nullptr };
+ db_enum_settings(0, enumDB_ProtoProc, "Protocols", ¶m);
// delete all settings
if (param.arrlen) {
@@ -161,19 +161,19 @@ void WriteDbAccounts() char buf[20];
_itoa(i, buf, 10);
- db_set_s(NULL, "Protocols", buf, pa->szModuleName);
+ db_set_s(0, "Protocols", buf, pa->szModuleName);
_itoa(OFFSET_PROTOPOS + i, buf, 10);
- db_set_dw(NULL, "Protocols", buf, pa->iOrder);
+ db_set_dw(0, "Protocols", buf, pa->iOrder);
_itoa(OFFSET_VISIBLE + i, buf, 10);
- db_set_dw(NULL, "Protocols", buf, pa->bIsVisible);
+ db_set_dw(0, "Protocols", buf, pa->bIsVisible);
_itoa(OFFSET_ENABLED + i, buf, 10);
- db_set_dw(NULL, "Protocols", buf, pa->bIsEnabled);
+ db_set_dw(0, "Protocols", buf, pa->bIsEnabled);
_itoa(OFFSET_NAME + i, buf, 10);
- db_set_ws(NULL, "Protocols", buf, pa->tszAccountName);
+ db_set_ws(0, "Protocols", buf, pa->tszAccountName);
}
db_unset(0, "Protocols", "ProtoCount");
@@ -220,14 +220,14 @@ static int InitializeStaticAccounts(WPARAM, LPARAM) BuildProtoMenus();
- if (count == 0 && !db_get_b(NULL, "FirstRun", "AccManager", 0)) {
- db_set_b(NULL, "FirstRun", "AccManager", 1);
+ if (count == 0 && !db_get_b(0, "FirstRun", "AccManager", 0)) {
+ db_set_b(0, "FirstRun", "AccManager", 1);
CallService(MS_PROTO_SHOWACCMGR, 0, 0);
}
// This is for pack creators with a profile with predefined accounts
- else if (db_get_b(NULL, "FirstRun", "ForceShowAccManager", 0)) {
+ else if (db_get_b(0, "FirstRun", "ForceShowAccManager", 0)) {
CallService(MS_PROTO_SHOWACCMGR, 0, 0);
- db_unset(NULL, "FirstRun", "ForceShowAccManager");
+ db_unset(0, "FirstRun", "ForceShowAccManager");
}
return 0;
}
@@ -286,14 +286,14 @@ static HANDLE CreateProtoServiceEx(const char* szModule, const char* szService, BOOL ActivateAccount(PROTOACCOUNT *pa)
{
PROTOCOLDESCRIPTOR* ppd = Proto_IsProtocolLoaded(pa->szProtoName);
- if (ppd == NULL)
+ if (ppd == nullptr)
return FALSE;
- if (ppd->fnInit == NULL)
+ if (ppd->fnInit == nullptr)
return FALSE;
PROTO_INTERFACE *ppi = ppd->fnInit(pa->szModuleName, pa->tszAccountName);
- if (ppi == NULL)
+ if (ppi == nullptr)
return FALSE;
pa->ppro = ppi;
@@ -346,7 +346,7 @@ static int DeactivationThread(DeactivationThreadParam* param) void DeactivateAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase)
{
- if (pa->ppro == NULL) {
+ if (pa->ppro == nullptr) {
if (bErase)
EraseAccount(pa->szModuleName);
return;
@@ -354,7 +354,7 @@ void DeactivateAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase) if (pa->hwndAccMgrUI) {
DestroyWindow(pa->hwndAccMgrUI);
- pa->hwndAccMgrUI = NULL;
+ pa->hwndAccMgrUI = nullptr;
pa->bAccMgrUIChanged = FALSE;
}
@@ -363,7 +363,7 @@ void DeactivateAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase) param->fnUninit = GetProtocolDestructor(pa->szProtoName);
param->bIsDynamic = bIsDynamic;
param->bErase = bErase;
- pa->ppro = NULL;
+ pa->ppro = nullptr;
if (bIsDynamic)
mir_forkthread((pThreadFunc)DeactivationThread, param);
else
@@ -375,14 +375,14 @@ void DeactivateAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase) void EraseAccount(const char *pszModuleName)
{
// remove protocol contacts first
- for (MCONTACT hContact = db_find_first(pszModuleName); hContact != NULL;) {
+ for (MCONTACT hContact = db_find_first(pszModuleName); hContact != 0;) {
MCONTACT hNext = db_find_next(hContact, pszModuleName);
db_delete_contact(hContact);
hContact = hNext;
}
// remove all protocol settings
- db_delete_module(NULL, pszModuleName);
+ db_delete_module(0, pszModuleName);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp index 664b6ee1f4..d9853b116d 100644 --- a/src/mir_app/src/proto_chains.cpp +++ b/src/mir_app/src/proto_chains.cpp @@ -28,11 +28,11 @@ extern LIST<PROTOCOLDESCRIPTOR> filters; static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen)
{
- if (currDb == NULL)
+ if (currDb == nullptr)
return 1;
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
- if (cc && cc->szProto != NULL) {
+ if (cc && cc->szProto != nullptr) {
strncpy(szBuf, cc->szProto, cbLen);
szBuf[cbLen - 1] = 0;
return 0;
@@ -45,10 +45,10 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen) int res = currDb->GetContactSettingStatic(hContact, "Protocol", "p", &dbv);
if (res == 0) {
- if (cc == NULL)
+ if (cc == nullptr)
cc = currDb->m_cache->AddContactToCache(hContact);
- cc->szProto = currDb->m_cache->GetCachedSetting(NULL, szBuf, 0, (int)mir_strlen(szBuf));
+ cc->szProto = currDb->m_cache->GetCachedSetting(nullptr, szBuf, 0, (int)mir_strlen(szBuf));
}
return res;
}
@@ -63,7 +63,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs) return 1;
for (int i = iOrder; i < filters.getCount(); i++) {
- if ((ret = CallProtoServiceInt(NULL, filters[i]->szName, ccs->szProtoService, i + 1, LPARAM(ccs))) != CALLSERVICE_NOTFOUND) {
+ if ((ret = CallProtoServiceInt(0, filters[i]->szName, ccs->szProtoService, i + 1, LPARAM(ccs))) != CALLSERVICE_NOTFOUND) {
//chain was started, exit
return ret;
}
@@ -74,7 +74,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs) return 1;
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- if (pa == NULL || pa->ppro == NULL)
+ if (pa == nullptr || pa->ppro == nullptr)
return 1;
if (pa->bOldProto)
@@ -113,7 +113,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs) else iOrder--;
for (int i = iOrder - 1; i >= 0; i--)
- if ((ret = CallProtoServiceInt(NULL, filters[i]->szName, ccs->szProtoService, i + 1, (LPARAM)ccs)) != CALLSERVICE_NOTFOUND)
+ if ((ret = CallProtoServiceInt(0, filters[i]->szName, ccs->szProtoService, i + 1, (LPARAM)ccs)) != CALLSERVICE_NOTFOUND)
//chain was started, exit
return ret;
@@ -123,7 +123,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs) return 1;
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- if (pa == NULL || pa->ppro == NULL)
+ if (pa == nullptr || pa->ppro == nullptr)
return 1;
if (pa->bOldProto)
@@ -138,12 +138,12 @@ MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs) PROTOACCOUNT* __fastcall Proto_GetAccount(MCONTACT hContact)
{
- if (hContact == NULL)
- return NULL;
+ if (hContact == 0)
+ return nullptr;
char szProto[40];
if (GetProtocolP(hContact, szProto, sizeof(szProto)))
- return NULL;
+ return nullptr;
return Proto_GetAccount(szProto);
}
@@ -151,18 +151,18 @@ PROTOACCOUNT* __fastcall Proto_GetAccount(MCONTACT hContact) MIR_APP_DLL(char*) GetContactProto(MCONTACT hContact)
{
PROTOACCOUNT *pa = Proto_GetAccount(hContact);
- return Proto_IsAccountEnabled(pa) ? pa->szModuleName : NULL;
+ return Proto_IsAccountEnabled(pa) ? pa->szModuleName : nullptr;
}
MIR_APP_DLL(char*) Proto_GetBaseAccountName(MCONTACT hContact)
{
PROTOACCOUNT *pa = Proto_GetAccount(hContact);
- return pa ? pa->szModuleName : NULL;
+ return pa ? pa->szModuleName : nullptr;
}
MIR_APP_DLL(int) Proto_IsProtoOnContact(MCONTACT hContact, const char *szProto)
{
- if (szProto == NULL)
+ if (szProto == nullptr)
return 0;
char szContactProto[40];
@@ -180,7 +180,7 @@ MIR_APP_DLL(int) Proto_IsProtoOnContact(MCONTACT hContact, const char *szProto) MIR_APP_DLL(int) Proto_AddToContact(MCONTACT hContact, const char *szProto)
{
PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(szProto);
- if (pd == NULL) {
+ if (pd == nullptr) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa) {
db_set_s(hContact, "Protocol", "p", szProto);
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp index 4a465153e5..636b2b46d9 100644 --- a/src/mir_app/src/proto_internal.cpp +++ b/src/mir_app/src/proto_internal.cpp @@ -28,20 +28,20 @@ char** __fastcall Proto_FilesMatrixA(wchar_t **files); void FreeFilesMatrix(wchar_t ***files)
{
- if (*files == NULL)
+ if (*files == nullptr)
return;
// Free each filename in the pointer array
wchar_t **pFile = *files;
- while (*pFile != NULL) {
+ while (*pFile != nullptr) {
mir_free(*pFile);
- *pFile = NULL;
+ *pFile = nullptr;
pFile++;
}
// Free the array itself
mir_free(*files);
- *files = NULL;
+ *files = nullptr;
}
struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 0cf1180f8d..250a5aa133 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -50,7 +50,7 @@ Here you can set up your IM accounts.\n\n\ Select an account from the list on the left to see the available options. \
Alternatively, just click on the Plus sign underneath the list to set up a new IM account.")
-static class CAccountManagerDlg *pAccMgr = NULL;
+static class CAccountManagerDlg *pAccMgr = nullptr;
extern HANDLE hAccListChanged;
@@ -59,8 +59,8 @@ int UnloadPlugin(wchar_t* buf, int bufLen); PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const wchar_t *tszAccountName)
{
PROTOACCOUNT *pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
- if (pa == NULL)
- return NULL;
+ if (pa == nullptr)
+ return nullptr;
pa->cbSize = sizeof(PROTOACCOUNT);
pa->bIsEnabled = pa->bIsVisible = true;
@@ -73,7 +73,7 @@ PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBasePr int count = 1;
while (true) {
mir_snprintf(buf, "%s_%d", szBaseProto, count++);
- if (ptrA(db_get_sa(NULL, buf, "AM_BaseProto")) == NULL)
+ if (ptrA(db_get_sa(0, buf, "AM_BaseProto")) == nullptr)
break;
}
pa->szModuleName = mir_strdup(buf);
@@ -82,12 +82,12 @@ PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBasePr pa->tszAccountName = mir_wstrdup(tszAccountName);
- db_set_s(NULL, pa->szModuleName, "AM_BaseProto", szBaseProto);
+ db_set_s(0, pa->szModuleName, "AM_BaseProto", szBaseProto);
accounts.insert(pa);
if (ActivateAccount(pa)) {
pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0);
- if (!db_get_b(NULL, "CList", "MoveProtoMenus", true))
+ if (!db_get_b(0, "CList", "MoveProtoMenus", true))
pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0);
}
@@ -108,7 +108,7 @@ static bool FindAccountByName(const char *szModuleName) ///////////////////////////////////////////////////////////////////////////////////////////////////
// Account edit form
-// gets PROTOACCOUNT* as a parameter, or NULL to edit a new one
+// gets PROTOACCOUNT* as a parameter, or nullptr to edit a new one
class ÑAccountFormDlg : public CDlgBase
{
@@ -238,7 +238,7 @@ public: CAccountListCtrl(CDlgBase *dlg, int ctrlId) :
CCtrlListBox(dlg, ctrlId),
m_iItem(-1),
- m_hwndEdit(NULL)
+ m_hwndEdit(nullptr)
{}
__forceinline CAccountManagerDlg* PARENT() { return (CAccountManagerDlg*)m_parentWnd; }
@@ -284,7 +284,7 @@ class CAccountManagerDlg : public CDlgBase m_iSelected = iItem;
m_accList.SetItemHeight(m_iSelected, m_selectedHeight);
- RedrawWindow(m_accList.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(m_accList.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
}
void UpdateAccountInfo()
@@ -320,7 +320,7 @@ class CAccountManagerDlg : public CDlgBase ShowWindow(GetDlgItem(m_hwnd, IDC_TXT_INFO), SW_HIDE);
GetWindowRect(GetDlgItem(m_hwnd, IDC_TXT_INFO), &rc);
- MapWindowPoints(NULL, m_hwnd, (LPPOINT)&rc, 2);
+ MapWindowPoints(nullptr, m_hwnd, (LPPOINT)&rc, 2);
SetWindowPos(hwnd, m_accList.GetHwnd(), rc.left, rc.top, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
pa->hwndAccMgrUI = hwnd;
@@ -419,7 +419,7 @@ public: m_iSelected = -1;
SendMessage(m_hwnd, WM_MY_REFRESH, 0, 0);
- Utils_RestoreWindowPositionNoSize(m_hwnd, NULL, "AccMgr", "");
+ Utils_RestoreWindowPositionNoSize(m_hwnd, 0, "AccMgr", "");
}
virtual void OnApply() override
@@ -459,7 +459,7 @@ public: pa->bAccMgrUIChanged = FALSE;
if (pa->hwndAccMgrUI) {
::DestroyWindow(pa->hwndAccMgrUI);
- pa->hwndAccMgrUI = NULL;
+ pa->hwndAccMgrUI = nullptr;
}
}
@@ -469,10 +469,10 @@ public: Button_FreeIcon_IcoLib(m_hwnd, IDC_REMOVE);
Button_FreeIcon_IcoLib(m_hwnd, IDC_OPTIONS);
Button_FreeIcon_IcoLib(m_hwnd, IDC_UPGRADE);
- Utils_SaveWindowPosition(m_hwnd, NULL, "AccMgr", "");
+ Utils_SaveWindowPosition(m_hwnd, 0, "AccMgr", "");
DeleteObject(m_hfntTitle);
DeleteObject(m_hfntText);
- pAccMgr = NULL;
+ pAccMgr = nullptr;
}
void OnListMenu(void*)
@@ -505,7 +505,7 @@ public: if (pa->bOldProto || pa->bDynDisabled)
AppendMenu(hMenu, MF_STRING, 5, TranslateT("Upgrade"));
- switch (TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL)) {
+ switch (TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) {
case 1:
m_accList.InitRename();
break;
@@ -544,19 +544,19 @@ public: void OnAccountCheck(int iItem)
{
PROTOACCOUNT *pa = (PROTOACCOUNT*)m_accList.GetItemData(iItem);
- if (pa == NULL || pa->bOldProto || pa->bDynDisabled)
+ if (pa == nullptr || pa->bOldProto || pa->bDynDisabled)
return;
pa->bIsEnabled = !pa->bIsEnabled;
if (pa->bIsEnabled) {
if (ActivateAccount(pa)) {
pa->ppro->OnEvent(EV_PROTO_ONLOAD, 0, 0);
- if (!db_get_b(NULL, "CList", "MoveProtoMenus", TRUE))
+ if (!db_get_b(0, "CList", "MoveProtoMenus", TRUE))
pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0);
}
}
else {
- DWORD dwStatus = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0);
+ DWORD dwStatus = CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0);
if (dwStatus >= ID_STATUS_ONLINE) {
wchar_t buf[200];
mir_snwprintf(buf, TranslateT("Account %s is being disabled"), pa->tszAccountName);
@@ -571,7 +571,7 @@ public: WriteDbAccounts();
NotifyEventHooks(hAccListChanged, PRAC_CHECKED, (LPARAM)pa);
UpdateAccountInfo();
- RedrawWindow(m_accList.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(m_accList.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
}
void OnOk(CCtrlButton*)
@@ -594,7 +594,7 @@ public: void OnAdd(CCtrlButton*)
{
- if (IDOK == ÑAccountFormDlg(this, PRAC_ADDED, NULL).DoModal())
+ if (IDOK == ÑAccountFormDlg(this, PRAC_ADDED, nullptr).DoModal())
SendMessage(m_hwnd, WM_MY_REFRESH, 0, 0);
}
@@ -679,13 +679,13 @@ public: m_iSelected = -1;
{
int i = m_accList.GetCurSel();
- PROTOACCOUNT *acc = (i == LB_ERR) ? NULL : (PROTOACCOUNT *)m_accList.GetItemData(i);
+ PROTOACCOUNT *acc = (i == LB_ERR) ? nullptr : (PROTOACCOUNT *)m_accList.GetItemData(i);
m_accList.ResetContent();
for (i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT *p = accounts[i];
PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(p->szProtoName);
- if (pd != NULL && pd->type != PROTOTYPE_PROTOCOL)
+ if (pd != nullptr && pd->type != PROTOTYPE_PROTOCOL)
continue;
int iItem = m_accList.AddString(p->tszAccountName);
@@ -722,7 +722,7 @@ public: m_accList.SetCurSel(iItem);
SelectItem(iItem);
- RedrawWindow(m_accList.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(m_accList.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
}
else mir_free((wchar_t*)lParam);
}
@@ -761,7 +761,7 @@ BOOL CAccountListCtrl::OnDrawItem(DRAWITEMSTRUCT *lps) int cyIcon = g_iIconSY;
PROTOACCOUNT *acc = (PROTOACCOUNT *)lps->itemData;
- if (lps->itemID == -1 || acc == NULL)
+ if (lps->itemID == -1 || acc == nullptr)
return FALSE;
SetBkMode(lps->hDC, TRANSPARENT);
@@ -823,8 +823,8 @@ BOOL CAccountListCtrl::OnDrawItem(DRAWITEMSTRUCT *lps) if (acc->ppro && Proto_IsProtocolLoaded(acc->szProtoName)) {
char *szIdName = (char *)acc->ppro->GetCaps(PFLAG_UNIQUEIDTEXT, 0);
ptrW tszIdName(szIdName ? mir_a2u(szIdName) : mir_wstrdup(TranslateT("Account ID")));
- ptrW tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, NULL, acc->szModuleName));
- if (tszUniqueID != NULL)
+ ptrW tszUniqueID(Contact_GetInfo(CNF_UNIQUEID, 0, acc->szModuleName));
+ if (tszUniqueID != nullptr)
text.Format(L"%s: %s", tszIdName, tszUniqueID);
else
text.Format(L"%s: %s", tszIdName, TranslateT("<unknown>"));
@@ -842,7 +842,7 @@ BOOL CAccountListCtrl::OnDrawItem(DRAWITEMSTRUCT *lps) BOOL CAccountListCtrl::OnMeasureItem(MEASUREITEMSTRUCT *lps)
{
PROTOACCOUNT *acc = (PROTOACCOUNT*)lps->itemData;
- if (acc == NULL)
+ if (acc == nullptr)
return FALSE;
lps->itemWidth = 10;
@@ -968,7 +968,7 @@ void CAccountListCtrl::InitRename() rc.bottom = rc.top + max(g_iIconSX, PARENT()->m_titleHeight) + 4 - 1;
++rc.top; --rc.right;
- m_hwndEdit = ::CreateWindow(L"EDIT", pa->tszAccountName, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, m_hwnd, NULL, g_hInst, NULL);
+ m_hwndEdit = ::CreateWindow(L"EDIT", pa->tszAccountName, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, m_hwnd, nullptr, g_hInst, nullptr);
mir_subclassWindow(m_hwndEdit, sttEditSubclassProc);
SendMessage(m_hwndEdit, WM_SETFONT, (WPARAM)PARENT()->m_hfntTitle, 0);
SendMessage(m_hwndEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
@@ -1024,7 +1024,7 @@ static int OnAccListChanged(WPARAM eventCode, LPARAM lParam) static int ShutdownAccMgr(WPARAM, LPARAM)
{
- delete pAccMgr; pAccMgr = NULL;
+ delete pAccMgr; pAccMgr = nullptr;
return 0;
}
diff --git a/src/mir_app/src/proto_order.cpp b/src/mir_app/src/proto_order.cpp index 89ef884abb..df00acf939 100644 --- a/src/mir_app/src/proto_order.cpp +++ b/src/mir_app/src/proto_order.cpp @@ -33,7 +33,7 @@ struct ProtocolData int isProtoSuitable(PROTO_INTERFACE* ppi)
{
- if (ppi == NULL)
+ if (ppi == nullptr)
return TRUE;
return ppi->GetCaps(PFLAGNUM_2, 0) & ~ppi->GetCaps(PFLAGNUM_5, 0);
@@ -97,7 +97,7 @@ static bool ProtoToInclude(PROTOACCOUNT *pa) return false;
PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(pa->szProtoName);
- return (pd != NULL && pd->type == PROTOTYPE_PROTOCOL);
+ return (pd != nullptr && pd->type == PROTOTYPE_PROTOCOL);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -109,7 +109,7 @@ class CProtocolOrderOpts : public CDlgBase m_order.DeleteAllItems();
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
@@ -145,7 +145,7 @@ public: m_order(this, IDC_PROTOCOLORDER),
m_btnReset(this, IDC_RESETPROTOCOLDATA),
m_bDragging(false),
- m_hDragItem(NULL)
+ m_hDragItem(nullptr)
{
m_btnReset.OnClick = Callback(this, &CProtocolOrderOpts::onReset_Click);
@@ -170,13 +170,13 @@ public: TVITEMEX tvi;
tvi.hItem = m_order.GetRoot();
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_IMAGE;
- while (tvi.hItem != NULL) {
+ while (tvi.hItem != nullptr) {
m_order.GetItem(&tvi);
if (tvi.lParam != 0) {
ProtocolData *ppd = (ProtocolData*)tvi.lParam;
PROTOACCOUNT *pa = Proto_GetAccount(ppd->RealName);
- if (pa != NULL) {
+ if (pa != nullptr) {
while (idx < accounts.getCount() && !ProtoToInclude(accounts[idx]))
idx++;
pa->iOrder = idx++;
diff --git a/src/mir_app/src/proto_ui.cpp b/src/mir_app/src/proto_ui.cpp index fcec6e8800..ee78049afd 100644 --- a/src/mir_app/src/proto_ui.cpp +++ b/src/mir_app/src/proto_ui.cpp @@ -26,11 +26,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE ProtoGetInstance(const char *szModuleName)
{
PROTOACCOUNT *pa = Proto_GetAccount(szModuleName);
- if (pa == NULL)
- return NULL;
+ if (pa == nullptr)
+ return nullptr;
PROTOCOLDESCRIPTOR *p = Proto_IsProtocolLoaded(pa->szProtoName);
- return (p == NULL) ? NULL : GetInstByAddress(p->fnInit);
+ return (p == nullptr) ? nullptr : GetInstByAddress(p->fnInit);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -40,7 +40,7 @@ CProtoIntDlgBase::CProtoIntDlgBase(PROTO_INTERFACE *proto, int idDialog, bool sh : CDlgBase(::ProtoGetInstance(proto->m_szModuleName), idDialog),
m_proto_interface(proto),
m_show_label(show_label),
- m_hwndStatus(NULL)
+ m_hwndStatus(nullptr)
{}
void CProtoIntDlgBase::CreateLink(CCtrlData& ctrl, char *szSetting, BYTE type, DWORD iValue)
@@ -72,7 +72,7 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) result = CSuper::DlgProc(msg, wParam, lParam);
m_proto_interface->WindowSubscribe(m_hwnd);
if (m_show_label) {
- m_hwndStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE, NULL, m_hwnd, 999);
+ m_hwndStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE, nullptr, m_hwnd, 999);
SetWindowPos(m_hwndStatus, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
UpdateStatusBar();
UpdateProtoTitle();
@@ -98,7 +98,7 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (m_hwndStatus) {
RECT rcStatus; GetWindowRect(m_hwndStatus, &rcStatus);
RECT rcClient; GetClientRect(m_hwnd, &rcClient);
- SetWindowPos(m_hwndStatus, NULL, 0, rcClient.bottom - (rcStatus.bottom - rcStatus.top), rcClient.right, (rcStatus.bottom - rcStatus.top), SWP_NOZORDER);
+ SetWindowPos(m_hwndStatus, nullptr, 0, rcClient.bottom - (rcStatus.bottom - rcStatus.top), rcClient.right, (rcStatus.bottom - rcStatus.top), SWP_NOZORDER);
UpdateStatusBar();
}
break;
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 101907b263..b68942c8ea 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -36,8 +36,8 @@ extern HANDLE hAckEvent; MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_IsProtocolLoaded(const char *szProtoName)
{
- if (szProtoName == NULL)
- return NULL;
+ if (szProtoName == nullptr)
+ return nullptr;
PROTOCOLDESCRIPTOR tmp;
tmp.szName = (char*)szProtoName;
@@ -123,10 +123,10 @@ MIR_APP_DLL(HANDLE) ProtoForkThreadEx(PROTO_INTERFACE *pThis, ProtoThreadFunc pF MIR_APP_DLL(void) ProtoWindowAdd(PROTO_INTERFACE *pThis, HWND hwnd)
{
- if (pThis->m_hWindowList == NULL)
+ if (pThis->m_hWindowList == nullptr)
pThis->m_hWindowList = WindowList_Create();
- WindowList_Add(pThis->m_hWindowList, hwnd, NULL);
+ WindowList_Add(pThis->m_hWindowList, hwnd, 0);
}
MIR_APP_DLL(void) ProtoWindowRemove(PROTO_INTERFACE *pThis, HWND hwnd)
@@ -158,11 +158,11 @@ MIR_APP_DLL(LPCTSTR) ProtoGetAvatarExtension(int format) MIR_APP_DLL(int) ProtoGetAvatarFormat(const wchar_t *ptszFileName)
{
- if (ptszFileName == NULL)
+ if (ptszFileName == nullptr)
return PA_FORMAT_UNKNOWN;
const wchar_t *ptszExt = wcsrchr(ptszFileName, '.');
- if (ptszExt == NULL)
+ if (ptszExt == nullptr)
return PA_FORMAT_UNKNOWN;
if (!wcsicmp(ptszExt, L".png"))
@@ -222,13 +222,13 @@ MIR_APP_DLL(int) ProtoGetBufferFormat(const void *pBuffer, const wchar_t **ptszE MIR_APP_DLL(int) ProtoGetAvatarFileFormat(const wchar_t *ptszFileName)
{
- HANDLE hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return PA_FORMAT_UNKNOWN;
DWORD dwBytes;
char buf[32];
- BOOL res = ReadFile(hFile, buf, _countof(buf), &dwBytes, NULL);
+ BOOL res = ReadFile(hFile, buf, _countof(buf), &dwBytes, nullptr);
CloseHandle(hFile);
return (res && dwBytes == _countof(buf)) ? ProtoGetBufferFormat(buf) : PA_FORMAT_UNKNOWN;
@@ -253,7 +253,7 @@ MIR_APP_DLL(const wchar_t*) ProtoGetAvatarMimeType(int iFileType) {
if (iFileType >= 0 && iFileType < _countof(wszMimeTypes))
return wszMimeTypes[iFileType];
- return NULL;
+ return nullptr;
}
MIR_APP_DLL(int) ProtoGetAvatarFormatByMimeType(const wchar_t *pwszMimeType)
@@ -270,12 +270,12 @@ MIR_APP_DLL(int) ProtoGetAvatarFormatByMimeType(const wchar_t *pwszMimeType) MCONTACT PROTO_INTERFACE::AddToList(int, PROTOSEARCHRESULT*)
{
- return NULL; // error
+ return 0; // error
}
MCONTACT PROTO_INTERFACE::AddToListByEvent(int, int, MEVENT)
{
- return NULL; // error
+ return 0; // error
}
int PROTO_INTERFACE::Authorize(MEVENT)
@@ -300,7 +300,7 @@ int PROTO_INTERFACE::AuthRequest(MCONTACT, const wchar_t*) HANDLE PROTO_INTERFACE::FileAllow(MCONTACT, HANDLE, const wchar_t*)
{
- return NULL; // error
+ return nullptr; // error
}
int PROTO_INTERFACE::FileCancel(MCONTACT, HANDLE)
@@ -330,27 +330,27 @@ int PROTO_INTERFACE::GetInfo(MCONTACT, int) HANDLE PROTO_INTERFACE::SearchBasic(const wchar_t*)
{
- return NULL; // error
+ return nullptr; // error
}
HANDLE PROTO_INTERFACE::SearchByEmail(const wchar_t*)
{
- return NULL; // error
+ return nullptr; // error
}
HANDLE PROTO_INTERFACE::SearchByName(const wchar_t*, const wchar_t*, const wchar_t*)
{
- return NULL; // error
+ return nullptr; // error
}
HWND PROTO_INTERFACE::SearchAdvanced(HWND)
{
- return NULL; // error
+ return nullptr; // error
}
HWND PROTO_INTERFACE::CreateExtendedSearchUI(HWND)
{
- return NULL; // error
+ return nullptr; // error
}
int PROTO_INTERFACE::RecvContacts(MCONTACT, PROTORECVEVENT*)
@@ -381,7 +381,7 @@ int PROTO_INTERFACE::SendContacts(MCONTACT, int, int, MCONTACT*) HANDLE PROTO_INTERFACE::SendFile(MCONTACT, const wchar_t*, wchar_t**)
{
- return NULL; // error
+ return nullptr; // error
}
int PROTO_INTERFACE::SendMsg(MCONTACT, int, const char*)
@@ -406,7 +406,7 @@ int PROTO_INTERFACE::SetStatus(int) HANDLE PROTO_INTERFACE::GetAwayMsg(MCONTACT)
{
- return NULL; // no away message
+ return nullptr; // no away message
}
int PROTO_INTERFACE::RecvAwayMsg(MCONTACT, int, PROTORECVEVENT*)
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index b71d63bc99..8f27b5fbd5 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -102,7 +102,7 @@ static PROTO_INTERFACE* defInitProto(const char* szModule, const wchar_t*) MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
{
- if (pd == NULL)
+ if (pd == nullptr)
return 1;
if (pd->cbSize != sizeof(PROTOCOLDESCRIPTOR) && pd->cbSize != PROTOCOLDESCRIPTOR_V3_SIZE)
@@ -116,13 +116,13 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd) p->szName = mir_strdup(pd->szName);
protos.insert(p);
- if (p->fnInit == NULL && (p->type == PROTOTYPE_PROTOCOL || p->type == PROTOTYPE_VIRTUAL)) {
+ if (p->fnInit == nullptr && (p->type == PROTOTYPE_PROTOCOL || p->type == PROTOTYPE_VIRTUAL)) {
// let's create a new container
PROTO_INTERFACE* ppi = AddDefaultAccount(pd->szName);
if (ppi) {
ppi->m_iVersion = (pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE) ? 1 : 2;
PROTOACCOUNT *pa = Proto_GetAccount(pd->szName);
- if (pa == NULL) {
+ if (pa == nullptr) {
pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
pa->cbSize = sizeof(PROTOACCOUNT);
pa->szModuleName = mir_strdup(pd->szName);
@@ -152,8 +152,8 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) {
CCSDATA *ccs = (CCSDATA*)lParam;
PROTORECVEVENT *pre = (PROTORECVEVENT*)ccs->lParam;
- if (pre->szMessage == NULL)
- return NULL;
+ if (pre->szMessage == nullptr)
+ return 0;
ptrA pszTemp;
mir_ptr<BYTE> pszBlob;
@@ -193,7 +193,7 @@ static INT_PTR Proto_AuthRecv(WPARAM wParam, LPARAM lParam) dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.cbBlob = pre->lParam;
dbei.pBlob = (PBYTE)pre->szMessage;
- return (INT_PTR)db_event_add(NULL, &dbei);
+ return (INT_PTR)db_event_add(0, &dbei);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -204,7 +204,7 @@ static int Proto_ValidTypingContact(MCONTACT hContact, char *szProto) if (!hContact || !szProto)
return 0;
- return (CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0;
+ return (CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0;
}
static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam)
@@ -215,7 +215,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) return 0;
if (Proto_ValidTypingContact(wParam, szProto))
- CallProtoServiceInt(NULL, szProto, PSS_USERISTYPING, wParam, lParam);
+ CallProtoServiceInt(0, szProto, PSS_USERISTYPING, wParam, lParam);
}
return 0;
@@ -242,16 +242,16 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) void Proto_SetStatus(const char *szProto, unsigned status)
{
- if (CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
+ if (CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
ptrW tszAwayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto));
- CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSG, status, tszAwayMsg);
+ CallProtoServiceInt(0, szProto, PS_SETAWAYMSG, status, tszAwayMsg);
}
- CallProtoServiceInt(NULL, szProto, PS_SETSTATUS, status, 0);
+ CallProtoServiceInt(0, szProto, PS_SETSTATUS, status, 0);
}
char** __fastcall Proto_FilesMatrixA(wchar_t **files)
{
- if (files == NULL) return NULL;
+ if (files == nullptr) return nullptr;
int count = 0;
while (files[count++]);
@@ -265,7 +265,7 @@ char** __fastcall Proto_FilesMatrixA(wchar_t **files) static wchar_t** __fastcall Proto_FilesMatrixU(char **files)
{
- if (files == NULL) return NULL;
+ if (files == nullptr) return nullptr;
int count = 0;
while (files[count++]);
@@ -280,7 +280,7 @@ static wchar_t** __fastcall Proto_FilesMatrixU(char **files) HICON Proto_GetIcon(PROTO_INTERFACE *ppro, int iconIndex)
{
if (LOWORD(iconIndex) != PLI_PROTOCOL)
- return NULL;
+ return nullptr;
if (iconIndex & PLIF_ICOLIBHANDLE)
return (HICON)ppro->m_hProtoIcon;
@@ -300,14 +300,14 @@ HICON Proto_GetIcon(PROTO_INTERFACE *ppro, int iconIndex) MIR_APP_DLL(PROTOACCOUNT*) Proto_GetAccount(const char *accName)
{
- if (accName == NULL)
- return NULL;
+ if (accName == nullptr)
+ return nullptr;
int idx;
PROTOACCOUNT temp;
temp.szModuleName = (char*)accName;
if ((idx = accounts.getIndex(&temp)) == -1)
- return NULL;
+ return nullptr;
return accounts[idx];
}
@@ -315,8 +315,8 @@ MIR_APP_DLL(PROTOACCOUNT*) Proto_GetAccount(const char *accName) static INT_PTR srvProto_CreateAccount(WPARAM, LPARAM lParam)
{
ACC_CREATE *p = (ACC_CREATE*)lParam;
- if (p == NULL)
- return NULL;
+ if (p == nullptr)
+ return 0;
PROTOACCOUNT *pa = Proto_CreateAccount(p->pszInternal, p->pszBaseProto, p->ptszAccountName);
if (pa) {
@@ -339,20 +339,20 @@ MIR_APP_DLL(bool) Proto_IsAccountEnabled(const PROTOACCOUNT *pa) MIR_APP_DLL(bool) Proto_IsAccountLocked(const PROTOACCOUNT *pa)
{
- return pa && db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0) != 0;
+ return pa && db_get_b(0, pa->szModuleName, "LockMainStatus", 0) != 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
MIR_APP_DLL(int) ProtoServiceExists(const char *szModule, const char *szService)
{
- if (szModule == NULL || szService == NULL)
+ if (szModule == nullptr || szService == nullptr)
return false;
PROTOACCOUNT *pa = Proto_GetAccount(szModule);
if (pa && !pa->bOldProto) {
TServiceListItem *item = (TServiceListItem*)bsearch(&szService, serviceItems, _countof(serviceItems), sizeof(serviceItems[0]), CompareServiceItems);
- if (item != NULL)
+ if (item != nullptr)
return true;
}
@@ -366,7 +366,7 @@ MIR_APP_DLL(int) ProtoServiceExists(const char *szModule, const char *szService) MIR_APP_DLL(INT_PTR) CallProtoService(const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam)
{
- return CallProtoServiceInt(NULL, szModule, szService, wParam, lParam);
+ return CallProtoServiceInt(0, szModule, szService, wParam, lParam);
}
INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam)
@@ -374,7 +374,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char PROTOACCOUNT *pa = Proto_GetAccount(szModule);
if (pa && !pa->bOldProto) {
PROTO_INTERFACE *ppi = pa->ppro;
- if (ppi != NULL && ppi->m_iVersion > 1) {
+ if (ppi != nullptr && ppi->m_iVersion > 1) {
TServiceListItem *item = (TServiceListItem*)bsearch(&szService, serviceItems, _countof(serviceItems), sizeof(serviceItems[0]), CompareServiceItems);
if (item) {
switch (item->id) {
@@ -430,7 +430,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char INT_PTR ProtoCallService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam)
{
- if (szModule == NULL || szService == NULL)
+ if (szModule == nullptr || szService == nullptr)
return false;
char str[MAXMODULELABELLENGTH * 2];
@@ -484,12 +484,12 @@ void UnloadProtocolsModule() if (hAckEvent) {
DestroyHookableEvent(hAckEvent);
- hAckEvent = NULL;
+ hAckEvent = nullptr;
}
if (hAccListChanged) {
DestroyHookableEvent(hAccListChanged);
- hAccListChanged = NULL;
+ hAccListChanged = nullptr;
}
}
@@ -498,5 +498,5 @@ void UnloadProtocolsModule() pfnUninitProto GetProtocolDestructor(char *szProto)
{
PROTOCOLDESCRIPTOR *p = Proto_IsProtocolLoaded(szProto);
- return (p == NULL) ? NULL : p->fnUninit;
+ return (p == nullptr) ? nullptr : p->fnUninit;
}
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index 3010fba28f..98ab3d797c 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -46,15 +46,15 @@ void SaveColumnSizes(HWND hwndResults) for (int i = 0; i < NUM_COLUMNID; i++) {
char szSetting[32];
mir_snprintf(szSetting, "ColOrder%d", i);
- db_set_b(NULL, "FindAdd", szSetting, (BYTE)columnOrder[i]);
+ db_set_b(0, "FindAdd", szSetting, (BYTE)columnOrder[i]);
mir_snprintf(szSetting, "ColWidth%d", i);
- db_set_w(NULL, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i));
+ db_set_w(0, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i));
}
- db_set_b(NULL, "FindAdd", "SortColumn", (BYTE)dat->iLastColumnSortIndex);
- db_set_b(NULL, "FindAdd", "SortAscending", (BYTE)dat->bSortAscending);
+ db_set_b(0, "FindAdd", "SortColumn", (BYTE)dat->iLastColumnSortIndex);
+ db_set_b(0, "FindAdd", "SortAscending", (BYTE)dat->bSortAscending);
}
-static const wchar_t *szColumnNames[] = { NULL, NULL, L"Nick", L"First Name", L"Last Name", L"E-mail" };
+static const wchar_t *szColumnNames[] = { nullptr, nullptr, L"Nick", L"First Name", L"Last Name", L"E-mail" };
static int defaultColumnSizes[] = { 0, 90, 100, 100, 100, 2000 };
void LoadColumnSizes(HWND hwndResults, const char *szProto)
{
@@ -70,13 +70,13 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) if (i < columnCount) {
bool bNeedsFree = false;
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
- if (szColumnNames[i] != NULL)
+ if (szColumnNames[i] != nullptr)
lvc.pszText = TranslateW(szColumnNames[i]);
else {
if (i == COLUMNID_HANDLE) {
lvc.pszText = L"ID";
if (szProto) {
- INT_PTR ret = CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ INT_PTR ret = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
if (ret != CALLSERVICE_NOTFOUND) {
bNeedsFree = true;
lvc.pszText = mir_a2u((char*)ret);
@@ -87,14 +87,14 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) }
mir_snprintf(szSetting, "ColWidth%d", i);
- lvc.cx = db_get_w(NULL, "FindAdd", szSetting, defaultColumnSizes[i]);
+ lvc.cx = db_get_w(0, "FindAdd", szSetting, defaultColumnSizes[i]);
ListView_InsertColumn(hwndResults, i, (LPARAM)&lvc);
if (bNeedsFree)
mir_free(lvc.pszText);
}
mir_snprintf(szSetting, "ColOrder%d", i);
- columnOrder[i] = db_get_b(NULL, "FindAdd", szSetting, -1);
+ columnOrder[i] = db_get_b(0, "FindAdd", szSetting, -1);
if (columnOrder[i] == -1 || columnOrder[i] >= NUM_COLUMNID)
colOrdersValid = false;
}
@@ -102,10 +102,10 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) if (colOrdersValid)
ListView_SetColumnOrderArray(hwndResults, columnCount, columnOrder);
- dat->iLastColumnSortIndex = db_get_b(NULL, "FindAdd", "SortColumn", COLUMNID_NICK);
+ dat->iLastColumnSortIndex = db_get_b(0, "FindAdd", "SortColumn", COLUMNID_NICK);
if (dat->iLastColumnSortIndex >= columnCount)
dat->iLastColumnSortIndex = COLUMNID_NICK;
- dat->bSortAscending = db_get_b(NULL, "FindAdd", "SortAscending", TRUE);
+ dat->bSortAscending = db_get_b(0, "FindAdd", "SortAscending", TRUE);
HDITEM hdi;
hdi.mask = HDI_FORMAT;
@@ -132,7 +132,7 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa if (!dat->bFlexSearchResult) {
ListSearchResult *lsr1 = (ListSearchResult*)ListView_GetItemLParam(hList, (int)lParam1);
ListSearchResult *lsr2 = (ListSearchResult*)ListView_GetItemLParam(hList, (int)lParam2);
- if (lsr1 == NULL || lsr2 == NULL)
+ if (lsr1 == nullptr || lsr2 == nullptr)
return 0;
switch (sortCol) {
@@ -166,7 +166,7 @@ void FreeSearchResults(HWND hwndResults) lvi.mask = LVIF_PARAM;
ListView_GetItem(hwndResults, &lvi);
ListSearchResult *lsr = (ListSearchResult*)lvi.lParam;
- if (lsr == NULL) continue;
+ if (lsr == nullptr) continue;
mir_free(lsr->psr.id.w);
mir_free(lsr->psr.email.w);
mir_free(lsr->psr.nick.w);
@@ -182,7 +182,7 @@ void FreeSearchResults(HWND hwndResults) static void BeginSearchFailed(void *arg)
{
wchar_t buf[128];
- if (arg != NULL) {
+ if (arg != nullptr) {
const wchar_t *protoName = (wchar_t*)arg;
mir_snwprintf(buf,
TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
@@ -195,7 +195,7 @@ static void BeginSearchFailed(void *arg) int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams)
{
- if (szProto == NULL) {
+ if (szProto == nullptr) {
int failures = 0;
dat->searchCount = 0;
dat->search = (struct ProtoSearchInfo*)mir_calloc(sizeof(struct ProtoSearchInfo) * accounts.getCount());
@@ -204,13 +204,13 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha if (!Proto_IsAccountEnabled(pa))
continue;
- DWORD caps = (DWORD)CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ DWORD caps = (DWORD)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (!(caps & requiredCapability))
continue;
- dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoServiceInt(NULL, pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams);
+ dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoServiceInt(0, pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[dat->searchCount].szProto = pa->szModuleName;
- if (dat->search[dat->searchCount].hProcess == NULL) failures++;
+ if (dat->search[dat->searchCount].hProcess == nullptr) failures++;
else dat->searchCount++;
}
if (failures) {
@@ -218,7 +218,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha if (dat->searchCount == 0) {
mir_forkthread(BeginSearchFailed);
mir_free(dat->search);
- dat->search = NULL;
+ dat->search = nullptr;
return 1;
}
}
@@ -226,14 +226,14 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha else {
dat->search = (struct ProtoSearchInfo*)mir_alloc(sizeof(struct ProtoSearchInfo));
dat->searchCount = 1;
- dat->search[0].hProcess = (HANDLE)CallProtoServiceInt(NULL, szProto, szSearchService, 0, (LPARAM)pvSearchParams);
+ dat->search[0].hProcess = (HANDLE)CallProtoServiceInt(0, szProto, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[0].szProto = szProto;
- if (dat->search[0].hProcess == NULL) {
+ if (dat->search[0].hProcess == nullptr) {
// infuriatingly vague error message. fixme.
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
mir_forkthread(BeginSearchFailed, mir_wstrdup(pa->tszAccountName));
mir_free(dat->search);
- dat->search = NULL;
+ dat->search = nullptr;
dat->searchCount = 0;
return 1;
}
@@ -275,13 +275,13 @@ void SetStatusBarResultInfo(HWND hwndDlg) int total = ListView_GetItemCount(hwndResults);
if (total != 0) {
LV_ITEM lvi;
- struct ProtoResultsSummary *subtotal = NULL;
+ struct ProtoResultsSummary *subtotal = nullptr;
int subtotalCount = 0;
for (lvi.iItem = total - 1; lvi.iItem >= 0; lvi.iItem--) {
lvi.mask = LVIF_PARAM;
ListView_GetItem(hwndResults, &lvi);
ListSearchResult *lsr = (ListSearchResult*)lvi.lParam;
- if (lsr == NULL)
+ if (lsr == nullptr)
continue;
int i = 0;
@@ -300,7 +300,7 @@ void SetStatusBarResultInfo(HWND hwndDlg) }
if (subtotalCount == 1) {
PROTOACCOUNT *pa = Proto_GetAccount(subtotal[0].szProto);
- if (pa == NULL) {
+ if (pa == nullptr) {
mir_free(subtotal);
return;
}
@@ -313,7 +313,7 @@ void SetStatusBarResultInfo(HWND hwndDlg) str.AppendFormat(TranslateT("%d users found ("), total);
for (int i = 0; i < subtotalCount; i++) {
PROTOACCOUNT *pa = Proto_GetAccount(subtotal[i].szProto);
- if (pa == NULL)
+ if (pa == nullptr)
continue;
if (i)
@@ -350,7 +350,7 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
HMENU hPopupMenu = GetSubMenu(hMenu, 4);
TranslateMenu(hPopupMenu);
- int commandId = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, hwndDlg, NULL);
+ int commandId = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, 0, hwndDlg, nullptr);
switch (commandId) {
case IDC_ADD:
{
@@ -363,13 +363,13 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) break;
case IDC_DETAILS:
{
- MCONTACT hContact = (MCONTACT)CallProtoServiceInt(NULL, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ MCONTACT hContact = (MCONTACT)CallProtoServiceInt(0, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
}
break;
case IDC_SENDMESSAGE:
{
- MCONTACT hContact = (MCONTACT)CallProtoServiceInt(NULL, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ MCONTACT hContact = (MCONTACT)CallProtoServiceInt(0, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
}
break;
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index e22a20004f..f38a8eb7f7 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -37,7 +37,7 @@ struct TreeItem static HICON ExtractIconFromPath(const wchar_t *path, int cxIcon, int cyIcon)
{
if (!path)
- return (HICON)NULL;
+ return (HICON)nullptr;
int n;
wchar_t file[MAX_PATH], fileFull[MAX_PATH];
@@ -52,7 +52,7 @@ static HICON ExtractIconFromPath(const wchar_t *path, int cxIcon, int cyIcon) PathToAbsoluteW(file, fileFull);
// SHOULD BE REPLACED WITH GOOD ENOUGH FUNCTION
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
_ExtractIconEx(fileFull, n, cxIcon, cyIcon, &hIcon, LR_COLOR);
return hIcon;
}
@@ -62,7 +62,7 @@ static HICON ExtractIconFromPath(const wchar_t *path, int cxIcon, int cyIcon) static HICON IconItem_GetIcon_Preview(IcolibItem *item)
{
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
if (!item->temp_reset) {
HICON hRefIcon = IcoLib_GetIconByHandle((HANDLE)item, false);
@@ -103,7 +103,7 @@ static HICON IconItem_GetIcon_Preview(IcolibItem *item) static void __fastcall MySetCursor(wchar_t *nCursor)
{
- SetCursor(LoadCursor(NULL, nCursor));
+ SetCursor(LoadCursor(nullptr, nCursor));
}
static wchar_t* OpenFileDlg(HWND hParent, const wchar_t *szFile, BOOL bAll)
@@ -142,7 +142,7 @@ static wchar_t* OpenFileDlg(HWND hParent, const wchar_t *szFile, BOOL bAll) ofn.nMaxFile = MAX_PATH * 2;
if (!GetOpenFileName(&ofn))
- return NULL;
+ return nullptr;
return mir_wstrdup(file);
}
@@ -262,12 +262,12 @@ public: lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = 0;
- int count = (int)_ExtractIconEx(filename, -1, 16, 16, NULL, LR_DEFAULTCOLOR);
+ int count = (int)_ExtractIconEx(filename, -1, 16, 16, nullptr, LR_DEFAULTCOLOR);
for (int i = 0; i < count; lvi.iItem++, i++) {
mir_snwprintf(caption, L"%d", i + 1);
lvi.pszText = caption;
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
if (_ExtractIconEx(filename, i, 16, 16, &hIcon, LR_DEFAULTCOLOR) == 1) {
lvi.iImage = ImageList_AddIcon(hIml, hIcon);
DestroyIcon(hIcon);
@@ -311,7 +311,7 @@ static void LoadSectionIcons(wchar_t *filename, SectionItem* sectionActive) if (!hIcon)
continue;
- replaceStrW(item->temp_file, NULL);
+ replaceStrW(item->temp_file, nullptr);
SafeDestroyIcon(item->temp_icon);
item->temp_file = mir_wstrdup(path);
@@ -328,7 +328,7 @@ static void UndoChanges(int iconIndx, int cmd) if (!item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
item->temp_reset = FALSE;
else {
- replaceStrW(item->temp_file, NULL);
+ replaceStrW(item->temp_file, nullptr);
SafeDestroyIcon(item->temp_icon);
}
@@ -373,7 +373,7 @@ class CIcoLibOptsDlg : public CDlgBase tvi.hItem = m_categoryList.GetNextSibling(tvi.hItem);
}
- return NULL;
+ return nullptr;
}
void RebuildTree()
@@ -381,13 +381,13 @@ class CIcoLibOptsDlg : public CDlgBase if (!m_categoryList.GetHwnd())
return;
- m_categoryList.SelectItem(NULL);
+ m_categoryList.SelectItem(nullptr);
m_categoryList.DeleteAllItems();
for (int indx = 0; indx < sectionList.getCount(); indx++) {
int sectionLevel = 0;
- HTREEITEM hSection = NULL;
+ HTREEITEM hSection = nullptr;
wchar_t itemName[1024];
mir_wstrcpy(itemName, sectionList[indx]->name);
wchar_t *sectionName = itemName;
@@ -416,7 +416,7 @@ class CIcoLibOptsDlg : public CDlgBase tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
tvis.item.pszText = pItemName;
tvis.item.lParam = (LPARAM)treeItem;
- tvis.item.state = tvis.item.stateMask = db_get_b(NULL, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED);
+ tvis.item.state = tvis.item.stateMask = db_get_b(0, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED);
hItem = m_categoryList.InsertItem(&tvis);
}
else {
@@ -441,7 +441,7 @@ class CIcoLibOptsDlg : public CDlgBase ShowWindow(m_categoryList.GetHwnd(), SW_SHOW);
- m_categoryList.SelectItem(FindNamedTreeItemAt(0, NULL));
+ m_categoryList.SelectItem(FindNamedTreeItemAt(0, nullptr));
}
int OpenPopupMenu()
@@ -451,7 +451,7 @@ class CIcoLibOptsDlg : public CDlgBase HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_ICOLIB_CONTEXT));
HMENU hPopup = GetSubMenu(hMenu, 0);
TranslateMenu(hPopup);
- int cmd = TrackPopupMenu(hPopup, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL);
+ int cmd = TrackPopupMenu(hPopup, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr);
DestroyMenu(hMenu);
return cmd;
}
@@ -561,8 +561,8 @@ public: m_btnGetMore(this, IDC_GETMORE),
m_btnLoadIcons(this, IDC_LOADICONS),
m_categoryList(this, IDC_CATEGORYLIST),
- m_hPrevItem(NULL),
- m_pDialog(NULL)
+ m_hPrevItem(nullptr),
+ m_pDialog(nullptr)
{
m_btnImport.OnClick = Callback(this, &CIcoLibOptsDlg::OnImport);
m_btnGetMore.OnClick = Callback(this, &CIcoLibOptsDlg::OnGetMore);
@@ -583,8 +583,8 @@ public: mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- iconList[indx]->temp_file = NULL;
- iconList[indx]->temp_icon = NULL;
+ iconList[indx]->temp_file = nullptr;
+ iconList[indx]->temp_icon = nullptr;
iconList[indx]->temp_reset = false;
}
bNeedRebuild = false;
@@ -649,16 +649,16 @@ public: for (int indx = 0; indx < iconList.getCount(); indx++) {
IcolibItem *item = iconList[indx];
if (item->temp_reset) {
- db_unset(NULL, "SkinIcons", item->name);
+ db_unset(0, "SkinIcons", item->name);
if (item->source_small != item->default_icon) {
item->source_small->release();
- item->source_small = NULL;
+ item->source_small = nullptr;
}
}
else if (item->temp_file) {
- db_set_ws(NULL, "SkinIcons", item->name, item->temp_file);
+ db_set_ws(0, "SkinIcons", item->name, item->temp_file);
item->source_small->release();
- item->source_small = NULL;
+ item->source_small = nullptr;
SafeDestroyIcon(item->temp_icon);
}
}
@@ -670,7 +670,7 @@ public: virtual void OnDestroy() override
{
HTREEITEM hti = m_categoryList.GetRoot();
- while (hti != NULL) {
+ while (hti != nullptr) {
TVITEMEX tvi;
tvi.mask = TVIF_STATE | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM;
tvi.hItem = hti;
@@ -680,17 +680,17 @@ public: if (tvi.cChildren > 0) {
TreeItem *treeItem = (TreeItem *)tvi.lParam;
if (tvi.state & TVIS_EXPANDED)
- db_set_b(NULL, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED);
+ db_set_b(0, "SkinIconsUI", treeItem->paramName, TVIS_EXPANDED);
else
- db_set_b(NULL, "SkinIconsUI", treeItem->paramName, 0);
+ db_set_b(0, "SkinIconsUI", treeItem->paramName, 0);
}
HTREEITEM ht = m_categoryList.GetChild(hti);
- if (ht == NULL) {
+ if (ht == nullptr) {
ht = m_categoryList.GetNextSibling(hti);
- while (ht == NULL) {
+ while (ht == nullptr) {
hti = m_categoryList.GetParent(hti);
- if (hti == NULL)
+ if (hti == nullptr)
break;
ht = m_categoryList.GetNextSibling(hti);
@@ -706,7 +706,7 @@ public: mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
IcolibItem *item = iconList[indx];
- replaceStrW(item->temp_file, NULL);
+ replaceStrW(item->temp_file, nullptr);
SafeDestroyIcon(item->temp_icon);
}
}
@@ -773,14 +773,14 @@ public: if (SECTIONPARAM_FLAGS(treeItem->value) & SECTIONPARAM_HAVEPAGE)
sectionActive = sectionList[SECTIONPARAM_INDEX(treeItem->value)];
else
- sectionActive = NULL;
+ sectionActive = nullptr;
- m_preview.Enable(sectionActive != NULL);
+ m_preview.Enable(sectionActive != nullptr);
m_preview.DeleteAllItems();
HIMAGELIST hIml = m_preview.GetImageList(LVSIL_NORMAL);
ImageList_RemoveAll(hIml);
- if (sectionActive == NULL)
+ if (sectionActive == nullptr)
return;
LVITEM lvi = { 0 };
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index 45867ee1b4..e16fed69ab 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -131,11 +131,11 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) {
wchar_t filename[MAX_PATH];
if (GetModuleFileName(hInstance, filename, MAX_PATH) == 0)
- return NULL;
+ return nullptr;
- HICON hIcon = NULL; // icon handle
+ HICON hIcon = nullptr; // icon handle
int index = -(INT_PTR)lpIconName;
- ExtractIconEx(filename, index, NULL, &hIcon, 1);
+ ExtractIconEx(filename, index, nullptr, &hIcon, 1);
return hIcon;
}
@@ -143,7 +143,7 @@ static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName) HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared)
{
HICON hResIcon = bShared ? LoadSmallIconShared(hInstance, lpIconName) : LoadSmallIcon(hInstance, lpIconName);
- if (hResIcon == NULL && g_hInst != hInstance) // Icon not found in hInstance, let's try to load it from core
+ if (hResIcon == nullptr && g_hInst != hInstance) // Icon not found in hInstance, let's try to load it from core
hResIcon = bShared ? LoadSmallIconShared(g_hInst, lpIconName) : LoadSmallIcon(g_hInst, lpIconName);
return hResIcon;
@@ -230,9 +230,9 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) {
char iconName[MAX_PATH];
INT_PTR caps2;
- if (szProto == NULL)
+ if (szProto == nullptr)
caps2 = -1;
- else if ((caps2 = CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_2, 0)) == CALLSERVICE_NOTFOUND)
+ else if ((caps2 = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_2, 0)) == CALLSERVICE_NOTFOUND)
caps2 = 0;
if (IsStatusConnecting(status)) {
@@ -248,7 +248,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) }
if (statusIndx == -1)
- return NULL;
+ return nullptr;
if (!szProto) {
// Only return a protocol specific icon if there is only one protocol
@@ -270,11 +270,11 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) // format: core_status_%s%d
mir_snprintf(iconName, "%s%s%d", statusIconsFmt, szProto, statusIndx);
HICON hIcon = IcoLib_GetIcon(iconName, big);
- if (hIcon == NULL && (caps2 == 0 || (caps2 & statusIcons[statusIndx].pf2))) {
+ if (hIcon == nullptr && (caps2 == 0 || (caps2 & statusIcons[statusIndx].pf2))) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa) {
wchar_t szPath[MAX_PATH], szFullPath[MAX_PATH], *str;
- GetModuleFileName(NULL, szPath, _countof(szPath));
+ GetModuleFileName(nullptr, szPath, _countof(szPath));
// Queried protocol isn't in list, adding
wchar_t tszSection[MAX_PATH];
@@ -285,21 +285,21 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) sid.flags = SIDF_ALL_UNICODE;
str = wcsrchr(szPath, '\\');
- if (str != NULL)
+ if (str != nullptr)
*str = 0;
mir_snwprintf(szFullPath, L"%s\\Icons\\proto_%S.dll", szPath, pa->szProtoName);
if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES)
sid.defaultFile.w = szFullPath;
else {
mir_snwprintf(szFullPath, L"%s\\Plugins\\%S.dll", szPath, szProto);
- if (int(ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, NULL, &hIcon, 1)) > 0) {
+ if (int(ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, nullptr, &hIcon, 1)) > 0) {
DestroyIcon(hIcon);
sid.defaultFile.w = szFullPath;
- hIcon = NULL;
+ hIcon = nullptr;
}
- if (sid.defaultFile.a == NULL) {
- if (str != NULL)
+ if (sid.defaultFile.a == nullptr) {
+ if (str != nullptr)
*str = '\\';
sid.defaultFile.w = szPath;
}
@@ -331,7 +331,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big) return hIcon;
}
- if (hIcon == NULL) {
+ if (hIcon == nullptr) {
mir_snprintf(iconName, "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, statusIndx);
hIcon = IcoLib_GetIcon(iconName, big);
}
@@ -345,7 +345,7 @@ MIR_APP_DLL(HANDLE) Skin_GetIconHandle(int idx) if (idx == mainIcons[i].id)
return mainIcons[i].hIcolib;
- return NULL;
+ return nullptr;
}
MIR_APP_DLL(char*) Skin_GetIconName(int idx)
@@ -358,7 +358,7 @@ MIR_APP_DLL(char*) Skin_GetIconName(int idx) return szIconName;
}
}
- return NULL;
+ return nullptr;
}
MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big)
@@ -366,9 +366,9 @@ MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big) // Query for global status icons
if (idx < SKINICON_EVENT_MESSAGE) {
if (idx >= _countof(statusIcons))
- return NULL;
+ return nullptr;
- return Skin_LoadProtoIcon(NULL, statusIcons[idx].id, big);
+ return Skin_LoadProtoIcon(nullptr, statusIcons[idx].id, big);
}
return IcoLib_GetIconByHandle(Skin_GetIconHandle(idx), big);
@@ -391,7 +391,7 @@ int LoadSkinIcons(void) // Add main icons to list
for (int i = 0; i < _countof(mainIcons); i++) {
mir_snprintf(iconName, "%s%d", mainIconsFmt, i);
- sid.section.a = mainIcons[i].section == NULL ? (char*)LPGEN("Main icons") : (char*)mainIcons[i].section;
+ sid.section.a = mainIcons[i].section == nullptr ? (char*)LPGEN("Main icons") : (char*)mainIcons[i].section;
sid.description.a = (char*)mainIcons[i].description;
sid.iDefaultIndex = mainIcons[i].resource_id;
mainIcons[i].hIcolib = IcoLib_AddIcon(&sid, 0);
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index ab4db8dec6..980dd75cef 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -76,47 +76,47 @@ HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const wchar_t* name) tvi.pszText = str;
tvi.cchTextMax = _countof(str);
tvi.hItem = TreeView_GetRoot(hwndTree);
- while (tvi.hItem != NULL) {
+ while (tvi.hItem != nullptr) {
SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
if (!mir_wstrcmpi(str, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
- return NULL;
+ return nullptr;
}
static BOOL bModuleInitialized = FALSE;
-static HANDLE hPlayEvent = NULL;
+static HANDLE hPlayEvent = nullptr;
static INT_PTR ServiceSkinAddNewSound(WPARAM wParam, LPARAM lParam)
{
SKINSOUNDDESCEX *ssd = (SKINSOUNDDESCEX*)lParam;
- if (ssd->cbSize != sizeof(SKINSOUNDDESCEX) || ssd->pszName == NULL || ssd->pszDescription == NULL)
+ if (ssd->cbSize != sizeof(SKINSOUNDDESCEX) || ssd->pszName == nullptr || ssd->pszDescription == nullptr)
return 1;
SoundItem *item = new SoundItem; // due to OBJLIST
item->name = mir_strdup(ssd->pszName);
- item->ptszTempFile = NULL;
+ item->ptszTempFile = nullptr;
item->hLangpack = (int)wParam;
arSounds.insert(item);
wchar_t *pwszDefaultFile;
if (ssd->dwFlags & SSDF_UNICODE) {
item->pwszDescription = mir_wstrdup(ssd->pwszDescription);
- item->pwszSection = mir_wstrdup((ssd->pszSection != NULL) ? ssd->pwszSection : L"Other");
+ item->pwszSection = mir_wstrdup((ssd->pszSection != nullptr) ? ssd->pwszSection : L"Other");
pwszDefaultFile = mir_wstrdup(ssd->pwszDefaultFile);
}
else {
item->pwszDescription = mir_a2u(ssd->pszDescription);
- item->pwszSection = mir_a2u((ssd->pszSection != NULL) ? ssd->pszSection : "Other");
+ item->pwszSection = mir_a2u((ssd->pszSection != nullptr) ? ssd->pszSection : "Other");
pwszDefaultFile = mir_a2u(ssd->pszDefaultFile);
}
if (pwszDefaultFile) {
DBVARIANT dbv;
- if (db_get_s(NULL, "SkinSounds", item->name, &dbv))
- db_set_ws(NULL, "SkinSounds", item->name, pwszDefaultFile);
+ if (db_get_s(0, "SkinSounds", item->name, &dbv))
+ db_set_ws(0, "SkinSounds", item->name, pwszDefaultFile);
else
db_free(&dbv);
mir_free(pwszDefaultFile);
@@ -128,8 +128,8 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM wParam, LPARAM lParam) static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam)
{
wchar_t *pszFile = (wchar_t*) lParam;
- if (pszFile && (db_get_b(NULL, "Skin", "UseSound", 0) || (int)wParam == 1))
- PlaySound(pszFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOSTOP);
+ if (pszFile && (db_get_b(0, "Skin", "UseSound", 0) || (int)wParam == 1))
+ PlaySound(pszFile, nullptr, SND_ASYNC | SND_FILENAME | SND_NOSTOP);
return 0;
}
@@ -137,7 +137,7 @@ static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam) static INT_PTR ServiceSkinPlaySoundFile(WPARAM, LPARAM lParam)
{
wchar_t *ptszFileName = (wchar_t*)lParam;
- if (ptszFileName == NULL)
+ if (ptszFileName == nullptr)
return 1;
wchar_t tszFull[MAX_PATH];
@@ -148,20 +148,20 @@ static INT_PTR ServiceSkinPlaySoundFile(WPARAM, LPARAM lParam) static INT_PTR ServiceSkinPlaySound(WPARAM, LPARAM lParam)
{
- char* pszSoundName = (char*)lParam;
- if (pszSoundName == NULL)
+ char *pszSoundName = (char*)lParam;
+ if (pszSoundName == nullptr)
return 1;
SoundItem tmp = { pszSoundName };
- int idx = arSounds.getIndex( &tmp );
+ int idx = arSounds.getIndex(&tmp);
if (idx == -1)
return 1;
- if ( db_get_b(NULL, "SkinSoundsOff", pszSoundName, 0))
+ if (db_get_b(0, "SkinSoundsOff", pszSoundName, 0))
return 1;
DBVARIANT dbv;
- if ( db_get_ws(NULL, "SkinSounds", pszSoundName, &dbv) == 0) {
+ if (db_get_ws(0, "SkinSounds", pszSoundName, &dbv) == 0) {
ServiceSkinPlaySoundFile(0, (LPARAM)dbv.ptszVal);
db_free(&dbv);
return 0;
@@ -176,7 +176,7 @@ static INT_PTR ServiceSkinPlaySound(WPARAM, LPARAM lParam) INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static HWND hwndTree = NULL;
+ static HWND hwndTree = nullptr;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -185,17 +185,17 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendMessage(hwndDlg, DM_HIDEPANE, 0, 0);
SendMessage(hwndDlg, DM_REBUILD_STREE, 0, 0);
TreeView_SetItemState(hwndTree, 0, TVIS_SELECTED, TVIS_SELECTED);
- CheckDlgButton(hwndDlg, IDC_ENABLESOUNDS, db_get_b(NULL, "Skin", "UseSound", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ENABLESOUNDS, db_get_b(0, "Skin", "UseSound", 0) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, DM_CHECKENABLED, 0, 0);
return TRUE;
case DM_REBUILD_STREE:
- TreeView_SelectItem(hwndTree, NULL);
+ TreeView_SelectItem(hwndTree, nullptr);
ShowWindow(hwndTree, SW_HIDE);
TreeView_DeleteAllItems(hwndTree);
{
TVINSERTSTRUCT tvis;
- tvis.hParent = NULL;
+ tvis.hParent = nullptr;
tvis.hInsertAfter = TVI_SORT;
tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
@@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvis.item.stateMask = TVIS_EXPANDED;
tvis.item.state = TVIS_EXPANDED;
tvis.hParent = FindNamedTreeItemAtRoot(hwndTree, arSounds[i].getSection());
- if (tvis.hParent == NULL) {
+ if (tvis.hParent == nullptr) {
tvis.item.lParam = -1;
tvis.item.pszText = arSounds[i].getSection();
tvis.hParent = tvis.item.hItem = TreeView_InsertItem(hwndTree, &tvis);
@@ -212,7 +212,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TreeView_SetItem(hwndTree, &tvis.item);
}
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(!db_get_b(NULL, "SkinSoundsOff", arSounds[i].name, 0)?2:1);
+ tvis.item.state = INDEXTOSTATEIMAGEMASK(!db_get_b(0, "SkinSoundsOff", arSounds[i].name, 0)?2:1);
tvis.item.lParam = i;
tvis.item.pszText = arSounds[i].getDescr();
TreeView_InsertItem(hwndTree, &tvis);
@@ -220,7 +220,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
TVITEM tvi;
tvi.hItem = TreeView_GetRoot(hwndTree);
- while (tvi.hItem != NULL) {
+ while (tvi.hItem != nullptr) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvi);
if (tvi.lParam == -1)
@@ -268,7 +268,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (LOWORD(wParam) == IDC_PREVIEW) {
HTREEITEM hti = TreeView_GetSelection(hwndTree);
- if (hti == NULL)
+ if (hti == nullptr)
break;
TVITEM tvi = { 0 };
@@ -283,7 +283,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM NotifyEventHooks(hPlayEvent, 1, (LPARAM)arSounds[tvi.lParam].ptszTempFile);
else {
DBVARIANT dbv;
- if (!db_get_ws(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
+ if (!db_get_ws(0, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
wchar_t szPathFull[MAX_PATH];
PathToAbsoluteW(dbv.ptszVal, szPathFull);
NotifyEventHooks(hPlayEvent, 1, (LPARAM)szPathFull);
@@ -295,7 +295,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (LOWORD(wParam) == IDC_CHANGE) {
HTREEITEM hti = TreeView_GetSelection(hwndTree);
- if (hti == NULL)
+ if (hti == nullptr)
break;
TVITEM tvi = { 0 };
@@ -306,15 +306,15 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (tvi.lParam == -1)
break;
- SoundItem& snd = arSounds[tvi.lParam];
+ SoundItem &snd = arSounds[tvi.lParam];
wchar_t str[MAX_PATH], strFull[MAX_PATH], strdir[MAX_PATH], filter[MAX_PATH];
if (snd.ptszTempFile)
wcsncpy_s(strFull, snd.ptszTempFile, _TRUNCATE);
else {
- if (db_get_b(NULL, "SkinSoundsOff", snd.name, 0) == 0) {
+ if (db_get_b(0, "SkinSoundsOff", snd.name, 0) == 0) {
DBVARIANT dbv;
- if (db_get_ws(NULL, "SkinSounds", snd.name, &dbv) == 0) {
+ if (db_get_ws(0, "SkinSounds", snd.name, &dbv) == 0) {
PathToAbsoluteW(dbv.ptszVal, strdir);
db_free(&dbv);
} } }
@@ -330,7 +330,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_snwprintf(filter, L"%s (*.wav)%c*.wav%c%s (*)%c*%c", TranslateT("WAV files"), 0, 0, TranslateT("All files"), 0, 0);
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = GetParent(hwndDlg);
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = filter;
wchar_t* slash = wcsrchr(strdir, '\\');
@@ -363,31 +363,32 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- db_set_b(NULL, "Skin", "UseSound", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS));
+ db_set_b(0, "Skin", "UseSound", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESOUNDS));
- for (int i=0; i < arSounds.getCount(); i++)
+ for (int i = 0; i < arSounds.getCount(); i++)
if (arSounds[i].ptszTempFile)
- db_set_ws(NULL, "SkinSounds", arSounds[i].name, arSounds[i].ptszTempFile);
+ db_set_ws(0, "SkinSounds", arSounds[i].name, arSounds[i].ptszTempFile);
TVITEM tvi, tvic;
tvi.hItem = TreeView_GetRoot(hwndTree);
- while (tvi.hItem != NULL) {
+ while (tvi.hItem != nullptr) {
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvi);
if (tvi.lParam == -1) {
tvic.hItem = TreeView_GetChild(hwndTree, tvi.hItem);
- while (tvic.hItem != NULL) {
+ while (tvic.hItem != nullptr) {
tvic.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
TreeView_GetItem(hwndTree, &tvic);
if (((tvic.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
- db_unset(NULL, "SkinSoundsOff", arSounds[tvic.lParam].name);
+ db_unset(0, "SkinSoundsOff", arSounds[tvic.lParam].name);
else
- db_set_b(NULL, "SkinSoundsOff", arSounds[tvic.lParam].name, 1);
+ db_set_b(0, "SkinSoundsOff", arSounds[tvic.lParam].name, 1);
tvic.hItem = TreeView_GetNextSibling(hwndTree, tvic.hItem);
- } }
+ }
+ }
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
@@ -396,7 +397,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case IDC_SOUNDTREE:
- switch(((NMHDR*)lParam)->code) {
+ switch (((NMHDR*)lParam)->code) {
case TVN_SELCHANGED:
{
NMTREEVIEW *pnmtv = (NMTREEVIEW*)lParam;
@@ -412,7 +413,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_LOCATION, arSounds[tvi.lParam].ptszTempFile);
else {
DBVARIANT dbv;
- if (!db_get_ws(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
+ if (!db_get_ws(0, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
SetDlgItemText(hwndDlg, IDC_LOCATION, dbv.ptszVal);
db_free(&dbv);
}
@@ -437,7 +438,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti))
if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMSTATEICON))
- if (TreeView_GetParent(hwndTree, hti.hItem) != NULL)
+ if (TreeView_GetParent(hwndTree, hti.hItem) != nullptr)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -486,6 +487,6 @@ int LoadSkinSounds(void) void UnloadSkinSounds(void)
{
- for (int i=0; i < arSounds.getCount(); i++)
+ for (int i = 0; i < arSounds.getCount(); i++)
arSounds[i].clear();
}
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index cb7e7430de..03aa63c405 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -34,9 +34,9 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si m_pEntry(nullptr), m_hContact(0) { - m_bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0) != 0; - m_bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1) != 0; - m_iLogFilterFlags = db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0); + m_bFilterEnabled = db_get_b(0, CHAT_MODULE, "FilterEnabled", 0) != 0; + m_bNicklistEnabled = db_get_b(0, CHAT_MODULE, "ShowNicklist", 1) != 0; + m_iLogFilterFlags = db_get_dw(0, CHAT_MODULE, "FilterFlags", 0x03E0); if (si) { m_hContact = si->hContact; @@ -83,7 +83,7 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) tr.chrg = pLink->chrg; tr.lpstrText = wszText.GetBuffer(); m_pLog->SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr); - if (wcschr(tr.lpstrText, '@') != NULL && wcschr(tr.lpstrText, ':') == NULL && wcschr(tr.lpstrText, '/') == NULL) + if (wcschr(tr.lpstrText, '@') != nullptr && wcschr(tr.lpstrText, ':') == nullptr && wcschr(tr.lpstrText, '/') == nullptr) wszText.Insert(0, L"mailto:"); if (pLink->msg == WM_RBUTTONDOWN) { @@ -94,7 +94,7 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) }; ClientToScreen(((NMHDR *)lParam)->hwndFrom, &pt); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) { case IDM_OPENLINK: Utils_OpenUrlW(wszText); break; diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp index bbd7202582..9b2f37207f 100644 --- a/src/mir_app/src/srmm_statusicon.cpp +++ b/src/mir_app/src/srmm_statusicon.cpp @@ -30,7 +30,7 @@ void UnloadSrmmToolbarModule(); void SafeDestroyIcon(HICON hIcon)
{
- if (hIcon != NULL)
+ if (hIcon != nullptr)
if (!IcoLib_IsManaged(hIcon))
::DestroyIcon(hIcon);
}
@@ -85,11 +85,11 @@ static HANDLE hHookIconsChanged; MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack)
{
- if (sid == NULL || sid->cbSize != sizeof(StatusIconData))
+ if (sid == nullptr || sid->cbSize != sizeof(StatusIconData))
return 1;
StatusIconMain *p = arIcons.find((StatusIconMain*)sid);
- if (p != NULL)
+ if (p != nullptr)
return Srmm_ModifyIcon(0, sid);
p = new StatusIconMain;
@@ -102,7 +102,7 @@ MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack) p->sid.tszTooltip = mir_a2u(sid->szTooltip);
arIcons.insert(p);
- NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
+ NotifyEventHooks(hHookIconsChanged, 0, (LPARAM)p);
return 0;
}
@@ -110,26 +110,26 @@ MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int _hLangpack) MIR_APP_DLL(int) Srmm_ModifyIcon(MCONTACT hContact, StatusIconData *sid)
{
- if (sid == NULL || sid->cbSize != sizeof(StatusIconData))
+ if (sid == nullptr || sid->cbSize != sizeof(StatusIconData))
return 1;
StatusIconMain *p = arIcons.find((StatusIconMain*)sid);
- if (p == NULL)
+ if (p == nullptr)
return 1;
- if (hContact == NULL) {
+ if (hContact == 0) {
mir_free(p->sid.szModule);
mir_free(p->sid.szTooltip);
memcpy(&p->sid, sid, sizeof(p->sid));
p->sid.szModule = mir_strdup(sid->szModule);
p->sid.tszTooltip = (sid->flags & MBF_UNICODE) ? mir_wstrdup(sid->wszTooltip) : mir_a2u(sid->szTooltip);
- NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
+ NotifyEventHooks(hHookIconsChanged, 0, (LPARAM)p);
return 0;
}
StatusIconChild *pc = p->arChildren.find((StatusIconChild*)&hContact);
- if (pc == NULL) {
+ if (pc == nullptr) {
pc = new StatusIconChild();
pc->hContact = hContact;
p->arChildren.insert(pc);
@@ -153,7 +153,7 @@ MIR_APP_DLL(void) Srmm_RemoveIcon(const char *szProto, DWORD iconId) {
StatusIconData tmp = { sizeof(tmp), (char*)szProto, iconId };
StatusIconMain *p = arIcons.find((StatusIconMain*)&tmp);
- if (p != NULL)
+ if (p != nullptr)
arIcons.remove(p);
}
@@ -191,7 +191,7 @@ MIR_APP_DLL(StatusIconData*) Srmm_GetNthIcon(MCONTACT hContact, int index) nVis++;
}
- return NULL;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -207,7 +207,7 @@ void KillModuleSrmmIcons(int _hLang) int LoadSrmmModule()
{
- g_hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
+ g_hCurHyperlinkHand = LoadCursor(nullptr, IDC_HAND);
LoadSrmmToolbarModule();
@@ -218,7 +218,7 @@ int LoadSrmmModule() void UnloadSrmmModule()
{
arIcons.destroy();
- NotifyEventHooks(hHookIconsChanged, NULL, NULL);
+ NotifyEventHooks(hHookIconsChanged, 0, 0);
DestroyHookableEvent(hHookIconsChanged);
DestroyCursor(g_hCurHyperlinkHand);
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 2531875b07..dd1c87c4fb 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -74,7 +74,7 @@ static void CB_GetButtonSettings(MCONTACT hContact, CustomButtonData *cbd) { DBVARIANT dbv = { 0 }; char SettingName[1024]; - char* token = NULL; + char* token = nullptr; // modulename_buttonID, position_inIM_inCHAT_isLSide_isRSide_CanBeHidden @@ -83,14 +83,14 @@ static void CB_GetButtonSettings(MCONTACT hContact, CustomButtonData *cbd) if (!db_get_s(hContact, MODULENAME, SettingName, &dbv)) { token = strtok(dbv.pszVal, "_"); cbd->m_dwPosition = (DWORD)atoi(token); - token = strtok(NULL, "_"); + token = strtok(nullptr, "_"); cbd->m_bIMButton = atoi(token) != 0; - token = strtok(NULL, "_"); + token = strtok(nullptr, "_"); cbd->m_bChatButton = atoi(token) != 0; - token = strtok(NULL, "_"); - token = strtok(NULL, "_"); + token = strtok(nullptr, "_"); + token = strtok(nullptr, "_"); cbd->m_bRSided = atoi(token) != 0; - token = strtok(NULL, "_"); + token = strtok(nullptr, "_"); cbd->m_bCanBeHidden = atoi(token) != 0; db_free(&dbv); @@ -109,7 +109,7 @@ MIR_APP_DLL(int) Srmm_GetButtonCount(void) MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang) { - if (bbdi == NULL) + if (bbdi == nullptr) return 1; CustomButtonData *cbd = new CustomButtonData(); @@ -139,7 +139,7 @@ MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang) cbd->m_hLangpack = _hLang; // download database settings - CB_GetButtonSettings(NULL, cbd); + CB_GetButtonSettings(0, cbd); arButtonsList.insert(cbd); @@ -154,7 +154,7 @@ MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang) MIR_APP_DLL(int) Srmm_GetButtonState(HWND hwndDlg, BBButton *bbdi) { - if (hwndDlg == NULL || bbdi == NULL) + if (hwndDlg == nullptr || bbdi == nullptr) return 1; DWORD tempCID = 0; @@ -176,7 +176,7 @@ MIR_APP_DLL(int) Srmm_GetButtonState(HWND hwndDlg, BBButton *bbdi) MIR_APP_DLL(int) Srmm_SetButtonState(MCONTACT hContact, BBButton *bbdi) { - if (hContact == NULL || bbdi == NULL) + if (hContact == 0 || bbdi == nullptr) return 1; DWORD tempCID = 0; @@ -191,11 +191,11 @@ MIR_APP_DLL(int) Srmm_SetButtonState(MCONTACT hContact, BBButton *bbdi) return 1; HWND hwndDlg = WindowList_Find(chatApi.hWindowList, hContact); - if (hwndDlg == NULL) + if (hwndDlg == nullptr) return 1; HWND hwndBtn = GetDlgItem(hwndDlg, tempCID); - if (hwndBtn == NULL) + if (hwndBtn == nullptr) return 1; SetWindowTextA(hwndBtn, bbdi->pszModuleName); @@ -217,7 +217,7 @@ MIR_APP_DLL(int) Srmm_RemoveButton(BBButton *bbdi) if (!bbdi) return 1; - CustomButtonData *pFound = NULL; + CustomButtonData *pFound = nullptr; { mir_cslock lck(csToolBar); @@ -243,7 +243,7 @@ MIR_APP_DLL(int) Srmm_ModifyButton(BBButton *bbdi) return 1; bool bFound = false; - CustomButtonData *cbd = NULL; + CustomButtonData *cbd = nullptr; { mir_cslock lck(csToolBar); @@ -329,9 +329,9 @@ MIR_APP_DLL(void) Srmm_CreateToolbarIcons(HWND hwndDlg, int flags) HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); if ((flags & BBBF_ISIMBUTTON) && cbd->m_bIMButton || (flags & BBBF_ISCHATBUTTON) && cbd->m_bChatButton) { - if (hwndButton == NULL) { - hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, cbd->m_iButtonWidth, DPISCALEX_S(22), hwndDlg, (HMENU)cbd->m_dwButtonCID, hInstance, NULL); - if (hwndButton == NULL) // smth went wrong + if (hwndButton == nullptr) { + hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, cbd->m_iButtonWidth, DPISCALEX_S(22), hwndDlg, (HMENU)cbd->m_dwButtonCID, hInstance, nullptr); + if (hwndButton == nullptr) // smth went wrong continue; // if there's a pre-created button control in a class, initialize it @@ -368,7 +368,7 @@ MIR_APP_DLL(void) Srmm_UpdateToolbarIcons(HWND hwndDlg) { for (int i = 0; i < arButtonsList.getCount(); i++) { CustomButtonData *cbd = arButtonsList[i]; - if (cbd->m_bSeparator || cbd->m_hIcon == NULL) + if (cbd->m_bSeparator || cbd->m_hIcon == nullptr) continue; HWND hwndBtn = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); @@ -456,7 +456,7 @@ class CSrmmToolbarOptions : public CDlgBase { mir_cslock lck(csToolBar); - while (tvi.hItem != NULL) { + while (tvi.hItem != nullptr) { m_toolBar.GetItem(&tvi); if (mir_wstrcmp(tvi.pszText, MIDDLE_SEPARATOR) == 0) { @@ -500,7 +500,7 @@ class CSrmmToolbarOptions : public CDlgBase } cbd->m_dwPosition = (DWORD)count; - CB_WriteButtonSettings(NULL, cbd); + CB_WriteButtonSettings(0, cbd); if (!(cbd->m_opFlags & BBSF_NTBDESTRUCT)) (RSide) ? (count -= 10) : (count += 10); @@ -524,7 +524,7 @@ class CSrmmToolbarOptions : public CDlgBase int iImage = 0; TVINSERTSTRUCT tvis; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE; @@ -589,7 +589,7 @@ public: m_btnReset(this, IDC_BBRESET), m_btnHidden(this, IDC_CANBEHIDDEN), m_btnSeparator(this, IDC_SEPARATOR), - m_hImgl(NULL) + m_hImgl(nullptr) { m_toolBar.SetFlags(MTREE_DND); // enable drag-n-drop m_toolBar.OnSelChanged = Callback(this, &CSrmmToolbarOptions::OnTreeSelChanged); @@ -609,7 +609,7 @@ public: m_btnHidden.Disable(); m_gap.SetRange(10); - m_gap.SetPosition(db_get_b(NULL, MODULENAME, "ButtonsBarGap", 1)); + m_gap.SetPosition(db_get_b(0, MODULENAME, "ButtonsBarGap", 1)); } virtual void OnDestroy() override @@ -620,12 +620,12 @@ public: virtual void OnApply() override { - OnTreeSelChanging(NULL); // save latest changes + OnTreeSelChanging(nullptr); // save latest changes SaveTree(); // save the whole tree then CB_ReInitCustomButtons(); WORD newGap = m_gap.GetPosition(); - if (newGap != db_get_b(NULL, MODULENAME, "ButtonsBarGap", 1)) { + if (newGap != db_get_b(0, MODULENAME, "ButtonsBarGap", 1)) { WindowList_BroadcastAsync(chatApi.hWindowList, WM_SIZE, 0, 0); db_set_b(0, MODULENAME, "ButtonsBarGap", newGap); } @@ -640,12 +640,12 @@ public: virtual void OnReset() override { CB_ReInitCustomButtons(); - dwSepCount = db_get_dw(NULL, MODULENAME, "SeparatorsCount", 0); + dwSepCount = db_get_dw(0, MODULENAME, "SeparatorsCount", 0); } void btnResetClicked(void*) { - db_delete_module(NULL, MODULENAME); + db_delete_module(0, MODULENAME); CB_HardReInit(); BuildMenuObjectsTree(); NotifyChange(); @@ -666,7 +666,7 @@ public: arButtonsList.insert(cbd); TVINSERTSTRUCT tvis; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = hItem; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; @@ -682,7 +682,7 @@ public: void OnTreeSelChanging(void*) { HTREEITEM hItem = m_toolBar.GetSelection(); - if (hItem == NULL) + if (hItem == nullptr) return; wchar_t strbuf[128]; @@ -706,7 +706,7 @@ public: void OnTreeSelChanged(void*) { HTREEITEM hItem = m_toolBar.GetSelection(); - if (hItem == NULL) + if (hItem == nullptr) return; wchar_t strbuf[128]; @@ -784,8 +784,8 @@ static void CALLBACK SrmmLoadToolbar() static int ConvertToolbarData(const char *szSetting, LPARAM) { DBVARIANT dbv; - if (!db_get(NULL, "Tab" MODULENAME, szSetting, &dbv)) { - db_set(NULL, MODULENAME, szSetting, &dbv); + if (!db_get(0, "Tab" MODULENAME, szSetting, &dbv)) { + db_set(0, MODULENAME, szSetting, &dbv); db_free(&dbv); } return 0; @@ -806,12 +806,12 @@ void LoadSrmmToolbarModule() ReleaseDC(0, hScrnDC); // old data? convert them - if (db_get_dw(NULL, "Tab" MODULENAME, "SeparatorsCount", -1) != -1) { - db_enum_settings(NULL, ConvertToolbarData, "Tab" MODULENAME, NULL); - db_delete_module(NULL, "Tab" MODULENAME); + if (db_get_dw(0, "Tab" MODULENAME, "SeparatorsCount", -1) != -1) { + db_enum_settings(0, ConvertToolbarData, "Tab" MODULENAME, nullptr); + db_delete_module(0, "Tab" MODULENAME); } - dwSepCount = db_get_dw(NULL, MODULENAME, "SeparatorsCount", 0); + dwSepCount = db_get_dw(0, MODULENAME, "SeparatorsCount", 0); CB_RegisterSeparators(); } diff --git a/src/mir_app/src/usedIcons.cpp b/src/mir_app/src/usedIcons.cpp index 7b0b90c8f3..ac679e201a 100644 --- a/src/mir_app/src/usedIcons.cpp +++ b/src/mir_app/src/usedIcons.cpp @@ -49,12 +49,12 @@ static OBJLIST<Icon> usedIcons(50, SortFunc); static Icon* FindIcon(const char *icolibName)
{
Icon *icon = usedIcons.find((Icon*)&icolibName);
- if (icon == NULL)
+ if (icon == nullptr)
usedIcons.insert(icon = new Icon(icolibName));
if (icon->hImage == INVALID_HANDLE_VALUE) {
HICON hIcon = IcoLib_GetIcon(icon->name);
- if (hIcon != NULL) {
+ if (hIcon != nullptr) {
icon->hImage = ExtraIcon_AddIcon(hIcon);
IcoLib_ReleaseIcon(hIcon);
}
@@ -78,7 +78,7 @@ HANDLE AddIcon(const char *icolibName) void RemoveIcon(const char *icolibName)
{
Icon *icon = usedIcons.find((Icon*)&icolibName);
- if (icon != NULL)
+ if (icon != nullptr)
icon->refCount--;
}
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp index 6a835d8565..375c150f7f 100644 --- a/src/mir_app/src/utils.cpp +++ b/src/mir_app/src/utils.cpp @@ -296,7 +296,7 @@ static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM) if ((int)wParam == countries[i].id)
return (INT_PTR)countries[i].szName;
- return NULL;
+ return 0;
}
static INT_PTR GetCountryByISOCode(WPARAM wParam, LPARAM)
@@ -305,7 +305,7 @@ static INT_PTR GetCountryByISOCode(WPARAM wParam, LPARAM) if ( mir_strcmpi((char*)wParam, countries[i].ISOcode) == 0)
return (INT_PTR)countries[i].szName;
- return NULL;
+ return 0;
}
static INT_PTR GetCountryList(WPARAM wParam, LPARAM lParam)
diff --git a/src/mir_app/src/visibility.cpp b/src/mir_app/src/visibility.cpp index 9705282332..d03a97c99f 100644 --- a/src/mir_app/src/visibility.cpp +++ b/src/mir_app/src/visibility.cpp @@ -102,18 +102,18 @@ static void SetAllContactIcons(HWND hwndList) {
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
- if (hItem == NULL)
+ if (hItem == nullptr)
continue;
DWORD flags;
WORD status;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL) {
+ if (szProto == nullptr) {
flags = 0;
status = 0;
}
else {
- flags = CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ flags = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAGNUM_1, 0);
status = db_get_w(hContact, szProto, "ApparentMode", 0);
}
@@ -157,7 +157,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP hItemAll = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
}
SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
return TRUE;
case WM_SETFOCUS:
@@ -173,7 +173,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
//fall through
case CLN_CONTACTMOVED:
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
break;
case CLN_OPTIONSCHANGED:
@@ -189,7 +189,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP // Find clicked item
DWORD hitFlags;
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL)
+ if (hItem == nullptr)
break;
// It was not a visbility icon
@@ -226,7 +226,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP }
}
// Update the all/none icons
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
// Activate Apply button
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -237,7 +237,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP if (((LPNMHDR)lParam)->code == PSN_APPLY) {
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, hContact, 0);
- if (hItem == NULL)
+ if (hItem == nullptr)
continue;
int set = 0;
diff --git a/src/mir_app/src/xmlApi.cpp b/src/mir_app/src/xmlApi.cpp index 475c856129..556708948c 100644 --- a/src/mir_app/src/xmlApi.cpp +++ b/src/mir_app/src/xmlApi.cpp @@ -40,34 +40,34 @@ MIR_APP_DLL(void) xmlDestroyNode(HXML n) MIR_APP_DLL(HXML) xmlParseFile(LPCTSTR str, int* datalen, LPCTSTR tag)
{
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
XMLResults res;
XMLNode result = XMLNode::parseFile(str, tag, &res);
- if (datalen != NULL)
+ if (datalen != nullptr)
datalen[0] += res.nChars;
- return (res.error == eXMLErrorNone || (tag != NULL && res.error == eXMLErrorMissingEndTag)) ? result.detach() : NULL;
+ return (res.error == eXMLErrorNone || (tag != nullptr && res.error == eXMLErrorMissingEndTag)) ? result.detach() : nullptr;
}
MIR_APP_DLL(HXML) xmlParseString(LPCTSTR str, int* datalen, LPCTSTR tag)
{
- if (str == NULL) return NULL;
+ if (str == nullptr) return nullptr;
XMLResults res;
XMLNode result = XMLNode::parseString(str, tag, &res);
- if (datalen != NULL)
+ if (datalen != nullptr)
datalen[0] += res.nChars;
- return (res.error == eXMLErrorNone || (tag != NULL && res.error == eXMLErrorMissingEndTag)) ? result.detach() : NULL;
+ return (res.error == eXMLErrorNone || (tag != nullptr && res.error == eXMLErrorMissingEndTag)) ? result.detach() : nullptr;
}
MIR_APP_DLL(HXML) xmlAddChild(HXML _n, LPCTSTR name, LPCTSTR text)
{
XMLNode result = XMLNode(_n).addChild(name);
- if (text != NULL)
+ if (text != nullptr)
result.updateText(text);
return result;
}
@@ -171,12 +171,12 @@ MIR_APP_DLL(LPTSTR) xmlToString(HXML _n, int* datalen) MIR_APP_DLL(XMLError) xmlToFile(HXML _n, LPCTSTR filename, int withformatting)
{
- return XMLNode(_n).writeToFile(filename, NULL, withformatting);
+ return XMLNode(_n).writeToFile(filename, nullptr, withformatting);
}
MIR_APP_DLL(void) xmlAddAttr(HXML _n, LPCTSTR attrName, LPCTSTR attrValue)
{
- if (attrName != NULL && attrValue != NULL)
+ if (attrName != nullptr && attrValue != nullptr)
XMLNode(_n).addAttribute(attrName, attrValue);
}
@@ -247,15 +247,15 @@ MIR_APP_DLL(int) xmlGetElement(HXML _n, XML_ELEMENT_POS pos, XML_ELEMENT_TYPE *t {
// reset all values
if (child)
- *child = NULL;
+ *child = nullptr;
if (value)
- *value = NULL;
+ *value = nullptr;
if (name)
- *name = NULL;
+ *name = nullptr;
if (openTag)
- *openTag = NULL;
+ *openTag = nullptr;
if (closeTag)
- *closeTag = NULL;
+ *closeTag = nullptr;
if (!type || pos >= XMLNode(_n).nElement())
return false;
@@ -325,12 +325,12 @@ MIR_APP_DLL(void) xmlAddChildEx2(HXML _n, HXML parent, XML_ELEMENT_POS pos) MIR_APP_DLL(void) xmlSetAttrByIndex(HXML _n, int i, LPCTSTR value)
{
- XMLNode(_n).updateAttribute(value, NULL, i);
+ XMLNode(_n).updateAttribute(value, nullptr, i);
}
MIR_APP_DLL(void) xmlSetAttrByName(HXML _n, LPCTSTR name, LPCTSTR value)
{
- XMLNode(_n).updateAttribute(value, NULL, name);
+ XMLNode(_n).updateAttribute(value, nullptr, name);
}
MIR_APP_DLL(void) xmlDeleteNodeContent(HXML _n)
diff --git a/src/mir_app/src/xmlParser.cpp b/src/mir_app/src/xmlParser.cpp index 945f809008..7048ad65b6 100644 --- a/src/mir_app/src/xmlParser.cpp +++ b/src/mir_app/src/xmlParser.cpp @@ -82,7 +82,7 @@ static ALLXMLClearTag XMLClearTags[] = { _CXML("<!--") , 4, _CXML("-->") }, { _CXML("<PRE>") , 5, _CXML("</PRE>") }, // { _CXML("<Script>") , 8, _CXML("</Script>")}, - { NULL , 0, NULL } + { nullptr , 0, nullptr } }; // You can modify the initialization of the variable "XMLEntities" below @@ -97,7 +97,7 @@ static XMLCharacterEntity XMLEntities[] = { _CXML(">"), 4, _CXML('>')}, { _CXML("""), 6, _CXML('\"')}, { _CXML("'"), 6, _CXML('\'')}, - { NULL , 0, '\0' } + { nullptr , 0, '\0' } }; // When rendering the XMLNode to a string (using the "createXMLString" function), @@ -176,13 +176,13 @@ char myIsTextWideChar(const void *b, int len) // inspired by the Wine API: RtlIs for (i=0; i<len; i++) if (s[i] <= (unsigned short)255) stats++; if (stats>len/2) return TRUE; - // Check for UNICODE NULL chars + // Check for UNICODE nullptr chars for (i=0; i<len; i++) if (!s[i]) return TRUE; return FALSE; } #else -char myIsTextWideChar(const void *b, int l) { return (char)IsTextUnicode((CONST LPVOID)b, l, NULL); } +char myIsTextWideChar(const void *b, int l) { return (char)IsTextUnicode((CONST LPVOID)b, l, nullptr); } #endif #endif @@ -192,9 +192,9 @@ char myIsTextWideChar(const void *b, int l) { return (char)IsTextUnicode((CONST wchar_t *myMultiByteToWideChar(const char *s, XMLNode::XMLCharEncoding ce) { int i; - if (ce == XMLNode::char_encoding_UTF8) i = (int)MultiByteToWideChar(CP_UTF8, 0 , s, -1, NULL, 0); - else i = (int)MultiByteToWideChar(CP_ACP , MB_PRECOMPOSED, s, -1, NULL, 0); - if (i<0) return NULL; + if (ce == XMLNode::char_encoding_UTF8) i = (int)MultiByteToWideChar(CP_UTF8, 0 , s, -1, nullptr, 0); + else i = (int)MultiByteToWideChar(CP_ACP , MB_PRECOMPOSED, s, -1, nullptr, 0); + if (i<0) return nullptr; wchar_t *d = (wchar_t *)malloc((i+1)*sizeof(XMLCHAR)); if (ce == XMLNode::char_encoding_UTF8) i = (int)MultiByteToWideChar(CP_UTF8, 0 , s, -1, d, i); else i = (int)MultiByteToWideChar(CP_ACP , MB_PRECOMPOSED, s, -1, d, i); @@ -216,12 +216,12 @@ char *myWideCharToMultiByte(const wchar_t *s) 0, // performance and mapping flags s, // wide-character string -1, // number of chars in string - NULL, // buffer for new string + nullptr, // buffer for new string 0, // size of buffer - NULL, // default for unmappable chars - NULL // set when default char used + nullptr, // default for unmappable chars + nullptr // set when default char used ); - if (i<0) return NULL; + if (i<0) return nullptr; char *d = (char*)malloc(i+1); WideCharToMultiByte(codePage, // code page 0, // performance and mapping flags @@ -229,8 +229,8 @@ char *myWideCharToMultiByte(const wchar_t *s) -1, // number of chars in string d, // buffer for new string i, // size of buffer - NULL, // default for unmappable chars - NULL // set when default char used + nullptr, // default for unmappable chars + nullptr // set when default char used ); d[i] = 0; return d; @@ -251,15 +251,15 @@ static inline XMLSTR xstrcpy(XMLSTR c1, XMLCSTR c2) { return (XMLSTR)mir_strcpy( #else // for gcc and CC #ifdef XML_NO_WIDE_CHAR -char *myWideCharToMultiByte(const wchar_t *s) { return NULL; } +char *myWideCharToMultiByte(const wchar_t *s) { return nullptr; } #else char *myWideCharToMultiByte(const wchar_t *s) { const wchar_t *ss = s; - int i = (int)wcsrtombs(NULL, &ss, 0, NULL); - if (i<0) return NULL; + int i = (int)wcsrtombs(nullptr, &ss, 0, nullptr); + if (i<0) return nullptr; char *d = (char *)malloc(i+1); - wcsrtombs(d, &s, i, NULL); + wcsrtombs(d, &s, i, nullptr); d[i] = 0; return d; } @@ -268,10 +268,10 @@ char *myWideCharToMultiByte(const wchar_t *s) wchar_t *myMultiByteToWideChar(const char *s, XMLNode::XMLCharEncoding ce) { const char *ss = s; - int i = (int)mbsrtowcs(NULL, &ss, 0, NULL); - if (i<0) return NULL; + int i = (int)mbsrtowcs(nullptr, &ss, 0, nullptr); + if (i<0) return nullptr; wchar_t *d = (wchar_t *)malloc((i+1)*sizeof(wchar_t)); - mbsrtowcs(d, &s, i, NULL); + mbsrtowcs(d, &s, i, nullptr); d[i] = 0; return d; } @@ -353,14 +353,14 @@ double xmltof(XMLCSTR t, double v) { if (t&&(*t)) swscanf(t, L"%lf", &v); /*v #ifdef sun // for CC #include <widec.h> -char xmltob(XMLCSTR t, char v) { if (t) return (char)wstol(t, NULL, 10); return v; } -int xmltoi(XMLCSTR t, int v) { if (t) return (int)wstol(t, NULL, 10); return v; } -long xmltol(XMLCSTR t, long v) { if (t) return wstol(t, NULL, 10); return v; } +char xmltob(XMLCSTR t, char v) { if (t) return (char)wstol(t, nullptr, 10); return v; } +int xmltoi(XMLCSTR t, int v) { if (t) return (int)wstol(t, nullptr, 10); return v; } +long xmltol(XMLCSTR t, long v) { if (t) return wstol(t, nullptr, 10); return v; } #else // for gcc -char xmltob(XMLCSTR t, char v) { if (t) return (char)wcstol(t, NULL, 10); return v; } -int xmltoi(XMLCSTR t, int v) { if (t) return (int)wcstol(t, NULL, 10); return v; } -long xmltol(XMLCSTR t, long v) { if (t) return wcstol(t, NULL, 10); return v; } +char xmltob(XMLCSTR t, char v) { if (t) return (char)wcstol(t, nullptr, 10); return v; } +int xmltoi(XMLCSTR t, int v) { if (t) return (int)wcstol(t, nullptr, 10); return v; } +long xmltol(XMLCSTR t, long v) { if (t) return wcstol(t, nullptr, 10); return v; } #endif double xmltof(XMLCSTR t, double v) { if (t&&(*t)) swscanf(t, L"%lf", &v); /*v = _wtof(t);*/ return v; } #endif @@ -412,7 +412,7 @@ XMLNode XMLNode::openFileHelper(XMLCSTR filename, XMLCSTR tag) // display message #if defined(_XMLWINDOWS) && !defined(UNDER_CE) && !defined(_XMLPARSER_NO_MESSAGEBOX_) - MessageBoxA(NULL, message, "XML Parsing error", MB_OK|MB_ICONERROR|MB_TOPMOST); + MessageBoxA(nullptr, message, "XML Parsing error", MB_OK|MB_ICONERROR|MB_TOPMOST); #else printf("%s", message); #endif @@ -528,8 +528,8 @@ static const char *XML_ByteTable = (const char *)XML_utf8ByteTable; // the defau XMLNode XMLNode::emptyXMLNode; -XMLClear XMLNode::emptyXMLClear = { NULL, NULL, NULL}; -XMLAttribute XMLNode::emptyXMLAttribute = { NULL, NULL}; +XMLClear XMLNode::emptyXMLClear = { nullptr, nullptr, nullptr}; +XMLAttribute XMLNode::emptyXMLAttribute = { nullptr, nullptr}; // Enumeration used to decipher what type a token is typedef enum XMLTokenTypeTag @@ -656,7 +656,7 @@ XMLError XMLNode::writeToFile(XMLCSTR filename, const char* /*encoding*/, char n // Duplicate a given string. XMLSTR stringDup(XMLCSTR lpszData, int cbData) { - if (lpszData == NULL) return NULL; + if (lpszData == nullptr) return nullptr; XMLSTR lpszNew; if (cbData == -1) cbData = (int)xstrlen(lpszData); @@ -664,7 +664,7 @@ XMLSTR stringDup(XMLCSTR lpszData, int cbData) if (lpszNew) { memcpy(lpszNew, lpszData, (cbData) * sizeof(XMLCHAR)); - lpszNew[cbData] = (XMLCHAR)NULL; + lpszNew[cbData] = (XMLCHAR)nullptr; } return lpszNew; } @@ -726,7 +726,7 @@ out_of_loop1: } ToXMLStringTool::~ToXMLStringTool() { freeBuffer(); } -void ToXMLStringTool::freeBuffer() { if (buf) free(buf); buf = NULL; buflen = 0; } +void ToXMLStringTool::freeBuffer() { if (buf) free(buf); buf = nullptr; buflen = 0; } XMLSTR ToXMLStringTool::toXML(XMLCSTR source) { if (!source) @@ -750,7 +750,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) // // in: string (s) and length (lo) of string // out: new allocated string converted from xml - if (!s) return NULL; + if (!s) return nullptr; int ll = 0, j; XMLSTR d; @@ -768,7 +768,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) if (*s != _CXML(';')) { pXML->error = eXMLErrorUnknownCharacterEntity; - return NULL; + return nullptr; } s++; lo--; } else @@ -782,7 +782,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) if (!entity->s) { pXML->error = eXMLErrorUnknownCharacterEntity; - return NULL; + return nullptr; } } } else @@ -813,7 +813,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) if ((*ss>=_CXML('0'))&&(*ss <= _CXML('9'))) j = (j<<4)+*ss-_CXML('0'); else if ((*ss>=_CXML('A'))&&(*ss <= _CXML('F'))) j = (j<<4)+*ss-_CXML('A')+10; else if ((*ss>=_CXML('a'))&&(*ss <= _CXML('f'))) j = (j<<4)+*ss-_CXML('a')+10; - else { free((void*)s); pXML->error = eXMLErrorUnknownCharacterEntity;return NULL;} + else { free((void*)s); pXML->error = eXMLErrorUnknownCharacterEntity;return nullptr;} ss++; } } else @@ -821,12 +821,12 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) while (*ss != _CXML(';')) { if ((*ss>=_CXML('0'))&&(*ss <= _CXML('9'))) j = (j*10)+*ss-_CXML('0'); - else { free((void*)s); pXML->error = eXMLErrorUnknownCharacterEntity;return NULL;} + else { free((void*)s); pXML->error = eXMLErrorUnknownCharacterEntity;return nullptr;} ss++; } } #ifndef _XMLWIDECHAR - if (j>255) { free((void*)s); pXML->error = eXMLErrorCharacterCodeAbove255;return NULL;} + if (j>255) { free((void*)s); pXML->error = eXMLErrorCharacterCodeAbove255;return nullptr;} #endif (*d++) = (XMLCHAR)j; ss++; } else @@ -857,7 +857,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML) #ifndef _XMLWIDECHAR if (characterEncoding != XMLNode::char_encoding_legacy) - Utf8Decode((XMLSTR)s, NULL); + Utf8Decode((XMLSTR)s, nullptr); #endif return (XMLSTR)s; @@ -903,7 +903,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT XMLCHAR ch; XMLCHAR chTemp; int indexStart, nFoundMatch, nIsText = FALSE; - result.pClr = NULL; // prevent warning + result.pClr = nullptr; // prevent warning // Find next non-white space character do { indexStart = pXML->nIndex; ch = getNextChar(pXML); } while XML_isSPACECHAR(ch); @@ -1058,7 +1058,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT // If we failed to obtain a valid character *pcbToken = 0; *pType = eTokenError; - result.pStr = NULL; + result.pStr = nullptr; } return result; @@ -1066,7 +1066,7 @@ static NextToken GetNextToken(XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pT XMLCSTR XMLNode::updateName_WOSD(XMLSTR lpszName) { - if (!d) { free(lpszName); return NULL; } + if (!d) { free(lpszName); return nullptr; } if (d->lpszName&&(lpszName != d->lpszName)) free((void*)d->lpszName); d->lpszName = lpszName; return lpszName; @@ -1079,7 +1079,7 @@ XMLNode::XMLNode(XMLNodeData *pParent, XMLSTR lpszName, char isDeclaration) d = (XMLNodeData*)malloc(sizeof(XMLNodeData)); d->ref_count = 1; - d->lpszName = NULL; + d->lpszName = nullptr; d->nChild = 0; d->nText = 0; d->nClear = 0; @@ -1088,17 +1088,17 @@ XMLNode::XMLNode(XMLNodeData *pParent, XMLSTR lpszName, char isDeclaration) d->isDeclaration = isDeclaration; d->pParent = pParent; - d->pChild = NULL; - d->pText = NULL; - d->pClear = NULL; - d->pAttribute = NULL; - d->pOrder = NULL; + d->pChild = nullptr; + d->pText = nullptr; + d->pClear = nullptr; + d->pAttribute = nullptr; + d->pOrder = nullptr; - d->pInnerText = NULL; + d->pInnerText = nullptr; updateName_WOSD(lpszName); - d->lpszNS = NULL; + d->lpszNS = nullptr; if (lpszName && pParent && pParent->lpszName && !pParent->isDeclaration) { wchar_t* p = wcschr(lpszName, ':'); if (p) { @@ -1109,15 +1109,15 @@ XMLNode::XMLNode(XMLNodeData *pParent, XMLSTR lpszName, char isDeclaration) } } -XMLNode XMLNode::createXMLTopNode_WOSD(XMLSTR lpszName, char isDeclaration) { return XMLNode(NULL, lpszName, isDeclaration); } -XMLNode XMLNode::createXMLTopNode(XMLCSTR lpszName, char isDeclaration) { return XMLNode(NULL, stringDup(lpszName), isDeclaration); } +XMLNode XMLNode::createXMLTopNode_WOSD(XMLSTR lpszName, char isDeclaration) { return XMLNode(nullptr, lpszName, isDeclaration); } +XMLNode XMLNode::createXMLTopNode(XMLCSTR lpszName, char isDeclaration) { return XMLNode(nullptr, stringDup(lpszName), isDeclaration); } #define MEMORYINCREASE 50 static inline void myFree(void *p) { if (p) free(p); } static inline void *myRealloc(void *p, int newsize, int memInc, int sizeofElem) { - if (p == NULL) { if (memInc) return malloc(memInc*sizeofElem); return malloc(sizeofElem); } + if (p == nullptr) { if (memInc) return malloc(memInc*sizeofElem); return malloc(sizeofElem); } if ((memInc == 0) || ((newsize%memInc) == 0)) p = realloc(p, (newsize+memInc)*sizeofElem); // if (!p) // { @@ -1179,7 +1179,7 @@ XMLNode XMLNode::addChild_priv(int memoryIncrease, XMLSTR lpszName, char isDecla { if (!lpszName) return emptyXMLNode; d->pChild = (XMLNode*)addToOrder(memoryIncrease, &pos, d->nChild, d->pChild, sizeof(XMLNode), eNodeChild); - d->pChild[pos].d = NULL; + d->pChild[pos].d = nullptr; d->pChild[pos] = XMLNode(d, lpszName, isDeclaration); d->nChild++; return d->pChild[pos]; @@ -1208,8 +1208,8 @@ XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XM // Add text to the element. XMLCSTR XMLNode::addText_priv(int memoryIncrease, XMLSTR lpszValue, int pos) { - if (!lpszValue) return NULL; - if (!d) { myFree(lpszValue); return NULL; } + if (!lpszValue) return nullptr; + if (!d) { myFree(lpszValue); return nullptr; } invalidateInnerText(); d->pText = (XMLCSTR*)addToOrder(memoryIncrease, &pos, d->nText, d->pText, sizeof(XMLSTR), eNodeText); d->pText[pos] = lpszValue; @@ -1241,7 +1241,7 @@ char XMLNode::parseClearTag(void *px, void *_pClear) XML *pXML = (XML *)px; ALLXMLClearTag pClear = *((ALLXMLClearTag*)_pClear); int cbTemp = 0; - XMLCSTR lpszTemp = NULL; + XMLCSTR lpszTemp = nullptr; XMLCSTR lpXML = &pXML->lpXML[pXML->nIndex]; static XMLCSTR docTypeEnd = _CXML("]>"); @@ -1270,7 +1270,7 @@ char XMLNode::parseClearTag(void *px, void *_pClear) pXML->nIndex += cbTemp+(int)xstrlen(pClear.lpszClose); // Add the clear node to the current element - addClear_priv(MEMORYINCREASE, cbTemp?stringDup(lpXML, cbTemp):NULL, pClear.lpszOpen, pClear.lpszClose, -1); + addClear_priv(MEMORYINCREASE, cbTemp?stringDup(lpXML, cbTemp):nullptr, pClear.lpszOpen, pClear.lpszClose, -1); return 0; } @@ -1295,12 +1295,12 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) if (!lpszText) return 0; if (dropWhiteSpace) while (XML_isSPACECHAR(*lpszText)&&(lpszText != tokenPStr)) lpszText++; int cbText = (int)(tokenPStr - lpszText); - if (!cbText) { pXML->lpszText = NULL; return 0; } + if (!cbText) { pXML->lpszText = nullptr; return 0; } if (dropWhiteSpace) { cbText--; while ((cbText)&&XML_isSPACECHAR(lpszText[cbText])) cbText--; cbText++; } - if (!cbText) { pXML->lpszText = NULL; return 0; } + if (!cbText) { pXML->lpszText = nullptr; return 0; } XMLSTR lpt = fromXMLString(lpszText, cbText, pXML); if (!lpt) return 1; - pXML->lpszText = NULL; + pXML->lpszText = nullptr; if (removeCommentsInMiddleOfText && d->nText && d->nClear) { // if the previous insertion was a comment (<!-- -->) AND @@ -1338,7 +1338,7 @@ int XMLNode::ParseXMLElement(void *pa) int cbToken; enum XMLTokenTypeTag xtype; NextToken token; - XMLCSTR lpszTemp = NULL; + XMLCSTR lpszTemp = nullptr; int cbTemp = 0; char nDeclaration; XMLNode pNew; @@ -1626,7 +1626,7 @@ LBL_Error: // Eg. 'Attribute AnotherAttribute' case eTokenText: // Add the unvalued attribute to the list - addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), NULL); + addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), nullptr); // Cache the token then indicate. We are next to // look for the equals attribute lpszTemp = token.pStr; @@ -1651,7 +1651,7 @@ LBL_Error: if (cbTemp) { // Add the unvalued attribute to the list - addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), NULL); + addAttribute_priv(MEMORYINCREASE, stringDup(lpszTemp, cbTemp), nullptr); } // If this is the end of the tag then return to the caller @@ -1761,7 +1761,7 @@ static void CountLinesAndColumns(XMLCSTR lpXML, int nUpto, XMLResults *pResults) assert(lpXML); assert(pResults); - struct XML xml = { lpXML, lpXML, 0, 0, eXMLErrorNone, NULL, 0, NULL, 0, TRUE }; + struct XML xml = { lpXML, lpXML, 0, 0, eXMLErrorNone, nullptr, 0, nullptr, 0, TRUE }; pResults->nLine = 1; pResults->nColumn = 1; @@ -1791,8 +1791,8 @@ XMLNode XMLNode::parseString(XMLCSTR lpszXML, XMLCSTR tag, XMLResults *pResults) return emptyXMLNode; } - XMLNode xnode(NULL, NULL, FALSE); - struct XML xml = { lpszXML, lpszXML, 0, 0, eXMLErrorNone, NULL, 0, NULL, 0, TRUE }; + XMLNode xnode(nullptr, nullptr, FALSE); + struct XML xml = { lpszXML, lpszXML, 0, 0, eXMLErrorNone, nullptr, 0, nullptr, 0, TRUE }; // Create header element xnode.ParseXMLElement(&xml); @@ -1848,7 +1848,7 @@ XMLNode XMLNode::parseFile(XMLCSTR filename, XMLCSTR tag, XMLResults *pResults) { if (pResults) { pResults->nLine = 0; pResults->nColumn = 0; } FILE *f = xfopen(filename, _CXML("rb")); - if (f == NULL) { if (pResults) pResults->error = eXMLErrorFileNotFound; return emptyXMLNode; } + if (f == nullptr) { if (pResults) pResults->error = eXMLErrorFileNotFound; return emptyXMLNode; } fseek(f, 0, SEEK_END); int l = (int)ftell(f), headerSz = 0; if (!l) { if (pResults) pResults->error = eXMLErrorEmpty; fclose(f); return emptyXMLNode; } @@ -2165,21 +2165,21 @@ int XMLNode::CreateXMLStringR(XMLNodeData *pEntry, XMLSTR lpszMarker, int nForma // with carriage returns and indentation. // @param int *pnSize - [out] pointer to the size of the // returned string not including the -// NULL terminator. +// nullptr terminator. // @return XMLSTR - Allocated XML string, you must free // this with free(). XMLSTR XMLNode::createXMLString(int nFormat, int *pnSize) const { - if (!d) { if (pnSize) *pnSize = 0; return NULL; } + if (!d) { if (pnSize) *pnSize = 0; return nullptr; } - XMLSTR lpszResult = NULL; + XMLSTR lpszResult = nullptr; int cbStr; // Recursively Calculate the size of the XML string if (!dropWhiteSpace) nFormat = 0; nFormat = nFormat ? 0 : -1; cbStr = CreateXMLStringR(d, 0, nFormat); - // Alllocate memory for the XML string + the NULL terminator and + // Alllocate memory for the XML string + the nullptr terminator and // create the recursively XML string. lpszResult = (XMLSTR)malloc((cbStr+1)*sizeof(XMLCHAR)); CreateXMLStringR(d, lpszResult, nFormat); @@ -2195,7 +2195,7 @@ int XMLNode::detachFromParent(XMLNodeData *d) while (((void*)(pa[i].d)) != ((void*)d)) i++; d->pParent->nChild--; if (d->pParent->nChild) memmove(pa+i, pa+i+1, (d->pParent->nChild-i)*sizeof(XMLNode)); - else { free(pa); d->pParent->pChild = NULL; } + else { free(pa); d->pParent->pChild = nullptr; } return removeOrderElement(d->pParent, eNodeChild, i); } @@ -2208,7 +2208,7 @@ XMLNode::~XMLNode() void XMLNode::deleteNodeContent() { if (!d) return; - if (d->pParent) { detachFromParent(d); d->pParent = NULL; d->ref_count--; } + if (d->pParent) { detachFromParent(d); d->pParent = nullptr; d->ref_count--; } emptyTheNode(1); } void XMLNode::emptyTheNode(char force) @@ -2222,7 +2222,7 @@ void XMLNode::emptyTheNode(char force) for (i=0; i<dd->nChild; i++) { pc = dd->pChild+i; - pc->d->pParent = NULL; + pc->d->pParent = nullptr; pc->d->ref_count--; pc->emptyTheNode(force); } @@ -2244,20 +2244,20 @@ void XMLNode::emptyTheNode(char force) else myFree((void*)dd->lpszName); dd->nChild = 0; dd->nText = 0; dd->nClear = 0; dd->nAttribute = 0; - dd->pChild = NULL; dd->pText = NULL; dd->pClear = NULL; dd->pAttribute = NULL; - dd->pOrder = NULL; dd->pInnerText = NULL; dd->lpszNS = dd->lpszName = NULL; dd->pParent = NULL; + dd->pChild = nullptr; dd->pText = nullptr; dd->pClear = nullptr; dd->pAttribute = nullptr; + dd->pOrder = nullptr; dd->pInnerText = nullptr; dd->lpszNS = dd->lpszName = nullptr; dd->pParent = nullptr; } if (dd->ref_count == 0) { free(dd); - d = NULL; + d = nullptr; } } void XMLNode::invalidateInnerText() { if (!d) return; myFree(d->pInnerText); - d->pInnerText = NULL; + d->pInnerText = nullptr; } XMLNode& XMLNode::operator = (const XMLNode& A) @@ -2282,7 +2282,7 @@ XMLNode::XMLNode(const XMLNode &A) XMLNode XMLNode::deepCopy() const { if (!d) return XMLNode::emptyXMLNode; - XMLNode x(NULL, stringDup(d->lpszName), d->isDeclaration); + XMLNode x(nullptr, stringDup(d->lpszName), d->isDeclaration); XMLNodeData *p = x.d; int n = d->nAttribute; if (n) @@ -2321,7 +2321,7 @@ XMLNode XMLNode::deepCopy() const p->nChild = n; p->pChild = (XMLNode*)malloc(n*sizeof(XMLNode)); while (n--) { - p->pChild[n].d = NULL; + p->pChild[n].d = nullptr; p->pChild[n] = d->pChild[n].deepCopy(); p->pChild[n].d->pParent = p; } @@ -2361,7 +2361,7 @@ void XMLNode::deleteAttribute(int i) XMLAttribute *p = d->pAttribute+i; free((void*)p->lpszName); if (p->lpszValue) free((void*)p->lpszValue); - if (d->nAttribute) memmove(p, p+1, (d->nAttribute-i)*sizeof(XMLAttribute)); else { free(p); d->pAttribute = NULL; } + if (d->nAttribute) memmove(p, p+1, (d->nAttribute-i)*sizeof(XMLAttribute)); else { free(p); d->pAttribute = nullptr; } } void XMLNode::deleteAttribute(XMLAttribute *a) { if (a) deleteAttribute(a->lpszName); } @@ -2374,11 +2374,11 @@ void XMLNode::deleteAttribute(XMLCSTR lpszName) XMLAttribute *XMLNode::updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName, int i) { - if (!d) { if (lpszNewValue) free(lpszNewValue); if (lpszNewName) free(lpszNewName); return NULL; } + if (!d) { if (lpszNewValue) free(lpszNewValue); if (lpszNewName) free(lpszNewName); return nullptr; } if (i>=d->nAttribute) { if (lpszNewName) return addAttribute_WOSD(lpszNewName, lpszNewValue); - return NULL; + return nullptr; } XMLAttribute *p = d->pAttribute+i; if (p->lpszValue&&p->lpszValue != lpszNewValue) free((void*)p->lpszValue); @@ -2422,7 +2422,7 @@ void XMLNode::deleteText(int i) d->nText--; XMLCSTR *p = d->pText+i; free((void*)*p); - if (d->nText) memmove(p, p+1, (d->nText-i)*sizeof(XMLCSTR)); else { free(p); d->pText = NULL; } + if (d->nText) memmove(p, p+1, (d->nText-i)*sizeof(XMLCSTR)); else { free(p); d->pText = nullptr; } removeOrderElement(d, eNodeText, i); } @@ -2430,7 +2430,7 @@ void XMLNode::deleteText(XMLCSTR lpszValue) { deleteText(indexText(lpszValue)); XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, int i) { - if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; } + if (!d) { if (lpszNewValue) free(lpszNewValue); return nullptr; } if (i>=d->nText) return addText_WOSD(lpszNewValue); invalidateInnerText(); XMLCSTR *p = d->pText+i; @@ -2440,7 +2440,7 @@ XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, int i) XMLCSTR XMLNode::updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue) { - if (!d) { if (lpszNewValue) free(lpszNewValue); return NULL; } + if (!d) { if (lpszNewValue) free(lpszNewValue); return nullptr; } int i = indexText(lpszOldValue); if (i>=0) return updateText_WOSD(lpszNewValue, i); return addText_WOSD(lpszNewValue); @@ -2453,7 +2453,7 @@ void XMLNode::deleteClear(int i) d->nClear--; XMLClear *p = d->pClear+i; free((void*)p->lpszValue); - if (d->nClear) memmove(p, p+1, (d->nClear-i)*sizeof(XMLClear)); else { free(p); d->pClear = NULL; } + if (d->nClear) memmove(p, p+1, (d->nClear-i)*sizeof(XMLClear)); else { free(p); d->pClear = nullptr; } removeOrderElement(d, eNodeClear, i); } @@ -2472,7 +2472,7 @@ void XMLNode::deleteClear(XMLClear *a) { if (a) deleteClear(a->lpszValue); } XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, int i) { - if (!d) { if (lpszNewContent) free(lpszNewContent); return NULL; } + if (!d) { if (lpszNewContent) free(lpszNewContent); return nullptr; } if (i>=d->nClear) return addClear_WOSD(lpszNewContent); invalidateInnerText(); XMLClear *p = d->pClear+i; @@ -2482,7 +2482,7 @@ XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, int i) XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, XMLCSTR lpszOldValue) { - if (!d) { if (lpszNewContent) free(lpszNewContent); return NULL; } + if (!d) { if (lpszNewContent) free(lpszNewContent); return nullptr; } int i = indexClear(lpszOldValue); if (i>=0) return updateClear_WOSD(lpszNewContent, i); return addClear_WOSD(lpszNewContent); @@ -2491,7 +2491,7 @@ XMLClear *XMLNode::updateClear_WOSD(XMLSTR lpszNewContent, XMLCSTR lpszOldValue) XMLClear *XMLNode::updateClear_WOSD(XMLClear *newP, XMLClear *oldP) { if (oldP) return updateClear_WOSD((XMLSTR)newP->lpszValue, (XMLSTR)oldP->lpszValue); - return NULL; + return nullptr; } int XMLNode::nChildNode(XMLCSTR name) const @@ -2640,7 +2640,7 @@ XMLNode XMLNode::getChildNodeWithAttribute(XMLCSTR name, XMLCSTR attributeName, // Find an attribute on an node. XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const { - if (!d) return NULL; + if (!d) return nullptr; int i=0, n = d->nAttribute; if (j) i = *j; XMLAttribute *pAttr = d->pAttribute+i; @@ -2653,7 +2653,7 @@ XMLCSTR XMLNode::getAttribute(XMLCSTR lpszAttrib, int *j) const } pAttr++; } - return NULL; + return nullptr; } char XMLNode::isAttributeSet(XMLCSTR lpszAttrib) const @@ -2674,7 +2674,7 @@ char XMLNode::isAttributeSet(XMLCSTR lpszAttrib) const XMLCSTR XMLNode::getAttribute(XMLCSTR name, int j) const { - if (!d) return NULL; + if (!d) return nullptr; int i=0; while (j-->0) getAttribute(name, &i); return getAttribute(name, &i); @@ -2705,7 +2705,7 @@ XMLNodeContents XMLNode::enumContents(int i) const XMLCSTR XMLNode::getInnerText() const { - if (!d) return NULL; + if (!d) return nullptr; if (nText() <= 1 && nClear() == 0) return getText(); if (d->pInnerText) return d->pInnerText; @@ -2744,7 +2744,7 @@ XMLCSTR XMLNode::getInnerText() const return d->pInnerText = buf; } -XMLCSTR XMLNode::getName() const { if (!d) return NULL; return d->lpszName; } +XMLCSTR XMLNode::getName() const { if (!d) return nullptr; return d->lpszName; } int XMLNode::nText() const { if (!d) return 0; return d->nText; } int XMLNode::nChildNode() const { if (!d) return 0; return d->nChild; } int XMLNode::nAttribute() const { if (!d) return 0; return d->nAttribute; } @@ -2752,13 +2752,13 @@ int XMLNode::nClear() const { if (!d) return 0; return d->nClear; } int XMLNode::nElement() const { if (!d) return 0; return d->nAttribute+d->nChild+d->nText+d->nClear; } XMLClear XMLNode::getClear (int i) const { if ((!d) || (i>=d->nClear)) return emptyXMLClear; return d->pClear[i]; } XMLAttribute XMLNode::getAttribute (int i) const { if ((!d) || (i>=d->nAttribute)) return emptyXMLAttribute; return d->pAttribute[i]; } -XMLCSTR XMLNode::getAttributeName (int i) const { if ((!d) || (i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszName; } -XMLCSTR XMLNode::getAttributeValue(int i) const { if ((!d) || (i>=d->nAttribute)) return NULL; return d->pAttribute[i].lpszValue; } -XMLCSTR XMLNode::getText (int i) const { if ((!d) || (i>=d->nText)) return NULL; return d->pText[i]; } +XMLCSTR XMLNode::getAttributeName (int i) const { if ((!d) || (i>=d->nAttribute)) return nullptr; return d->pAttribute[i].lpszName; } +XMLCSTR XMLNode::getAttributeValue(int i) const { if ((!d) || (i>=d->nAttribute)) return nullptr; return d->pAttribute[i].lpszValue; } +XMLCSTR XMLNode::getText (int i) const { if ((!d) || (i>=d->nText)) return nullptr; return d->pText[i]; } XMLNode XMLNode::getChildNode (int i) const { if ((!d) || (i>=d->nChild)) return emptyXMLNode; return d->pChild[i]; } XMLNode XMLNode::getParentNode () const { if ((!d) || (!d->pParent)) return emptyXMLNode; return XMLNode(d->pParent); } char XMLNode::isDeclaration () const { if (!d) return 0; return d->isDeclaration; } -char XMLNode::isEmpty () const { return (d == NULL); } +char XMLNode::isEmpty () const { return (d == nullptr); } XMLNode XMLNode::emptyNode () { return XMLNode::emptyXMLNode; } XMLNode XMLNode::addChild(XMLCSTR lpszName, char isDeclaration, XMLElementPosition pos) @@ -2897,7 +2897,7 @@ const unsigned char base64DecodeTable[] = { XMLParserBase64Tool::~XMLParserBase64Tool() { freeBuffer(); } -void XMLParserBase64Tool::freeBuffer() { if (buf) free(buf); buf = NULL; buflen = 0; } +void XMLParserBase64Tool::freeBuffer() { if (buf) free(buf); buf = nullptr; buflen = 0; } int XMLParserBase64Tool::encodeLength(int inlen, char formatted) { @@ -3045,10 +3045,10 @@ unsigned char *XMLParserBase64Tool::decode(XMLCSTR data, int *outlen, XMLError * if (outlen) *outlen = len; if (!len) - return NULL; + return nullptr; alloc(len+1); if(!decode(data, (unsigned char*)buf, len, xe)) - return NULL; + return nullptr; return (unsigned char*)buf; } @@ -3071,6 +3071,6 @@ void XMLNode::attach(HXML h) HXML XMLNode::detach() { HXML res = (HXML)d; - d = NULL; + d = nullptr; return res; } diff --git a/src/mir_app/src/xmlParser.h b/src/mir_app/src/xmlParser.h index 6433d00191..eeeabf7d0a 100644 --- a/src/mir_app/src/xmlParser.h +++ b/src/mir_app/src/xmlParser.h @@ -209,7 +209,7 @@ public: * @{ */
/// Parse an XML string and return the root of a XMLNode tree representing the string.
- static XMLNode parseString (XMLCSTR lpXMLString, XMLCSTR tag = NULL, XMLResults *pResults = NULL);
+ static XMLNode parseString (XMLCSTR lpXMLString, XMLCSTR tag = nullptr, XMLResults *pResults = nullptr);
/**< The "parseString" function parse an XML string and return the root of a XMLNode tree. The "opposite" of this function is
* the function "createXMLString" that re-creates an XML string from an XMLNode tree. If the XML document is corrupted, the
* "parseString" method will initialize the "pResults" variable with some information that can be used to trace the error.
@@ -222,7 +222,7 @@ public: */
/// Parse an XML file and return the root of a XMLNode tree representing the file.
- static XMLNode parseFile (XMLCSTR filename, XMLCSTR tag = NULL, XMLResults *pResults = NULL);
+ static XMLNode parseFile (XMLCSTR filename, XMLCSTR tag = nullptr, XMLResults *pResults = nullptr);
/**< The "parseFile" function parse an XML file and return the root of a XMLNode tree. The "opposite" of this function is
* the function "writeToFile" that re-creates an XML file from an XMLNode tree. If the XML document is corrupted, the
* "parseFile" method will initialize the "pResults" variable with some information that can be used to trace the error.
@@ -235,7 +235,7 @@ public: */
/// Parse an XML file and return the root of a XMLNode tree representing the file. A very crude error checking is made. An attempt to guess the Char Encoding used in the file is made.
- static XMLNode openFileHelper(XMLCSTR filename, XMLCSTR tag = NULL);
+ static XMLNode openFileHelper(XMLCSTR filename, XMLCSTR tag = nullptr);
/**< The "openFileHelper" function reports to the screen all the warnings and errors that occurred during parsing of the XML file.
* This function also tries to guess char Encoding (UTF-8, ASCII or SHIT-JIS) based on the first 200 bytes of the file. Since each
* application has its own way to report and deal with errors, you should rather use the "parseFile" function to parse XML files
@@ -256,7 +256,7 @@ public: static XMLCSTR getError(XMLError error); ///< this gives you a user-friendly explanation of the parsing error
/// Create an XML string starting from the current XMLNode.
- XMLSTR createXMLString(int nFormat = 1, int *pnSize = NULL) const;
+ XMLSTR createXMLString(int nFormat = 1, int *pnSize = nullptr) const;
/**< The returned string should be free'd using the "freeXMLString" function.
*
* If nFormat == 0, no formatting is required otherwise this returns an user friendly XML string from a given element
@@ -264,7 +264,7 @@ public: /// Save the content of an xmlNode inside a file
XMLError writeToFile(XMLCSTR filename,
- const char *encoding = NULL,
+ const char *encoding = nullptr,
char nFormat = 1) const;
/**< If nFormat == 0, no formatting is required otherwise this returns an user friendly XML string from a given element with appropriate white spaces and carriage returns.
* If the global parameter "characterEncoding == encoding_UTF8", then the "encoding" parameter is ignored and always set to "utf-8".
@@ -283,11 +283,11 @@ public: XMLNode getParentNode() const; ///< return the parent node
XMLNode getChildNode(int i=0) const; ///< return ith child node
XMLNode getChildNode(XMLCSTR name, int i) const; ///< return ith child node with specific name (return an empty node if failing). If i == -1, this returns the last XMLNode with the given name.
- XMLNode getChildNode(XMLCSTR name, int *i = NULL) const; ///< return next child node with specific name (return an empty node if failing)
+ XMLNode getChildNode(XMLCSTR name, int *i = nullptr) const; ///< return next child node with specific name (return an empty node if failing)
XMLNode getChildNodeWithAttribute(XMLCSTR tagName,
XMLCSTR attributeName,
- XMLCSTR attributeValue = NULL,
- int *i = NULL) const; ///< return child node with specific name/attribute (return an empty node if failing)
+ XMLCSTR attributeValue = nullptr,
+ int *i = nullptr) const; ///< return child node with specific name/attribute (return an empty node if failing)
XMLNode getChildNodeByPath(XMLSTR path, char createNodeIfMissing = 0, XMLCHAR sep = '/');
///< return the first child node with specific path. WARNING: the value of the parameter "path" is destroyed!
XMLNode getChildNodeByPath(XMLCSTR path, char createNodeIfMissing = 0, XMLCHAR sep = '/');
@@ -302,8 +302,8 @@ public: XMLCSTR getAttributeName(int i=0) const; ///< return ith attribute name
XMLCSTR getAttributeValue(int i=0) const; ///< return ith attribute value
char isAttributeSet(XMLCSTR name) const; ///< test if an attribute with a specific name is given
- XMLCSTR getAttribute(XMLCSTR name, int i) const; ///< return ith attribute content with specific name (return a NULL if failing)
- XMLCSTR getAttribute(XMLCSTR name, int *i = NULL) const; ///< return next attribute content with specific name (return a NULL if failing)
+ XMLCSTR getAttribute(XMLCSTR name, int i) const; ///< return ith attribute content with specific name (return a nullptr if failing)
+ XMLCSTR getAttribute(XMLCSTR name, int *i = nullptr) const; ///< return next attribute content with specific name (return a nullptr if failing)
int nAttribute() const; ///< nbr of attribute
XMLClear getClear(int i=0) const; ///< return ith clear field (comments)
int nClear() const; ///< nbr of clear field
@@ -319,7 +319,7 @@ public: XMLNode(const XMLNode &A); ///< to allow shallow/fast copy:
XMLNode& operator = (const XMLNode& A); ///< to allow shallow/fast copy:
- XMLNode(): d(NULL) {};
+ XMLNode(): d(nullptr) {};
static XMLNode emptyXMLNode;
static XMLClear emptyXMLClear;
static XMLAttribute emptyXMLAttribute;
@@ -348,7 +348,7 @@ public: XMLNode addChild(XMLNode nodeToAdd, XMLElementPosition pos = -1); ///< If the "nodeToAdd" has some parents, it will be detached from it's parents before being attached to the current XMLNode
XMLAttribute *addAttribute(XMLCSTR lpszName, XMLCSTR lpszValuev); ///< Add a new attribute
XMLCSTR addText(XMLCSTR lpszValue, XMLElementPosition pos = -1); ///< Add a new text content
- XMLClear *addClear(XMLCSTR lpszValue, XMLCSTR lpszOpen = NULL, XMLCSTR lpszClose = NULL, XMLElementPosition pos = -1);
+ XMLClear *addClear(XMLCSTR lpszValue, XMLCSTR lpszOpen = nullptr, XMLCSTR lpszClose = nullptr, XMLElementPosition pos = -1);
/**< Add a new clear tag
* @param lpszOpen default value "<![CDATA["
* @param lpszClose default value "]]>"
@@ -362,8 +362,8 @@ public: */
XMLCSTR updateName(XMLCSTR lpszName); ///< change node's name
XMLAttribute *updateAttribute(XMLAttribute *newAttribute, XMLAttribute *oldAttribute); ///< if the attribute to update is missing, a new one will be added
- XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName = NULL, int i=0); ///< if the attribute to update is missing, a new one will be added
- XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName, XMLCSTR lpszOldName);///< set lpszNewName = NULL if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added
+ XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName = nullptr, int i=0); ///< if the attribute to update is missing, a new one will be added
+ XMLAttribute *updateAttribute(XMLCSTR lpszNewValue, XMLCSTR lpszNewName, XMLCSTR lpszOldName);///< set lpszNewName = nullptr if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added
XMLCSTR updateText(XMLCSTR lpszNewValue, int i=0); ///< if the text to update is missing, a new one will be added
XMLCSTR updateText(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the text to update is missing, a new one will be added
XMLClear *updateClear(XMLCSTR lpszNewContent, int i=0); ///< if the clearTag to update is missing, a new one will be added
@@ -396,14 +396,14 @@ public: * will be free'd by the XMLNode class. For example, it means that this is incorrect:
* \code
* xNode.addText_WOSD("foo");
- * xNode.updateAttribute_WOSD("#newcolor" , NULL, "color");
+ * xNode.updateAttribute_WOSD("#newcolor" , nullptr, "color");
* \endcode
* In opposition, this is correct:
* \code
* xNode.addText("foo");
* xNode.addText_WOSD(stringDup("foo"));
- * xNode.updateAttribute("#newcolor" , NULL, "color");
- * xNode.updateAttribute_WOSD(stringDup("#newcolor"), NULL, "color");
+ * xNode.updateAttribute("#newcolor" , nullptr, "color");
+ * xNode.updateAttribute_WOSD(stringDup("#newcolor"), nullptr, "color");
* \endcode
* Typically, you will never do:
* \code
@@ -422,12 +422,12 @@ public: XMLNode addChild_WOSD(XMLSTR lpszName, char isDeclaration = FALSE, XMLElementPosition pos = -1); ///< Add a new child node
XMLAttribute *addAttribute_WOSD(XMLSTR lpszName, XMLSTR lpszValue); ///< Add a new attribute
XMLCSTR addText_WOSD(XMLSTR lpszValue, XMLElementPosition pos = -1); ///< Add a new text content
- XMLClear *addClear_WOSD(XMLSTR lpszValue, XMLCSTR lpszOpen = NULL, XMLCSTR lpszClose = NULL, XMLElementPosition pos = -1); ///< Add a new clear Tag
+ XMLClear *addClear_WOSD(XMLSTR lpszValue, XMLCSTR lpszOpen = nullptr, XMLCSTR lpszClose = nullptr, XMLElementPosition pos = -1); ///< Add a new clear Tag
XMLCSTR updateName_WOSD(XMLSTR lpszName); ///< change node's name
XMLAttribute *updateAttribute_WOSD(XMLAttribute *newAttribute, XMLAttribute *oldAttribute); ///< if the attribute to update is missing, a new one will be added
- XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName = NULL, int i=0); ///< if the attribute to update is missing, a new one will be added
- XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName, XMLCSTR lpszOldName); ///< set lpszNewName = NULL if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added
+ XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName = nullptr, int i=0); ///< if the attribute to update is missing, a new one will be added
+ XMLAttribute *updateAttribute_WOSD(XMLSTR lpszNewValue, XMLSTR lpszNewName, XMLCSTR lpszOldName); ///< set lpszNewName = nullptr if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added
XMLCSTR updateText_WOSD(XMLSTR lpszNewValue, int i=0); ///< if the text to update is missing, a new one will be added
XMLCSTR updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the text to update is missing, a new one will be added
XMLClear *updateClear_WOSD(XMLSTR lpszNewContent, int i=0); ///< if the clearTag to update is missing, a new one will be added
@@ -448,7 +448,7 @@ public: XMLElementPosition positionOfClear(XMLClear *a) const;
XMLElementPosition positionOfChildNode(int i=0) const;
XMLElementPosition positionOfChildNode(XMLNode x) const;
- XMLElementPosition positionOfChildNode(XMLCSTR name, int i=0) const; ///< return the position of the ith childNode with the specified name if (name == NULL) return the position of the ith childNode
+ XMLElementPosition positionOfChildNode(XMLCSTR name, int i=0) const; ///< return the position of the ith childNode with the specified name if (name == nullptr) return the position of the ith childNode
/** @} */
/// Enumeration for XML character encoding.
@@ -538,14 +538,14 @@ private: typedef struct XMLNodeDataTag // to allow shallow copy and "intelligent/smart" pointers (automatic delete):
{
- XMLCSTR lpszName; // Element name ( = NULL if root)
+ XMLCSTR lpszName; // Element name ( = nullptr if root)
XMLCSTR lpszNS; // Namespace
int nChild, // Number of child nodes
nText, // Number of text fields
nClear, // Number of Clear fields (comments)
nAttribute; // Number of attributes
char isDeclaration; // Whether node is an XML declaration - '<?xml ?>'
- struct XMLNodeDataTag *pParent; // Pointer to parent element ( = NULL if root)
+ struct XMLNodeDataTag *pParent; // Pointer to parent element ( = nullptr if root)
XMLNode *pChild; // Array of child nodes
XMLCSTR *pText; // Array of text fields
XMLClear *pClear; // Array of clear fields
@@ -605,7 +605,7 @@ XMLDLLENTRY void freeXMLString(XMLSTR t); // {free(t);} /** @defgroup atoX ato? like functions
* @ingroup XMLParserGeneral
* The "xmlto?" functions are equivalents to the atoi, atol, atof functions.
-* The only difference is: If the variable "xmlString" is NULL, than the return value
+* The only difference is: If the variable "xmlString" is nullptr, than the return value
* is "defautValue". These 6 functions are only here as "convenience" functions for the
* user (they are not used inside the XMLparser). If you don't need them, you can
* delete them without any trouble.
@@ -635,7 +635,7 @@ XMLDLLENTRY XMLCHAR xmltoc(XMLCSTR xmlString, const XMLCHAR defautValue = _CXML( typedef struct XMLDLLENTRY ToXMLStringTool
{
public:
- ToXMLStringTool(): buf(NULL), buflen(0) {}
+ ToXMLStringTool(): buf(nullptr), buflen(0) {}
~ToXMLStringTool();
void freeBuffer();///<call this function when you have finished using this object to release memory used by the internal buffer.
@@ -668,7 +668,7 @@ private: typedef struct XMLDLLENTRY XMLParserBase64Tool
{
public:
- XMLParserBase64Tool(): buf(NULL), buflen(0) {}
+ XMLParserBase64Tool(): buf(nullptr), buflen(0) {}
~XMLParserBase64Tool();
void freeBuffer();///< Call this function when you have finished using this object to release memory used by the internal buffer.
@@ -684,20 +684,20 @@ public: XMLSTR encode(unsigned char *inByteBuf, unsigned int inByteLen, char formatted = 0); ///< returns a pointer to an internal buffer containing the base64 string containing the binary data encoded from "inByteBuf"
/// returns the number of bytes which will be decoded from "inString".
- static unsigned int decodeSize(XMLCSTR inString, XMLError *xe = NULL);
+ static unsigned int decodeSize(XMLCSTR inString, XMLError *xe = nullptr);
/**
* The "decode" function returns a pointer to a buffer containing the binary data decoded from "inString"
* The output buffer will be free'd when the XMLParserBase64Tool object is deleted.
* All output buffer are sharing the same memory space.
- * @param inString If "instring" is malformed, NULL will be returned */
- unsigned char* decode(XMLCSTR inString, int *outByteLen = NULL, XMLError *xe = NULL); ///< returns a pointer to an internal buffer containing the binary data decoded from "inString"
+ * @param inString If "instring" is malformed, nullptr will be returned */
+ unsigned char* decode(XMLCSTR inString, int *outByteLen = nullptr, XMLError *xe = nullptr); ///< returns a pointer to an internal buffer containing the binary data decoded from "inString"
/**
* decodes data from "inString" to "outByteBuf". You need to provide the size (in byte) of "outByteBuf"
* in "inMaxByteOutBuflen". If "outByteBuf" is not large enough or if data is malformed, then "FALSE"
* will be returned; otherwise "TRUE". */
- static unsigned char decode(XMLCSTR inString, unsigned char *outByteBuf, int inMaxByteOutBuflen, XMLError *xe = NULL); ///< deprecated.
+ static unsigned char decode(XMLCSTR inString, unsigned char *outByteBuf, int inMaxByteOutBuflen, XMLError *xe = nullptr); ///< deprecated.
private:
void *buf;
|