From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/UserInfoEx/src/Flags/svc_flags.cpp | 4 +- plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp | 58 +-- plugins/UserInfoEx/src/classMAnnivDate.cpp | 16 +- plugins/UserInfoEx/src/classMTime.cpp | 12 +- plugins/UserInfoEx/src/classPsTree.cpp | 66 ++-- plugins/UserInfoEx/src/classPsTreeItem.cpp | 42 +-- plugins/UserInfoEx/src/commonheaders.cpp | 12 +- plugins/UserInfoEx/src/ctrl_annivedit.cpp | 26 +- plugins/UserInfoEx/src/ctrl_button.cpp | 60 ++-- plugins/UserInfoEx/src/ctrl_combo.cpp | 6 +- plugins/UserInfoEx/src/ctrl_contact.cpp | 56 +-- plugins/UserInfoEx/src/ctrl_edit.cpp | 20 +- plugins/UserInfoEx/src/ctrl_tzcombo.cpp | 6 +- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 36 +- plugins/UserInfoEx/src/dlg_msgbox.cpp | 10 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 80 ++--- .../src/ex_import/classExImContactBase.cpp | 48 +-- .../src/ex_import/classExImContactXML.cpp | 46 +-- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 24 +- .../src/ex_import/dlg_ExImOpenSaveFile.cpp | 4 +- .../UserInfoEx/src/ex_import/dlg_ExImProgress.cpp | 8 +- plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 26 +- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 46 +-- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 36 +- plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp | 14 +- plugins/UserInfoEx/src/ex_import/tinyxml.cpp | 164 ++++----- plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp | 92 ++--- plugins/UserInfoEx/src/init.cpp | 4 +- plugins/UserInfoEx/src/mir_contactqueue.cpp | 2 +- plugins/UserInfoEx/src/mir_db.cpp | 26 +- plugins/UserInfoEx/src/mir_icolib.cpp | 12 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 60 ++-- plugins/UserInfoEx/src/mir_string.cpp | 18 +- plugins/UserInfoEx/src/psp_anniversary.cpp | 8 +- plugins/UserInfoEx/src/psp_options.cpp | 2 +- plugins/UserInfoEx/src/psp_origin.cpp | 4 +- plugins/UserInfoEx/src/psp_profile.cpp | 52 +-- plugins/UserInfoEx/src/svc_avatar.cpp | 4 +- plugins/UserInfoEx/src/svc_constants.cpp | 400 ++++++++++----------- plugins/UserInfoEx/src/svc_email.cpp | 34 +- plugins/UserInfoEx/src/svc_gender.cpp | 18 +- plugins/UserInfoEx/src/svc_homepage.cpp | 28 +- plugins/UserInfoEx/src/svc_phone.cpp | 22 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 42 +-- plugins/UserInfoEx/src/svc_reminder.cpp | 40 +-- plugins/UserInfoEx/src/svc_timezone.cpp | 4 +- 46 files changed, 899 insertions(+), 899 deletions(-) (limited to 'plugins/UserInfoEx/src') diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 0960b61b54..431accf995 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -69,7 +69,7 @@ static void CALLBACK SetExtraImage(LPARAM lParam) { /* get contact's country */ int countryNumber = ServiceDetectContactOriginCountry(lParam, 0); - ExtraIcon_SetIcon(hExtraIconSvc, lParam, (countryNumber != 0xFFFF || g_bUseUnknownFlag) ? LoadFlagHandle(countryNumber) : NULL); + ExtraIcon_SetIcon(hExtraIconSvc, lParam, (countryNumber != 0xFFFF || g_bUseUnknownFlag) ? LoadFlagHandle(countryNumber) : nullptr); } static int OnCListApplyIcons(WPARAM wParam, LPARAM) @@ -135,7 +135,7 @@ static int OnMsgWndEvent(WPARAM, LPARAM lParam) switch (msgwe->uType) { case MSG_WINDOW_EVT_OPENING: msgwnd = gMsgWndList.find((MsgWndData*)&msgwe->hContact); - if (msgwnd == NULL) { + if (msgwnd == nullptr) { msgwnd = new MsgWndData(msgwe->hwndWindow, msgwe->hContact); gMsgWndList.insert(msgwnd); } diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index 056bb048c4..95c95a443b 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -123,13 +123,13 @@ static int CountryNumberToBitmapIndex(int countryNumber) /************************* Utils **********************************/ -static HANDLE *phIconHandles = NULL; +static HANDLE *phIconHandles = nullptr; HICON LoadFlag(int countryNumber) { /* create identifier */ char *szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber,0); - if (szCountry == NULL) + if (szCountry == nullptr) szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber=0xFFFF,0); char szId[20]; @@ -139,8 +139,8 @@ HICON LoadFlag(int countryNumber) HANDLE LoadFlagHandle(int countryNumber) { - if (phIconHandles == NULL) - return NULL; + if (phIconHandles == nullptr) + return nullptr; return phIconHandles[ CountryNumberToIndex(countryNumber) ]; } @@ -157,7 +157,7 @@ int CountryNumberToIndex(int countryNumber) FIBITMAP* ConvertTo(FIBITMAP* dib, UINT destBits, bool greyscale) { - FIBITMAP* dib_res = NULL; + FIBITMAP* dib_res = nullptr; switch (destBits) { case 8: // convert to 8Bits @@ -192,7 +192,7 @@ FIBITMAP* ConvertTo(FIBITMAP* dib, UINT destBits, bool greyscale) FIBITMAP* LoadResource(UINT ID, LPTSTR lpType) { - FIBITMAP *dib = NULL; + FIBITMAP *dib = nullptr; if (lpType) { HRSRC hResInfo = FindResource(ghInst,MAKEINTRESOURCE(ID),lpType); DWORD ResSize = SizeofResource(ghInst,hResInfo); @@ -215,7 +215,7 @@ FIBITMAP* LoadResource(UINT ID, LPTSTR lpType) } else { HBITMAP hScrBM = (HBITMAP)LoadImage(ghInst,MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED); - if (hScrBM == NULL) + if (hScrBM == nullptr) return dib; dib = FIP->FI_CreateDIBFromHBITMAP(hScrBM); DeleteObject(hScrBM); @@ -229,7 +229,7 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) { /* return handle */ if ((BOOL)lParam) { - if (phIconHandles==NULL) return NULL; + if (phIconHandles==nullptr) return NULL; return (INT_PTR)phIconHandles[CountryNumberToIndex((int)wParam)]; } /* return icon */ @@ -241,28 +241,28 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) //TODO: use freeimage to create merget icon and add RGB(A) support ICONINFO icoi; BITMAP bm; - HICON hIcon=NULL; + HICON hIcon=nullptr; /* load both icons */ HICON hLowerIcon=(HICON)ServiceLoadFlagIcon((WPARAM)lParam,0); - if (hLowerIcon == NULL) return NULL; + if (hLowerIcon == nullptr) return NULL; HICON hUpperIcon=(HICON)ServiceLoadFlagIcon(wParam,0); /* merge them */ if (GetIconInfo(hLowerIcon,&icoi)) { - if (hUpperIcon!=NULL && GetObject(icoi.hbmColor,sizeof(bm),&bm)) { - HDC hdc=CreateCompatibleDC(NULL); - if (hdc!=NULL) { + if (hUpperIcon!=nullptr && GetObject(icoi.hbmColor,sizeof(bm),&bm)) { + HDC hdc=CreateCompatibleDC(nullptr); + if (hdc!=nullptr) { POINT aptTriangle[3]; memset(&aptTriangle, 0, sizeof(aptTriangle)); aptTriangle[1].y=bm.bmHeight-1; aptTriangle[2].x=bm.bmWidth-1; HRGN hrgn=CreatePolygonRgn(aptTriangle,_countof(aptTriangle),WINDING); - if (hrgn!=NULL) { + if (hrgn!=nullptr) { SelectClipRgn(hdc,hrgn); HBITMAP hbmPrev=(HBITMAP)SelectObject(hdc,icoi.hbmColor); - if (hbmPrev!=NULL) { /* error on select? */ - if (DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_IMAGE)) { - if (SelectObject(hdc,icoi.hbmMask)!=NULL) /* error on select? */ - DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_MASK); + if (hbmPrev!=nullptr) { /* error on select? */ + if (DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_IMAGE)) { + if (SelectObject(hdc,icoi.hbmMask)!=nullptr) /* error on select? */ + DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_MASK); } SelectObject(hdc,hbmPrev); } @@ -285,16 +285,16 @@ void InitIcons() { // all those flag icons storing in a large 24bit opaque bitmap to reduce file size FIBITMAP *dib = LoadResource(IDB_FLAGSPNG, L"PNG"); - if (dib == NULL) + if (dib == nullptr) return; if (FIP->FI_GetBPP(dib) != ILC_COLOR32) - if (NULL == (dib = ConvertTo(dib, ILC_COLOR32, 0))) + if (nullptr == (dib = ConvertTo(dib, ILC_COLOR32, 0))) return; // create new dib FIBITMAP *dib_ico = FIP->FI_Allocate(FIP->FI_GetWidth(dib), 16, ILC_COLOR32, 0, 0, 0); - if (dib_ico == NULL) { + if (dib_ico == nullptr) { FIP->FI_Unload(dib); return; } @@ -306,7 +306,7 @@ void InitIcons() // copy dib to new dib_ico (centered) if (FIP->FI_Paste(dib_ico, dib, 0, t - 1, 255 + 1)) { - FIP->FI_Unload(dib); dib = NULL; + FIP->FI_Unload(dib); dib = nullptr; // Calculate the number of bytes per pixel (3 for 24-bit or 4 for 32-bit) int bytespp = FIP->FI_GetLine(dib_ico) / w; @@ -333,15 +333,15 @@ void InitIcons() // create ImageList HIMAGELIST himl = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, nCountriesCount); - ImageList_Add(himl, hScrBM, NULL); + ImageList_Add(himl, hScrBM, nullptr); DeleteObject(hScrBM); - hScrBM = NULL; + hScrBM = nullptr; - if (himl != NULL) { + if (himl != nullptr) { phIconHandles = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE)); - if (phIconHandles != NULL) { + if (phIconHandles != nullptr) { char szId[20]; - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.section.w = LPGENW("Country flags"); sid.pszName = szId; // name to refer to icon when playing and in db sid.flags = SIDF_SORTED | SIDF_UNICODE; @@ -356,9 +356,9 @@ void InitIcons() index = CountryNumberToIndex(countries[i].id); phIconHandles[index] = IcoLib_AddIcon(&sid); - if (sid.hDefaultIcon != NULL) + if (sid.hDefaultIcon != nullptr) DestroyIcon(sid.hDefaultIcon); - mir_free(sid.description.w); sid.description.w = NULL; + mir_free(sid.description.w); sid.description.w = nullptr; } } ImageList_Destroy(himl); diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index c907d10ad7..796e247cb4 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -231,7 +231,7 @@ static zodiac[] = { { 1, 19, LPGENW("Capricorn"), ICO_ZOD_CAPRICORN }, // Steinbock { 20, 49, LPGENW("Aquarius"), ICO_ZOD_AQUARIUS }, // Wassermann { 50, 79, LPGENW("Pisces"), ICO_ZOD_PISCES }, // Fische - { 0, 0, NULL, "" } // end of array + { 0, 0, nullptr, "" } // end of array }; MZodiac MAnnivDate::Zodiac() @@ -442,7 +442,7 @@ int MAnnivDate::DBGetDateStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSe **/ int MAnnivDate::DBWriteDateStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { - if (hContact == INVALID_CONTACT_ID || pszModule == 0 || *pszModule == 0 || pszSetting == 0 || *pszSetting == 0) + if (hContact == INVALID_CONTACT_ID || pszModule == nullptr || *pszModule == 0 || pszSetting == nullptr || *pszSetting == 0) return 1; DWORD dwStamp = DateStamp(); @@ -474,7 +474,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) SetFlags(MADF_HASCUSTOM); } // if pszProto is set to NULL, this will be scaned only incase the birthday date has not been found yet - else if (pszProto || (pszProto = Proto_GetBaseAccountName(hContact)) != NULL) + else if (pszProto || (pszProto = Proto_GetBaseAccountName(hContact)) != nullptr) { // try to get birthday from basic protocol if (!DBGetDate(hContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)) @@ -487,7 +487,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) const int def = db_mc_getDefaultNum(hContact); if (def > -1 && def < INT_MAX) { MCONTACT hSubContact = db_mc_getSub(hContact, def); - if (hSubContact != NULL && !DBGetBirthDate(hSubContact, NULL)) { + if (hSubContact != NULL && !DBGetBirthDate(hSubContact, nullptr)) { RemoveFlags(MADF_HASCUSTOM); SetFlags(MADF_HASMETA); } @@ -501,7 +501,7 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) for (int i = 0; i < cnt; i++) { if (i != def) { MCONTACT hSubContact = db_mc_getSub(hContact, i); - if (hSubContact != NULL && !DBGetBirthDate(hSubContact, NULL)) { + if (hSubContact != NULL && !DBGetBirthDate(hSubContact, nullptr)) { RemoveFlags(MADF_HASCUSTOM); SetFlags(MADF_HASMETA); break; @@ -692,9 +692,9 @@ static WORD AskUser(MCONTACT hContact, MAnnivDate *pOldCustomDate, MAnnivDate *p DB::Contact::DisplayName(hContact), szDate, szoldDate); MB.cbSize = sizeof(MSGBOX); - MB.hParent = NULL; + MB.hParent = nullptr; MB.hiLogo = IcoLib_GetIcon(ICO_DLG_ANNIVERSARY); - MB.hiMsg = NULL; + MB.hiMsg = nullptr; MB.uType = MB_YESALLNO|MB_ICON_QUESTION|MB_INFOBAR|MB_NOPOPUP; MB.ptszTitle = LPGENW("Update custom birthday"); MB.ptszInfoText = LPGENW("Keeps your custom birthday up to date."); @@ -719,7 +719,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo // This birthday is a protocol based or metasubcontact's anniversary and no custom information exist, // so directly back it up under all circumstances! if ( _wFlags & (MADF_HASPROTO | MADF_HASMETA)) { - if (lastAnswer == NULL) { + if (lastAnswer == nullptr) { DBWriteDateStamp(hContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED); DBWriteBirthDate(hContact); } diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp index cb3a485fad..a615733c21 100644 --- a/plugins/UserInfoEx/src/classMTime.cpp +++ b/plugins/UserInfoEx/src/classMTime.cpp @@ -326,7 +326,7 @@ WORD MTime::TimeFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat) { if (!ptszTimeFormat || !cchTimeFormat) return 0; - if ((cchTimeFormat = GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &_SysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) { + if ((cchTimeFormat = GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &_SysTime, nullptr, ptszTimeFormat, cchTimeFormat)) == 0) { *ptszTimeFormat = 0; return 0; } @@ -337,7 +337,7 @@ WORD MTime::DateFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat) { if (!ptszTimeFormat || !cchTimeFormat) return 0; - if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &_SysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) { + if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &_SysTime, nullptr, ptszTimeFormat, cchTimeFormat)) == 0) { *ptszTimeFormat = 0; return 0; } @@ -358,7 +358,7 @@ WORD MTime::DateFormatAlt(LPTSTR ptszTimeFormat, WORD cchTimeFormat) mtNow.GetLocalTime(); AltSysTime.wYear=mtNow.Year(); - if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &AltSysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) { + if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &AltSysTime, nullptr, ptszTimeFormat, cchTimeFormat)) == 0) { *ptszTimeFormat = 0; return 0; } @@ -381,7 +381,7 @@ WORD MTime::DateFormatLong(LPTSTR ptszTimeFormat, WORD cchTimeFormat) { if (!ptszTimeFormat || !cchTimeFormat) return 0; - if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &_SysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) { + if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &_SysTime, nullptr, ptszTimeFormat, cchTimeFormat)) == 0) { *ptszTimeFormat = 0; return 0; } @@ -458,7 +458,7 @@ void MTime::GetLocalTime(MCONTACT hContact) int MTime::DBGetStamp (MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { - if (hContact == INVALID_CONTACT_ID || pszModule == NULL || pszModule[0] == 0 || pszSetting == NULL || pszSetting[0] == 0) { + if (hContact == INVALID_CONTACT_ID || pszModule == nullptr || pszModule[0] == 0 || pszSetting == nullptr || pszSetting[0] == 0) { ZeroDate(); return 1; } @@ -475,7 +475,7 @@ int MTime::DBGetStamp (MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) int MTime::DBWriteStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { - if (hContact == INVALID_CONTACT_ID || pszModule == NULL || pszModule[0] == 0 || pszSetting == NULL || pszSetting[0] == 0) + if (hContact == INVALID_CONTACT_ID || pszModule == nullptr || pszModule[0] == 0 || pszSetting == nullptr || pszSetting[0] == 0) return 1; return db_set_dw(hContact, pszModule, pszSetting, TimeStamp()); diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index df14d06c57..30283b2b2b 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -34,15 +34,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ CPsTree::CPsTree(LPPS pPs) { - _hWndTree = NULL; - _hImages = NULL; + _hWndTree = nullptr; + _hImages = nullptr; - _pItems = NULL; + _pItems = nullptr; _numItems = 0; _curItem = -1; _dwFlags = 0; - _hLabelEdit = NULL; - _hDragItem = NULL; + _hLabelEdit = nullptr; + _hDragItem = nullptr; _isDragging = FALSE; _pPs = pPs; } @@ -58,7 +58,7 @@ CPsTree::~CPsTree() if (_hLabelEdit) { DestroyWindow(_hLabelEdit); - _hLabelEdit = NULL; + _hLabelEdit = nullptr; } if (_pItems) { @@ -67,15 +67,15 @@ CPsTree::~CPsTree() if (_pItems[i]) { delete _pItems[i]; - _pItems[i] = NULL; + _pItems[i] = nullptr; } } MIR_FREE(_pItems); - _pItems = NULL; + _pItems = nullptr; _numItems = NULL; } ImageList_Destroy(_hImages); - _hImages = NULL; + _hImages = nullptr; } /** @@ -177,7 +177,7 @@ BYTE CPsTree::InitTreeItems(LPWORD needWidth) // init the iParent member for all the items for (i = 0; i < _numItems; i++) { - if (_pItems[i] && (pszGroup = _pItems[i]->ParentItemName()) != NULL) + if (_pItems[i] && (pszGroup = _pItems[i]->ParentItemName()) != nullptr) { int iParent = FindItemIndexByName(pszGroup); @@ -266,7 +266,7 @@ CPsTreeItem* CPsTree::FindItemByHandle(HTREEITEM hItem) { return _pItems[i]; } - return NULL; + return nullptr; } /** @@ -284,7 +284,7 @@ CPsTreeItem* CPsTree::FindItemByName(LPCSTR pszName) { return _pItems[i]; } - return NULL; + return nullptr; } /** @@ -304,7 +304,7 @@ CPsTreeItem* CPsTree::FindItemByResource(HINSTANCE hInst, int idDlg) return _pItems[i]; } } - return NULL; + return nullptr; } @@ -323,7 +323,7 @@ HTREEITEM CPsTree::FindItemHandleByName(LPCSTR pszName) { return _pItems[i]->Hti(); } - return NULL; + return nullptr; } /*********************************************************************************************************** @@ -343,7 +343,7 @@ void CPsTree::HideItem(const int iPageIndex) if (IsIndexValid(iPageIndex)) { TreeView_DeleteItem(_hWndTree, _pItems[iPageIndex]->Hti()); - _pItems[iPageIndex]->Hti(0); + _pItems[iPageIndex]->Hti(nullptr); _dwFlags |= PSTVF_STATE_CHANGED; } } @@ -369,16 +369,16 @@ HTREEITEM CPsTree::ShowItem(const int iPageIndex, LPWORD needWidth) !pti->Label()) { MsgErr(GetParent(_hWndTree), LPGENW("Due to a parameter error, one of the treeitems can't be added!")); - return NULL; + return nullptr; } // item is visible at the moment - if ((tvii.itemex.hItem = pti->Hti()) == NULL) + if ((tvii.itemex.hItem = pti->Hti()) == nullptr) { RECT rc; const int iParent = pti->Parent(); // init the rest of the treeitem - tvii.hParent = IsIndexValid(iParent) ? ShowItem(iParent, needWidth) : NULL; + tvii.hParent = IsIndexValid(iParent) ? ShowItem(iParent, needWidth) : nullptr; tvii.hInsertAfter = (_dwFlags & PSTVF_SORTTREE) ? TVI_SORT : TVI_LAST; tvii.itemex.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE; tvii.itemex.pszText = pti->Label(); @@ -391,10 +391,10 @@ HTREEITEM CPsTree::ShowItem(const int iPageIndex, LPWORD needWidth) tvii.itemex.mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE; } // insert item into tree if set visible - if ((tvii.itemex.hItem = TreeView_InsertItem(_hWndTree, &tvii)) == NULL) + if ((tvii.itemex.hItem = TreeView_InsertItem(_hWndTree, &tvii)) == nullptr) { MsgErr(GetParent(_hWndTree), LPGENW("A fatal error occurred on adding a property sheet page!\nDialog creation aborted!")); - return NULL; + return nullptr; } pti->Hti(tvii.itemex.hItem); // calculate width of treeview @@ -423,7 +423,7 @@ HTREEITEM CPsTree::MoveItem(HTREEITEM hItem, HTREEITEM hInsertAfter, BYTE bAsChi int iItemIndex; if (!hItem || !hInsertAfter) - return NULL; + return nullptr; if (hItem == hInsertAfter) return hItem; @@ -658,9 +658,9 @@ int CPsTree::BeginLabelEdit(HTREEITEM hItem) rc.left, rc.top, rcTree.right - rc.left, rc.bottom - rc.top, _hWndTree, - NULL, + nullptr, ghInst, - NULL ); + nullptr ); if (_hLabelEdit) { _hDragItem = hItem; @@ -705,8 +705,8 @@ int CPsTree::EndLabelEdit(const BYTE bSave) } } DestroyWindow(_hLabelEdit); - _hLabelEdit = NULL; - _hDragItem = NULL; + _hLabelEdit = nullptr; + _hDragItem = nullptr; return 0; } @@ -785,7 +785,7 @@ void CPsTree::PopupMenu() InsertMenuItem(hPopup, ++i, TRUE, &mii); } // show the popup menu - iItem = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, _hWndTree, NULL); + iItem = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, _hWndTree, nullptr); DestroyMenu(hPopup); switch (iItem) { @@ -799,7 +799,7 @@ void CPsTree::PopupMenu() DBResetState(); break; default: // show a hidden item - if ((iItem -= 100) >= 0 && ShowItem(iItem, NULL)) + if ((iItem -= 100) >= 0 && ShowItem(iItem, nullptr)) AddFlags(PSTVF_STATE_CHANGED | PSTVF_POS_CHANGED); break; } @@ -839,7 +839,7 @@ BYTE CPsTree::OnInfoChanged() pshn.hdr.code = PSN_INFOCHANGED; for (int i = 0; i < _numItems; i++) { pshn.hdr.hwndFrom = _pItems[i]->Wnd(); - if (pshn.hdr.hwndFrom != NULL) { + if (pshn.hdr.hwndFrom != nullptr) { pshn.lParam = (LPARAM)_pItems[i]->hContact(); SendMessage(pshn.hdr.hwndFrom, WM_NOTIFY, 0, (LPARAM)&pshn); if (PSP_CHANGED == GetWindowLongPtr(pshn.hdr.hwndFrom, DWLP_MSGRESULT)) @@ -862,9 +862,9 @@ BYTE CPsTree::OnSelChanging() { CPsTreeItem *pti = CurrentItem(); - if (pti != NULL) { + if (pti != nullptr) { TreeView_SetItemState(_hWndTree, pti->Hti(), 0, TVIS_SELECTED); - if (pti->Wnd() != NULL) { + if (pti->Wnd() != nullptr) { PSHNOTIFY pshn; pshn.hdr.code = PSN_KILLACTIVE; @@ -894,12 +894,12 @@ void CPsTree::OnSelChanged(LPNMTREEVIEW lpnmtv) _curItem = (int)lpnmtv->itemNew.lParam; if (pti = CurrentItem()) { - if (pti->Wnd() == NULL) { + if (pti->Wnd() == nullptr) { pti->CreateWnd(_pPs); } } // hide old page even if new item has no valid one - if (oldPage && oldPage->Wnd() != NULL) + if (oldPage && oldPage->Wnd() != nullptr) ShowWindow(oldPage->Wnd(), SW_HIDE); if (pti) ShowWindow(pti->Wnd(), SW_SHOW); @@ -938,7 +938,7 @@ void CPsTree::OnCancel() int CPsTree::OnApply() { CPsTreeItem *pti = CurrentItem(); - if (pti == NULL) + if (pti == nullptr) return 1; PSHNOTIFY pshn; diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index b006a05789..56be6b3605 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -44,15 +44,15 @@ BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hWnd, LPARAM lParam) * odp - optiondialogpage structure with the info about the item to add * return: nothing **/ -CPsTreeItem::CPsTreeItem() : _idDlg(NULL), _pTemplate(NULL), _hInst(NULL), _pfnDlgProc(NULL), _hWnd(NULL), _dwFlags(NULL), - _hItem(NULL), // handle to the treeview item +CPsTreeItem::CPsTreeItem() : _idDlg(NULL), _pTemplate(nullptr), _hInst(nullptr), _pfnDlgProc(nullptr), _hWnd(nullptr), _dwFlags(NULL), + _hItem(nullptr), // handle to the treeview item _iParent(-1), // index to the parent item _iImage(-1), // index of treeview item's image _bState(NULL), // initial state of this treeitem - _pszName(NULL), // original name, given by plugin (not customized) - _ptszLabel(NULL), - _pszProto(NULL), - _pszPrefix(NULL), + _pszName(nullptr), // original name, given by plugin (not customized) + _ptszLabel(nullptr), + _pszProto(nullptr), + _pszPrefix(nullptr), _hContact(NULL), _iPosition(0), _initParam(0) @@ -97,7 +97,7 @@ LPCSTR CPsTreeItem::PropertyKey(LPCSTR pszProperty) **/ LPCSTR CPsTreeItem::GlobalName() { - LPSTR pgn = NULL; + LPSTR pgn = nullptr; if (_dwFlags & PSPF_PROTOPREPENDED) { pgn = mir_strchr(_pszName, '\\'); @@ -137,7 +137,7 @@ LPCSTR CPsTreeItem::IconKey() mir_snprintf(pszSetting, MODNAME"_{%s}", pszIconName); return pszSetting; } - return NULL; + return nullptr; } /** @@ -159,7 +159,7 @@ LPSTR CPsTreeItem::ParentItemName() int cchGroup = p - _pszName + 1; return mir_strncpy((LPSTR)mir_alloc(cchGroup), _pszName, cchGroup); } - return NULL; + return nullptr; } /** @@ -186,7 +186,7 @@ int CPsTreeItem::Name(LPTSTR ptszTitle, const BYTE bIsUnicode) } } } - return _pszName == NULL; + return _pszName == nullptr; } /** @@ -245,7 +245,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) mir_free(_ptszLabel); // try to get custom label from database - if (!bReadDBValue || DB::Setting::GetTString(NULL, MODNAME, GlobalPropertyKey(SET_ITEM_LABEL), &dbv) || (_ptszLabel = dbv.ptszVal) == NULL) { + if (!bReadDBValue || DB::Setting::GetTString(NULL, MODNAME, GlobalPropertyKey(SET_ITEM_LABEL), &dbv) || (_ptszLabel = dbv.ptszVal) == nullptr) { // extract the name LPSTR pszName = mir_strrchr(_pszName, '\\'); if (pszName && pszName[1]) @@ -260,7 +260,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) } } // return nonezero if label is invalid - return _ptszLabel == NULL; + return _ptszLabel == nullptr; } /** @@ -273,7 +273,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) HICON CPsTreeItem::ProtoIcon() { if (!_pszName) - return NULL; + return nullptr; PROTOACCOUNT **pa; int ProtoCount; @@ -289,7 +289,7 @@ HICON CPsTreeItem::ProtoIcon() return hIco; } } - return NULL; + return nullptr; } /** @@ -316,7 +316,7 @@ int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOn bool bNeedFree = false; ptrW pwszSection(mir_a2u(SECT_TREE)); - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.flags = SIDF_ALL_UNICODE; sid.pszName = (LPSTR)pszIconName; sid.description.w = _ptszLabel; @@ -413,11 +413,11 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp) } // set the unique utf8 encoded name for the item if (err = Name(szTitle, (_dwFlags & ODPF_UNICODE) == ODPF_UNICODE)) - MsgErr(NULL, LPGENW("Creating unique name for a page failed with %d and error code %d"), err, GetLastError()); + MsgErr(nullptr, LPGENW("Creating unique name for a page failed with %d and error code %d"), err, GetLastError()); // read label from database or create it else if (err = ItemLabel(TRUE)) - MsgErr(NULL, LPGENW("Creating the label for a page failed with %d and error code %d"), err, GetLastError()); + MsgErr(nullptr, LPGENW("Creating the label for a page failed with %d and error code %d"), err, GetLastError()); else { // load icon for the item Icon(pPsh->_hImages, odp, (pPsh->_dwFlags & PSTVF_INITICONS) == PSTVF_INITICONS); @@ -437,7 +437,7 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp) // error for no longer supported dialog template type if (((UINT_PTR)odp->pszTemplate & 0xFFFF0000)) - MsgErr(NULL, LPGENW("The dialog template type is no longer supported")); + MsgErr(nullptr, LPGENW("The dialog template type is no longer supported")); else { // fetch dialog resource id _idDlg = (INT_PTR)odp->pszTemplate; @@ -507,7 +507,7 @@ HWND CPsTreeItem::CreateWnd(LPPS pPs) { if (pPs && !_hWnd && _pTemplate && _pfnDlgProc) { _hWnd = CreateDialogIndirectParam(_hInst, _pTemplate, pPs->hDlg, _pfnDlgProc, (LPARAM)_hContact); - if (_hWnd != NULL) { + if (_hWnd != nullptr) { PSHNOTIFY pshn; pshn.hdr.code = PSN_PARAMCHANGED; pshn.hdr.hwndFrom = _hWnd; @@ -535,7 +535,7 @@ HWND CPsTreeItem::CreateWnd(LPPS pPs) return _hWnd; } } - return NULL; + return nullptr; } /*********************************************************************************************************** @@ -594,7 +594,7 @@ void CPsTreeItem::OnIconsChanged(CPsTree *pTree) RECT rc; // update tree item icons - if (pTree->ImageList() && (hIcon = IcoLib_GetIcon(IconKey())) != NULL) { + if (pTree->ImageList() && (hIcon = IcoLib_GetIcon(IconKey())) != nullptr) { _iImage = (_iImage > 0) ? ImageList_ReplaceIcon(pTree->ImageList(), _iImage, hIcon) : ImageList_AddIcon(pTree->ImageList(), hIcon); diff --git a/plugins/UserInfoEx/src/commonheaders.cpp b/plugins/UserInfoEx/src/commonheaders.cpp index 69488a542f..0bd406ea1e 100644 --- a/plugins/UserInfoEx/src/commonheaders.cpp +++ b/plugins/UserInfoEx/src/commonheaders.cpp @@ -22,9 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" // global: -HINSTANCE ghInst = NULL; -FI_INTERFACE *FIP = NULL; //freeimage interface -CLIST_INTERFACE *pcli = NULL; +HINSTANCE ghInst = nullptr; +FI_INTERFACE *FIP = nullptr; //freeimage interface +CLIST_INTERFACE *pcli = nullptr; MGLOBAL myGlobals; pfnDwmIsCompositionEnabled dwmIsCompositionEnabled; @@ -134,7 +134,7 @@ unsigned int __fastcall hash_M2(const void * key, unsigned int len) unsigned int hashSettingW_M2(const char * key) { - if (key == NULL) return 0; + if (key == nullptr) return 0; const unsigned int len = (unsigned int)mir_wstrlen((const wchar_t*)key); char* buf = (char*)alloca(len + 1); for (unsigned i = 0; i <= len ; ++i) @@ -144,14 +144,14 @@ unsigned int hashSettingW_M2(const char * key) unsigned int hashSetting_M2(const char * key) { - if (key == NULL) return 0; + if (key == nullptr) return 0; const unsigned int len = (unsigned int)mir_strlen((const char*)key); return hash_M2(key, len); } unsigned int hashSetting_M2(const wchar_t * key) { - if (key == NULL) return 0; + if (key == nullptr) return 0; const unsigned int len = (unsigned int)mir_wstrlen((const wchar_t*)key); return hash_M2(key, len * sizeof(wchar_t)); } diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp index 05828dfc61..0c6e34bd54 100644 --- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp +++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. CBaseCtrl* CAnnivEditCtrl::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting) { - CAnnivEditCtrl *ctrl = NULL; + CAnnivEditCtrl *ctrl = nullptr; ctrl = new CAnnivEditCtrl(hDlg, idCtrl, pszSetting); if (ctrl) @@ -43,7 +43,7 @@ CAnnivEditCtrl::CAnnivEditCtrl(HWND hDlg, WORD idCtrl, LPCSTR pszSetting) _hwndDate = GetDlgItem(hDlg, EDIT_ANNIVERSARY_DATE); _ReminderEnabled = db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED); - _pDates = NULL; + _pDates = nullptr; _curDate = 0; _numDates = 0; @@ -69,14 +69,14 @@ CAnnivEditCtrl::~CAnnivEditCtrl() { WORD i; - if (_pDates != NULL) + if (_pDates != nullptr) { for (i = 0; i < _numDates; i++) { delete _pDates[i]; } mir_free(_pDates); - _pDates = NULL; + _pDates = nullptr; } } @@ -95,7 +95,7 @@ void CAnnivEditCtrl::Release() **/ BYTE CAnnivEditCtrl::ItemValid(WORD wIndex) const { - return (_pDates != NULL && wIndex < _numDates && _pDates[wIndex] != NULL); + return (_pDates != nullptr && wIndex < _numDates && _pDates[wIndex] != nullptr); } /** @@ -168,14 +168,14 @@ MAnnivDate* CAnnivEditCtrl::FindDateById(const WORD wId) { WORD i; - if (_pDates != NULL) { + if (_pDates != nullptr) { for (i = 0; i < _numDates; i++) { if (_pDates[i]->Id() < ANID_NONE && _pDates[i]->Id() == wId) { return _pDates[i]; } } } - return NULL; + return nullptr; } /** @@ -190,7 +190,7 @@ INT_PTR CAnnivEditCtrl::AddDate(MAnnivDate &mda) MAnnivDate *pmda, **pmd; // if a date with wID exists, replace it - if ((pmda = FindDateById(mda.Id())) != NULL) { + if ((pmda = FindDateById(mda.Id())) != nullptr) { BYTE bChanged = pmda->IsChanged(), bRemindChanged = pmda->IsReminderChanged(); @@ -321,7 +321,7 @@ INT_PTR CAnnivEditCtrl::DBWriteBirthDay(MCONTACT hContact) { MAnnivDate *pmdb; - if ((pmdb = FindDateById(ANID_BIRTHDAY)) == NULL) + if ((pmdb = FindDateById(ANID_BIRTHDAY)) == nullptr) return 1; if (pmdb->IsChanged()) { @@ -354,7 +354,7 @@ INT_PTR CAnnivEditCtrl::DBWriteAnniversaries(MCONTACT hContact) for (i = 0; i < _numDates; i++) { if ( - _pDates[i] != NULL && + _pDates[i] != nullptr && !_pDates[i]->DBWriteAnniversaryDate(hContact, wIndex) && !_pDates[i]->DBWriteReminderOpts(hContact) ) @@ -454,7 +454,7 @@ void CAnnivEditCtrl::OnMenuPopup() } ClientToScreen(_hBtnMenu, &pt); GetClientRect(_hBtnMenu, &rc); - i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, _hwndDlg, NULL); + i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, _hwndDlg, nullptr); DestroyMenu(hMenu); SendMessage(_hBtnMenu, BM_SETCHECK, NULL, NULL); if (i >= WM_USER) SetCurSel(i - WM_USER); @@ -506,7 +506,7 @@ void CAnnivEditCtrl::OnRemindEditChanged() if (pCurrent) { - UINT iVal = GetDlgItemInt(_hwndDlg, EDIT_REMIND, NULL, FALSE); + UINT iVal = GetDlgItemInt(_hwndDlg, EDIT_REMIND, nullptr, FALSE); if (iVal != pCurrent->RemindOffset() && IsDlgButtonChecked(_hwndDlg, RADIO_REMIND2) == BST_CHECKED) { SendMessage(GetParent(_hwndDlg), PSM_CHANGED, NULL, NULL); @@ -587,7 +587,7 @@ void CAnnivEditCtrl::SetZodiacAndAge(MAnnivDate *mt) MZodiac zod; zod = mt->Zodiac(); - if (zod.pszName != NULL) + if (zod.pszName != nullptr) { ShowWindow(GetDlgItem(_hwndDlg, TEXT_ZODIAC), SW_SHOW); SetDlgItemText(_hwndDlg, TEXT_ZODIAC, TranslateW(zod.pszName)); diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp index 38b8ef5fc3..534bf8edc2 100644 --- a/plugins/UserInfoEx/src/ctrl_button.cpp +++ b/plugins/UserInfoEx/src/ctrl_button.cpp @@ -46,7 +46,7 @@ typedef struct TMBCtrl{ // External theme methods and properties static mir_cs csTips; -static HWND hwndToolTips = NULL; +static HWND hwndToolTips = nullptr; /** * name: DestroyTheme @@ -57,11 +57,11 @@ static HWND hwndToolTips = NULL; static void __fastcall DestroyTheme(BTNCTRL *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; } } @@ -120,7 +120,7 @@ static void __fastcall PaintIcon(BTNCTRL *ctl, HDC hdcMem, LPWORD ccText, LPRECT OffsetRect(rcText, rcImage.right + 4, 0); if (ctl->stateId == PBS_PRESSED) OffsetRect(&rcImage, 1, 1); - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->hIcon, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->hIcon, 0, rcImage.left, rcImage.top, rcImage.right - rcImage.left, rcImage.bottom - rcImage.top, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); @@ -137,7 +137,7 @@ static void __fastcall PaintIcon(BTNCTRL *ctl, HDC hdcMem, LPWORD ccText, LPRECT rcImage.top = (rcClient->bottom - rcClient->top - rcImage.bottom) / 2; if (ctl->stateId == PBS_PRESSED) OffsetRect(&rcImage, 1, 1); - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->arrow, 0, rcImage.left, rcImage.top, rcImage.right - rcImage.left, rcImage.bottom - rcImage.top, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); @@ -205,7 +205,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien wszText, ccText, DST_PREFIXTEXT, - NULL, + nullptr, &sizeText); if (ctl->cHot) { @@ -218,7 +218,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien L"&", 1, DST_PREFIXTEXT, - NULL, + nullptr, &rcHot); sizeText.right -= (rcHot.right - rcHot.left); @@ -259,7 +259,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) // Draw the flat button if (ctl->dwStyle & MBS_FLAT) { - HBRUSH hbr = NULL; + HBRUSH hbr = nullptr; if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT) hbr = GetSysColorBrush(COLOR_3DLIGHT); @@ -338,7 +338,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) : GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); - DrawState(hdcMem, NULL, NULL, (LPARAM)szText, 0, + DrawState(hdcMem, nullptr, nullptr, (LPARAM)szText, 0, rcText.left, rcText.top, rcText.right - rcText.left, rcText.bottom - rcText.top, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); SelectObject(hdcMem, hOldFont); @@ -393,7 +393,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L } if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) { DestroyWindow(hwndToolTips); - hwndToolTips = NULL; + hwndToolTips = nullptr; } } DestroyTheme(bct); @@ -413,7 +413,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L } tmp++; } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; case WM_SYSKEYUP: @@ -421,7 +421,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L if (bct->dwStyle & MBS_PUSHBUTTON) { if (bct->pbState) bct->pbState = 0; else bct->pbState = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } else SetFocus(hwndBtn); @@ -432,7 +432,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case WM_THEMECHANGED: // themed changed, reload theme object 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 bct->hFont = (HFONT)wParam; // maybe we should redraw? @@ -472,13 +472,13 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case BM_SETIMAGE: 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->hIcon = NULL; + bct->hIcon = nullptr; bct->hBitmap = (HBITMAP)lParam; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; case BM_SETCHECK: @@ -491,20 +491,20 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L bct->pbState = 0; bct->stateId = PBS_NORMAL; } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case BM_GETCHECK: if (bct->dwStyle & MBS_PUSHBUTTON) return bct->pbState ? BST_CHECKED : BST_UNCHECKED; return 0; case BUTTONSETDEFAULT: bct->defbutton = (wParam != 0); - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case BUTTONADDTOOLTIP: if (wParam) { mir_cslock lck(csTips); if (!hwndToolTips) - hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandleA("mir_app.mir"), NULL); + hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandleA("mir_app.mir"), nullptr); if (lParam == MBBF_UNICODE) { TOOLINFOW ti; @@ -549,29 +549,29 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L break; case WM_SETFOCUS: // set keybord bFocus and redraw bct->bFocus = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); break; case WM_KILLFOCUS: // kill bFocus and redraw bct->bFocus = 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); } break; case WM_LBUTTONUP: @@ -587,16 +587,16 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L // Tell your daddy you got clicked, if mouse is still over the button. if ((bct->dwStyle & MBS_PUSHBUTTON) || bPressed) SendMessage(GetParent(hwndBtn), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndBtn), BN_CLICKED), (LPARAM)hwndBtn); - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); } break; 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(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); + SetTimer(hwndBtn, BUTTON_POLLID, BUTTON_POLLDELAY, nullptr); break; case WM_TIMER: // use a timer to check if they have did a mouseout if (wParam == BUTTON_POLLID) { @@ -630,7 +630,7 @@ void CtrlButtonLoadModule() wc.cbSize = sizeof(wc); wc.lpszClassName = UINFOBUTTONCLASS; wc.lpfnWndProc = Button_WndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(LPBTNCTRL); wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); diff --git a/plugins/UserInfoEx/src/ctrl_combo.cpp b/plugins/UserInfoEx/src/ctrl_combo.cpp index 8480e0f969..fb23e48f0c 100644 --- a/plugins/UserInfoEx/src/ctrl_combo.cpp +++ b/plugins/UserInfoEx/src/ctrl_combo.cpp @@ -144,7 +144,7 @@ void CCombo::Release() **/ BOOL CCombo::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) { - if (!_Flags.B.hasChanged && _pList != NULL) { + if (!_Flags.B.hasChanged && _pList != nullptr) { DBVARIANT dbv; int iVal = CB_ERR; @@ -194,7 +194,7 @@ void CCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) LPIDSTRLIST pd; pd = (LPIDSTRLIST)SendMessage(_hwnd, CB_GETITEMDATA, _curSel, 0); - if (pd != NULL) { + if (pd != nullptr) { switch (_bDataType) { case DBVT_BYTE: db_set_b(hContact, pszModule, _pszSetting, pd->nID); @@ -221,7 +221,7 @@ void CCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) _Flags.B.hasChanged = false; OnInfoChanged(hContact, pszProto); } - InvalidateRect(_hwnd, NULL, TRUE); + InvalidateRect(_hwnd, nullptr, TRUE); } } diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index f86c9be82c..35460aa35a 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -340,7 +340,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam if (noRecursion) break; noRecursion = 1; { - wchar_t szText[MAXDATASIZE], *pText = 0, *pArea, *pNumber; + wchar_t szText[MAXDATASIZE], *pText = nullptr, *pArea, *pNumber; bool isValid = true; GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText)); if (szText[0] != '+') @@ -447,8 +447,8 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L WS_VISIBLE|WS_CHILD|WS_TABSTOP, 0, 0, wWidth, wHeight, hwnd, - NULL, - cbex->hInstance, NULL))) { + nullptr, + cbex->hInstance, nullptr))) { cbex->bLocked = 0; return FALSE; } @@ -456,13 +456,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L wWidth = wHeight; if (!(cbex->hBtnMenu = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, - NULL, + nullptr, WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_PUSHBUTTON|MBS_DOWNARROW, x, 0, wWidth, wHeight, hwnd, - NULL, - cbex->hInstance, NULL))) { + nullptr, + cbex->hInstance, nullptr))) { DestroyWindow(cbex->hBtnEdit); cbex->bLocked = 0; return FALSE; @@ -471,13 +471,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L wWidth = (WORD)(cbex->rect.right - cbex->rect.left - x - (2 * (wHeight + 2))); if (!(cbex->hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", - NULL, + nullptr, WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL, x, 1, wWidth, wHeight - 2, hwnd, - NULL, - cbex->hInstance, NULL))) { + nullptr, + cbex->hInstance, nullptr))) { DestroyWindow(cbex->hBtnEdit); DestroyWindow(cbex->hBtnMenu); cbex->bLocked = 0; @@ -487,13 +487,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L wWidth = wHeight; if (!(cbex->hBtnAdd = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, - NULL, + nullptr, WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT, x, 0, wWidth, wHeight, hwnd, - NULL, - cbex->hInstance, NULL))) { + nullptr, + cbex->hInstance, nullptr))) { DestroyWindow(cbex->hBtnEdit); DestroyWindow(cbex->hBtnMenu); DestroyWindow(cbex->hEdit); @@ -503,13 +503,13 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L x += wWidth + 2; if (!(cbex->hBtnDel = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, - NULL, + nullptr, WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT, x, 0, wWidth, wHeight, hwnd, - NULL, - cbex->hInstance, NULL))) { + nullptr, + cbex->hInstance, nullptr))) { DestroyWindow(cbex->hBtnEdit); DestroyWindow(cbex->hBtnMenu); DestroyWindow(cbex->hEdit); @@ -641,7 +641,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } ClientToScreen((HWND)lParam, &pt); GetClientRect((HWND)lParam, &rc); - i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, hwnd, NULL); + i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, hwnd, nullptr); SendMessage(cbex->hBtnMenu, BM_SETCHECK, NULL, NULL); if (i >= CBEXM_MENIITEMFIRST && i < CBEXM_MENIITEMFIRST + cbex->numItems) { CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, (WPARAM)i - CBEXM_MENIITEMFIRST, NULL); @@ -870,7 +870,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED; cbex->pItems[cbex->iSelectedItem].wFlags |= (hContact ? CTRLF_HASCUSTOM : CTRLF_HASPROTO); cbex->bIsChanged = TRUE; - InvalidateRect((HWND)lParam, NULL, TRUE); + InvalidateRect((HWND)lParam, nullptr, TRUE); SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL); } return 0; @@ -953,7 +953,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal && pItem->pszVal[0]) cbex->pItems[cbex->numItems].pszVal = mir_wstrdup(pItem->pszVal); else - cbex->pItems[cbex->numItems].pszVal = NULL; + cbex->pItems[cbex->numItems].pszVal = nullptr; // set icon if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->pszIcon) { cbex->pItems[cbex->numItems].pszIcon = pItem->pszIcon; @@ -1107,7 +1107,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L MIR_FREE(cbex->pItems[i].pszVal); } MIR_FREE(cbex->pItems); - cbex->pItems = NULL; + cbex->pItems = nullptr; } cbex->numItems = 0; cbex->iSelectedItem = -1; @@ -1253,7 +1253,7 @@ int CtrlContactLoadModule() wc.cbSize = sizeof(wc); wc.lpszClassName = UINFOCOMBOEXCLASS; wc.lpfnWndProc = CtrlContactWndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(LPCBEX); wc.hbrBackground = (HBRUSH)GetStockObject(COLOR_WINDOW); wc.style = CS_GLOBALCLASS; @@ -1288,13 +1288,13 @@ int CtrlContactAddItemFromDB( DBVARIANT dbv; CBEXITEM cbi; - cbi.pszVal = NULL; + cbi.pszVal = nullptr; cbi.dwID = hashSetting(szSettingVal); cbi.wFlags = CBEXIF_CATREADONLY|DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, szSettingVal, &dbv); if (dbv.type >= DBVT_WCHAR) { // no value read from database if (cbi.wFlags == CBEXIF_CATREADONLY) - cbi.pszVal = NULL; + cbi.pszVal = nullptr; else { // check the database value cbi.pszVal = dbv.ptszVal; if (LPTSTR sms = wcsstr(cbi.pszVal, L" SMS")) { @@ -1357,7 +1357,7 @@ int CtrlContactAddMyItemsFromDB( cbi.dwID = hashSetting(pszSetting); cbi.pszVal = dbv.ptszVal; dbv.type = DBVT_DELETED; - dbv.ptszVal = NULL; + dbv.ptszVal = nullptr; // read category if (SUCCEEDED(mir_snprintf(pszSetting, szFormatCat, i))) { @@ -1374,7 +1374,7 @@ int CtrlContactAddMyItemsFromDB( if (dbv.type > DBVT_DELETED && dbv.ptszVal && *dbv.ptszVal) { cbi.pszCat = dbv.ptszVal; dbv.type = DBVT_DELETED; - dbv.ptszVal = NULL; + dbv.ptszVal = nullptr; } } if (sms = wcsstr(cbi.pszVal, L" SMS")) { @@ -1387,11 +1387,11 @@ int CtrlContactAddMyItemsFromDB( bAnyItemIsChanged |= (cbi.wFlags & CTRLF_CHANGED) == CTRLF_CHANGED; if (cbi.pszCat) { mir_free(cbi.pszCat); - cbi.pszCat = NULL; + cbi.pszCat = nullptr; } if (cbi.pszVal) { mir_free(cbi.pszVal); - cbi.pszVal = NULL; + cbi.pszVal = nullptr; } } SendMessage(hCtrl, CBEXM_SORT, NULL, NULL); @@ -1435,7 +1435,7 @@ int CtrlContactWriteItemToDB( cbi.wFlags &= ~CTRLF_CHANGED; cbi.wMask = CBEXIM_FLAGS; CtrlContactWndProc(hCtrl, CBEXM_SETITEM, NULL, (LPARAM)&cbi); - InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), NULL, TRUE); + InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), nullptr, TRUE); return 0; } @@ -1499,6 +1499,6 @@ int CtrlContactWriteMyItemsToDB( } DB::Setting::DeleteArray(hContact, pszModule, szFormatCat, i); DB::Setting::DeleteArray(hContact, pszModule, szFormatVal, i); - InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), NULL, TRUE); + InvalidateRect(GetDlgItem(hCtrl, EDIT_VALUE), nullptr, TRUE); return 0; } diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp index 3fb01c479b..1da43c143c 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.cpp +++ b/plugins/UserInfoEx/src/ctrl_edit.cpp @@ -179,15 +179,15 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) dbv.type = _dbType; switch (_dbType) { case DBVT_BYTE: - dbv.bVal = (BYTE)wcstol(val, NULL, 10); + dbv.bVal = (BYTE)wcstol(val, nullptr, 10); break; case DBVT_WORD: - dbv.wVal = (WORD)wcstol(val, NULL, 10); + dbv.wVal = (WORD)wcstol(val, nullptr, 10); break; case DBVT_DWORD: - dbv.dVal = (DWORD)wcstol(val, NULL, 10); + dbv.dVal = (DWORD)wcstol(val, nullptr, 10); break; case DBVT_WCHAR: @@ -209,7 +209,7 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) // save new value MIR_FREE(_pszValue); _pszValue = val; - val = NULL; + val = nullptr; } } } @@ -223,7 +223,7 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) OnInfoChanged(hContact, pszProto); } - InvalidateRect(_hwnd, NULL, TRUE); + InvalidateRect(_hwnd, nullptr, TRUE); } } @@ -253,7 +253,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) need_free = 1; } - if (szText != NULL) { + if (szText != nullptr) { GetWindowText(_hwnd, szText, cch + 1); _Flags.B.hasChanged = mir_wstrcmp(_pszValue, szText) != 0; if (need_free) @@ -261,7 +261,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg) } else _Flags.B.hasChanged = false; } - InvalidateRect(_hwnd, NULL, TRUE); + InvalidateRect(_hwnd, nullptr, TRUE); if (_Flags.B.hasChanged) SendMessage(GetParent(GetParent(_hwnd)), PSM_CHANGED, 0, 0); @@ -295,12 +295,12 @@ void CEditCtrl::OpenUrl() LRESULT CEditCtrl::LinkNotificationHandler(ENLINK* lnk) { - if (lnk == NULL) + if (lnk == nullptr) return FALSE; switch (lnk->msg) { case WM_SETCURSOR: - SetCursor(LoadCursor(NULL, IDC_HAND)); + SetCursor(LoadCursor(nullptr, IDC_HAND)); SetWindowLongPtr(GetParent(_hwnd), DWLP_MSGRESULT, TRUE); return TRUE; @@ -323,7 +323,7 @@ LRESULT CEditCtrl::LinkNotificationHandler(ENLINK* lnk) need_free = 1; } if (tr.lpstrText && (SendMessage(_hwnd, EM_GETTEXTRANGE, NULL, (LPARAM)&tr) > 0)) { - 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) { memmove(tr.lpstrText + 7, tr.lpstrText, (tr.chrg.cpMax - tr.chrg.cpMin + 1)*sizeof(wchar_t)); memcpy(tr.lpstrText, L"mailto:", (7 * sizeof(wchar_t))); } diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp index b92524006f..86c2b251fb 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp @@ -40,7 +40,7 @@ CBaseCtrl* CTzCombo::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting) //set the adress of our timezone handle as itemdata //caller can obtain the handle htz to extract all relevant information ctrl->_curSel = 0; - TimeZone_PrepareList(NULL, NULL, hCtrl, TZF_PLF_CB); + TimeZone_PrepareList(NULL, nullptr, hCtrl, TZF_PLF_CB); } return (ctrl); } @@ -133,7 +133,7 @@ void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) const char* pszModule = hContact ? USERINFO : pszProto; if (_Flags.B.hasCustom || !hContact) { //use new core tz interface - TimeZone_StoreListResult(hContact, NULL, _hwnd, TZF_PLF_CB); + TimeZone_StoreListResult(hContact, nullptr, _hwnd, TZF_PLF_CB); if (!hContact) { _Flags.B.hasCustom = false; _Flags.B.hasProto = true; @@ -150,7 +150,7 @@ void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) _Flags.B.hasChanged = false; OnInfoChanged(hContact, pszProto); } - InvalidateRect(_hwnd, NULL, TRUE); + InvalidateRect(_hwnd, nullptr, TRUE); } } diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index f999611d19..6c2d1e3c1f 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CAnnivList; -static CAnnivList *gpDlg = NULL; +static CAnnivList *gpDlg = nullptr; /*********************************************************************************************************** * class CAnnivList @@ -84,8 +84,8 @@ class CAnnivList { wDaysBefore = (WORD)-1; bFilterIndex = 0; - pszProto = NULL; - pszAnniv = NULL; + pszProto = nullptr; + pszAnniv = nullptr; } } _filter; @@ -114,7 +114,7 @@ class CAnnivList _pDate->DBWriteReminderOpts(_hContact); } delete _pDate; - _pDate = NULL; + _pDate = nullptr; } } }; @@ -203,7 +203,7 @@ class CAnnivList { if (!(_wndPos->flags & SWP_NOSIZE)) { HWND hCtrl = GetDlgItem(_wndPos->hwnd, idCtrl); - if (NULL != hCtrl) { /* Wine fix. */ + if (nullptr != hCtrl) { /* Wine fix. */ RECT rcc = _CalcPos(hCtrl, anchors); _hdWnds = DeferWindowPos( _hdWnds, //HDWP hWinPosInfo @@ -414,7 +414,7 @@ class CAnnivList if (hPopup) { POINT pt; GetCursorPos(&pt); - TrackPopupMenu(hPopup, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hDlg, NULL); + TrackPopupMenu(hPopup, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hDlg, nullptr); DestroyMenu(hPopup); } } @@ -456,7 +456,7 @@ class CAnnivList // number of days to remind in advance is edited case EDIT_REMIND: if (pid && pDlg->_bRemindEnable && HIWORD(wParam) == EN_CHANGE) { - WORD wDaysBefore = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE); + WORD wDaysBefore = GetDlgItemInt(hDlg, LOWORD(wParam), nullptr, FALSE); if (pid->_wReminderState == BST_CHECKED && pid->_wDaysBefore != wDaysBefore) { pid->_wDaysBefore = wDaysBefore; } @@ -470,7 +470,7 @@ class CAnnivList BYTE isChecked = Button_GetCheck((HWND)lParam); EnableWindow(GetDlgItem(hDlg, EDIT_DAYS), isChecked); EnableWindow(GetDlgItem(hDlg, TXT_DAYS), isChecked); - pDlg->_filter.wDaysBefore = isChecked ? GetDlgItemInt(hDlg, EDIT_DAYS, NULL, FALSE) : (WORD)-1; + pDlg->_filter.wDaysBefore = isChecked ? GetDlgItemInt(hDlg, EDIT_DAYS, nullptr, FALSE) : (WORD)-1; pDlg->RebuildList(); } break; @@ -478,7 +478,7 @@ class CAnnivList // the number of days a contact must have an anniversary in advance to be displayed is edited case EDIT_DAYS: if (HIWORD(wParam) == EN_CHANGE) { - WORD wNewDays = GetDlgItemInt(hDlg, LOWORD(wParam), NULL, FALSE); + WORD wNewDays = GetDlgItemInt(hDlg, LOWORD(wParam), nullptr, FALSE); if (wNewDays != pDlg->_filter.wDaysBefore) { pDlg->_filter.wDaysBefore = wNewDays; pDlg->RebuildList(); @@ -816,7 +816,7 @@ class CAnnivList if (ListView_GetItem(_hList, &lvi) && PtrIsValid(lvi.lParam)) return (CItemData *)lvi.lParam; } - return NULL; + return nullptr; } // This method loads all filter settings from db @@ -830,7 +830,7 @@ class CAnnivList void SaveFilter() { if (_hDlg) { - db_set_w(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, NULL, FALSE)); + db_set_w(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, nullptr, FALSE)); db_set_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_DAYSENABLED, (BYTE)Button_GetCheck(GetDlgItem(_hDlg, CHECK_DAYS))); db_set_b(NULL, MODNAME, SET_ANNIVLIST_FILTER_INDEX, (BYTE)ComboBox_GetCurSel(GetDlgItem(_hDlg, EDIT_DAYS))); } @@ -841,7 +841,7 @@ public: // This is the default constructor. CAnnivList() { - _hList = NULL; + _hList = nullptr; _sortHeader = 0; _sortOrder = 1; _curSel = -1; @@ -850,11 +850,11 @@ public: _rcWin.left = _rcWin.right = _rcWin.top = _rcWin.bottom = 0; LoadFilter(); - _hDlg = CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_LIST), NULL, DlgProc, (LPARAM)this); + _hDlg = CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_LIST), nullptr, DlgProc, (LPARAM)this); if (_hDlg) _mHookExit = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, _hDlg, WM_CLOSE); else { - _mHookExit = NULL; + _mHookExit = nullptr; delete this; } } @@ -865,7 +865,7 @@ public: // delete the shutdown hook if (_mHookExit) { UnhookEvent(_mHookExit); - _mHookExit = NULL; + _mHookExit = nullptr; } // close window if required @@ -893,7 +893,7 @@ public: DestroyWindow(_hDlg); } } - gpDlg = NULL; + gpDlg = nullptr; } /** @@ -933,7 +933,7 @@ INT_PTR DlgAnniversaryListShow(WPARAM, LPARAM) } catch(...) { delete gpDlg; - gpDlg = NULL; + gpDlg = nullptr; } } else @@ -958,7 +958,7 @@ INT_PTR DlgAnniversaryListShow(WPARAM, LPARAM) **/ void DlgAnniversaryListOnTopToolBarLoaded() { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; ttb.pszService = MS_USERINFO_REMINDER_LIST; ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_ANNIVERSARY); diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index 8a83a0e286..3a5e3161b4 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -75,14 +75,14 @@ static HICON MsgLoadIcon(LPMSGBOX pMsgBox) case MB_ICON_WARNING: case MB_ICON_INFO: { - LPCTSTR ico[] = { 0, IDI_ERROR, IDI_QUESTION, IDI_WARNING, IDI_INFORMATION }; - hIcon = LoadIcon(NULL, ico[MB_ICON_INDEX(pMsgBox->uType)]); + LPCTSTR ico[] = { nullptr, IDI_ERROR, IDI_QUESTION, IDI_WARNING, IDI_INFORMATION }; + hIcon = LoadIcon(nullptr, ico[MB_ICON_INDEX(pMsgBox->uType)]); } break; // no icon default: - hIcon = NULL; + hIcon = nullptr; } return hIcon; } @@ -671,7 +671,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN); - mb.hiMsg = NULL; + mb.hiMsg = nullptr; mb.ptszTitle = TranslateW(pszTitle); mb.ptszInfoText = TranslateW(pszInfo); mb.ptszMsg = tszMsg; @@ -698,7 +698,7 @@ INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...) mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN); - mb.hiMsg = NULL; + mb.hiMsg = nullptr; mb.ptszTitle = tszTitle; mb.ptszMsg = tszMsg; mb.uType = MB_OK | MB_ICON_ERROR; diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 6e300df305..6324c74669 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -59,8 +59,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ***********************************************************************************************************/ static BYTE bInitIcons = INIT_ICONS_NONE; -static MWindowList g_hWindowList = NULL; -static HANDLE g_hDetailsInitEvent = NULL; +static MWindowList g_hWindowList = nullptr; +static HANDLE g_hDetailsInitEvent = nullptr; static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -69,12 +69,12 @@ CPsHdr::CPsHdr() { _dwSize = sizeof(*this); _hContact = NULL; - _pszProto = NULL; - _pszPrefix = NULL; - _pPages = NULL; + _pszProto = nullptr; + _pszPrefix = nullptr; + _pPages = nullptr; _numPages = 0; _dwFlags = 0; - _hImages = NULL; + _hImages = nullptr; } CPsHdr::~CPsHdr() @@ -139,7 +139,7 @@ private: EnableWindow(GetDlgItem(_pPs->hDlg, IDAPPLY), FALSE); mir_snprintf(_pPs->szUpdating, "%s (%s)", Translate("Uploading"), (*_pPd)->szModuleName); ShowWindow(GetDlgItem(_pPs->hDlg, TXT_UPDATING), SW_SHOW); - SetTimer(_pPs->hDlg, TIMERID_UPDATING, 100, NULL); + SetTimer(_pPs->hDlg, TIMERID_UPDATING, 100, nullptr); return 0; } } @@ -158,9 +158,9 @@ public: CPsUpload(LPPS pPs, BYTE bExitAfter) { _pPs = pPs; - _pPd = NULL; + _pPd = nullptr; _numProto = 0; - _hUploading = NULL; + _hUploading = nullptr; _bExitAfterUploading = bExitAfter; } @@ -179,7 +179,7 @@ public: * @return nothing **/ ~CPsUpload() - { _pPs->pUpload = NULL; } + { _pPs->pUpload = nullptr; } /** * @name Handle @@ -267,8 +267,8 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) // create imagelist metrics.x = GetSystemMetrics(SM_CXSMICON); metrics.y = GetSystemMetrics(SM_CYSMICON); - if ((psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) == NULL) { - MsgErr(NULL, LPGENW("Creating the image list failed!")); + if ((psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) == nullptr) { + MsgErr(nullptr, LPGENW("Creating the image list failed!")); return 1; } @@ -284,14 +284,14 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) if (psh._hContact == NULL) { // mark owner icons as initiated bInitIcons |= INIT_ICONS_OWNER; - psh._pszProto = NULL; - psh._pszPrefix = NULL; + psh._pszProto = nullptr; + psh._pszPrefix = nullptr; } else { // get contact's protocol psh._pszPrefix = psh._pszProto = Proto_GetBaseAccountName(wParam); - if (psh._pszProto == NULL) { - MsgErr(NULL, LPGENW("Could not find contact's protocol. Maybe it is not active!")); + if (psh._pszProto == nullptr) { + MsgErr(nullptr, LPGENW("Could not find contact's protocol. Maybe it is not active!")); return 1; } // prepare scanning for metacontact's subcontact's pages @@ -302,7 +302,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) // add the pages NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, wParam); if (!psh._pPages || !psh._numPages) { - MsgErr(NULL, LPGENW("No pages have been added. Canceling dialog creation!")); + MsgErr(nullptr, LPGENW("No pages have been added. Canceling dialog creation!")); return 1; } @@ -329,8 +329,8 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) qsort(psh._pPages, psh._numPages, sizeof(CPsTreeItem*), (int(*)(const void*, const void*))SortProc); // create the dialog itself - if (!CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProc, (LPARAM)&psh)) - MsgErr(NULL, LPGENW("Details dialog failed to be created. Returning error is %d."), GetLastError()); + if (!CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_DETAILS), nullptr, DlgProc, (LPARAM)&psh)) + MsgErr(nullptr, LPGENW("Details dialog failed to be created. Returning error is %d."), GetLastError()); return 0; } @@ -348,7 +348,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE *)lParam; // check size of the handled structures - if (pPsh == NULL || odp == NULL || pPsh->_dwSize != sizeof(CPsHdr)) + if (pPsh == nullptr || odp == nullptr || pPsh->_dwSize != sizeof(CPsHdr)) return 1; // try to check whether the flag member is initialized or not @@ -382,7 +382,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) // resize the array pPsh->_pPages = (CPsTreeItem **)mir_realloc(pPsh->_pPages, (pPsh->_numPages + 1) * sizeof(CPsTreeItem*)); - if (pPsh->_pPages != NULL) { + if (pPsh->_pPages != nullptr) { pPsh->_pPages[pPsh->_numPages++] = pNew; return 0; } @@ -400,7 +400,7 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) static int OnDeleteContact(WPARAM wParam, LPARAM) { HWND hWnd = WindowList_Find(g_hWindowList, wParam); - if (hWnd != NULL) + if (hWnd != nullptr) DestroyWindow(hWnd); return 0; } @@ -426,7 +426,7 @@ static int OnShutdown(WPARAM, LPARAM) * * @return 0 **/ -static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProto = NULL) +static int AddProtocolPages(OPTIONSDIALOGPAGE& odp, WPARAM wParam, LPSTR pszProto = nullptr) { wchar_t szTitle[MAX_PATH]; const BYTE ofs = (pszProto) ? mir_snwprintf(szTitle, L"%S\\", pszProto) : 0; @@ -587,7 +587,7 @@ void DlgContactInfoInitTreeIcons() // load all treeitems for owner contact if (!(bInitIcons & INIT_ICONS_OWNER)) { psh._hContact = NULL; - psh._pszProto = NULL; + psh._pszProto = nullptr; NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact); if (psh._pPages) { psh.Free_pPages(); @@ -863,7 +863,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case 0x031E: /*WM_DWMCOMPOSITIONCHANGED:*/ ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG), IsAeroMode()); - InvalidateRect(hDlg, NULL, TRUE); + InvalidateRect(hDlg, nullptr, TRUE); break; /** @@ -933,7 +933,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hBoldFont); return TRUE; } - *(HFONT *)lParam = NULL; + *(HFONT *)lParam = nullptr; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0); break; @@ -962,7 +962,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hContact); return TRUE; } - *(HANDLE *)lParam = NULL; + *(HANDLE *)lParam = nullptr; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, NULL); } break; @@ -993,7 +993,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar return TRUE; } } - *(LPCSTR *)lParam = NULL; + *(LPCSTR *)lParam = nullptr; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0); break; @@ -1067,7 +1067,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case PSM_GETPAGEHWND: if (CPsTreeItem *pti = pPs->pTree->FindItemByResource((HINSTANCE)lParam, wParam)) { SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pti->Wnd()); - return (pti->Wnd() != NULL); + return (pti->Wnd() != nullptr); } return FALSE; @@ -1276,7 +1276,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (iSubContact < pPs->nSubContacts) { // init the acks structure for a sub contact - if (pPs->infosUpdated[iSubContact].acks == NULL) { + if (pPs->infosUpdated[iSubContact].acks == nullptr) { pPs->infosUpdated[iSubContact].acks = (LPINT)mir_calloc(sizeof(int) * (int)(INT_PTR)ack->hProcess); pPs->infosUpdated[iSubContact].count = (int)(INT_PTR)ack->hProcess; } @@ -1395,7 +1395,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ScreenToClient(pPs->pTree->Window(), &hti.pt); TreeView_HitTest(pPs->pTree->Window(), &hti); if ((hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) && hti.hItem == TreeView_GetSelection(pPs->pTree->Window())) - SetTimer(hDlg, TIMERID_RENAME, 500, NULL); + SetTimer(hDlg, TIMERID_RENAME, 500, nullptr); } break; @@ -1423,11 +1423,11 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar BYTE height = (BYTE)(rc.bottom - rc.top); if (hti.pt.y - (height / 3) < rc.top) { - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); TreeView_SetInsertMark(pPs->pTree->Window(), hti.hItem, 0); } else if (hti.pt.y + (height / 3) > rc.bottom) { - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); TreeView_SetInsertMark(pPs->pTree->Window(), hti.hItem, 1); } else { @@ -1452,7 +1452,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TreeView_SetInsertMark(pPs->pTree->Window(), NULL, 0); ReleaseCapture(); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); TVHITTESTINFO hti; hti.pt.x = (SHORT)LOWORD(lParam); @@ -1552,7 +1552,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (ProtoServiceExists(Proto_GetBaseAccountName(hSubContact), PSS_GETINFO)) { pPs->infosUpdated = (TAckInfo *)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo) * (pPs->nSubContacts + 1)); pPs->infosUpdated[pPs->nSubContacts].hContact = hSubContact; - pPs->infosUpdated[pPs->nSubContacts].acks = NULL; + pPs->infosUpdated[pPs->nSubContacts].acks = nullptr; pPs->infosUpdated[pPs->nSubContacts].count = 0; pPs->nSubContacts++; } @@ -1570,7 +1570,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (bDo) { EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE); ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_SHOW); - SetTimer(hDlg, TIMERID_UPDATING, 100, NULL); + SetTimer(hDlg, TIMERID_UPDATING, 100, nullptr); } } } @@ -1581,7 +1581,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE); ShowWindow(GetDlgItem(hDlg, TXT_UPDATING), SW_SHOW); - SetTimer(hDlg, TIMERID_UPDATING, 100, NULL); + SetTimer(hDlg, TIMERID_UPDATING, 100, nullptr); } } break; @@ -1624,16 +1624,16 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "DetailsDlg"); // save current tree and destroy it - if (pPs->pTree != NULL) { + if (pPs->pTree != nullptr) { // save tree's current look pPs->pTree->SaveState(); delete pPs->pTree; - pPs->pTree = NULL; + pPs->pTree = nullptr; } DeleteObject(pPs->hCaptionFont); DeleteObject(pPs->hBoldFont); - mir_free(pPs); pPs = NULL; + mir_free(pPs); pPs = nullptr; } return FALSE; } diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 34eb007d36..af55004dc5 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -30,13 +30,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ CExImContactBase::CExImContactBase() { - _pszNick = NULL; - _pszDisp = NULL; - _pszGroup = NULL; - _pszProto = NULL; - _pszProtoOld = NULL; - _pszAMPro = NULL; - _pszUIDKey = NULL; + _pszNick = nullptr; + _pszDisp = nullptr; + _pszGroup = nullptr; + _pszProto = nullptr; + _pszProtoOld = nullptr; + _pszAMPro = nullptr; + _pszUIDKey = nullptr; _dbvUIDHash = NULL; memset(&_dbvUID, 0, sizeof(DBVARIANT)); _hContact = INVALID_CONTACT_ID; @@ -115,7 +115,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) else { uidSetting = (LPCSTR)CallProtoService(pszProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); // valid - if (uidSetting != NULL && (INT_PTR)uidSetting != CALLSERVICE_NOTFOUND) { + if (uidSetting != nullptr && (INT_PTR)uidSetting != CALLSERVICE_NOTFOUND) { _pszUIDKey = mir_strdup(uidSetting); if (!DB::Setting::GetAsIs(_hContact, pszProto, uidSetting, &_dbvUID)) { ret = TRUE; @@ -158,8 +158,8 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) **/ BYTE CExImContactBase::fromIni(LPSTR& row) { - LPSTR p1, p2 = NULL; - LPSTR pszUIDValue, pszUIDSetting, pszProto = NULL; + LPSTR p1, p2 = nullptr; + LPSTR pszUIDValue, pszUIDSetting, pszProto = nullptr; LPSTR pszBuf = &row[0]; size_t cchBuf = mir_strlen(row); @@ -230,7 +230,7 @@ MCONTACT CExImContactBase::toDB() // create new contact if none exists if (_hContact == INVALID_CONTACT_ID && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) { PROTOACCOUNT *pszAccount = Proto_GetAccount(_pszProto); - if (pszAccount == NULL) { + if (pszAccount == nullptr) { //account does not exist return _hContact = INVALID_CONTACT_ID; } @@ -279,7 +279,7 @@ void CExImContactBase::toIni(FILE* file, int modCount) if (_hContact){ int loaded = _pszUIDKey ? 1 : 0; - if (_pszProto == NULL || !loaded) { + if (_pszProto == nullptr || !loaded) { if (_pszProto){ if (_pszNick) mir_snprintf(name,"%s (%s)", _pszNick, _pszProto); @@ -384,8 +384,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) break; case DBVT_WCHAR: //'u' pwszVal is valid r = mir_utf8encodeW(_dbvUID.pwszVal); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; if (bPrependType == FALSE) return r; *ptr++ = 'u'; @@ -399,8 +399,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) break; case DBVT_ASCIIZ: r = mir_utf8encode(_dbvUID.pszVal); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; if (bPrependType == FALSE) return r; *ptr++ = 's'; @@ -411,8 +411,8 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) if (bPrependType) { //True = XML baselen = mir_base64_encode_bufsize(_dbvUID.cpbVal); r = (LPSTR)mir_alloc((baselen + 8)); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; memset((r + baselen), 0, 8); ptr = r; if (bPrependType) { // Allways true. @@ -421,15 +421,15 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) } if (!mir_base64_encodebuf(_dbvUID.pbVal, _dbvUID.cpbVal, ptr, baselen)) { mir_free(r); - return NULL; + return nullptr; } return r; } else { //FALSE = INI baselen = ((_dbvUID.cpbVal * 3) + 8); r = (LPSTR)mir_alloc(baselen); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; memset(r, 0, baselen); ptr = r; for (SIZE_T j = 0; j < _dbvUID.cpbVal; j ++, ptr += 3) { @@ -439,7 +439,7 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) } break; default: - return NULL; + return nullptr; } return mir_strdup(szUID); } @@ -460,7 +460,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) // compare protocols pszProto = Proto_GetBaseAccountName(hContact); - if (pszProto == NULL || (INT_PTR)pszProto == CALLSERVICE_NOTFOUND || mir_strcmp(pszProto, _pszProto)) + if (pszProto == nullptr || (INT_PTR)pszProto == CALLSERVICE_NOTFOUND || mir_strcmp(pszProto, _pszProto)) return FALSE; // compare uids @@ -477,7 +477,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) if (dbv.type == DBVT_UTF8 && dbv.pszVal && !mir_strcmpi(dbv.pszVal,_pszNick)) { LPTSTR ptszNick = mir_utf8decodeW(_pszNick); LPTSTR ptszProto = mir_a2u(_pszProto); - int ans = MsgBox(NULL, MB_ICONQUESTION|MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), + int ans = MsgBox(nullptr, MB_ICONQUESTION|MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), LPGENW("The contact %s(%s) has no unique ID in the vCard,\nbut there is a contact in your contact list with the same nick and protocol.\nDo you wish to use this contact?"), ptszNick, ptszProto); MIR_FREE(ptszNick); diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index de3135c5b4..f01d6a66fb 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -49,7 +49,7 @@ static int SortProc(const LPDWORD item1, const LPDWORD item2) CExImContactXML::CExImContactXML(CFileXml *pXmlFile) : CExImContactBase() { - _xmlNode = NULL; + _xmlNode = nullptr; _pXmlFile = pXmlFile; _hEvent = NULL; } @@ -84,7 +84,7 @@ BYTE CExImContactXML::IsContactInfo(LPCSTR pszKey) char buf[MAXSETTING]; // convert to hash and make bsearch as it is much faster then working with strings const DWORD dwHash = hashSetting(_strlwr(mir_strncpy(buf, pszKey, _countof(buf)))); - return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != NULL; + return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int (*)(const void*, const void*))SortProc) != nullptr; } return FALSE; } @@ -131,7 +131,7 @@ TiXmlElement* CExImContactXML::CreateXmlElement() } } } - else _xmlNode = NULL; + else _xmlNode = nullptr; } else _xmlNode = new TiXmlElement(XKEY_OWNER); @@ -238,14 +238,14 @@ int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules) // add xContact to document if (_xmlNode->NoChildren()) { delete _xmlNode; - _xmlNode = NULL; + _xmlNode = nullptr; return ERROR_NOT_ADDED; } _xmlNode->Print(xmlfile, 1); fputc('\n', xmlfile); delete _xmlNode; - _xmlNode = NULL; + _xmlNode = nullptr; return ERROR_OK; } @@ -294,10 +294,10 @@ int CExImContactXML::ExportModule(LPCSTR pszModule) int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LPCSTR pszSetting) { - TiXmlElement *xmlEntry = NULL; - TiXmlText *xmlValue = NULL; + TiXmlElement *xmlEntry = nullptr; + TiXmlText *xmlValue = nullptr; CHAR buf[32]; - LPSTR str = NULL; + LPSTR str = nullptr; DBVARIANT dbv; if (DB::Setting::GetAsIs(_hContact, pszModule, pszSetting, &dbv)) @@ -353,7 +353,7 @@ int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LP // new buffer for base64 encoded data INT_PTR baselen = mir_base64_encode_bufsize(dbv.cpbVal); str = (LPSTR)mir_alloc(baselen + 6); - assert(str != NULL); + assert(str != nullptr); // encode data if ( mir_base64_encodebuf(dbv.pbVal, dbv.cpbVal, str+1, baselen)) { str[baselen+1] = 0; @@ -420,7 +420,7 @@ BYTE CExImContactXML::ExportEvents() // find module TiXmlNode *xmlModule; - for (xmlModule = _xmlNode->FirstChild(); xmlModule != NULL; xmlModule = xmlModule->NextSibling()) + for (xmlModule = _xmlNode->FirstChild(); xmlModule != nullptr; xmlModule = xmlModule->NextSibling()) if (!mir_strcmpi(((TiXmlElement*)xmlModule)->Attribute("key"), dbei.szModule)) break; @@ -458,10 +458,10 @@ void CExImContactXML::CountKeys(DWORD &numSettings, DWORD &numEvents) numSettings = numEvents = 0; for (TiXmlNode *xmod = _xmlNode->FirstChild(); - xmod != NULL; + xmod != nullptr; xmod = xmod->NextSibling(XKEY_MOD)) { for (TiXmlNode *xkey = xmod->FirstChild(); - xkey != NULL; + xkey != nullptr; xkey = xkey->NextSibling()) { if (!mir_strcmpi(xkey->Value(), XKEY_SET)) numSettings++; @@ -481,7 +481,7 @@ void CExImContactXML::CountKeys(DWORD &numSettings, DWORD &numEvents) int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) { - if (xContact == NULL) + if (xContact == nullptr) return ERROR_INVALID_PARAMS; // delete last contact @@ -504,7 +504,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) // meta contact must be uniquelly identified by its subcontacts // the metaID may change during an export or import call - for(xSub = xContact->FirstChildElement(XKEY_CONTACT); xSub != NULL; xSub = xSub->NextSiblingElement(XKEY_CONTACT)) { + for(xSub = xContact->FirstChildElement(XKEY_CONTACT); xSub != nullptr; xSub = xSub->NextSiblingElement(XKEY_CONTACT)) { CExImContactXML vSub(_pXmlFile); if (vSub = xSub) { // identify metacontact by the first valid subcontact in xmlfile @@ -536,9 +536,9 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) if (_pszUIDKey && mir_strcmp("#NV", _pszUIDKey) != 0) { LPCSTR pUID = xContact->Attribute("uidv"); - if (pUID != NULL) { + if (pUID != nullptr) { unsigned valLen; - PBYTE pbVal = NULL; + PBYTE pbVal = nullptr; switch (*(pUID++)) { case 'b': @@ -559,11 +559,11 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) break; case 'n': pbVal = (PBYTE)mir_base64_decode(pUID, &valLen); - if (pbVal != NULL) + if (pbVal != nullptr) uidn(pbVal, valLen); break; default: - uidu((LPCSTR)NULL); + uidu((LPCSTR)nullptr); break; } } @@ -597,12 +597,12 @@ int CExImContactXML::ImportContact() _pXmlFile->_numEventsTodo += numEvents; // import all modules - for (TiXmlNode *xmod = _xmlNode->FirstChild(); xmod != NULL; xmod = xmod->NextSibling(XKEY_MOD)) { + for (TiXmlNode *xmod = _xmlNode->FirstChild(); xmod != nullptr; xmod = xmod->NextSibling(XKEY_MOD)) { // import module if (ImportModule(xmod) == ERROR_ABORTED) { // ask to delete new incomplete contact if (_isNewContact && _hContact != NULL) { - int result = MsgBox(NULL, MB_YESNO|MB_ICONWARNING, + int result = MsgBox(nullptr, MB_YESNO|MB_ICONWARNING, LPGENW("Question"), LPGENW("Importing a new contact was aborted!"), LPGENW("You aborted import of a new contact.\nSome information may be missing for this contact.\n\nDo you want to delete the incomplete contact?")); @@ -741,7 +741,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) if (_isNewContact && _hContact != NULL) { LPTSTR ptszNick = mir_utf8decodeW(_pszNick); LPTSTR ptszMetaNick = mir_utf8decodeW(pMetaContact->_pszNick); - int result = MsgBox(NULL, MB_YESNO|MB_ICONWARNING, + int result = MsgBox(nullptr, MB_YESNO|MB_ICONWARNING, LPGENW("Question"), LPGENW("Importing a new meta subcontact failed!"), LPGENW("The newly created meta subcontact '%s'\ncould not be added to metacontact '%s'!\n\nDo you want to delete this contact?"), @@ -789,7 +789,7 @@ int CExImContactXML::ImportModule(TiXmlNode* xmlModule) if (!mir_strcmpi(pszModule, "Protocol")) return ERROR_OK; - for (TiXmlElement *xKey = xmlModule->FirstChildElement(); xKey != NULL; xKey = xKey->NextSiblingElement()) { + for (TiXmlElement *xKey = xmlModule->FirstChildElement(); xKey != nullptr; xKey = xKey->NextSiblingElement()) { // import setting if (!mir_strcmpi(xKey->Value(), XKEY_SET)) { // check if the module to import is the contact's protocol module @@ -892,7 +892,7 @@ int CExImContactXML::ImportSetting(LPCSTR pszModule, TiXmlElement *xmlEntry) case 'n': dbv.type = DBVT_BLOB; dbv.pbVal = (PBYTE)mir_base64_decode(value + 1, &baselen); - if (dbv.pbVal != NULL) + if (dbv.pbVal != nullptr) dbv.cpbVal = baselen; else { mir_free(dbv.pbVal); diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 13d8558ec7..35b5b31444 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -85,20 +85,20 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) TVITEMA tvi; CHAR szBuf[128]; - if (!pszText || !*pszText) return NULL; + if (!pszText || !*pszText) return nullptr; tvi.mask = TVIF_TEXT; tvi.pszText = szBuf; tvi.cchTextMax = _countof(szBuf); for (tvi.hItem = TreeView_GetChild(hTree, hParent); - tvi.hItem != NULL; + tvi.hItem != nullptr; tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem)) { if (SendMessageA(hTree, TVM_GETITEMA, NULL, (LPARAM)&tvi) && !mir_strcmpi(tvi.pszText, pszText)) return tvi.hItem; } - return NULL; + return nullptr; } /** @@ -114,7 +114,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) HTREEITEM ExportTree_AddItem(HWND hTree, HTREEITEM hParent, LPSTR pszDesc, BYTE bUseImages, BYTE bState) { TVINSERTSTRUCTA tvii; - HTREEITEM hItem = NULL; + HTREEITEM hItem = nullptr; tvii.hParent = hParent; tvii.hInsertAfter = TVI_SORT; @@ -176,13 +176,13 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar if (GetVersionEx(&osvi)) { HIMAGELIST hImages = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) ? ILC_COLOR32 : ILC_COLOR16)|ILC_MASK,0, 1); - if (hImages != NULL) + if (hImages != nullptr) { SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages); HICON hIcon; - bImagesLoaded = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != NULL) && 0 == ImageList_AddIcon(hImages, hIcon)) - && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != NULL) && 1 == ImageList_AddIcon(hImages, hIcon))); + bImagesLoaded = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != nullptr) && 0 == ImageList_AddIcon(hImages, hIcon)) + && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != nullptr) && 1 == ImageList_AddIcon(hImages, hIcon))); } } } @@ -195,7 +195,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar } // Set the Window Title and description { - LPCTSTR name = NULL; + LPCTSTR name = nullptr; wchar_t oldTitle[MAXDATASIZE], newTitle[MAXDATASIZE]; switch (pDat->ExImContact->Typ) { @@ -236,7 +236,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar pszProto = (pDat->ExImContact->Typ == EXIM_CONTACT && pDat->ExImContact->hContact != NULL) ? (LPSTR)Proto_GetBaseAccountName(pDat->ExImContact->hContact) - : NULL; + : nullptr; // add items that are always exported tviiT.hParent = TVI_ROOT; @@ -369,7 +369,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // search the tree item of optional items for (hParent = TreeView_GetRoot(hTree); - hParent != NULL; + hParent != nullptr; hParent = TreeView_GetNextSibling(hTree, hParent)) { ExportTree_AppendModuleList(hTree, hParent, pDat->pModules); @@ -393,7 +393,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // search the tree item of optional items for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, NULL); - tvi.hItem != NULL && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi); + tvi.hItem != nullptr && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi); tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem)) { if (!mir_strcmpi(tvi.pszText, pszRoot)) { @@ -402,7 +402,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar tvi.stateMask = TVIS_STATEIMAGEMASK; for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)tvi.hItem); - tvi.hItem != NULL; + tvi.hItem != nullptr; tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem)) { SendMessageA(hTree, TVM_SETITEMA, NULL, (LPARAM)&tvi); diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 466ad2a89c..8cf1ef0cc9 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -90,7 +90,7 @@ static void InitAlteredPlacesBar() **/ static void ResetAlteredPlaceBars() { - RegOverridePredefKey(HKEY_CURRENT_USER, NULL); + RegOverridePredefKey(HKEY_CURRENT_USER, nullptr); SHDeleteKey(HKEY_CURRENT_USER, HKEY_MIRANDA_PLACESBAR); } @@ -174,7 +174,7 @@ static UINT_PTR CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM, LP HWND hPlacesBar = GetDlgItem(GetParent(hDlg), ctl1); // we have a places bar? - if (hPlacesBar != NULL) { + if (hPlacesBar != nullptr) { InitAlteredPlacesBar(); // finally subclass the places bar mir_subclassWindow(hPlacesBar, PlacesBarSubclassProc); diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp index aaf300bc55..67b1f7a288 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp @@ -89,7 +89,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar CProgress::CProgress() { _dwStartTime = GetTickCount(); - _hDlg = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress); + _hDlg = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress); } /** @@ -167,7 +167,7 @@ BYTE CProgress::Update() UpdateWindow(_hDlg); while (PeekMessage(&msg, _hDlg, 0, 0, PM_REMOVE) != 0) { - if (_hDlg == NULL || !IsDialogMessage(_hDlg, &msg)) { /* Wine fix. */ + if (_hDlg == nullptr || !IsDialogMessage(_hDlg, &msg)) { /* Wine fix. */ TranslateMessage(&msg); DispatchMessage(&msg); } @@ -184,7 +184,7 @@ BYTE CProgress::Update() **/ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...) { - if (_hDlg != NULL) { + if (_hDlg != nullptr) { HWND hProg = GetDlgItem(_hDlg, IDC_PROGRESS2); if (pszFormat) { wchar_t buf[MAX_PATH]; @@ -210,7 +210,7 @@ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...) **/ BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...) { - if (_hDlg != NULL) { + if (_hDlg != nullptr) { HWND hProg = GetDlgItem(_hDlg, IDC_PROGRESS); if (pszFormat) { wchar_t buf[MAX_PATH]; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index dfc1499a08..8dc1e60c31 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -165,19 +165,19 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) { DB::CEnumList Modules; - if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL)) + if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr)) { FILE *file; errno_t err = fopen_s(&file, pszFileName, "wt"); if (err != NULL) { - MsgErr(NULL, + MsgErr(nullptr, LPGENW("The ini-file \"%s\"\nfor saving contact information could not be opened."), pszFileName); return 1; } - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); // write header SYSTEMTIME now; @@ -208,7 +208,7 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) ExportContact(ExImContact->hContact, &Modules, file); fclose(file); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } return 0; } @@ -226,7 +226,7 @@ LPSTR strnrchr(LPSTR string, int ch, DWORD len) while (--string != start && *string != (CHAR)ch); if (*string == (CHAR)ch) /* char found ? */ return ((LPSTR)string); - return(NULL); + return(nullptr); } /** @@ -327,7 +327,7 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) // check Module and filter "Protocol" if (!pszModule || !*pszModule || mir_strncmp(pszModule, "Protocol", 8) == 0) return 1; - if ((end = value = mir_strchr(pszLine, '=')) == NULL) + if ((end = value = mir_strchr(pszLine, '=')) == nullptr) return 1; // truncate setting string if it has spaces at the end @@ -407,8 +407,8 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) dbv.pbVal = (PBYTE)value; for ( dest = dbv.pbVal, value = strtok(value, " "); value && *value; - value = strtok(NULL, " ")) - *(dest++) = (BYTE)strtol(value, NULL, 16); + value = strtok(nullptr, " ")) + *(dest++) = (BYTE)strtol(value, nullptr, 16); *dest = 0; break; } @@ -439,7 +439,7 @@ int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName) numContactsAdded = 0; // number of contacts, that were added to the database CHAR *strBuf = (CHAR *) mir_alloc(1); *strBuf = 0; - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); while (ImportreadLine(file, strBuf)) { numLines++; @@ -495,23 +495,23 @@ int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName) } //end while fclose(file); mir_free(strBuf); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); // the contact was not found in the file if (numContactsInFile > 0 && !numContactsAdded) { - MsgErr(NULL, + MsgErr(nullptr, LPGENW("None of the %d contacts, stored in the ini-file, match the selected contact!\nNothing will be imported"), numContactsInFile); } // Import complete else{ - MsgBox(NULL, MB_ICON_INFO, LPGENW("Import complete"), LPGENW("Some basic statistics"), + MsgBox(nullptr, MB_ICON_INFO, LPGENW("Import complete"), LPGENW("Some basic statistics"), LPGENW("Added %d of %d contacts stored in the ini-file."), numContactsAdded, numContactsInFile); } return 0; } - MsgErr(NULL, + MsgErr(nullptr, LPGENW("The ini-file \"%s\"\nfor reading contact information could not be opened."), pszFileName); return 1; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index ca7fdc4a25..1231a72c84 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -42,7 +42,7 @@ BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer) PBYTE s = (PBYTE)pBuffer; BYTE bIsUTF = 0; - if (s == NULL) return 1; + if (s == nullptr) return 1; while ((c = *s++) != 0) { if (c < 0x80) continue; if (!pcbBuffer) return 0; @@ -68,8 +68,8 @@ BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer) **/ CLineBuffer::CLineBuffer() { - _pVal = NULL; - _pTok = NULL; + _pVal = nullptr; + _pTok = nullptr; _cbVal = 0; _cbUsed = 0; } @@ -458,7 +458,7 @@ int CLineBuffer::fgetEncoded(FILE *inFile) case '=': if (_resizeBuf(1)) { fread(hex, 2, 1, inFile); - *(_pVal + _cbUsed++) = (BYTE)strtol(hex, NULL, 16); + *(_pVal + _cbUsed++) = (BYTE)strtol(hex, nullptr, 16); wAdd++; } break; @@ -502,7 +502,7 @@ size_t CLineBuffer::GetTokenFirst(const CHAR delim, CLineBuffer * pBuf) *pBuf = (LPCSTR)_pTok; *here = c; } - _pTok = (*here == 0 || *here == '\n') ? NULL : ++here; + _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here; break; } } @@ -537,7 +537,7 @@ size_t CLineBuffer::GetTokenNext(const CHAR delim, CLineBuffer * pBuf) *pBuf = (LPCSTR)_pTok; *here = c; } - _pTok = (*here == 0 || *here == '\n') ? NULL : ++here; + _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here; break; } } @@ -572,7 +572,7 @@ int CLineBuffer::DBWriteTokenFirst(MCONTACT hContact, const CHAR* pszModule, con iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok); *here = c; } - _pTok = (*here == 0 || *here == '\n') ? NULL : ++here; + _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here; break; } } @@ -608,7 +608,7 @@ int CLineBuffer::DBWriteTokenNext(MCONTACT hContact, const CHAR* pszModule, cons iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok); *here = c; } - _pTok = (*here == 0 || *here == '\n') ? NULL : ++here; + _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here; break; } } @@ -647,9 +647,9 @@ int CLineBuffer::DBWriteSettingString(MCONTACT hContact, const CHAR* pszModule, **/ CVCardFileVCF::CVCardFileVCF() { - _pFile = NULL; + _pFile = nullptr; _hContact = INVALID_CONTACT_ID; - _pszBaseProto = NULL; + _pszBaseProto = nullptr; _hasUtf8 = 0; _useUtf8 = FALSE; _cbRew = 0; @@ -690,12 +690,12 @@ size_t CVCardFileVCF::packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *c BYTE CVCardFileVCF::GetSetting(const CHAR *pszModule, const CHAR *pszSetting, DBVARIANT *dbv) { int type = _useUtf8 ? DBVT_UTF8 : DBVT_ASCIIZ; - dbv->pszVal = NULL; + dbv->pszVal = nullptr; if (!pszModule || db_get_s(_hContact, pszModule, pszSetting, dbv, type) || (dbv->type == DBVT_ASCIIZ && !dbv->pszVal && !*dbv->pszVal)) if (!_pszBaseProto || db_get_s(_hContact, _pszBaseProto, pszSetting, dbv) || (dbv->type == DBVT_ASCIIZ && !dbv->pszVal && !*dbv->pszVal)) return DBVT_DELETED; - _hasUtf8 += _useUtf8 && !IsUSASCII(dbv->pszVal, NULL); + _hasUtf8 += _useUtf8 && !IsUSASCII(dbv->pszVal, nullptr); return dbv->type; } @@ -869,9 +869,9 @@ void CVCardFileVCF::Close(void) { if (_pFile) fclose(_pFile); - _pFile = NULL; + _pFile = nullptr; _hContact = INVALID_CONTACT_ID; - _pszBaseProto = NULL; + _pszBaseProto = nullptr; } /** @@ -1055,7 +1055,7 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) { MAnnivDate mdb; - if (!mdb.DBGetBirthDate(_hContact, NULL)) + if (!mdb.DBGetBirthDate(_hContact, nullptr)) fprintf(_pFile, "BDAY:%d%02d%02d\n", mdb.Year(), mdb.Month(), mdb.Day()); } @@ -1165,8 +1165,8 @@ BYTE CVCardFileVCF::Import() if (!mir_strcmp(szEnt, "ADR")) { if (!pszParam) continue; if (!mir_strcmp(pszParam, "HOME")) { - _clVal.GetTokenFirst(';', NULL); - _clVal.GetTokenNext(';', NULL); + _clVal.GetTokenFirst(';', nullptr); + _clVal.GetTokenNext(';', nullptr); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STREET, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_CITY, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STATE, ';'); @@ -1175,7 +1175,7 @@ BYTE CVCardFileVCF::Import() continue; } if (!mir_strcmp(pszParam, "WORK")) { - _clVal.GetTokenFirst(';', NULL); + _clVal.GetTokenFirst(';', nullptr); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_OFFICE, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_STREET, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_CITY, ';'); @@ -1185,8 +1185,8 @@ BYTE CVCardFileVCF::Import() continue; } if (!mir_strcmp(pszParam, "POSTAL")) { - _clVal.GetTokenFirst(';', NULL); - _clVal.GetTokenNext(';', NULL); + _clVal.GetTokenFirst(';', nullptr); + _clVal.GetTokenNext(';', nullptr); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STREET, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_CITY, ';'); _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STATE, ';'); @@ -1203,13 +1203,13 @@ BYTE CVCardFileVCF::Import() memcpy(buf, _clVal.GetBuffer(), 4); buf[4] = 0; - db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, NULL, 10)); + db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, nullptr, 10)); memcpy(buf, _clVal.GetBuffer() + 4, 2); buf[2] = 0; - db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, NULL, 10)); + db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, nullptr, 10)); memcpy(buf, _clVal.GetBuffer() + 6, 2); buf[2] = 0; - db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, NULL, 10)); + db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, nullptr, 10)); } } continue; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index aee6a83b5f..170b39329f 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -92,7 +92,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) DWORD result = (DWORD) DialogBox(ghInst, MAKEINTRESOURCE(IDD_EXPORT_DATAHISTORY), - NULL, DlgProc_DataHistory); + nullptr, DlgProc_DataHistory); if (LOWORD(result) != IDOK) { return 0; @@ -101,13 +101,13 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) // show dialog to enable user to select modules for export if (!(_wExport & EXPORT_DATA) || - !DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL)) + !DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr)) { FILE *xmlfile = fopen(pszFileName, "wt"); if (!xmlfile) { - MsgErr(NULL, LPGENW("Can't create xml file!\n%S"), pszFileName); + MsgErr(nullptr, LPGENW("Can't create xml file!\n%S"), pszFileName); return 1; } @@ -183,7 +183,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) } // *end for #ifdef _DEBUG QueryPerformanceCounter(&t2); - MsgErr(NULL, LPGENW("Export took %f ms"), + MsgErr(nullptr, LPGENW("Export took %f ms"), (long double)(t2.QuadPart - t1.QuadPart) / freq.QuadPart * 1000.); #endif }// *end other export mode @@ -250,7 +250,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) CExImContactXML vContact(this); // import contacts - for (TiXmlElement *xContact = xmlParent->FirstChildElement(); xContact != NULL; xContact = xContact->NextSiblingElement()) { + for (TiXmlElement *xContact = xmlParent->FirstChildElement(); xContact != nullptr; xContact = xContact->NextSiblingElement()) { if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT)) { // update progressbar and abort if user clicked cancel LPTSTR pszNick = mir_utf8decodeW(xContact->Attribute("nick")); @@ -271,7 +271,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED; #ifdef _DEBUG default: - MsgErr(NULL, LPGENW("Importing %s caused error %d"), pszNick, result); + MsgErr(nullptr, LPGENW("Importing %s caused error %d"), pszNick, result); break; #endif } @@ -282,7 +282,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED; #ifdef _DEBUG default: - MsgErr(NULL, LPGENW("Loading contact %s from xml failed with error %d"), pszNick, result); + MsgErr(nullptr, LPGENW("Loading contact %s from xml failed with error %d"), pszNick, result); break; #endif } @@ -300,7 +300,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) return ERROR_ABORTED; #ifdef _DEBUG default: - MsgErr(NULL, LPGENW("Importing Owner caused error %d"), result); + MsgErr(nullptr, LPGENW("Importing Owner caused error %d"), result); #endif } } @@ -319,7 +319,7 @@ DWORD CFileXml::CountContacts(TiXmlElement* xmlParent) try { DWORD dwCount = 0; // count contacts in file for progress bar - for (TiXmlNode *xContact = xmlParent->FirstChild(); xContact != NULL; xContact = xContact->NextSibling()) + for (TiXmlNode *xContact = xmlParent->FirstChild(); xContact != nullptr; xContact = xContact->NextSibling()) if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT) || !mir_strcmpi(xContact->Value(), XKEY_OWNER)) dwCount += CountContacts(xContact->ToElement()) + 1; @@ -345,19 +345,19 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) // load xml file TiXmlDocument doc; if (!doc.LoadFile(pszFileName)) { - MsgErr(NULL, LPGENW("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"), + MsgErr(nullptr, LPGENW("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"), pszFileName, doc.ErrorId(), doc.ErrorDesc()); return 1; } // is xmlfile a XMLCard ? TiXmlElement *xmlCard = doc.FirstChildElement("XMLCard"); - if (xmlCard == NULL) { - MsgErr(NULL, LPGENW("The selected file is no valid XMLCard")); + if (xmlCard == nullptr) { + MsgErr(nullptr, LPGENW("The selected file is no valid XMLCard")); return 1; } // check version if (mir_strcmp(xmlCard->Attribute("ver"), XMLCARD_VERSION)) { - MsgErr(NULL, LPGENW("The version of the XMLCard is not supported by UserInfoEx")); + MsgErr(nullptr, LPGENW("The version of the XMLCard is not supported by UserInfoEx")); return 1; } @@ -373,13 +373,13 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) db_set_safety_mode(1); if (!ret) { - MsgBox(NULL, MB_ICONINFORMATION, + MsgBox(nullptr, MB_ICONINFORMATION, LPGENW("Complete"), LPGENW("Import complete"), LPGENW("Owner contact successfully imported.")); return 0; } else { - MsgErr(NULL, LPGENW("Selected XMLCard does not contain an owner contact!")); + MsgErr(nullptr, LPGENW("Selected XMLCard does not contain an owner contact!")); return 1; } } @@ -406,11 +406,11 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) #ifdef _DEBUG QueryPerformanceCounter(&t2); - MsgErr(NULL, LPGENW("Import took %f ms"), + MsgErr(nullptr, LPGENW("Import took %f ms"), (long double)(t2.QuadPart - t1.QuadPart) / freq.QuadPart * 1000.); #endif // show results - MsgBox(NULL, MB_ICONINFORMATION, LPGENW("Import complete"), LPGENW("Some basic statistics"), + MsgBox(nullptr, MB_ICONINFORMATION, LPGENW("Import complete"), LPGENW("Some basic statistics"), LPGENW("added contacts: %u / %u\nadded settings: %u / %u\nadded events %u / %u\nduplicated events: %u"), _numContactsDone, _numContactsTodo, _numSettingsDone, _numSettingsTodo, @@ -421,7 +421,7 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName) return 0; } catch(...) { - MsgErr(NULL, LPGENW("FATAL: An exception was thrown while importing contacts from xmlCard!")); + MsgErr(nullptr, LPGENW("FATAL: An exception was thrown while importing contacts from xmlCard!")); return 1; } } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index f18d2a2d1b..4d6d2fc829 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -35,8 +35,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WORD cchFileName) { - LPCSTR disp = 0; - LPSTR temp = 0; + LPCSTR disp = nullptr; + LPSTR temp = nullptr; cchFileName--; pszFileName[0] = 0; @@ -88,7 +88,7 @@ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WO LPCSTR FilterString(lpExImParam ExImContact) { - LPCSTR pszFilter = 0; + LPCSTR pszFilter = nullptr; switch (ExImContact->Typ) { case EXIM_SUBGROUP: case EXIM_ACCOUNT: @@ -135,12 +135,12 @@ INT_PTR SvcExImport_Export(lpExImParam ExImContact, HWND hwndParent) case 3: // .vcf { CVCardFileVCF vcfFile; - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); if (vcfFile.Open(ExImContact->hContact, szFileName, "wt")) { vcfFile.Export(FALSE); vcfFile.Close(); } - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); return 0; } } @@ -184,10 +184,10 @@ INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent) case 3: CVCardFileVCF vcfFile; if (vcfFile.Open(ExImContact->hContact, szFileName, "rt")) { - SetCursor(LoadCursor(NULL, IDC_WAIT)); + SetCursor(LoadCursor(nullptr, IDC_WAIT)); vcfFile.Import(); vcfFile.Close(); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } return 0; } diff --git a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp index 61342c94fe..be5292e438 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxml.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxml.cpp @@ -148,19 +148,19 @@ TiXmlBase::StringToBuffer::~StringToBuffer() TiXmlNode::TiXmlNode(NodeType _type) : TiXmlBase() { - parent = 0; + parent = nullptr; type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; + firstChild = nullptr; + lastChild = nullptr; + prev = nullptr; + next = nullptr; } TiXmlNode::~TiXmlNode() { TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; + TiXmlNode* temp = nullptr; while (node) { @@ -182,7 +182,7 @@ void TiXmlNode::CopyTo(TiXmlNode* target) const void TiXmlNode::Clear() { TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; + TiXmlNode* temp = nullptr; while (node) { @@ -191,27 +191,27 @@ void TiXmlNode::Clear() delete temp; } - firstChild = 0; - lastChild = 0; + firstChild = nullptr; + lastChild = nullptr; } TiXmlNode* TiXmlNode::LinkEndChild(TiXmlNode* node) { - assert(node->parent == 0 || node->parent == this); - assert(node->GetDocument() == 0 || node->GetDocument() == this->GetDocument()); + assert(node->parent == nullptr || node->parent == this); + assert(node->GetDocument() == nullptr || node->GetDocument() == this->GetDocument()); if (node->Type() == TiXmlNode::DOCUMENT) { delete node; - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } node->parent = this; node->prev = lastChild; - node->next = 0; + node->next = nullptr; if (lastChild) lastChild->next = node; @@ -227,12 +227,12 @@ TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) { if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; return LinkEndChild(node); } @@ -241,17 +241,17 @@ TiXmlNode* TiXmlNode::InsertEndChild(const TiXmlNode& addThis) TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& addThis) { if (!beforeThis || beforeThis->parent != this) { - return 0; + return nullptr; } if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; node->parent = this; node->next = beforeThis; @@ -273,17 +273,17 @@ TiXmlNode* TiXmlNode::InsertBeforeChild(TiXmlNode* beforeThis, const TiXmlNode& TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& addThis) { if (!afterThis || afterThis->parent != this) { - return 0; + return nullptr; } if (addThis.Type() == TiXmlNode::DOCUMENT) { - if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + if (GetDocument()) GetDocument()->SetError(TIXML_ERROR_DOCUMENT_TOP_ONLY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } TiXmlNode* node = addThis.Clone(); if (!node) - return 0; + return nullptr; node->parent = this; node->prev = afterThis; @@ -305,11 +305,11 @@ TiXmlNode* TiXmlNode::InsertAfterChild(TiXmlNode* afterThis, const TiXmlNode& ad TiXmlNode* TiXmlNode::ReplaceChild(TiXmlNode* replaceThis, const TiXmlNode& withThis) { if (replaceThis->parent != this) - return 0; + return nullptr; TiXmlNode* node = withThis.Clone(); if (!node) - return 0; + return nullptr; node->next = replaceThis->next; node->prev = replaceThis->prev; @@ -360,7 +360,7 @@ const TiXmlNode* TiXmlNode::FirstChild(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } @@ -372,7 +372,7 @@ TiXmlNode* TiXmlNode::FirstChild(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } @@ -384,7 +384,7 @@ const TiXmlNode* TiXmlNode::LastChild(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::LastChild(const char * _value) @@ -395,7 +395,7 @@ TiXmlNode* TiXmlNode::LastChild(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } const TiXmlNode* TiXmlNode::IterateChildren(const TiXmlNode* previous) const @@ -458,7 +458,7 @@ const TiXmlNode* TiXmlNode::NextSibling(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::NextSibling(const char * _value) @@ -469,7 +469,7 @@ TiXmlNode* TiXmlNode::NextSibling(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } const TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) const @@ -480,7 +480,7 @@ const TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) const if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) @@ -491,7 +491,7 @@ TiXmlNode* TiXmlNode::PreviousSibling(const char * _value) if (mir_strcmp(node->Value(), _value) == 0) return node; } - return 0; + return nullptr; } void TiXmlElement::RemoveAttribute(const char * name) @@ -516,7 +516,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement() const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::FirstChildElement() @@ -530,7 +530,7 @@ TiXmlElement* TiXmlNode::FirstChildElement() if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) const @@ -544,7 +544,7 @@ const TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) @@ -558,7 +558,7 @@ TiXmlElement* TiXmlNode::FirstChildElement(const char * _value) if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::NextSiblingElement() const @@ -572,7 +572,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement() const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::NextSiblingElement() @@ -586,7 +586,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement() if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } const TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) const @@ -600,7 +600,7 @@ const TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) const if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) @@ -614,7 +614,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement(const char * _value) if (node->ToElement()) return node->ToElement(); } - return 0; + return nullptr; } @@ -627,7 +627,7 @@ const TiXmlDocument* TiXmlNode::GetDocument() const if (node->ToDocument()) return node->ToDocument(); } - return 0; + return nullptr; } TiXmlDocument* TiXmlNode::GetDocument() @@ -639,13 +639,13 @@ TiXmlDocument* TiXmlNode::GetDocument() if (node->ToDocument()) return node->ToDocument(); } - return 0; + return nullptr; } TiXmlElement::TiXmlElement (const char * _value) : TiXmlNode(TiXmlNode::ELEMENT) { - firstChild = lastChild = 0; + firstChild = lastChild = nullptr; value = _value; } @@ -663,7 +663,7 @@ TiXmlElement::TiXmlElement(const std::string& _value) TiXmlElement::TiXmlElement(const TiXmlElement& copy) : TiXmlNode(TiXmlNode::ELEMENT) { - firstChild = lastChild = 0; + firstChild = lastChild = nullptr; copy.CopyTo(this); } @@ -701,7 +701,7 @@ const char * TiXmlElement::Attribute(const char * name) const if (node) return node->Value(); - return 0; + return nullptr; } @@ -801,7 +801,7 @@ void TiXmlElement::SetAttribute(const char * cname, const char * cvalue) else { TiXmlDocument* document = GetDocument(); - if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN); + if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); } } @@ -965,7 +965,7 @@ void TiXmlElement::CopyTo(TiXmlElement* target) const // Element class: // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; + const TiXmlAttribute* attribute = nullptr; for ( attribute = attributeSet.First(); attribute; attribute = attribute->Next()) @@ -973,7 +973,7 @@ void TiXmlElement::CopyTo(TiXmlElement* target) const target->SetAttribute(attribute->Name(), attribute->Value()); } - TiXmlNode* node = 0; + TiXmlNode* node = nullptr; for (node = firstChild; node; node = node->NextSibling()) { target->LinkEndChild(node->Clone()); @@ -985,7 +985,7 @@ TiXmlNode* TiXmlElement::Clone() const { TiXmlElement* clone = new TiXmlElement(Value()); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1001,7 +1001,7 @@ const char* TiXmlElement::GetText() const return childText->Value(); } } - return 0; + return nullptr; } @@ -1120,7 +1120,7 @@ bool TiXmlDocument::LoadFile(const char* filename, TiXmlEncoding encoding) } else { - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } } @@ -1129,7 +1129,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) { if (!file) { - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1146,7 +1146,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) // Strange case, but good to handle up front. if (length == 0) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1181,7 +1181,7 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) if (fread(buf, length, 1, file) != 1) { delete [] buf; - SetError(TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); + SetError(TIXML_ERROR_OPENING_FILE, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); return false; } @@ -1229,9 +1229,9 @@ bool TiXmlDocument::LoadFile(FILE* file, TiXmlEncoding encoding) data.append(lastPos, p-lastPos); } delete [] buf; - buf = 0; + buf = nullptr; - Parse(data.c_str(), 0, encoding); + Parse(data.c_str(), nullptr, encoding); if ( Error()) return false; @@ -1278,7 +1278,7 @@ void TiXmlDocument::CopyTo(TiXmlDocument* target) const target->error = error; target->errorDesc = errorDesc.c_str (); - TiXmlNode* node = 0; + TiXmlNode* node = nullptr; for (node = firstChild; node; node = node->NextSibling()) { target->LinkEndChild(node->Clone()); @@ -1290,7 +1290,7 @@ TiXmlNode* TiXmlDocument::Clone() const { TiXmlDocument* clone = new TiXmlDocument(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1342,7 +1342,7 @@ const TiXmlAttribute* TiXmlAttribute::Next() const // We are using knowledge of the sentinel. The sentinel // have a value or name. if (next->value.empty() && next->name.empty()) - return 0; + return nullptr; return next; } @@ -1351,7 +1351,7 @@ TiXmlAttribute* TiXmlAttribute::Next() // We are using knowledge of the sentinel. The sentinel // have a value or name. if (next->value.empty() && next->name.empty()) - return 0; + return nullptr; return next; } @@ -1360,7 +1360,7 @@ const TiXmlAttribute* TiXmlAttribute::Previous() const // We are using knowledge of the sentinel. The sentinel // have a value or name. if (prev->value.empty() && prev->name.empty()) - return 0; + return nullptr; return prev; } @@ -1369,7 +1369,7 @@ TiXmlAttribute* TiXmlAttribute::Previous() // We are using knowledge of the sentinel. The sentinel // have a value or name. if (prev->value.empty() && prev->name.empty()) - return 0; + return nullptr; return prev; } @@ -1494,7 +1494,7 @@ TiXmlNode* TiXmlComment::Clone() const TiXmlComment* clone = new TiXmlComment(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1558,11 +1558,11 @@ void TiXmlText::CopyTo(TiXmlText* target) const TiXmlNode* TiXmlText::Clone() const { - TiXmlText* clone = 0; + TiXmlText* clone = nullptr; clone = new TiXmlText(""); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1667,7 +1667,7 @@ TiXmlNode* TiXmlDeclaration::Clone() const TiXmlDeclaration* clone = new TiXmlDeclaration(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1704,7 +1704,7 @@ TiXmlNode* TiXmlUnknown::Clone() const TiXmlUnknown* clone = new TiXmlUnknown(); if (!clone) - return 0; + return nullptr; CopyTo(clone); return clone; @@ -1746,8 +1746,8 @@ void TiXmlAttributeSet::Remove(TiXmlAttribute* removeMe) { node->prev->next = node->next; node->next->prev = node->prev; - node->next = 0; - node->prev = 0; + node->next = nullptr; + node->prev = nullptr; return; } } @@ -1763,7 +1763,7 @@ const TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) const if (node->name == name) return node; } - return 0; + return nullptr; } TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) @@ -1775,7 +1775,7 @@ TiXmlAttribute* TiXmlAttributeSet::Find(const TIXML_STRING& name) if (node->name == name) return node; } - return 0; + return nullptr; } #ifdef TIXML_USE_STL @@ -1818,7 +1818,7 @@ TiXmlHandle TiXmlHandle::FirstChild() const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1830,7 +1830,7 @@ TiXmlHandle TiXmlHandle::FirstChild(const char * value) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1842,7 +1842,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement() const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1854,7 +1854,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement(const char * value) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1873,7 +1873,7 @@ TiXmlHandle TiXmlHandle::Child(int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1892,7 +1892,7 @@ TiXmlHandle TiXmlHandle::Child(const char* value, int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1911,7 +1911,7 @@ TiXmlHandle TiXmlHandle::ChildElement(int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } @@ -1930,5 +1930,5 @@ TiXmlHandle TiXmlHandle::ChildElement(const char* value, int count) const if (child) return TiXmlHandle(child); } - return TiXmlHandle(0); + return TiXmlHandle(nullptr); } diff --git a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp index 2c7a65bec9..eb5e97134e 100644 --- a/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp +++ b/plugins/UserInfoEx/src/ex_import/tinyxmlparser.cpp @@ -303,7 +303,7 @@ void TiXmlParsingData::Stamp(const char* now, TiXmlEncoding encoding) const char* TiXmlBase::SkipWhiteSpace(const char* p, TiXmlEncoding encoding) { if (!p || !*p) { - return 0; + return nullptr; } if (encoding == TIXML_ENCODING_UTF8) { while (*p) { @@ -400,7 +400,7 @@ const char* TiXmlBase::ReadName(const char* p, TIXML_STRING * name, TiXmlEncodin } return p; } - return 0; + return nullptr; } const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlEncoding encoding) @@ -417,12 +417,12 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE if (*(p + 2) == 'x') { // Hexadecimal. - if (!*(p + 3)) return 0; + if (!*(p + 3)) return nullptr; const char* q = p + 3; q = strchr(q, ';'); - if (!q || !*q) return 0; + if (!q || !*q) return nullptr; delta = q - p; --q; @@ -435,19 +435,19 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE else if (*q >= 'A' && *q <= 'F') ucs += mult * (*q - 'A' + 10); else - return 0; + return nullptr; mult *= 16; --q; } } else { // Decimal. - if (!*(p + 2)) return 0; + if (!*(p + 2)) return nullptr; const char* q = p + 2; q = strchr(q, ';'); - if (!q || !*q) return 0; + if (!q || !*q) return nullptr; delta = q - p; --q; @@ -456,7 +456,7 @@ const char* TiXmlBase::GetEntity(const char* p, char* value, int* length, TiXmlE if (*q >= '0' && *q <= '9') ucs += mult * (*q - '0'); else - return 0; + return nullptr; mult *= 10; --q; } @@ -646,8 +646,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm // contains nothing but other tags, most of what happens // here is skipping white space. if (!p || !*p) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } // Note that, for a document, this needs to come @@ -678,8 +678,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm p = SkipWhiteSpace(p, encoding); if (!p) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN); - return 0; + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); + return nullptr; } while (p && *p) { @@ -714,8 +714,8 @@ const char* TiXmlDocument::Parse(const char* p, TiXmlParsingData* prevData, TiXm // Was this empty? if (!firstChild) { - SetError(TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding); - return 0; + SetError(TIXML_ERROR_DOCUMENT_EMPTY, nullptr, nullptr, encoding); + return nullptr; } // All is well. @@ -743,18 +743,18 @@ void TiXmlDocument::SetError(int err, const char* pError, TiXmlParsingData* data TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding) { - TiXmlNode* returnNode = 0; + TiXmlNode* returnNode = nullptr; p = SkipWhiteSpace(p, encoding); if (!p || !*p || *p != '<') { - return 0; + return nullptr; } TiXmlDocument* doc = GetDocument(); p = SkipWhiteSpace(p, encoding); if (!p || !*p) { - return 0; + return nullptr; } // What is this thing? @@ -815,7 +815,7 @@ TiXmlNode* TiXmlNode::Identify(const char* p, TiXmlEncoding encoding) } else { if (doc) - doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN); + doc->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, TIXML_ENCODING_UNKNOWN); } return returnNode; } @@ -944,8 +944,8 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco TiXmlDocument* document = GetDocument(); if (!p || !*p) { - if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding); - return 0; + if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, nullptr, nullptr, encoding); + return nullptr; } if (data) { @@ -955,7 +955,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (*p != '<') { if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, p, data, encoding); - return 0; + return nullptr; } p = SkipWhiteSpace(p + 1, encoding); @@ -966,7 +966,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco p = ReadName(p, &value, encoding); if (!p || !*p) { if (document) document->SetError(TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding); - return 0; + return nullptr; } TIXML_STRING endTag("SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding); - return 0; + return nullptr; } if (*p == '/') { ++p; // Empty tag. if (*p != '>') { if (document) document->SetError(TIXML_ERROR_PARSING_EMPTY, p, data, encoding); - return 0; + return nullptr; } return (p + 1); } @@ -998,7 +998,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco ++p; p = ReadValue(p, data, encoding); // Note this is an Element method, and will set the error if one happens. if (!p || !*p) - return 0; + return nullptr; // We should find the end tag now if (StringEqual(p, endTag.c_str(), false, encoding)) { @@ -1007,7 +1007,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco } else { if (document) document->SetError(TIXML_ERROR_READING_END_TAG, p, data, encoding); - return 0; + return nullptr; } } else { @@ -1015,7 +1015,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco TiXmlAttribute* attrib = new TiXmlAttribute(); if (!attrib) { if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding); - return 0; + return nullptr; } attrib->SetDocument(document); @@ -1025,7 +1025,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (!p || !*p) { if (document) document->SetError(TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding); delete attrib; - return 0; + return nullptr; } // Handle the strange case of double attributes: @@ -1033,7 +1033,7 @@ const char* TiXmlElement::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (node) { node->SetValue(attrib->Value()); delete attrib; - return 0; + return nullptr; } attributeSet.Add(attrib); @@ -1057,8 +1057,8 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml TiXmlText* textNode = new TiXmlText(""); if (!textNode) { - if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding); - return 0; + if (document) document->SetError(TIXML_ERROR_OUT_OF_MEMORY, nullptr, nullptr, encoding); + return nullptr; } if (TiXmlBase::IsWhiteSpaceCondensed()) { @@ -1089,7 +1089,7 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml LinkEndChild(node); } else { - return 0; + return nullptr; } } } @@ -1098,7 +1098,7 @@ const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data, TiXml } if (!p) { - if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding); + if (document) document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, nullptr, nullptr, encoding); } return p; } @@ -1137,7 +1137,7 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco } if (!p || !*p || *p != '<') { if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding); - return 0; + return nullptr; } ++p; value = ""; @@ -1148,7 +1148,7 @@ const char* TiXmlUnknown::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco } if (!p) { - if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding); + if (document) document->SetError(TIXML_ERROR_PARSING_UNKNOWN, nullptr, nullptr, encoding); } if (*p == '>') return p + 1; @@ -1196,7 +1196,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco if (!StringEqual(p, startTag, false, encoding)) { document->SetError(TIXML_ERROR_PARSING_COMMENT, p, data, encoding); - return 0; + return nullptr; } p += mir_strlen(startTag); p = ReadText(p, &value, false, endTag, false, encoding); @@ -1207,7 +1207,7 @@ const char* TiXmlComment::Parse(const char* p, TiXmlParsingData* data, TiXmlEnco const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEncoding encoding) { p = SkipWhiteSpace(p, encoding); - if (!p || !*p) return 0; + if (!p || !*p) return nullptr; // int tabsize = 4; // if (document) @@ -1222,19 +1222,19 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn p = ReadName(p, &name, encoding); if (!p || !*p) { if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding); - return 0; + return nullptr; } p = SkipWhiteSpace(p, encoding); if (!p || !*p || *p != '=') { if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding); - return 0; + return nullptr; } ++p; // skip '=' p = SkipWhiteSpace(p, encoding); if (!p || !*p) { if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding); - return 0; + return nullptr; } const char* end; @@ -1265,7 +1265,7 @@ const char* TiXmlAttribute::Parse(const char* p, TiXmlParsingData* data, TiXmlEn // We did not have an opening quote but seem to have a // closing one. Give up and throw an error. if (document) document->SetError(TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding); - return 0; + return nullptr; } value += *p; ++p; @@ -1332,7 +1332,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin if (!StringEqual(p, startTag, false, encoding)) { document->SetError(TIXML_ERROR_PARSING_CDATA, p, data, encoding); - return 0; + return nullptr; } p += mir_strlen(startTag); @@ -1355,7 +1355,7 @@ const char* TiXmlText::Parse(const char* p, TiXmlParsingData* data, TiXmlEncodin p = ReadText(p, &value, ignoreWhite, end, false, encoding); if (p) return p - 1; // don't truncate the '<' - return 0; + return nullptr; } } @@ -1387,8 +1387,8 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml // the stuff in-between. TiXmlDocument* document = GetDocument(); if (!p || !*p || !StringEqual(p, "SetError(TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding); - return 0; + if (document) document->SetError(TIXML_ERROR_PARSING_DECLARATION, nullptr, nullptr, _encoding); + return nullptr; } if (data) { data->Stamp(p, _encoding); @@ -1428,7 +1428,7 @@ const char* TiXmlDeclaration::Parse(const char* p, TiXmlParsingData* data, TiXml ++p; } } - return 0; + return nullptr; } bool TiXmlText::Blank() const diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index f02b3c4eb3..b44a98ca60 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -175,8 +175,8 @@ extern "C" int __declspec(dllexport) Load(void) if (ServiceExists(MS_IMG_GETINTERFACE)) result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); - if (FIP == NULL || result != S_OK) { - MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags module will be disabled."), L"Error", MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); + if (FIP == nullptr || result != S_OK) { + MessageBoxEx(nullptr, TranslateT("Fatal error, image services not found. Flags module will be disabled."), L"Error", MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); return 1; } diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp index f0d8c23a62..8353ecb9ce 100644 --- a/plugins/UserInfoEx/src/mir_contactqueue.cpp +++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp @@ -35,7 +35,7 @@ static int QueueSortItems(const CQueueItem *i1, const CQueueItem *i2) CContactQueue::CContactQueue(int initialSize) : _queue(initialSize, QueueSortItems) { - _hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + _hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); _status = RUNNING; mir_forkthread((pThreadFunc)CContactQueue::ThreadProc, this); diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 00deddc966..9d3525b342 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -162,7 +162,7 @@ LPSTR GetAString(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) db_free(&dbv); } - return NULL; + return nullptr; } /** @@ -183,7 +183,7 @@ LPWSTR GetWString(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) db_free(&dbv); } - return NULL; + return nullptr; } /** @@ -268,7 +268,7 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps if (def > -1 && def < INT_MAX) { hSubContact = db_mc_getSub(hContact, def); if (hSubContact != NULL) { - wFlags = GetCtrl(hSubContact, pszSubModule, NULL, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType); + wFlags = GetCtrl(hSubContact, pszSubModule, nullptr, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType); if (wFlags != 0) { wFlags &= ~CTRLF_HASCUSTOM; wFlags |= CTRLF_HASMETA; @@ -283,7 +283,7 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps if (i != def) { hSubContact = db_mc_getSub(hContact, i); if (hSubContact != NULL) { - wFlags = GetCtrl(hSubContact, pszSubModule, NULL, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType); + wFlags = GetCtrl(hSubContact, pszSubModule, nullptr, Proto_GetBaseAccountName(hSubContact), pszSetting, dbv, destType); if (wFlags != 0) { wFlags &= ~CTRLF_HASCUSTOM; wFlags |= CTRLF_HASMETA; @@ -350,7 +350,7 @@ namespace Variant { BYTE ConvertString(DBVARIANT* dbv, const BYTE destType) { - if (dbv == NULL) + if (dbv == nullptr) return 1; switch (dbv->type) { @@ -381,13 +381,13 @@ BYTE ConvertString(DBVARIANT* dbv, const BYTE destType) switch (destType) { // destination type is "ascii" case DBVT_ASCIIZ: - mir_utf8decode(dbv->pszVal, NULL); + mir_utf8decode(dbv->pszVal, nullptr); dbv->type = (dbv->pszVal) ? destType : DBVT_DELETED; break; // destination type is "wchar" case DBVT_WCHAR: LPSTR savePtr = dbv->pszVal; - dbv->pszVal = NULL; + dbv->pszVal = nullptr; mir_utf8decode(savePtr, &dbv->pwszVal); mir_free(savePtr); dbv->type = (dbv->pwszVal) ? destType : DBVT_DELETED; @@ -430,7 +430,7 @@ BYTE ConvertString(DBVARIANT* dbv, const BYTE destType) BYTE dbv2String(DBVARIANT* dbv, const BYTE destType) { - if (dbv == NULL) + if (dbv == nullptr) return 1; WCHAR wbuf[32]; @@ -514,7 +514,7 @@ namespace Event { bool GetInfo(MEVENT hEvent, DBEVENTINFO *dbei) { dbei->cbBlob = 0; - dbei->pBlob = NULL; + dbei->pBlob = nullptr; return db_event_get(hEvent, dbei) != 0; } @@ -536,15 +536,15 @@ bool GetInfoWithData(MEVENT hEvent, DBEVENTINFO *dbei) } if (dbei->cbBlob) { dbei->pBlob = (PBYTE) mir_alloc(dbei->cbBlob); - if (dbei->pBlob == NULL) + if (dbei->pBlob == nullptr) dbei->cbBlob = 0; } - else dbei->pBlob = NULL; + else dbei->pBlob = nullptr; bool result = db_event_get(hEvent, dbei) != 0; if (result && dbei->pBlob) { mir_free(dbei->pBlob); - dbei->pBlob = NULL; + dbei->pBlob = nullptr; } return result; } @@ -713,7 +713,7 @@ LPSTR CEnumList::Insert(LPCSTR str) LPSTR p = mir_strdup(str); if (p && !insert(p)) { mir_free(p); - p = NULL; + p = nullptr; } return p; } diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index e836756b0d..542d31d12d 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -30,7 +30,7 @@ typedef struct _ICODESC BYTE size; } ICODESC; -HICON ghDefIcon = NULL; +HICON ghDefIcon = nullptr; static ICODESC icoDesc[] = { // common @@ -139,7 +139,7 @@ LPTSTR IcoLib_GetDefaultIconFileName() if (PathFileExists(absolute)) return path[i]; } - return NULL; + return nullptr; } /** @@ -165,12 +165,12 @@ static void IcoLib_CheckIconPackVersion(LPTSTR szIconPack) if (!LoadStringA(hIconDll, IDS_ICOPACKVERSION, szFileVersion, sizeof(szFileVersion)) || mir_strcmp(szFileVersion, "__UserInfoEx_IconPack_1.2__")) - MsgErr(NULL, LPGENW("Warning: Your current IconPack's version differs from the one UserInfoEx is designed for.\nSome icons may not be displayed correctly")); + MsgErr(nullptr, LPGENW("Warning: Your current IconPack's version differs from the one UserInfoEx is designed for.\nSome icons may not be displayed correctly")); FreeLibrary(hIconDll); } } else - MsgErr(NULL, LPGENW("Warning: No IconPack found in one of the following directories: 'customize\\icons', 'icons' or 'plugins'!")); + MsgErr(nullptr, LPGENW("Warning: No IconPack found in one of the following directories: 'customize\\icons', 'icons' or 'plugins'!")); } } @@ -223,10 +223,10 @@ void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL *pCtrl, BYTE numCtrls) **/ static HANDLE IcoLib_RegisterIconHandleEx(LPSTR szIconID, LPSTR szDescription, LPSTR szSection, LPTSTR szDefaultFile, int idIcon, int Size, HICON hDefIcon) { - HANDLE hIconHandle = NULL; + HANDLE hIconHandle = nullptr; if (szIconID && szDescription && szSection) { - SKINICONDESC sid = { 0 }; + SKINICONDESC sid = {}; sid.flags = SIDF_ALL_UNICODE; sid.pszName = szIconID; sid.description.w = mir_a2u(szDescription); diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 6cf37d3060..4aa17f387f 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -28,8 +28,8 @@ enum ECascadeType { MCAS_NOTINITIATED = 128 }; -HGENMENU hMenuItemRefresh = NULL; -HGENMENU *hMenuItemAccount = NULL; +HGENMENU hMenuItemRefresh = nullptr; +HGENMENU *hMenuItemAccount = nullptr; /** * Helper function to remove all menu items backward (first item second group). @@ -48,7 +48,7 @@ INT_PTR RemoveMenuItems(HGENMENU *pItems, int Count) while (Count--) { if (pItems[Count]) { Menu_RemoveItem(pItems[Count]); - pItems[Count] = NULL; + pItems[Count] = nullptr; } } return 0; @@ -65,9 +65,9 @@ INT_PTR RemoveMenuItems(HGENMENU *pItems, int Count) **/ void RebuildContact() { - HGENMENU mhRoot = NULL; - HGENMENU mhExIm = NULL; - static HGENMENU hMenuItem[4] = { NULL, NULL, NULL, NULL }; + HGENMENU mhRoot = nullptr; + HGENMENU mhExIm = nullptr; + static HGENMENU hMenuItem[4] = { nullptr, nullptr, nullptr, nullptr }; SvcEMailRebuildMenu(); SvcHomepageRebuildMenu(); @@ -89,8 +89,8 @@ void RebuildContact() switch (flag) { case 3: //cascade off - mhRoot = mhExIm = NULL; - hMenuItem[0] = NULL; + mhRoot = mhExIm = nullptr; + hMenuItem[0] = nullptr; break; case 5: //cascade all @@ -110,7 +110,7 @@ void RebuildContact() mi.name.a = LPGEN("Export/import contact"); mhExIm = Menu_AddContactMenuItem(&mi); hMenuItem[0] = mhExIm; - mhRoot = NULL; + mhRoot = nullptr; break; default: //disable Menu @@ -161,9 +161,9 @@ void RebuildMain() { BYTE item = 0; - HGENMENU mhRoot = NULL; - HGENMENU mhExIm = NULL; - static HGENMENU hMenuItem[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; + HGENMENU mhRoot = nullptr; + HGENMENU mhExIm = nullptr; + static HGENMENU hMenuItem[8] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; // load options int flag = db_get_b(NULL, MODNAME, SET_MI_MAIN, MCAS_NOTINITIATED); @@ -181,8 +181,8 @@ void RebuildMain() switch (flag) { case 3: //cascade off - mhRoot = mhExIm = NULL; - hMenuItem[item++] = NULL; + mhRoot = mhExIm = nullptr; + hMenuItem[item++] = nullptr; break; case 5: //cascade all @@ -202,7 +202,7 @@ void RebuildMain() mi.name.a = LPGEN("Export/import contact"); mhExIm = Menu_AddMainMenuItem(&mi); hMenuItem[item++] = mhExIm; - mhRoot = NULL; + mhRoot = nullptr; break; default: //disable Menue @@ -260,8 +260,8 @@ void RebuildMain() hMenuItem[item++] = Menu_AddMainMenuItem(&mi); } else { - hMenuItem[item++] = NULL; - hMenuItem[item++] = NULL; + hMenuItem[item++] = nullptr; + hMenuItem[item++] = nullptr; } // Refresh Contact Details @@ -295,9 +295,9 @@ void RebuildGroup() int flag = 0; BYTE item = 0; - HGENMENU mhRoot = NULL; - HGENMENU mhExIm = NULL; - static HGENMENU hMenuItem[3] = { NULL, NULL, NULL }; + HGENMENU mhRoot = nullptr; + HGENMENU mhExIm = nullptr; + static HGENMENU hMenuItem[3] = { nullptr, nullptr, nullptr }; // load options flag = db_get_b(NULL, MODNAME, SET_MI_GROUP, MCAS_NOTINITIATED); @@ -319,8 +319,8 @@ void RebuildGroup() switch (flag) { case 3: //cascade off - mhRoot = mhExIm = NULL; - hMenuItem[item++] = NULL; + mhRoot = mhExIm = nullptr; + hMenuItem[item++] = nullptr; break; case 5: //cascade all @@ -340,7 +340,7 @@ void RebuildGroup() mi.name.a = LPGEN("Export/import contact"); mhExIm = Menu_AddGroupMenuItem(&mi); hMenuItem[item++] = mhExIm; - mhRoot = NULL; + mhRoot = nullptr; break; default: //disable Menue @@ -386,9 +386,9 @@ void RebuildSubGroup() BYTE item = 0; GroupMenuParam gmp = { 0 }; - HGENMENU mhRoot = NULL; - HGENMENU mhExIm = NULL; - static HGENMENU hMenuItem[3] = { NULL, NULL, NULL }; + HGENMENU mhRoot = nullptr; + HGENMENU mhExIm = nullptr; + static HGENMENU hMenuItem[3] = { nullptr, nullptr, nullptr }; // load options flag = db_get_b(NULL, MODNAME, SET_MI_SUBGROUP, MCAS_NOTINITIATED); @@ -411,8 +411,8 @@ void RebuildSubGroup() switch (flag) { case 3: //cascade off - mhRoot = mhExIm = NULL; - hMenuItem[item++] = NULL; + mhRoot = mhExIm = nullptr; + hMenuItem[item++] = nullptr; break; case 5: //cascade all @@ -432,7 +432,7 @@ void RebuildSubGroup() mi.name.a = LPGEN("Export/import group"); mhExIm = Menu_AddSubGroupMenuItem(&mi); hMenuItem[item++] = mhExIm; - mhRoot = NULL; + mhRoot = nullptr; break; default: //disable Menue @@ -510,7 +510,7 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) item = 0; HGENMENU mhRoot = pcli->menuProtos[i].pMenu, mhExIm; - if (mhRoot == NULL) + if (mhRoot == nullptr) break; PROTOACCOUNT *pa = Proto_GetAccount(pcli->menuProtos[i].szProto); diff --git a/plugins/UserInfoEx/src/mir_string.cpp b/plugins/UserInfoEx/src/mir_string.cpp index b483b0fdb9..da3d819fa7 100644 --- a/plugins/UserInfoEx/src/mir_string.cpp +++ b/plugins/UserInfoEx/src/mir_string.cpp @@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char* mir_strncat_c(char *pszDest, const char cSrc) { size_t size = 2; - if (pszDest != NULL) + if (pszDest != nullptr) size += mir_strlen(pszDest); //cSrc = 1 + 1 forNULL temination char *pszRet = (char *)mir_realloc(pszDest, (sizeof(char) * size)); - if (pszRet == NULL) - return NULL; + if (pszRet == nullptr) + return nullptr; pszRet[size - 2] = cSrc; pszRet[size - 1] = 0; @@ -39,12 +39,12 @@ char* mir_strncat_c(char *pszDest, const char cSrc) wchar_t* mir_wcsncat_c(wchar_t *pwszDest, const wchar_t wcSrc) { size_t size = 2; - if (pwszDest != NULL) + if (pwszDest != nullptr) size += mir_wstrlen(pwszDest); //cSrc = 1 + 1 forNULL temination wchar_t *pwszRet = (wchar_t *)mir_realloc(pwszDest, (sizeof(wchar_t) * size)); - if (pwszRet == NULL) - return NULL; + if (pwszRet == nullptr) + return nullptr; pwszRet[size - 2] = wcSrc; pwszRet[size - 1] = 0; @@ -53,7 +53,7 @@ wchar_t* mir_wcsncat_c(wchar_t *pwszDest, const wchar_t wcSrc) char* mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo) { - char *pszReturn = NULL; + char *pszReturn = nullptr; size_t sizeNew = 0, sizeLen = mir_strlen(pszDest); if (sizeFrom < sizeLen && sizeTo <= sizeLen && sizeFrom < sizeTo) { sizeNew = sizeLen - (sizeTo - sizeFrom); @@ -72,7 +72,7 @@ char* mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo) int mir_IsEmptyA(char *str) { - if (str == NULL || str[0] == 0) + if (str == nullptr || str[0] == 0) return 1; int i = 0; @@ -88,7 +88,7 @@ int mir_IsEmptyA(char *str) int mir_IsEmptyW(wchar_t *str) { - if (str == NULL || str[0] == 0) + if (str == nullptr || str[0] == 0) return 1; int i = 0; diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp index 5ce0033301..205bf80add 100644 --- a/plugins/UserInfoEx/src/psp_anniversary.cpp +++ b/plugins/UserInfoEx/src/psp_anniversary.cpp @@ -78,7 +78,7 @@ static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM w LPTSTR pszText; if (len == 0 - || (pszText = (LPTSTR)_alloca((len + 1) * sizeof(wchar_t))) == NULL + || (pszText = (LPTSTR)_alloca((len + 1) * sizeof(wchar_t))) == nullptr || !Edit_GetText(hEdit, pszText, len + 1)) { MsgErr(hDlg, LPGENW("Please enter a valid description first!")); @@ -126,7 +126,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM TranslateDialogDefault(hDlg); pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_AGE, SET_CONTACT_AGE, DBVT_BYTE)); - pCtrlList->insert(CAnnivEditCtrl::CreateObj(hDlg, EDIT_ANNIVERSARY_DATE, NULL)); + pCtrlList->insert(CAnnivEditCtrl::CreateObj(hDlg, EDIT_ANNIVERSARY_DATE, nullptr)); // hContact == NULL or reminder disabled CAnnivEditCtrl::GetObj(hDlg, EDIT_ANNIVERSARY_DATE)->EnableReminderCtrl(lParam != NULL); @@ -164,7 +164,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case DTN_DROPDOWN: HWND hMonthCal = DateTime_GetMonthCal(lpNmhdr->hwndFrom); SetWindowLongPtr(hMonthCal, GWL_STYLE, GetWindowLongPtr(hMonthCal, GWL_STYLE) | MCS_WEEKNUMBERS); - InvalidateRect(hMonthCal, NULL, TRUE); + InvalidateRect(hMonthCal, nullptr, TRUE); } } return FALSE; @@ -232,7 +232,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl)) { MAnnivDate *pCurrent = pDateCtrl->Current(); if (pCurrent) { - int rc = MsgBox(hDlg, MB_YESNO | MB_ICON_QUESTION | MB_NOPOPUP, LPGENW("Delete"), NULL, + int rc = MsgBox(hDlg, MB_YESNO | MB_ICON_QUESTION | MB_NOPOPUP, LPGENW("Delete"), nullptr, LPGENW("Do you really want to delete the %s?"), pCurrent->Description()); if (rc == IDYES) diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index b8a979296a..0bab0f9a8d 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -870,7 +870,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR else if (IsDlgButtonChecked(hDlg, RADIO_OPT_POPUP_CUSTOM)) { wchar_t szDelay[4]; GetDlgItemText(hDlg, EDIT_DELAY, szDelay, _countof(szDelay)); - db_set_b(NULL, MODNAME, SET_POPUP_DELAY, (BYTE)wcstol(szDelay, NULL, 10)); + db_set_b(NULL, MODNAME, SET_POPUP_DELAY, (BYTE)wcstol(szDelay, nullptr, 10)); } else db_unset(NULL, MODNAME, SET_POPUP_DELAY); diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp index 5c696c90b4..cf18c2aa90 100644 --- a/plugins/UserInfoEx/src/psp_origin.cpp +++ b/plugins/UserInfoEx/src/psp_origin.cpp @@ -46,7 +46,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SendDlgItemMessage(hDlg, IDC_PAGETITLE, WM_SETFONT, (WPARAM)hBoldFont, 0); TranslateDialogDefault(hDlg); - SetTimer(hDlg, 1, 5000, NULL); + SetTimer(hDlg, 1, 5000, nullptr); pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_STREET, SET_CONTACT_ORIGIN_STREET, DBVT_WCHAR)); pCtrlList->insert(CEditCtrl::CreateObj(hDlg, EDIT_ZIP, SET_CONTACT_ORIGIN_ZIP, DBVT_WCHAR)); @@ -56,7 +56,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara GetCountryList(&nList, &pList); pCtrlList->insert(CCombo::CreateObj(hDlg, EDIT_COUNTRY, SET_CONTACT_ORIGIN_COUNTRY, DBVT_WORD, pList, nList)); - pCtrlList->insert(CTzCombo::CreateObj(hDlg, EDIT_TIMEZONE, NULL)); + pCtrlList->insert(CTzCombo::CreateObj(hDlg, EDIT_TIMEZONE, nullptr)); } } break; diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index 85a0c98b08..f1ce019d2e 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -134,11 +134,11 @@ static LPLCITEM ProfileList_GetItemData(HWND hList, int iItem) LVITEM lvi; if (iItem < 0) - return NULL; + return nullptr; lvi.mask = LVIF_PARAM; lvi.iSubItem = 0; lvi.iItem = iItem; - return (SendMessage(hList, LVM_GETITEM, NULL, (LPARAM)&lvi)) ? (LPLCITEM)lvi.lParam : NULL; + return (SendMessage(hList, LVM_GETITEM, NULL, (LPARAM)&lvi)) ? (LPLCITEM)lvi.lParam : nullptr; } /** @@ -205,11 +205,11 @@ static int ProfileList_EndLabelEdit(LPLISTCTRL pList, BYTE bSave) return 1; // set hEdit NULL to indicate the endlabeledit call and prevent other calls hEdit = pList->labelEdit.hEdit; - pList->labelEdit.hEdit = NULL; + pList->labelEdit.hEdit = nullptr; if (bSave != FALSE && pList->labelEdit.pItem) { WORD ccText; - LPTSTR szEdit = NULL; + LPTSTR szEdit = nullptr; BYTE bChanged = FALSE; // an list element was selected @@ -217,7 +217,7 @@ static int ProfileList_EndLabelEdit(LPLISTCTRL pList, BYTE bSave) pList->labelEdit.pItem->iListItem = pList->labelEdit.dropDown.iItem; if (pList->labelEdit.pItem->pszText[0]) { mir_free(pList->labelEdit.pItem->pszText[0]); - pList->labelEdit.pItem->pszText[0] = NULL; + pList->labelEdit.pItem->pszText[0] = nullptr; } bChanged = TRUE; } @@ -278,7 +278,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem RECT rcList; if (!PtrIsValid(pList)) - return NULL; + return nullptr; if (pList->labelEdit.hEdit) ProfileList_EndLabelEdit(pList, FALSE); @@ -288,7 +288,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem lvi.iSubItem = iSubItem; if (!ListView_GetItem(pList->hList, &lvi)) - return NULL; + return nullptr; pItem = (LPLCITEM)lvi.lParam; @@ -296,7 +296,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem // do not edit deviders or protocol based contact information if (!(lvi.state & LVIS_SELECTED) || !PtrIsValid(pItem) || (hContact && (pItem->wFlags & CTRLF_HASPROTO))) - return NULL; + return nullptr; ListView_EnsureVisible(pList->hList, iItem, FALSE); ListView_GetSubItemRect(pList->hList, iItem, iSubItem, LVIR_BOUNDS, &pList->labelEdit.rcCombo); @@ -314,11 +314,11 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem // create the button control for the combobox if (!iSubItem && pItem->idstrList) { - pList->labelEdit.hBtn = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, NULL, WS_VISIBLE | WS_CHILD | MBS_DOWNARROW, + pList->labelEdit.hBtn = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, nullptr, WS_VISIBLE | WS_CHILD | MBS_DOWNARROW, pList->labelEdit.rcCombo.right - (pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top), pList->labelEdit.rcCombo.top, pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, - pList->hList, NULL, ghInst, NULL); + pList->hList, nullptr, ghInst, nullptr); if (pList->labelEdit.hBtn) { SetWindowLongPtr(pList->labelEdit.hBtn, GWLP_ID, BTN_EDIT); pList->labelEdit.rcCombo.right -= pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top; @@ -341,9 +341,9 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem pList->labelEdit.rcCombo.left, pList->labelEdit.rcCombo.top, pList->labelEdit.rcCombo.right - pList->labelEdit.rcCombo.left, pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top, - pList->hList, NULL, ghInst, NULL); + pList->hList, nullptr, ghInst, nullptr); if (!pList->labelEdit.hEdit) - return NULL; + return nullptr; SendMessage(pList->labelEdit.hEdit, WM_SETFONT, (WPARAM)(pList->hFont), 0); SendMessage(pList->labelEdit.hEdit, EM_SETSEL, 0, (LPARAM)-1); SetUserData(pList->labelEdit.hEdit, pList); @@ -430,8 +430,8 @@ static BYTE ProfileList_AddNewItem(HWND hDlg, LPLISTCTRL pList, const PROFILEENT pItem->nType = CTRL_LIST_ITEM; pItem->wFlags = hContact ? CTRLF_HASCUSTOM : 0; pItem->iListItem = 0; - pItem->pszText[0] = NULL; - pItem->pszText[1] = NULL; + pItem->pszText[0] = nullptr; + pItem->pszText[1] = nullptr; // get category list pEntry->GetList((WPARAM)&pItem->idstrListCount, (LPARAM)&pItem->idstrList); @@ -505,13 +505,13 @@ static int ProfileList_AddItemlistFromDB( pItem->idstrList = idList; pItem->idstrListCount = nList; pItem->iListItem = 0; - pItem->pszText[0] = NULL; + pItem->pszText[0] = nullptr; pItem->pszText[1] = dbvVal.ptszVal; pItem->wFlags = wFlags; lvi.lParam = (LPARAM)pItem; // get id-str-list-item for the category string - if (idList != NULL) { + if (idList != nullptr) { for (j = 0; j < nList; j++) { switch (dbvCat.type) { case DBVT_BYTE: @@ -536,7 +536,7 @@ static int ProfileList_AddItemlistFromDB( } } // item not found in the predefined category list? - if ((idList == NULL || j == nList) && dbvCat.type == DBVT_ASCIIZ) { + if ((idList == nullptr || j == nList) && dbvCat.type == DBVT_ASCIIZ) { pItem->pszText[0] = mir_a2u(dbvCat.pszVal); db_free(&dbvCat); } @@ -661,7 +661,7 @@ static LRESULT CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wP if (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_WANTRETURN && !(GetKeyState(VK_CONTROL) & 0x8000)) break; if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) { - bEditNext = !pList->labelEdit.iSubItem && !ProfileList_GetItemText(pList->hList, pList->labelEdit.iItem, 1, NULL, NULL); + bEditNext = !pList->labelEdit.iSubItem && !ProfileList_GetItemText(pList->hList, pList->labelEdit.iItem, 1, nullptr, NULL); iItem = pList->labelEdit.iItem; ProfileList_EndLabelEdit(pList->hList, TRUE); if (bEditNext) ProfileList_BeginLabelEdit(pList->hList, pList->labelEdit.iItem, 1); @@ -824,7 +824,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa // calculate size of text on the screen HDC hDC = GetDC(GetParent(hwnd)); - if (hDC != NULL) { + if (hDC != nullptr) { SelectObject(hDC, (HFONT)SendMessage(GetParent(hwnd), WM_GETFONT, NULL, NULL)); GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], (int)mir_wstrlen(pItem->pszText[hi.iSubItem]), &textSize); ReleaseDC(GetParent(hwnd), hDC); @@ -850,7 +850,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa ? pItem->pszText[0] : TranslateT("")) ); - InvalidateRect(pList->hTip, NULL, TRUE); + InvalidateRect(pList->hTip, nullptr, TRUE); } else SendMessage(pList->hTip, TTM_SETTITLE, 0, (LPARAM)""); @@ -914,7 +914,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa GetWindowText(pList->labelEdit.hEdit, szEdit, _countof(szEdit)); // need to create the dropdown list? - if (pList->labelEdit.dropDown.hDrop == NULL) { + if (pList->labelEdit.dropDown.hDrop == nullptr) { const int listHeight = 120; RECT rc, rcList; int add; @@ -933,10 +933,10 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa rc.bottom = rc.top + listHeight; } - pList->labelEdit.dropDown.hDrop = CreateWindowEx(0, L"LISTBOX", NULL, + pList->labelEdit.dropDown.hDrop = CreateWindowEx(0, L"LISTBOX", nullptr, WS_CHILD | WS_BORDER | WS_VSCROLL | LBS_COMBOBOX | LBS_HASSTRINGS, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, - hwnd, NULL, ghInst, NULL); + hwnd, nullptr, ghInst, nullptr); if (!pList->labelEdit.dropDown.hDrop) return FALSE; SetUserData(pList->labelEdit.dropDown.hDrop, pList); @@ -1073,8 +1073,8 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR rc.right -= GetSystemMetrics(SM_CXVSCROLL); // initiate the tooltips - pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_BALLOON | TTS_NOPREFIX | TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, NULL, ghInst, NULL); + pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_BALLOON | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, nullptr, ghInst, nullptr); if (pList->hTip) { SetWindowPos(pList->hTip, HWND_TOPMOST, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -1307,7 +1307,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR mii.dwTypeData = TranslateT("Delete"); InsertMenuItem(hMenu, 7, TRUE, &mii); } - TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDlg, 0); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hDlg, nullptr); DestroyMenu(hMenu); } return 0; diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp index 48a619d79d..88e593c5b9 100644 --- a/plugins/UserInfoEx/src/svc_avatar.cpp +++ b/plugins/UserInfoEx/src/svc_avatar.cpp @@ -25,7 +25,7 @@ namespace NServices { namespace NAvatar { - static HANDLE ghChangedHook = NULL; + static HANDLE ghChangedHook = nullptr; static int GetContactAvatarFileName(LPCWSTR zodiac, LPWSTR szFileName, int cchFileName) { @@ -141,7 +141,7 @@ namespace NServices } else if (!bEnable && ghChangedHook) { UnhookEvent(ghChangedHook); - ghChangedHook = NULL; + ghChangedHook = nullptr; // walk through all the contacts stored in the DB for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) diff --git a/plugins/UserInfoEx/src/svc_constants.cpp b/plugins/UserInfoEx/src/svc_constants.cpp index 2b89416c5e..2ab6f5fa40 100644 --- a/plugins/UserInfoEx/src/svc_constants.cpp +++ b/plugins/UserInfoEx/src/svc_constants.cpp @@ -22,226 +22,226 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" static IDSTRLIST TmplLanguages[] = { - { 0, LPGEN("Unspecified"), 0}, - {55, LPGEN("Afrikaans"), 0}, - {58, LPGEN("Albanian"), 0}, - { 1, LPGEN("Arabic"), 0}, - {59, LPGEN("Armenian"), 0}, - {68, LPGEN("Azerbaijani"), 0}, - {72, LPGEN("Belorussian"), 0}, - { 2, LPGEN("Bhojpuri"), 0}, - {56, LPGEN("Bosnian"), 0}, - { 3, LPGEN("Bulgarian"), 0}, - { 4, LPGEN("Burmese"), 0}, - { 5, LPGEN("Cantonese"), 0}, - { 6, LPGEN("Catalan"), 0}, - {61, LPGEN("Chamorro"), 0}, - { 7, LPGEN("Chinese"), 0}, - { 8, LPGEN("Croatian"), 0}, - { 9, LPGEN("Czech"), 0}, - {10, LPGEN("Danish"), 0}, - {11, LPGEN("Dutch"), 0}, - {12, LPGEN("English"), 0}, - {13, LPGEN("Esperanto"), 0}, - {14, LPGEN("Estonian"), 0}, - {15, LPGEN("Farsi"), 0}, - {16, LPGEN("Finnish"), 0}, - {17, LPGEN("French"), 0}, - {18, LPGEN("Gaelic"), 0}, - {19, LPGEN("German"), 0}, - {20, LPGEN("Greek"), 0}, - {70, LPGEN("Gujarati"), 0}, - {21, LPGEN("Hebrew"), 0}, - {22, LPGEN("Hindi"), 0}, - {23, LPGEN("Hungarian"), 0}, - {24, LPGEN("Icelandic"), 0}, - {25, LPGEN("Indonesian"), 0}, - {26, LPGEN("Italian"), 0}, - {27, LPGEN("Japanese"), 0}, - {28, LPGEN("Khmer"), 0}, - {29, LPGEN("Korean"), 0}, - {69, LPGEN("Kurdish"), 0}, - {30, LPGEN("Lao"), 0}, - {31, LPGEN("Latvian"), 0}, - {32, LPGEN("Lithuanian"), 0}, - {65, LPGEN("Macedonian"), 0}, - {33, LPGEN("Malay"), 0}, - {63, LPGEN("Mandarin"), 0}, - {62, LPGEN("Mongolian"), 0}, - {34, LPGEN("Norwegian"), 0}, - {57, LPGEN("Persian"), 0}, - {35, LPGEN("Polish"), 0}, - {36, LPGEN("Portuguese"), 0}, - {60, LPGEN("Punjabi"), 0}, - {37, LPGEN("Romanian"), 0}, - {38, LPGEN("Russian"), 0}, - {39, LPGEN("Serbo-Croatian"), 0}, - {66, LPGEN("Sindhi"), 0}, - {40, LPGEN("Slovak"), 0}, - {41, LPGEN("Slovenian"), 0}, - {42, LPGEN("Somali"), 0}, - {43, LPGEN("Spanish"), 0}, - {44, LPGEN("Swahili"), 0}, - {45, LPGEN("Swedish"), 0}, - {46, LPGEN("Tagalog"), 0}, - {64, LPGEN("Taiwanese"), 0}, - {71, LPGEN("Tamil"), 0}, - {47, LPGEN("Tatar"), 0}, - {48, LPGEN("Thai"), 0}, - {49, LPGEN("Turkish"), 0}, - {50, LPGEN("Ukrainian"), 0}, - {51, LPGEN("Urdu"), 0}, - {52, LPGEN("Vietnamese"), 0}, - {67, LPGEN("Welsh"), 0}, - {53, LPGEN("Yiddish"), 0}, - {54, LPGEN("Yoruba"), 0}, + { 0, LPGEN("Unspecified"), nullptr}, + {55, LPGEN("Afrikaans"), nullptr}, + {58, LPGEN("Albanian"), nullptr}, + { 1, LPGEN("Arabic"), nullptr}, + {59, LPGEN("Armenian"), nullptr}, + {68, LPGEN("Azerbaijani"), nullptr}, + {72, LPGEN("Belorussian"), nullptr}, + { 2, LPGEN("Bhojpuri"), nullptr}, + {56, LPGEN("Bosnian"), nullptr}, + { 3, LPGEN("Bulgarian"), nullptr}, + { 4, LPGEN("Burmese"), nullptr}, + { 5, LPGEN("Cantonese"), nullptr}, + { 6, LPGEN("Catalan"), nullptr}, + {61, LPGEN("Chamorro"), nullptr}, + { 7, LPGEN("Chinese"), nullptr}, + { 8, LPGEN("Croatian"), nullptr}, + { 9, LPGEN("Czech"), nullptr}, + {10, LPGEN("Danish"), nullptr}, + {11, LPGEN("Dutch"), nullptr}, + {12, LPGEN("English"), nullptr}, + {13, LPGEN("Esperanto"), nullptr}, + {14, LPGEN("Estonian"), nullptr}, + {15, LPGEN("Farsi"), nullptr}, + {16, LPGEN("Finnish"), nullptr}, + {17, LPGEN("French"), nullptr}, + {18, LPGEN("Gaelic"), nullptr}, + {19, LPGEN("German"), nullptr}, + {20, LPGEN("Greek"), nullptr}, + {70, LPGEN("Gujarati"), nullptr}, + {21, LPGEN("Hebrew"), nullptr}, + {22, LPGEN("Hindi"), nullptr}, + {23, LPGEN("Hungarian"), nullptr}, + {24, LPGEN("Icelandic"), nullptr}, + {25, LPGEN("Indonesian"), nullptr}, + {26, LPGEN("Italian"), nullptr}, + {27, LPGEN("Japanese"), nullptr}, + {28, LPGEN("Khmer"), nullptr}, + {29, LPGEN("Korean"), nullptr}, + {69, LPGEN("Kurdish"), nullptr}, + {30, LPGEN("Lao"), nullptr}, + {31, LPGEN("Latvian"), nullptr}, + {32, LPGEN("Lithuanian"), nullptr}, + {65, LPGEN("Macedonian"), nullptr}, + {33, LPGEN("Malay"), nullptr}, + {63, LPGEN("Mandarin"), nullptr}, + {62, LPGEN("Mongolian"), nullptr}, + {34, LPGEN("Norwegian"), nullptr}, + {57, LPGEN("Persian"), nullptr}, + {35, LPGEN("Polish"), nullptr}, + {36, LPGEN("Portuguese"), nullptr}, + {60, LPGEN("Punjabi"), nullptr}, + {37, LPGEN("Romanian"), nullptr}, + {38, LPGEN("Russian"), nullptr}, + {39, LPGEN("Serbo-Croatian"), nullptr}, + {66, LPGEN("Sindhi"), nullptr}, + {40, LPGEN("Slovak"), nullptr}, + {41, LPGEN("Slovenian"), nullptr}, + {42, LPGEN("Somali"), nullptr}, + {43, LPGEN("Spanish"), nullptr}, + {44, LPGEN("Swahili"), nullptr}, + {45, LPGEN("Swedish"), nullptr}, + {46, LPGEN("Tagalog"), nullptr}, + {64, LPGEN("Taiwanese"), nullptr}, + {71, LPGEN("Tamil"), nullptr}, + {47, LPGEN("Tatar"), nullptr}, + {48, LPGEN("Thai"), nullptr}, + {49, LPGEN("Turkish"), nullptr}, + {50, LPGEN("Ukrainian"), nullptr}, + {51, LPGEN("Urdu"), nullptr}, + {52, LPGEN("Vietnamese"), nullptr}, + {67, LPGEN("Welsh"), nullptr}, + {53, LPGEN("Yiddish"), nullptr}, + {54, LPGEN("Yoruba"), nullptr}, }; static IDSTRLIST TmplOccupations[] = { - { 0, LPGEN("Unspecified"), 0}, - { 1, LPGEN("Academic"), 0}, - { 2, LPGEN("Administrative"), 0}, - { 3, LPGEN("Art/Entertainment"), 0}, - { 4, LPGEN("College Student"), 0}, - { 5, LPGEN("Computers"), 0}, - { 6, LPGEN("Community & Social"), 0}, - { 7, LPGEN("Education"), 0}, - { 8, LPGEN("Engineering"), 0}, - { 9, LPGEN("Financial Services"), 0}, - {10, LPGEN("Government"), 0}, - {11, LPGEN("High School Student"), 0}, - {12, LPGEN("Home"), 0}, - {13, LPGEN("ICQ - Providing Help"), 0}, - {14, LPGEN("Law"), 0}, - {15, LPGEN("Managerial"), 0}, - {16, LPGEN("Manufacturing"), 0}, - {17, LPGEN("Medical/Health"), 0}, - {18, LPGEN("Military"), 0}, - {19, LPGEN("Non-Government Organization"), 0}, - {20, LPGEN("Professional"), 0}, - {21, LPGEN("Retail"), 0}, - {22, LPGEN("Retired"), 0}, - {23, LPGEN("Science & Research"), 0}, - {24, LPGEN("Sports"), 0}, - {25, LPGEN("Technical"), 0}, - {26, LPGEN("University Student"), 0}, - {27, LPGEN("Web Building"), 0}, - {99, LPGEN("Other Services"), 0} + { 0, LPGEN("Unspecified"), nullptr}, + { 1, LPGEN("Academic"), nullptr}, + { 2, LPGEN("Administrative"), nullptr}, + { 3, LPGEN("Art/Entertainment"), nullptr}, + { 4, LPGEN("College Student"), nullptr}, + { 5, LPGEN("Computers"), nullptr}, + { 6, LPGEN("Community & Social"), nullptr}, + { 7, LPGEN("Education"), nullptr}, + { 8, LPGEN("Engineering"), nullptr}, + { 9, LPGEN("Financial Services"), nullptr}, + {10, LPGEN("Government"), nullptr}, + {11, LPGEN("High School Student"), nullptr}, + {12, LPGEN("Home"), nullptr}, + {13, LPGEN("ICQ - Providing Help"), nullptr}, + {14, LPGEN("Law"), nullptr}, + {15, LPGEN("Managerial"), nullptr}, + {16, LPGEN("Manufacturing"), nullptr}, + {17, LPGEN("Medical/Health"), nullptr}, + {18, LPGEN("Military"), nullptr}, + {19, LPGEN("Non-Government Organization"), nullptr}, + {20, LPGEN("Professional"), nullptr}, + {21, LPGEN("Retail"), nullptr}, + {22, LPGEN("Retired"), nullptr}, + {23, LPGEN("Science & Research"), nullptr}, + {24, LPGEN("Sports"), nullptr}, + {25, LPGEN("Technical"), nullptr}, + {26, LPGEN("University Student"), nullptr}, + {27, LPGEN("Web Building"), nullptr}, + {99, LPGEN("Other Services"), nullptr} }; static IDSTRLIST TmplInterests[] = { - { 0, LPGEN("Unspecified"), 0}, - {100, LPGEN("Art"), 0}, - {101, LPGEN("Cars"), 0}, - {102, LPGEN("Celebrity Fans"), 0}, - {103, LPGEN("Collections"), 0}, - {104, LPGEN("Computers"), 0}, - {105, LPGEN("Culture & Literature"), 0}, - {106, LPGEN("Fitness"), 0}, - {107, LPGEN("Games"), 0}, - {108, LPGEN("Hobbies"), 0}, - {109, LPGEN("ICQ - Providing Help"), 0}, - {110, LPGEN("Internet"), 0}, - {111, LPGEN("Lifestyle"), 0}, - {112, LPGEN("Movies/TV"), 0}, - {113, LPGEN("Music"), 0}, - {114, LPGEN("Outdoor Activities"), 0}, - {115, LPGEN("Parenting"), 0}, - {116, LPGEN("Pets/Animals"), 0}, - {117, LPGEN("Religion"), 0}, - {118, LPGEN("Science/Technology"), 0}, - {119, LPGEN("Skills"), 0}, - {120, LPGEN("Sports"), 0}, - {121, LPGEN("Web Design"), 0}, - {122, LPGEN("Nature and Environment"), 0}, - {123, LPGEN("News & Media"), 0}, - {124, LPGEN("Government"), 0}, - {125, LPGEN("Business & Economy"), 0}, - {126, LPGEN("Mystics"), 0}, - {127, LPGEN("Travel"), 0}, - {128, LPGEN("Astronomy"), 0}, - {129, LPGEN("Space"), 0}, - {130, LPGEN("Clothing"), 0}, - {131, LPGEN("Parties"), 0}, - {132, LPGEN("Women"), 0}, - {133, LPGEN("Social science"), 0}, - {134, LPGEN("60's"), 0}, - {135, LPGEN("70's"), 0}, - {136, LPGEN("80's"), 0}, - {137, LPGEN("50's"), 0}, - {138, LPGEN("Finance and corporate"), 0}, - {139, LPGEN("Entertainment"), 0}, - {140, LPGEN("Consumer electronics"), 0}, - {141, LPGEN("Retail stores"), 0}, - {142, LPGEN("Health and beauty"), 0}, - {143, LPGEN("Media"), 0}, - {144, LPGEN("Household products"), 0}, - {145, LPGEN("Mail order catalog"), 0}, - {146, LPGEN("Business services"), 0}, - {147, LPGEN("Audio and visual"), 0}, - {148, LPGEN("Sporting and athletic"), 0}, - {149, LPGEN("Publishing"), 0}, - {150, LPGEN("Home automation"), 0} + { 0, LPGEN("Unspecified"), nullptr}, + {100, LPGEN("Art"), nullptr}, + {101, LPGEN("Cars"), nullptr}, + {102, LPGEN("Celebrity Fans"), nullptr}, + {103, LPGEN("Collections"), nullptr}, + {104, LPGEN("Computers"), nullptr}, + {105, LPGEN("Culture & Literature"), nullptr}, + {106, LPGEN("Fitness"), nullptr}, + {107, LPGEN("Games"), nullptr}, + {108, LPGEN("Hobbies"), nullptr}, + {109, LPGEN("ICQ - Providing Help"), nullptr}, + {110, LPGEN("Internet"), nullptr}, + {111, LPGEN("Lifestyle"), nullptr}, + {112, LPGEN("Movies/TV"), nullptr}, + {113, LPGEN("Music"), nullptr}, + {114, LPGEN("Outdoor Activities"), nullptr}, + {115, LPGEN("Parenting"), nullptr}, + {116, LPGEN("Pets/Animals"), nullptr}, + {117, LPGEN("Religion"), nullptr}, + {118, LPGEN("Science/Technology"), nullptr}, + {119, LPGEN("Skills"), nullptr}, + {120, LPGEN("Sports"), nullptr}, + {121, LPGEN("Web Design"), nullptr}, + {122, LPGEN("Nature and Environment"), nullptr}, + {123, LPGEN("News & Media"), nullptr}, + {124, LPGEN("Government"), nullptr}, + {125, LPGEN("Business & Economy"), nullptr}, + {126, LPGEN("Mystics"), nullptr}, + {127, LPGEN("Travel"), nullptr}, + {128, LPGEN("Astronomy"), nullptr}, + {129, LPGEN("Space"), nullptr}, + {130, LPGEN("Clothing"), nullptr}, + {131, LPGEN("Parties"), nullptr}, + {132, LPGEN("Women"), nullptr}, + {133, LPGEN("Social science"), nullptr}, + {134, LPGEN("60's"), nullptr}, + {135, LPGEN("70's"), nullptr}, + {136, LPGEN("80's"), nullptr}, + {137, LPGEN("50's"), nullptr}, + {138, LPGEN("Finance and corporate"), nullptr}, + {139, LPGEN("Entertainment"), nullptr}, + {140, LPGEN("Consumer electronics"), nullptr}, + {141, LPGEN("Retail stores"), nullptr}, + {142, LPGEN("Health and beauty"), nullptr}, + {143, LPGEN("Media"), nullptr}, + {144, LPGEN("Household products"), nullptr}, + {145, LPGEN("Mail order catalog"), nullptr}, + {146, LPGEN("Business services"), nullptr}, + {147, LPGEN("Audio and visual"), nullptr}, + {148, LPGEN("Sporting and athletic"), nullptr}, + {149, LPGEN("Publishing"), nullptr}, + {150, LPGEN("Home automation"), nullptr} }; static IDSTRLIST TmplAffiliations[] = { - { 0, LPGEN("Unspecified"), 0}, - {200, LPGEN("Alumni Org."), 0}, - {201, LPGEN("Charity Org."), 0}, - {202, LPGEN("Club/Social Org."), 0}, - {203, LPGEN("Community Org."), 0}, - {204, LPGEN("Cultural Org."), 0}, - {205, LPGEN("Fan Clubs"), 0}, - {206, LPGEN("Fraternity/Sorority"), 0}, - {207, LPGEN("Hobbyists Org."), 0}, - {208, LPGEN("International Org."), 0}, - {209, LPGEN("Nature and Environment Org."), 0}, - {210, LPGEN("Professional Org."), 0}, - {211, LPGEN("Scientific/Technical Org."), 0}, - {212, LPGEN("Self Improvement Group"), 0}, - {213, LPGEN("Spiritual/Religious Org."), 0}, - {214, LPGEN("Sports Org."), 0}, - {215, LPGEN("Support Org."), 0}, - {216, LPGEN("Trade and Business Org."), 0}, - {217, LPGEN("Union"), 0}, - {218, LPGEN("Volunteer Org."), 0}, - {299, LPGEN("Other"), 0}, + { 0, LPGEN("Unspecified"), nullptr}, + {200, LPGEN("Alumni Org."), nullptr}, + {201, LPGEN("Charity Org."), nullptr}, + {202, LPGEN("Club/Social Org."), nullptr}, + {203, LPGEN("Community Org."), nullptr}, + {204, LPGEN("Cultural Org."), nullptr}, + {205, LPGEN("Fan Clubs"), nullptr}, + {206, LPGEN("Fraternity/Sorority"), nullptr}, + {207, LPGEN("Hobbyists Org."), nullptr}, + {208, LPGEN("International Org."), nullptr}, + {209, LPGEN("Nature and Environment Org."), nullptr}, + {210, LPGEN("Professional Org."), nullptr}, + {211, LPGEN("Scientific/Technical Org."), nullptr}, + {212, LPGEN("Self Improvement Group"), nullptr}, + {213, LPGEN("Spiritual/Religious Org."), nullptr}, + {214, LPGEN("Sports Org."), nullptr}, + {215, LPGEN("Support Org."), nullptr}, + {216, LPGEN("Trade and Business Org."), nullptr}, + {217, LPGEN("Union"), nullptr}, + {218, LPGEN("Volunteer Org."), nullptr}, + {299, LPGEN("Other"), nullptr}, }; static IDSTRLIST TmplPast[] = { - { 0, LPGEN("Unspecified"), 0}, - {300, LPGEN("Elementary School"), 0}, - {301, LPGEN("High School"), 0}, - {302, LPGEN("College"), 0}, - {303, LPGEN("University"), 0}, - {304, LPGEN("Military"), 0}, - {305, LPGEN("TmplPast Work Place"), 0}, - {306, LPGEN("TmplPast Organization"), 0}, - {399, LPGEN("Other"), 0} + { 0, LPGEN("Unspecified"), nullptr}, + {300, LPGEN("Elementary School"), nullptr}, + {301, LPGEN("High School"), nullptr}, + {302, LPGEN("College"), nullptr}, + {303, LPGEN("University"), nullptr}, + {304, LPGEN("Military"), nullptr}, + {305, LPGEN("TmplPast Work Place"), nullptr}, + {306, LPGEN("TmplPast Organization"), nullptr}, + {399, LPGEN("Other"), nullptr} }; static IDSTRLIST TmplMarital[]={ - { 0, LPGEN("Unspecified"), 0}, - {10, LPGEN("Single"), 0}, - {11, LPGEN("Close relationships"), 0}, - {12, LPGEN("Engaged"), 0}, - {20, LPGEN("Married"), 0}, - {30, LPGEN("Divorced"), 0}, - {31, LPGEN("Separated"), 0}, - {40, LPGEN("Widowed"), 0}, - {50, LPGEN("Actively searching"), 0 }, - {60, LPGEN("In love"), 0 }, - {70, LPGEN("It's complicated"), 0 }, - {80, LPGEN("In a civil union"), 0 } + { 0, LPGEN("Unspecified"), nullptr}, + {10, LPGEN("Single"), nullptr}, + {11, LPGEN("Close relationships"), nullptr}, + {12, LPGEN("Engaged"), nullptr}, + {20, LPGEN("Married"), nullptr}, + {30, LPGEN("Divorced"), nullptr}, + {31, LPGEN("Separated"), nullptr}, + {40, LPGEN("Widowed"), nullptr}, + {50, LPGEN("Actively searching"), nullptr }, + {60, LPGEN("In love"), nullptr }, + {70, LPGEN("It's complicated"), nullptr }, + {80, LPGEN("In a civil union"), nullptr } }; static IDSTRLIST TmplPrefixes[]={ - { 0, LPGEN("Unspecified"), 0}, - {'j', LPGEN("jun."), 0}, - {'s', LPGEN("sen."), 0} + { 0, LPGEN("Unspecified"), nullptr}, + {'j', LPGEN("jun."), nullptr}, + {'s', LPGEN("sen."), nullptr} }; -static IDSTRLIST *MyCountries = NULL; +static IDSTRLIST *MyCountries = nullptr; static UINT MyCountriesCount = 0; /** diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 949a6cee5a..ba70f83a50 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -21,12 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static HGENMENU ghMenuItem = NULL; +static HGENMENU ghMenuItem = nullptr; static HANDLE ghExtraIconDef = INVALID_HANDLE_VALUE; static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE; -static HANDLE hChangedHook = NULL; -static HANDLE hApplyIconHook = NULL; +static HANDLE hChangedHook = nullptr; +static HANDLE hApplyIconHook = nullptr; bool g_eiEmail = false; @@ -45,7 +45,7 @@ static LPSTR Get(MCONTACT hContact) if (hContact != NULL) { LPCSTR pszProto = Proto_GetBaseAccountName(hContact); - if (pszProto != NULL) { + if (pszProto != nullptr) { LPCSTR e[2][4] = { { SET_CONTACT_EMAIL, SET_CONTACT_EMAIL0, SET_CONTACT_EMAIL1, "Mye-mail0"}, { SET_CONTACT_COMPANY_EMAIL, SET_CONTACT_COMPANY_EMAIL0, SET_CONTACT_COMPANY_EMAIL1, "MyCompanye-mail0"} @@ -64,7 +64,7 @@ static LPSTR Get(MCONTACT hContact) } } } - return NULL; + return nullptr; } /** @@ -80,7 +80,7 @@ static LPSTR Get(MCONTACT hContact) static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) { int result = 0; - LPSTR val = NULL; + LPSTR val = nullptr; __try { @@ -100,7 +100,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) } else { result = 1; - MsgBox((HWND)lParam, MB_OK, LPGENW("Send e-mail"), NULL, LPGENW("Memory allocation error!")); + MsgBox((HWND)lParam, MB_OK, LPGENW("Send e-mail"), nullptr, LPGENW("Memory allocation error!")); } } __except(GetExceptionCode()==EXCEPTION_ACCESS_VIOLATION ? @@ -127,7 +127,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) static int OnCListApplyIcons(WPARAM wParam, LPARAM) { LPSTR val = Get(wParam); - ExtraIcon_SetIconByName(ghExtraIconSvc, wParam, (val) ? ICO_BTN_EMAIL : 0); + ExtraIcon_SetIconByName(ghExtraIconSvc, wParam, (val) ? ICO_BTN_EMAIL : nullptr); mir_free(val); return 0; } @@ -164,7 +164,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb static int OnPreBuildMenu(WPARAM wParam, LPARAM) { LPSTR val = Get(wParam); - Menu_ShowItem(ghMenuItem, val != NULL); + Menu_ShowItem(ghMenuItem, val != nullptr); mir_free(val); return 0; } @@ -175,7 +175,7 @@ static int OnPreBuildMenu(WPARAM wParam, LPARAM) void SvcEMailRebuildMenu() { - static HANDLE hPrebuildMenuHook = NULL; + static HANDLE hPrebuildMenuHook = nullptr; if (db_get_b(NULL, MODNAME, SET_EXTENDED_EMAILSERVICE, TRUE)) { if (!hPrebuildMenuHook) @@ -198,7 +198,7 @@ void SvcEMailRebuildMenu() if (ghMenuItem) { Menu_RemoveItem(ghMenuItem); - ghMenuItem = NULL; + ghMenuItem = nullptr; } } } @@ -222,10 +222,10 @@ bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB) if (g_eiEmail) { // E-mail checked // hook events - if (hChangedHook == NULL) + if (hChangedHook == nullptr) hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - if (hApplyIconHook == NULL) + if (hApplyIconHook == nullptr) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons); if (ghExtraIconSvc == INVALID_HANDLE_VALUE) @@ -234,11 +234,11 @@ bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB) else { // E-mail uncheckt if (hChangedHook) { UnhookEvent(hChangedHook); - hChangedHook = NULL; + hChangedHook = nullptr; } if (hApplyIconHook) { UnhookEvent(hApplyIconHook); - hApplyIconHook = NULL; + hApplyIconHook = nullptr; } } @@ -270,6 +270,6 @@ void SvcEMailLoadModule() void SvcEMailUnloadModule() { // unhook event handlers - UnhookEvent(hChangedHook); hChangedHook = NULL; - UnhookEvent(hApplyIconHook); hApplyIconHook = NULL; + UnhookEvent(hChangedHook); hChangedHook = nullptr; + UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr; } diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index 6045376bdb..122af6582b 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -25,8 +25,8 @@ static HANDLE ghExtraIconF = INVALID_HANDLE_VALUE; static HANDLE ghExtraIconM = INVALID_HANDLE_VALUE; static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE; -static HANDLE hChangedHook = NULL; -static HANDLE hApplyIconHook = NULL; +static HANDLE hChangedHook = nullptr; +static HANDLE hApplyIconHook = nullptr; bool g_eiGender = false; @@ -76,7 +76,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM) switch (GenderOf(hContact)) { case 'M': icoName = ICO_COMMON_MALE; break; case 'F': icoName = ICO_COMMON_FEMALE; break; - default: icoName = NULL; + default: icoName = nullptr; } ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, icoName); } @@ -120,20 +120,20 @@ bool SvcGenderEnableExtraIcons(bool bEnable, bool bUpdateDB) ghExtraIconSvc = ExtraIcon_RegisterIcolib("gender", LPGEN("Gender (UInfoEx)"), ICO_COMMON_MALE); // hook events - if (hChangedHook == NULL) + if (hChangedHook == nullptr) hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - if (hApplyIconHook == NULL) + if (hApplyIconHook == nullptr) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); } else { if (hChangedHook) { UnhookEvent(hChangedHook); - hChangedHook = NULL; + hChangedHook = nullptr; } if (hApplyIconHook) { UnhookEvent(hApplyIconHook); - hApplyIconHook = NULL; + hApplyIconHook = nullptr; } } return bChanged; @@ -150,6 +150,6 @@ bool SvcGenderEnableExtraIcons(bool bEnable, bool bUpdateDB) void SvcGenderUnloadModule() { // unhook event handlers - UnhookEvent(hChangedHook); hChangedHook = NULL; - UnhookEvent(hApplyIconHook); hApplyIconHook = NULL; + UnhookEvent(hChangedHook); hChangedHook = nullptr; + UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr; } diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 4e7394514b..867d663c88 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -21,12 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static HGENMENU ghMenuItem = NULL; +static HGENMENU ghMenuItem = nullptr; static HANDLE ghExtraIconDef = INVALID_HANDLE_VALUE; static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE; -static HANDLE hChangedHook = NULL; -static HANDLE hApplyIconHook = NULL; +static HANDLE hChangedHook = nullptr; +static HANDLE hApplyIconHook = nullptr; bool g_eiHome = false; @@ -44,7 +44,7 @@ static LPSTR Get(MCONTACT hContact) // ignore owner if (hContact != NULL) { LPCSTR pszProto = Proto_GetBaseAccountName(hContact); - if (pszProto != NULL) { + if (pszProto != nullptr) { LPCSTR e[2] = { SET_CONTACT_HOMEPAGE, SET_CONTACT_COMPANY_HOMEPAGE }; for (int i = 0; i < 2; i++) { LPSTR pszHomepage = DB::Setting::GetAStringEx(hContact, USERINFO, pszProto, e[i]); @@ -53,7 +53,7 @@ static LPSTR Get(MCONTACT hContact) } } } - return NULL; + return nullptr; } /** @@ -93,7 +93,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM) { LPSTR val = Get(hContact); if (ghExtraIconSvc != INVALID_HANDLE_VALUE) - ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : NULL); + ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : nullptr); MIR_FREE(val); return 0; } @@ -128,7 +128,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb static int OnPreBuildMenu(WPARAM wParam, LPARAM) { LPSTR val = Get(wParam); - Menu_ShowItem(ghMenuItem, val != 0); + Menu_ShowItem(ghMenuItem, val != nullptr); mir_free(val); return 0; } @@ -146,7 +146,7 @@ static int OnPreBuildMenu(WPARAM wParam, LPARAM) void SvcHomepageRebuildMenu() { - static HANDLE hPrebuildMenuHook = NULL; + static HANDLE hPrebuildMenuHook = nullptr; if (!hPrebuildMenuHook) hPrebuildMenuHook = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildMenu); @@ -182,10 +182,10 @@ bool SvcHomepageEnableExtraIcons(bool bEnable, bool bUpdateDB) if (g_eiHome) { // hook events - if (hChangedHook == NULL) + if (hChangedHook == nullptr) hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - if (hApplyIconHook == NULL) + if (hApplyIconHook == nullptr) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); if (ghExtraIconSvc == INVALID_HANDLE_VALUE) @@ -194,11 +194,11 @@ bool SvcHomepageEnableExtraIcons(bool bEnable, bool bUpdateDB) else { if (hChangedHook) { UnhookEvent(hChangedHook); - hChangedHook = NULL; + hChangedHook = nullptr; } if (hApplyIconHook) { UnhookEvent(hApplyIconHook); - hApplyIconHook = NULL; + hApplyIconHook = nullptr; } } return bChanged; @@ -227,6 +227,6 @@ void SvcHomepageLoadModule() void SvcHomepageUnloadModule() { // unhook event handlers - UnhookEvent(hChangedHook); hChangedHook = NULL; - UnhookEvent(hApplyIconHook); hApplyIconHook = NULL; + UnhookEvent(hChangedHook); hChangedHook = nullptr; + UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr; } diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index e18bacef16..daae9f022a 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -28,12 +28,12 @@ enum EPhoneType PHONE_SMS }; -static HANDLE ghMenuItem = NULL; +static HANDLE ghMenuItem = nullptr; static HANDLE ghExtraIconDef[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE }; static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE; -static HANDLE hChangedHook = NULL; -static HANDLE hApplyIconHook = NULL; +static HANDLE hChangedHook = nullptr; +static HANDLE hApplyIconHook = nullptr; bool g_eiPhone = false; @@ -54,7 +54,7 @@ static INT_PTR Get(MCONTACT hContact) // ignore owner if (hContact != NULL) { LPCSTR pszProto = Proto_GetBaseAccountName(hContact); - if (pszProto != NULL) { + if (pszProto != nullptr) { LPCSTR e[2][4] = { { SET_CONTACT_CELLULAR, SET_CONTACT_PHONE, "MyPhone0" }, { SET_CONTACT_COMPANY_CELLULAR, SET_CONTACT_COMPANY_PHONE, "MyCompanyPhone0" } @@ -92,7 +92,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM) switch (Get(hContact)) { case PHONE_NORMAL: icoName = ICO_BTN_PHONE; break; case PHONE_SMS: icoName = ICO_BTN_CELLULAR; break; - default: icoName = NULL; + default: icoName = nullptr; } ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, icoName); return 0; @@ -139,10 +139,10 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) // force module enabled, if extraicon plugin was found if (g_eiPhone) { // hook events - if (hChangedHook == NULL) + if (hChangedHook == nullptr) hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - if (hApplyIconHook == NULL) + if (hApplyIconHook == nullptr) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); if (ghExtraIconSvc == INVALID_HANDLE_VALUE) @@ -151,11 +151,11 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) else { if (hChangedHook) { UnhookEvent(hChangedHook); - hChangedHook = NULL; + hChangedHook = nullptr; } if (hApplyIconHook) { UnhookEvent(hApplyIconHook); - hApplyIconHook = NULL; + hApplyIconHook = nullptr; } } return bChanged; @@ -172,6 +172,6 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) void SvcPhoneUnloadModule() { // unhook event handlers - UnhookEvent(hChangedHook); hChangedHook = NULL; - UnhookEvent(hApplyIconHook); hApplyIconHook = NULL; + UnhookEvent(hChangedHook); hChangedHook = nullptr; + UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr; } diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 4b26516ad1..1edda986a4 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -96,7 +96,7 @@ public: BYTE IsVisible() const { - return _hWnd != NULL; + return _hWnd != nullptr; } /** * @@ -195,9 +195,9 @@ public: **/ CUpdProgress() { - _hWnd = NULL; - _pFnCallBack = NULL; - _pData = NULL; + _hWnd = nullptr; + _pFnCallBack = nullptr; + _pData = nullptr; _bIsCanceled = FALSE; _bBBCode = FALSE; } @@ -208,8 +208,8 @@ public: **/ CUpdProgress(void *data) { - _hWnd = NULL; - _pFnCallBack = NULL; + _hWnd = nullptr; + _pFnCallBack = nullptr; _pData = data; _bIsCanceled = FALSE; _bBBCode = FALSE; @@ -283,7 +283,7 @@ public: _pFnCallBack = pFnCallBack; _hWnd = CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_REFRESHDETAILS), - 0, + nullptr, CDlgUpdProgress::WndProc, (LPARAM) this); if (_hWnd) @@ -304,7 +304,7 @@ public: { SetUserData(_hWnd, NULL); EndDialog(_hWnd, IDOK); - _hWnd = NULL; + _hWnd = nullptr; } } @@ -389,7 +389,7 @@ public: CPopupUpdProgress(void *data) : CUpdProgress(data) { - _szText = NULL; + _szText = nullptr; _bBBCode = db_get_b(NULL, "Popup", "UseMText", FALSE); _popupButtons[0].cbSize = sizeof(POPUPACTION); @@ -443,7 +443,7 @@ public: if (_hWnd) { PUDeletePopup(_hWnd); - _hWnd = NULL; + _hWnd = nullptr; } MIR_FREE(_szText); } @@ -583,7 +583,7 @@ class CContactUpdater : public CContactQueue if (_hProtoAckEvent) { UnhookEvent(_hProtoAckEvent); - _hProtoAckEvent = NULL; + _hProtoAckEvent = nullptr; } // free up last ackresult array @@ -597,7 +597,7 @@ class CContactUpdater : public CContactQueue _pProgress->Destroy(); delete _pProgress; - _pProgress = NULL; + _pProgress = nullptr; } // reset menu @@ -653,11 +653,11 @@ public: **/ CContactUpdater() : CContactQueue() { - _hContactAcks = NULL; + _hContactAcks = nullptr; _nContactAcks = 0; _hContact = NULL; - _pProgress = NULL; - _hProtoAckEvent = NULL; + _pProgress = nullptr; + _hProtoAckEvent = nullptr; } /** @@ -728,7 +728,7 @@ public: }; -static CContactUpdater *ContactUpdater = NULL; +static CContactUpdater *ContactUpdater = nullptr; /*********************************************************************************************************** * common helper functions @@ -785,7 +785,7 @@ static INT_PTR RefreshService(WPARAM, LPARAM) { ContactUpdater->RefreshAll(); } - else if (IDYES == MsgBox(NULL, MB_YESNO|MB_ICON_QUESTION, LPGENW("Refresh contact details"), NULL, + else if (IDYES == MsgBox(nullptr, MB_YESNO|MB_ICON_QUESTION, LPGENW("Refresh contact details"), nullptr, LPGENW("Do you want to cancel the current refresh procedure?"))) { ContactUpdater->Cancel(); @@ -793,12 +793,12 @@ static INT_PTR RefreshService(WPARAM, LPARAM) } else { - MsgErr(NULL, LPGENW("Miranda must be online for refreshing contact information!")); + MsgErr(nullptr, LPGENW("Miranda must be online for refreshing contact information!")); } } catch(...) { - MsgErr(NULL, LPGENW("The function caused an exception!")); + MsgErr(nullptr, LPGENW("The function caused an exception!")); } return 0; } @@ -838,7 +838,7 @@ static int OnContactAdded(WPARAM hContact, LPARAM) } catch(...) { - MsgErr(NULL, LPGENW("The function caused an exception!")); + MsgErr(nullptr, LPGENW("The function caused an exception!")); } return 0; } @@ -856,7 +856,7 @@ static int OnPreShutdown(WPARAM, LPARAM) { if (ContactUpdater) { delete ContactUpdater; - ContactUpdater = 0; + ContactUpdater = nullptr; } //MIR_DELETE(ContactUpdater); return 0; diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 151b3a7bfb..a48187a13f 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -57,9 +57,9 @@ REMINDEROPTIONS, *LPREMINDEROPTIONS; static HANDLE ExtraIcon = INVALID_HANDLE_VALUE; -static HANDLE ghCListIA = NULL; -static HANDLE ghCListIR = NULL; -static HANDLE ghSettingsChanged = NULL; +static HANDLE ghCListIA = nullptr; +static HANDLE ghCListIR = nullptr; +static HANDLE ghSettingsChanged = nullptr; static UINT_PTR ghRemindTimer = 0; static UINT_PTR ghRemindDateChangeTimer = 0; @@ -139,7 +139,7 @@ BYTE CEvent::operator << (const CEvent& evt) static HICON GetAnnivIcon(const CEvent &evt) { - HICON hIcon = NULL; + HICON hIcon = nullptr; CHAR szIcon[MAXSETTING]; @@ -461,7 +461,7 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti // make backup of each protocol based birthday if (db_get_b(NULL, MODNAME, SET_REMIND_SECUREBIRTHDAY, TRUE)) - mtb.BackupBirthday(hContact, NULL, 0, LastAnwer); + mtb.BackupBirthday(hContact, nullptr, 0, LastAnwer); if (mtb.RemindOption() != BST_UNCHECKED) { WORD wDaysEarlier = (mtb.RemindOption() == BST_CHECKED) ? mtb.RemindOffset() : -1; @@ -530,7 +530,7 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti * @return nothing **/ -static void CheckContact(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer = 0) +static void CheckContact(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer = nullptr) { // ignore meta subcontacts here as their birthday information are collected explicitly if (hContact && (!gRemindOpts.bCheckVisibleOnly || !db_get_b(hContact, MOD_CLIST, "Hidden", FALSE)) && !db_mc_isSub(hContact)) { @@ -576,7 +576,7 @@ void SvcReminderCheckAll(const ENotify notify) DlgAnniversaryListShow(0, 0); if (evt._wDaysLeft > gRemindOpts.wDaysEarlier && notify == NOTIFY_NOANNIV) - NotifyWithPopup(NULL, CEvent::NONE, 0, NULL, TranslateT("No anniversaries to remind of")); + NotifyWithPopup(NULL, CEvent::NONE, 0, nullptr, TranslateT("No anniversaries to remind of")); } UpdateTimer(FALSE); } @@ -659,7 +659,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb WORD LastAnswer = IDNONE; CheckContact(hContact, now, evt, FALSE, &LastAnswer); } - else CheckContact(hContact, now, evt, FALSE, 0); + else CheckContact(hContact, now, evt, FALSE, nullptr); } return 0; } @@ -678,7 +678,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb void SvcReminderOnTopToolBarLoaded() { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; ttb.pszService = MS_USERINFO_REMINDER_CHECK; ttb.name = ttb.pszTooltipUp = LPGEN("Check anniversaries"); @@ -721,7 +721,7 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam) if (hContact) { if (!mdb.DBGetBirthDate(hContact)) - mdb.BackupBirthday(hContact, NULL, TRUE); + mdb.BackupBirthday(hContact, nullptr, TRUE); } else { WORD a1 = 0; @@ -729,13 +729,13 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam) //walk through all the contacts stored in the DB for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) if (!db_mc_isSub(hContact) && !mdb.DBGetBirthDate(hContact)) - mdb.BackupBirthday(hContact, NULL, TRUE, &a1); + mdb.BackupBirthday(hContact, nullptr, TRUE, &a1); } if (lParam != TRUE) { MSGBOX mBox; mBox.cbSize = sizeof(MSGBOX); - mBox.hParent = NULL; + mBox.hParent = nullptr; mBox.hiLogo = IcoLib_GetIcon(ICO_COMMON_BIRTHDAY); mBox.uType = MB_ICON_INFO; mBox.ptszTitle = TranslateT("Update custom birthday"); @@ -823,13 +823,13 @@ static void UpdateTimer(BYTE bStartup) else wNotifyInterval -= now.Compare(last); - ghRemindDateChangeTimer = SetTimer(0, 0, 1000 * 60 * 5, (TIMERPROC)TimerProc_DateChanged); + ghRemindDateChangeTimer = SetTimer(nullptr, 0, 1000 * 60 * 5, (TIMERPROC)TimerProc_DateChanged); } else now.DBWriteStamp(NULL, MODNAME, SET_REMIND_LASTCHECK); // wait at least 5 seconds before checking at startup, to give miranda a better chance to load faster - KillTimer(0, ghRemindTimer); - ghRemindTimer = SetTimer(0, 0, 1000 * wNotifyInterval, TimerProc_Check); + KillTimer(nullptr, ghRemindTimer); + ghRemindTimer = SetTimer(nullptr, 0, 1000 * wNotifyInterval, TimerProc_Check); } /*********************************************************************************************************** @@ -924,16 +924,16 @@ void SvcReminderLoadModule(void) void SvcReminderUnloadModule(void) { // kill timers - KillTimer(0, ghRemindTimer); + KillTimer(nullptr, ghRemindTimer); ghRemindTimer = 0; - KillTimer(0, ghRemindDateChangeTimer); + KillTimer(nullptr, ghRemindDateChangeTimer); ghRemindDateChangeTimer = 0; // unhook event handlers UnhookEvent(ghCListIR); - ghCListIR = 0; + ghCListIR = nullptr; UnhookEvent(ghCListIA); - ghCListIA = 0; + ghCListIA = nullptr; UnhookEvent(ghSettingsChanged); - ghSettingsChanged = 0; + ghSettingsChanged = nullptr; } diff --git a/plugins/UserInfoEx/src/svc_timezone.cpp b/plugins/UserInfoEx/src/svc_timezone.cpp index 76954c6d17..ebff28999f 100644 --- a/plugins/UserInfoEx/src/svc_timezone.cpp +++ b/plugins/UserInfoEx/src/svc_timezone.cpp @@ -42,8 +42,8 @@ INT_PTR GetContactTimeZoneInformation(WPARAM wParam, LPARAM lParam) if (lParam == NULL) return (1); //use new core tz interface - LPTIME_ZONE_INFORMATION pTimeZoneInformation = TimeZone_GetInfo(TimeZone_CreateByContact(wParam, 0, 0)); - if (pTimeZoneInformation == NULL) + LPTIME_ZONE_INFORMATION pTimeZoneInformation = TimeZone_GetInfo(TimeZone_CreateByContact(wParam, nullptr, 0)); + if (pTimeZoneInformation == nullptr) return (1); memcpy((void *)lParam, pTimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); return (0); -- cgit v1.2.3