From 1c0172cca4f1e90679321912e20436a7f42f122d Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Sat, 24 Feb 2018 15:32:06 +0100 Subject: more nullptr --- include/m_chat.h | 4 +- include/m_chat_int.h | 2 +- include/m_clist.h | 12 +-- include/m_contacts.h | 2 +- include/m_core.h | 20 ++-- include/m_database.h | 4 +- include/m_db_int.h | 4 +- include/m_extraicons.h | 6 +- include/m_genmenu.h | 2 +- include/m_gui.h | 6 +- include/m_jabber.h | 10 +- include/m_json.h | 2 +- include/m_netlib.h | 2 +- include/m_options.h | 4 +- include/m_popup.h | 4 +- include/m_string.h | 8 +- include/m_string.inl | 72 +++++++------- include/m_system.h | 2 +- include/m_system_cpp.h | 34 ++++--- include/m_timezones.h | 10 +- include/m_utils.h | 12 +-- plugins/AVS/src/stdafx.h | 4 +- plugins/Alarms/src/alarmlist.h | 8 +- plugins/AvatarHistory/src/popup.h | 2 +- plugins/BasicHistory/src/ExportManager.h | 2 +- plugins/BasicHistory/src/ImageDataObject.h | 4 +- plugins/BasicHistory/src/Options.h | 4 +- plugins/BasicHistory/src/codecvt_CodePage.h | 2 +- plugins/Boltun/src/Engine/PerContactData.h | 8 +- plugins/Boltun/src/Engine/ValueChooser.h | 2 +- plugins/Boltun/src/config.h | 2 +- plugins/CSList/src/stdafx.h | 14 +-- plugins/Clist_nicer/src/rowheight_funcs.h | 2 +- plugins/ContactsPlus/src/receive.h | 2 +- plugins/ContactsPlus/src/send.h | 8 +- plugins/Dbx_mdbx/src/ui.cpp | 2 +- plugins/ExternalAPI/m_account.h | 4 +- plugins/ExternalAPI/m_assocmgr.h | 2 +- plugins/ExternalAPI/m_flags.h | 6 +- plugins/ExternalAPI/m_folders.h | 10 +- plugins/ExternalAPI/m_mails.h | 8 +- plugins/ExternalAPI/m_notify.h | 2 +- plugins/ExternalAPI/m_skin_eng.h | 2 +- plugins/ExternalAPI/m_statusplugins.h | 2 +- plugins/ExternalAPI/m_synchro.h | 2 +- plugins/ExternalAPI/m_text.h | 8 +- plugins/ExternalAPI/m_variables.h | 14 ++- plugins/FTPFileYM/src/deletetimer.h | 2 +- plugins/FTPFileYM/src/job_generic.h | 2 +- plugins/FTPFileYM/src/manager.h | 2 +- plugins/FTPFileYM/src/options.h | 2 +- plugins/FTPFileYM/src/serverlist.h | 2 +- plugins/FavContacts/src/favlist.h | 6 +- plugins/FavContacts/src/stdafx.h | 4 +- plugins/FileAsMessage/src/dialog.cpp | 2 +- plugins/FloatingContacts/src/bitmap_funcs.h | 8 +- plugins/HTTPServer/src/FileShareNode.h | 2 +- plugins/HTTPServer/src/HttpUser.h | 4 +- plugins/HistoryStats/src/bandctrl.h | 4 +- plugins/HistoryStats/src/column.h | 2 +- plugins/HistoryStats/src/message.h | 2 +- plugins/HistoryStats/src/mu_common.h | 2 +- plugins/HistoryStats/src/optionsctrl.h | 4 +- plugins/HistoryStats/src/statistic.h | 6 +- plugins/HistoryStats/src/utf8buffer.h | 2 +- plugins/HistoryStats/src/utils.h | 2 +- plugins/ListeningTo/src/stdafx.h | 10 +- plugins/MirLua/src/mlua.h | 2 +- plugins/MirLua/src/mlua_metatable.h | 6 +- plugins/MirandaG15/src/LCDFramework/CLCDGfx.h | 2 +- plugins/MirandaG15/src/LCDFramework/CLCDList.h | 80 +++++++-------- .../src/LCDFramework/CLCDOutputManager.h | 2 +- plugins/MirandaG15/src/LCDFramework/misc.h | 4 +- plugins/MyDetails/src/stdafx.h | 2 +- plugins/NewAwaySysMod/src/AwayOpt.cpp | 42 ++++---- plugins/NewAwaySysMod/src/AwaySys.cpp | 34 +++---- plugins/NewAwaySysMod/src/CString.cpp | 2 +- plugins/NewAwaySysMod/src/CString.h | 8 +- plugins/NewAwaySysMod/src/Client.cpp | 6 +- plugins/NewAwaySysMod/src/ContactList.cpp | 4 +- plugins/NewAwaySysMod/src/ContactList.h | 4 +- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 6 +- plugins/NewAwaySysMod/src/MsgTree.cpp | 4 +- plugins/NewAwaySysMod/src/Notification.cpp | 10 +- plugins/NewAwaySysMod/src/Options.cpp | 22 ++--- plugins/NewAwaySysMod/src/Options.h | 92 +++++++++--------- plugins/NewAwaySysMod/src/Properties.cpp | 40 ++++---- plugins/NewAwaySysMod/src/Properties.h | 20 ++-- plugins/NewAwaySysMod/src/ReadAwayMsg.cpp | 2 +- plugins/NewAwaySysMod/src/Services.cpp | 14 +-- plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 30 +++--- plugins/NewAwaySysMod/src/TMyArray.h | 8 +- plugins/NewAwaySysMod/src/stdafx.h | 6 +- plugins/NewXstatusNotify/src/popup.h | 2 +- plugins/NotesAndReminders/src/miscutils.h | 2 +- plugins/Ping/src/collection.h | 28 +++--- plugins/PluginUpdater/src/stdafx.h | 2 +- plugins/Popup/src/common.h | 2 +- plugins/Popup/src/formula.h | 6 +- plugins/Popup/src/opt_gen.h | 2 +- plugins/Popup/src/opttree.h | 4 +- plugins/Popup/src/popup_wnd2.h | 6 +- plugins/Popup/src/skin.h | 2 +- .../SMS/src/AdditionalFunctions/MemoryFindByte.h | 2 +- plugins/SendScreenshotPlus/src/CSend.h | 2 +- plugins/SendScreenshotPlus/src/UMainForm.h | 2 +- plugins/SendScreenshotPlus/src/Utils.h | 4 +- plugins/SmileyAdd/src/imagecache.h | 2 +- plugins/SmileyAdd/src/services.h | 2 +- plugins/SmileyAdd/src/smileys.h | 4 +- plugins/StopSpamMod/src/utilities.cpp | 2 +- plugins/TabSRMM/src/contactcache.h | 4 +- plugins/TabSRMM/src/controls.h | 2 +- plugins/TabSRMM/src/infopanel.h | 4 +- plugins/TabSRMM/src/mim.h | 6 +- plugins/TabSRMM/src/muchighlight.h | 4 +- plugins/TabSRMM/src/sidebar.h | 4 +- plugins/TabSRMM/src/taskbar.h | 6 +- plugins/TabSRMM/src/themes.h | 8 +- plugins/TabSRMM/src/utils.h | 6 +- plugins/TopToolBar/src/stdafx.h | 4 +- plugins/UserInfoEx/src/classMAnnivDate.h | 6 +- plugins/UserInfoEx/src/ctrl_annivedit.h | 2 +- plugins/UserInfoEx/src/dlg_propsheet.h | 6 +- .../src/ex_import/classExImContactBase.h | 12 +-- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h | 10 +- plugins/UserInfoEx/src/mir_contactqueue.h | 8 +- plugins/UserInfoEx/src/mir_db.h | 6 +- plugins/YAMN/src/proto/netclient.h | 4 +- plugins/YAMN/src/proto/netlib.h | 8 +- plugins/YAMN/src/proto/pop3/pop3.h | 4 +- plugins/YAMN/src/stdafx.h | 4 +- plugins/mTextControl/src/FormattedTextDraw.h | 14 +-- protocols/EmLanProto/src/mlan.h | 2 +- protocols/FacebookRM/src/proto.h | 4 +- protocols/Gadu-Gadu/src/dialogs.cpp | 2 +- protocols/IRCG/src/irc_dlg.h | 2 +- protocols/IRCG/src/stdafx.h | 2 +- protocols/IcqOscarJ/src/changeinfo.h | 2 +- protocols/IcqOscarJ/src/icq_proto.h | 6 +- protocols/IcqOscarJ/src/icq_rates.h | 2 +- protocols/JabberG/src/jabber_notes.h | 4 +- protocols/JabberG/src/jabber_thread.cpp | 4 +- protocols/MRA/src/MraProto.h | 4 +- protocols/MRA/src/MraSendCommand.cpp | 26 ++--- protocols/MRA/src/Mra_functions.cpp | 46 ++++----- protocols/MRA/src/Sdk/ListMT.h | 22 ++--- protocols/MRA/src/Sdk/MemoryFind.h | 2 +- protocols/MRA/src/Sdk/MemoryFindByte.h | 2 +- protocols/MSN/src/msn_proto.h | 12 +-- protocols/MSN/src/stdafx.h | 8 +- protocols/MinecraftDynmap/src/proto.h | 6 +- protocols/MinecraftDynmap/src/utils.h | 2 +- protocols/Omegle/src/client.h | 18 ++-- protocols/Omegle/src/proto.h | 2 +- protocols/Omegle/src/stdafx.h | 2 +- protocols/Tox/src/http_request.h | 12 +-- protocols/Tox/src/tox_profile.cpp | 2 +- protocols/Tox/src/tox_proto.h | 2 +- protocols/Tox/src/tox_thread.h | 6 +- protocols/Twitter/src/proto.h | 2 +- protocols/Twitter/src/utility.h | 4 +- utils/mir_buffer.h | 28 +++--- utils/std_string_utils.h | 4 +- utils/utf8_helpers.h | 108 ++++++++++----------- 165 files changed, 719 insertions(+), 709 deletions(-) diff --git a/include/m_chat.h b/include/m_chat.h index f640d5f90b..e5fa914151 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -171,7 +171,7 @@ EXTERN_C MIR_APP_DLL(struct GCSessionInfoBase*) Chat_NewSession( const char *pszModule, // The name of the protocol owning the session (the same as pszModule when you register) const wchar_t *ptszID, // The unique identifier for the session. const wchar_t *ptszName, // The name of the session as it will be displayed to the user - void *pItemData = NULL // Set user defined data for this session. Retrieve it by using the Chat_GetUserInfo() call + void *pItemData = nullptr // Set user defined data for this session. Retrieve it by using the Chat_GetUserInfo() call ); /* @@ -372,7 +372,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT*); EXTERN_C MIR_APP_DLL(void*) Chat_GetUserInfo(const char *szModule, const wchar_t *wszId); EXTERN_C MIR_APP_DLL(int) Chat_SetUserInfo(const char *szModule, const wchar_t *wszId, void *pItemData); -EXTERN_C MIR_APP_DLL(int) Chat_AddGroup(const char *szModule, const wchar_t *wszId, const wchar_t *wszText, HICON hIcon = NULL); +EXTERN_C MIR_APP_DLL(int) Chat_AddGroup(const char *szModule, const wchar_t *wszId, const wchar_t *wszText, HICON hIcon = nullptr); EXTERN_C MIR_APP_DLL(int) Chat_ChangeSessionName(const char *szModule, const wchar_t *wszId, const wchar_t *wszNewName); EXTERN_C MIR_APP_DLL(int) Chat_ChangeUserId(const char *szModule, const wchar_t *wszId, const wchar_t *wszOldId, const wchar_t *wszNewId); EXTERN_C MIR_APP_DLL(int) Chat_SendUserMessage(const char *szModule, const wchar_t *wszId, const wchar_t *wszText); diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 4af2db76e2..f90c7082a9 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -364,7 +364,7 @@ struct CHAT_MANAGER extern CHAT_MANAGER *pci; #endif -EXTERN_C MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pData = NULL, int = hLangpack); +EXTERN_C MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pData = nullptr, int = hLangpack); ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/m_clist.h b/include/m_clist.h index 1ef9117309..b3eb928deb 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -85,7 +85,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_GetMainMenu(void); // adds a new element into contact menu -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(TMO_MenuItem *pmi, const char *pszProto = NULL); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(TMO_MenuItem *pmi, const char *pszProto = nullptr); // builds the context menu for a specific contact // returns a HMENU identifying the menu. This should be DestroyMenu()ed when @@ -109,7 +109,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_GetStatusMenu(void); // adds an item to a status menu -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszProto = NULL); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszProto = nullptr); // the status menu is about to be built // wParam = lParam = 0 @@ -121,7 +121,7 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const c // adds an item to status or main menu, according to the option -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddProtoMenuItem(TMO_MenuItem *pmi, const char *pszProto = NULL); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddProtoMenuItem(TMO_MenuItem *pmi, const char *pszProto = nullptr); ///////////////////////////////////////////////////////////////////////////////////////// // GROUP MENU @@ -139,7 +139,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildGroupMenu(void); // adds a new item to the Group menus -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp = NULL); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp = nullptr); // the Group menu is about to be built // wParam = lParam = 0 @@ -158,7 +158,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildSubGroupMenu(struct ClcGroup *group); // wParam=GroupMenuParam*, params to call when exec menuitem // lParam=(LPARAM)(TMO_MenuItem*)&mi -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp = NULL); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp = nullptr); // the SubGroup menu is about to be built // wParam = lParam = 0 @@ -402,7 +402,7 @@ EXTERN_C MIR_APP_DLL(int) Clist_GroupRename(MGROUP hGroup, const wchar_t *ptszNe #define GROUPF_EXPANDED 0x04 #define GROUPF_HIDEOFFLINE 0x08 -EXTERN_C MIR_APP_DLL(wchar_t*) Clist_GroupGetName(MGROUP hGroup, DWORD *pdwFlags = NULL); +EXTERN_C MIR_APP_DLL(wchar_t*) Clist_GroupGetName(MGROUP hGroup, DWORD *pdwFlags = nullptr); ///////////////////////////////////////////////////////////////////////////////////////// // change the expanded state flag for a group internally diff --git a/include/m_contacts.h b/include/m_contacts.h index f976f4f789..779582878f 100644 --- a/include/m_contacts.h +++ b/include/m_contacts.h @@ -77,7 +77,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. EXTERN_C MIR_APP_DLL(wchar_t*) Contact_GetInfo( int type, // one of the CNF_* constants MCONTACT hContact, // contact id or NULL for the global data - const char *szProto = NULL); // protocol for global data. if skipped, grabbed from hContact + const char *szProto = nullptr); // protocol for global data. if skipped, grabbed from hContact ///////////////////////////////////////////////////////////////////////////////////////// // Add contact's dialog diff --git a/include/m_core.h b/include/m_core.h index 662912988a..f39e711750 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -172,8 +172,8 @@ typedef struct tagIconItemT IconItemT; #if defined( __cplusplus ) -MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char* szSection, IconItem* pIcons, size_t iCount, char *prefix = NULL, int = hLangpack); -MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t* szSection, IconItemT* pIcons, size_t iCount, char *prefix = NULL, int = hLangpack); +MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char* szSection, IconItem* pIcons, size_t iCount, char *prefix = nullptr, int = hLangpack); +MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t* szSection, IconItemT* pIcons, size_t iCount, char *prefix = nullptr, int = hLangpack); #else MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char* szSection, IconItem* pIcons, size_t iCount, char *prefix, int hLangpack); MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const wchar_t* szSection, IconItemT* pIcons, size_t iCount, char *prefix, int hLangpack); @@ -187,7 +187,7 @@ MIR_CORE_DLL(unsigned int) mir_hash(const void * key, unsigned int len); #pragma optimize("gt", on) __forceinline unsigned int mir_hashstr(const char * key) { - if (key == NULL) return 0; + if (key == nullptr) return 0; else { unsigned int len = (unsigned int)strlen((const char*)key); return mir_hash(key, len); @@ -195,7 +195,7 @@ __forceinline unsigned int mir_hashstr(const char * key) __forceinline unsigned int mir_hashstrW(const wchar_t * key) { - if (key == NULL) return 0; + if (key == nullptr) return 0; else { unsigned int len = (unsigned int)wcslen((const wchar_t*)key); return mir_hash(key, len * sizeof(wchar_t)); @@ -348,7 +348,7 @@ MIR_APP_DLL(int) ProtoGetAvatarFormatByMimeType(const wchar_t *pwszMimeType); // returns the image format and extension by the first bytes of picture // ptszExtension might be NULL #if defined( __cplusplus ) - MIR_APP_DLL(int) ProtoGetBufferFormat(const void *buf, const wchar_t **ptszExtension = NULL); + MIR_APP_DLL(int) ProtoGetBufferFormat(const void *buf, const wchar_t **ptszExtension = nullptr); #else MIR_APP_DLL(int) ProtoGetBufferFormat(const void *buf, const wchar_t **ptszExtension); #endif @@ -467,7 +467,7 @@ typedef unsigned (__stdcall *pThreadFuncEx)(void *param); typedef unsigned (__cdecl *pThreadFuncOwner)(void *owner, void *param); #if defined( __cplusplus ) - MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner = NULL); + MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner = nullptr); #else MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner); #endif @@ -475,9 +475,9 @@ MIR_CORE_DLL(INT_PTR) Thread_Pop(void); MIR_CORE_DLL(void) Thread_Wait(void); #if defined( __cplusplus ) -MIR_CORE_DLL(HANDLE) mir_forkthread(pThreadFunc aFunc, void *arg = NULL); -MIR_CORE_DLL(HANDLE) mir_forkthreadex(pThreadFuncEx aFunc, void *arg = NULL, unsigned *pThreadID = NULL); -MIR_CORE_DLL(HANDLE) mir_forkthreadowner(pThreadFuncOwner aFunc, void *owner, void *arg = NULL, unsigned *pThreadID = NULL); +MIR_CORE_DLL(HANDLE) mir_forkthread(pThreadFunc aFunc, void *arg = nullptr); +MIR_CORE_DLL(HANDLE) mir_forkthreadex(pThreadFuncEx aFunc, void *arg = nullptr, unsigned *pThreadID = nullptr); +MIR_CORE_DLL(HANDLE) mir_forkthreadowner(pThreadFuncOwner aFunc, void *owner, void *arg = nullptr, unsigned *pThreadID = nullptr); #else MIR_CORE_DLL(HANDLE) mir_forkthread(pThreadFunc aFunc, void *arg); MIR_CORE_DLL(HANDLE) mir_forkthreadex(pThreadFuncEx aFunc, void *arg, unsigned *pThreadID); @@ -516,7 +516,7 @@ MIR_CORE_DLL(BOOL) Utf8CheckString(const char* str); __forceinline char* mir_utf8decodeA(const char* src) { char *tmp = mir_strdup(src); - mir_utf8decode(tmp, NULL); + mir_utf8decode(tmp, nullptr); return tmp; } diff --git a/include/m_database.h b/include/m_database.h index 9cd38c1273..41ce36bef5 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -208,7 +208,7 @@ are no contacts in the db. */ #if defined(__cplusplus) -EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto = NULL); +EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto = nullptr); #else EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto); #endif @@ -222,7 +222,7 @@ hContact was the last contact in the db or hContact was invalid. */ #if defined(__cplusplus) -EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto = NULL); +EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto = nullptr); #else EXTERN_C MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto); #endif diff --git a/include/m_db_int.h b/include/m_db_int.h index 5885e6f015..fd10999153 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -88,8 +88,8 @@ interface MIR_APP_EXPORT MIDatabase STDMETHOD_(void, SetCacheSafetyMode)(BOOL) PURE; STDMETHOD_(LONG, GetContactCount)(void) PURE; - STDMETHOD_(MCONTACT, FindFirstContact)(const char *szProto = NULL) PURE; - STDMETHOD_(MCONTACT, FindNextContact)(MCONTACT contactID, const char *szProto = NULL) PURE; + STDMETHOD_(MCONTACT, FindFirstContact)(const char *szProto = nullptr) PURE; + STDMETHOD_(MCONTACT, FindNextContact)(MCONTACT contactID, const char *szProto = nullptr) PURE; STDMETHOD_(LONG, DeleteContact)(MCONTACT contactID) PURE; STDMETHOD_(MCONTACT, AddContact)(void) PURE; diff --git a/include/m_extraicons.h b/include/m_extraicons.h index 2ec4feaf0a..8611a02e6c 100644 --- a/include/m_extraicons.h +++ b/include/m_extraicons.h @@ -110,10 +110,10 @@ EXTERN_C MIR_APP_DLL(void) KillModuleExtraIcons(int hLangpack); #define EIF_DISABLED_BY_DEFAULT 0x0001 EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const char *description, const char *descIcon, - MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0, int flags = 0, int = hLangpack); + MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick = nullptr, LPARAM onClickParam = 0, int flags = 0, int = hLangpack); -EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const char *description, const char *descIcon = NULL, - MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0, int flags = 0, int = hLangpack); +EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const char *description, const char *descIcon = nullptr, + MIRANDAHOOKPARAM OnClick = nullptr, LPARAM onClickParam = 0, int flags = 0, int = hLangpack); ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/m_genmenu.h b/include/m_genmenu.h index 01e8c60da7..33a56e2daa 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -118,7 +118,7 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pItem // Adds new submenu // Returns HGENMENU on success, or NULL on failure -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCWSTR ptszName, int position, HANDLE hIcoLib = NULL, int hLang = hLangpack); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCWSTR ptszName, int position, HANDLE hIcoLib = nullptr, int hLang = hLangpack); ///////////////////////////////////////////////////////////////////////////////////////// // process a WM_DRAWITEM message for user context menus v0.1.1.0+ diff --git a/include/m_gui.h b/include/m_gui.h index 45b6130122..0a1dfc2025 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -259,7 +259,7 @@ struct CCallbackImp }; public: - __inline CCallbackImp(): m_object(NULL), m_func(NULL) {} + __inline CCallbackImp(): m_object(nullptr), m_func(nullptr) {} __inline CCallbackImp(const CCallbackImp &other): m_object(other.m_object), m_func(other.m_func) {} __inline CCallbackImp &operator=(const CCallbackImp &other) { m_object = other.m_object; m_func = other.m_func; return *this; } @@ -362,7 +362,7 @@ public: __forceinline DWORD LoadInt() { return (DWORD)(T)*m_option; } __forceinline void SaveInt(DWORD value) { *m_option = (T)value; } - __forceinline wchar_t* LoadText() { return NULL; } + __forceinline wchar_t* LoadText() { return nullptr; } __forceinline void SaveText(wchar_t*) {} }; @@ -1453,7 +1453,7 @@ protected: virtual void OnProtoCheckOnline(WPARAM, LPARAM); private: - void UpdateProtoTitle(const wchar_t *szText = NULL); + void UpdateProtoTitle(const wchar_t *szText = nullptr); void UpdateStatusBar(); }; diff --git a/include/m_jabber.h b/include/m_jabber.h index 58ff47b78a..a89f873a2b 100644 --- a/include/m_jabber.h +++ b/include/m_jabber.h @@ -124,21 +124,21 @@ struct IJabberInterface // Registers incoming handler. Returns handler handle on success or NULL on error. - virtual HJHANDLER STDMETHODCALLTYPE AddPresenceHandler(JABBER_HANDLER_FUNC Func, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT) = 0; + virtual HJHANDLER STDMETHODCALLTYPE AddPresenceHandler(JABBER_HANDLER_FUNC Func, void *pUserData = nullptr, int iPriority = JH_PRIORITY_DEFAULT) = 0; // Registers incoming handler for messages of types specified by iMsgTypes. iMsgTypes is a combination of JABBER_MESSAGE_TYPE_* flags. Returns handler handle on success or NULL on error. - virtual HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT) = 0; + virtual HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData = nullptr, int iPriority = JH_PRIORITY_DEFAULT) = 0; // Registers incoming handler. iIqTypes is a combination of JABBER_IQ_TYPE_* flags. Returns handler handle on success or NULL on error. - virtual HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT) = 0; + virtual HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData = nullptr, int iPriority = JH_PRIORITY_DEFAULT) = 0; // Registers temporary handler for incoming stanza of type iIqType with id iIqId. iIqTypes is a combination of JABBER_IQ_TYPE_* flags. Returns handler handle on success or NULL on error. // If dwTimeout milliseconds pass and no Iq stanza with the specified iIqId is received, Jabber plugin will call Func() with NULL node. - virtual HJHANDLER STDMETHODCALLTYPE AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData = NULL, DWORD dwTimeout = 30000, int iPriority = JH_PRIORITY_DEFAULT) = 0; + virtual HJHANDLER STDMETHODCALLTYPE AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData = nullptr, DWORD dwTimeout = 30000, int iPriority = JH_PRIORITY_DEFAULT) = 0; // Registers handler for outgoing nodes. Returns handler handle on success or NULL on error. // Return FALSE in the handler to continue, or TRUE to abort sending. - virtual HJHANDLER STDMETHODCALLTYPE AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT) = 0; + virtual HJHANDLER STDMETHODCALLTYPE AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData = nullptr, int iPriority = JH_PRIORITY_DEFAULT) = 0; // Unregisters handler by its handle. virtual int STDMETHODCALLTYPE RemoveHandler(HJHANDLER hHandler) = 0; diff --git a/include/m_json.h b/include/m_json.h index ed4de56c37..9df72cd305 100644 --- a/include/m_json.h +++ b/include/m_json.h @@ -135,7 +135,7 @@ class JSONROOT JSONNode *m_node; public: - __forceinline JSONROOT() { m_node = NULL; } + __forceinline JSONROOT() { m_node = nullptr; } __forceinline JSONROOT(LPCSTR text) { Parse(text); } __forceinline ~JSONROOT() { json_delete(m_node); } diff --git a/include/m_netlib.h b/include/m_netlib.h index 4bc5dc01be..10fa59eb31 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -726,7 +726,7 @@ EXTERN_C MIR_APP_DLL(int) Netlib_LogfW(HNETLIBUSER hUser, const wchar_t *fmt, .. // Returns HANDLE = NULL on error or non-null value on success // Known providers: Basic, NTLM, Negotiate, Kerberos, GSSAPI - (Kerberos SASL) -EXTERN_C MIR_APP_DLL(HANDLE) Netlib_InitSecurityProvider(const wchar_t *szProviderName, const wchar_t *szPrincipal = NULL); +EXTERN_C MIR_APP_DLL(HANDLE) Netlib_InitSecurityProvider(const wchar_t *szProviderName, const wchar_t *szPrincipal = nullptr); ///////////////////////////////////////////////////////////////////////////////////////// // Destroys a security provider's handle, provided by Netlib_InitSecurityProvider. diff --git a/include/m_options.h b/include/m_options.h index f54314ae8e..cdf89a9115 100644 --- a/include/m_options.h +++ b/include/m_options.h @@ -95,9 +95,9 @@ EXTERN_C MIR_APP_DLL(void) KillModuleOptions(int _hLang); // Opens the options dialog, optionally at the specified page // Returns 0 on success, nonzero on failure -EXTERN_C MIR_APP_DLL(int) Options_Open(const wchar_t *pszGroup, const wchar_t *pszPage = NULL, const wchar_t *pszTab = NULL, int = hLangpack); +EXTERN_C MIR_APP_DLL(int) Options_Open(const wchar_t *pszGroup, const wchar_t *pszPage = nullptr, const wchar_t *pszTab = nullptr, int = hLangpack); // Opens the options dialog, with only specified page -EXTERN_C MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPage = NULL, const wchar_t *pszTab = NULL, int = hLangpack); +EXTERN_C MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPage = nullptr, const wchar_t *pszTab = nullptr, int = hLangpack); #endif //M_OPTIONS_H__ diff --git a/include/m_popup.h b/include/m_popup.h index 1c1342295e..509a6f20f4 100644 --- a/include/m_popup.h +++ b/include/m_popup.h @@ -287,7 +287,7 @@ and it will work. Just look at the example I've written above (PopupDlgProc). */ #define MS_POPUP_GETPLUGINDATA "Popup/GetPluginData" static void __inline * PUGetPluginData(HWND hPopupWindow) { - long * uselessPointer = NULL; + long * uselessPointer = nullptr; return (void*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hPopupWindow, (LPARAM)uselessPointer); } @@ -667,7 +667,7 @@ typedef struct { HANDLE __forceinline Popup_RegisterClass(POPUPCLASS *pc) { if (!ServiceExists(MS_POPUP_REGISTERCLASS)) - return NULL; + return nullptr; return (HANDLE)CallService(MS_POPUP_REGISTERCLASS, 0, LPARAM(pc)); } diff --git a/include/m_string.h b/include/m_string.h index c7dee400e0..1077298bcb 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -626,13 +626,13 @@ public: static int __stdcall GetBaseTypeLength(LPCSTR pszSrc) { // Returns required buffer size in wchar_ts - return ::MultiByteToWideChar(CP_ACP, 0, pszSrc, -1, NULL, 0)-1; + return ::MultiByteToWideChar(CP_ACP, 0, pszSrc, -1, nullptr, 0)-1; } static int __stdcall GetBaseTypeLength(LPCSTR pszSrc, int nLength) { // Returns required buffer size in wchar_ts - return ::MultiByteToWideChar(CP_ACP, 0, pszSrc, nLength, NULL, 0); + return ::MultiByteToWideChar(CP_ACP, 0, pszSrc, nLength, nullptr, 0); } static int __stdcall GetBaseTypeLength(LPCWSTR pszSrc) @@ -677,13 +677,13 @@ public: static int __stdcall SafeStringLen(LPCSTR psz) { // returns length in bytes - return (psz != NULL) ? (int)strlen(psz) : 0; + return (psz != nullptr) ? (int)strlen(psz) : 0; } static int __stdcall SafeStringLen(LPCWSTR psz) { // returns length in wchar_ts - return (psz != NULL) ? (int)wcslen(psz) : 0; + return (psz != nullptr) ? (int)wcslen(psz) : 0; } static int __stdcall GetCharLen(const wchar_t* pch) diff --git a/include/m_string.inl b/include/m_string.inl index 33acc46c64..97b94040b9 100644 --- a/include/m_string.inl +++ b/include/m_string.inl @@ -45,7 +45,7 @@ CMSimpleStringT::CMSimpleStringT(PCXSTR pszSrc) { int nLength = StringLength(pszSrc); CMStringData* pData = mirstr_allocate(nLength, sizeof(XCHAR)); - if (pData != NULL) { + if (pData != nullptr) { Attach(pData); SetLength(nLength); CopyChars(m_pszData, nLength, pszSrc, nLength); @@ -56,7 +56,7 @@ template CMSimpleStringT::CMSimpleStringT(const XCHAR* pchSrc, int nLength) { CMStringData* pData = mirstr_allocate(nLength, sizeof(XCHAR)); - if (pData != NULL) { + if (pData != nullptr) { Attach(pData); SetLength(nLength); CopyChars(m_pszData, nLength, pchSrc, nLength); @@ -165,7 +165,7 @@ void CMSimpleStringT::FreeExtra() if (!pOldData->IsLocked()) { // Don't reallocate a locked buffer that's shrinking CMStringData* pNewData = mirstr_allocate(nLength, sizeof(XCHAR)); - if (pNewData == NULL) { + if (pNewData == nullptr) { SetLength(nLength); return; } @@ -326,7 +326,7 @@ void __stdcall CMSimpleStringT::CopyCharsOverlapped(XCHAR* pchDest, si template int __stdcall CMSimpleStringT::StringLength(const char* psz) { - if (psz == NULL) + if (psz == nullptr) return(0); return (int(strlen(psz))); @@ -335,7 +335,7 @@ int __stdcall CMSimpleStringT::StringLength(const char* psz) template int __stdcall CMSimpleStringT::StringLength(const wchar_t* psz) { - if (psz == NULL) + if (psz == nullptr) return 0; return int(wcslen(psz)); @@ -344,7 +344,7 @@ int __stdcall CMSimpleStringT::StringLength(const wchar_t* psz) template int __stdcall CMSimpleStringT::StringLengthN(const char* psz, size_t sizeInXChar) { - if (psz == NULL) + if (psz == nullptr) return 0; return int(strnlen(psz, sizeInXChar)); @@ -353,7 +353,7 @@ int __stdcall CMSimpleStringT::StringLengthN(const char* psz, size_t s template int __stdcall CMSimpleStringT::StringLengthN(const wchar_t* psz, size_t sizeInXChar) { - if (psz == NULL) + if (psz == nullptr) return 0; return int(wcsnlen(psz, sizeInXChar)); @@ -381,7 +381,7 @@ void CMSimpleStringT::Fork(int nLength) CMStringData* pOldData = GetData(); int nOldLength = pOldData->nDataLength; CMStringData* pNewData = mirstr_allocate(nLength, sizeof(XCHAR)); - if (pNewData != NULL) { + if (pNewData != nullptr) { int nCharsToCopy = ((nOldLength < nLength) ? nOldLength : nLength) + 1; // Copy '\0' CopyChars(PXSTR(pNewData->data()), nCharsToCopy, PCXSTR(pOldData->data()), nCharsToCopy); pNewData->nDataLength = nOldLength; @@ -435,7 +435,7 @@ void CMSimpleStringT::Reallocate(int nLength) return; CMStringData* pNewData = mirstr_realloc(pOldData, nLength, sizeof(XCHAR)); - if (pNewData != NULL) + if (pNewData != nullptr) Attach(pNewData); } @@ -449,7 +449,7 @@ void CMSimpleStringT::SetLength(int nLength) template CMStringData* __stdcall CMSimpleStringT::CloneData(CMStringData* pData) { - CMStringData* pNewData = NULL; + CMStringData* pNewData = nullptr; if (!pData->IsLocked()) { pNewData = pData; @@ -588,7 +588,7 @@ template< typename BaseType, class StringTraits > CMStringT& CMStringT::operator=(PCYSTR pszSrc) { // nDestLength is in XCHARs - int nDestLength = (pszSrc != NULL) ? StringTraits::GetBaseTypeLength(pszSrc) : 0; + int nDestLength = (pszSrc != nullptr) ? StringTraits::GetBaseTypeLength(pszSrc) : 0; if (nDestLength > 0) { PXSTR pszBuffer = this->GetBuffer(nDestLength); StringTraits::ConvertToBaseType(pszBuffer, nDestLength, pszSrc); @@ -836,7 +836,7 @@ int CMStringT::Replace(PCXSTR pszOld, PCXSTR pszNew) PCXSTR pszEnd = pszStart + this->GetLength(); while (pszStart < pszEnd) { PCXSTR pszTarget; - while ((pszTarget = StringTraits::StringFindString(pszStart, pszOld)) != NULL) { + while ((pszTarget = StringTraits::StringFindString(pszStart, pszOld)) != nullptr) { nCount++; pszStart = pszTarget + nSourceLen; } @@ -859,7 +859,7 @@ int CMStringT::Replace(PCXSTR pszOld, PCXSTR pszNew) // loop again to actually do the work while (pszStart < pszEnd) { PXSTR pszTarget; - while ((pszTarget = StringTraits::StringFindString(pszStart, pszOld)) != NULL) { + while ((pszTarget = StringTraits::StringFindString(pszStart, pszOld)) != nullptr) { int nBalance = nOldLength - int(pszTarget - pszBuffer + nSourceLen); memmove_s(pszTarget + nReplacementLen, nBalance*sizeof(XCHAR), pszTarget + nSourceLen, nBalance*sizeof(XCHAR)); @@ -913,7 +913,7 @@ int CMStringT::Remove(XCHAR chRemove) template< typename BaseType, class StringTraits > CMStringT CMStringT::Tokenize(PCXSTR pszTokens, int& iStart) const { - if ((pszTokens == NULL) || (*pszTokens == (XCHAR)0)) { + if ((pszTokens == nullptr) || (*pszTokens == (XCHAR)0)) { if (iStart < this->GetLength()) return CMStringT(this->GetString() + iStart); } @@ -957,7 +957,7 @@ int CMStringT::Find(XCHAR ch, int iStart = 0) const PCXSTR psz = StringTraits::StringFindChar(this->GetString() + iStart, ch); // return -1 if not found and index otherwise - return (psz == NULL) ? -1 : int(psz - this->GetString()); + return (psz == nullptr) ? -1 : int(psz - this->GetString()); } // look for a specific sub-string @@ -967,7 +967,7 @@ template< typename BaseType, class StringTraits > int CMStringT::Find(PCXSTR pszSub, int iStart = 0) const { // iStart is in XCHARs - if (pszSub == NULL) + if (pszSub == nullptr) return -1; // nLength is in XCHARs @@ -979,7 +979,7 @@ int CMStringT::Find(PCXSTR pszSub, int iStart = 0) const PCXSTR psz = StringTraits::StringFindString(this->GetString() + iStart, pszSub); // return -1 for not found, distance from beginning otherwise - return (psz == NULL) ? -1 : int(psz - this->GetString()); + return (psz == nullptr) ? -1 : int(psz - this->GetString()); } // Find the first occurrence of any of the characters in string 'pszCharSet' @@ -987,7 +987,7 @@ template< typename BaseType, class StringTraits > int CMStringT::FindOneOf(PCXSTR pszCharSet) const { PCXSTR psz = StringTraits::StringScanSet(this->GetString(), pszCharSet); - return (psz == NULL) ? -1 : int(psz - this->GetString()); + return (psz == nullptr) ? -1 : int(psz - this->GetString()); } // Find the last occurrence of character 'ch' @@ -998,7 +998,7 @@ int CMStringT::ReverseFind(XCHAR ch) const PCXSTR psz = StringTraits::StringFindCharRev(this->GetString(), ch); // return -1 if not found, distance from beginning otherwise - return (psz == NULL) ? -1 : int(psz - this->GetString()); + return (psz == nullptr) ? -1 : int(psz - this->GetString()); } // manipulation @@ -1049,19 +1049,19 @@ CMStringT& CMStringT::TrimRight( // at beginning (DBCS aware) PCXSTR psz = this->GetString(); - PCXSTR pszLast = NULL; + PCXSTR pszLast = nullptr; while (*psz != 0) { if (StringTraits::IsSpace(*psz)) { - if (pszLast == NULL) + if (pszLast == nullptr) pszLast = psz; } - else pszLast = NULL; + else pszLast = nullptr; psz = StringTraits::CharNext(psz); } - if (pszLast != NULL) { + if (pszLast != nullptr) { // truncate at trailing space start int iLast = int(pszLast - this->GetString()); @@ -1126,19 +1126,19 @@ CMStringT& CMStringT::TrimRight( // by starting at beginning (DBCS aware) PCXSTR psz = this->GetString(); - PCXSTR pszLast = NULL; + PCXSTR pszLast = nullptr; while (*psz != 0) { if (*psz == chTarget) { - if (pszLast == NULL) + if (pszLast == nullptr) pszLast = psz; } - else pszLast = NULL; + else pszLast = nullptr; psz = StringTraits::CharNext(psz); } - if (pszLast != NULL) { + if (pszLast != nullptr) { // truncate at left-most matching character int iLast = int(pszLast - this->GetString()); this->Truncate(iLast); @@ -1152,7 +1152,7 @@ template< typename BaseType, class StringTraits > CMStringT& CMStringT::TrimRight(PCXSTR pszTargets) { // if we're not trimming anything, we're not doing any work - if ((pszTargets == NULL) || (*pszTargets == 0)) { + if ((pszTargets == nullptr) || (*pszTargets == 0)) { return *this; } @@ -1160,21 +1160,21 @@ CMStringT& CMStringT::TrimRight( // by starting at beginning (DBCS aware) PCXSTR psz = this->GetString(); - PCXSTR pszLast = NULL; + PCXSTR pszLast = nullptr; while (*psz != 0) { - if (StringTraits::StringFindChar(pszTargets, *psz) != NULL) { - if (pszLast == NULL) { + if (StringTraits::StringFindChar(pszTargets, *psz) != nullptr) { + if (pszLast == nullptr) { pszLast = psz; } } else { - pszLast = NULL; + pszLast = nullptr; } psz = StringTraits::CharNext(psz); } - if (pszLast != NULL) { + if (pszLast != nullptr) { // truncate at left-most matching character int iLast = int(pszLast - this->GetString()); this->Truncate(iLast); @@ -1213,12 +1213,12 @@ template< typename BaseType, class StringTraits > CMStringT& CMStringT::TrimLeft(PCXSTR pszTargets) { // if we're not trimming anything, we're not doing any work - if ((pszTargets == NULL) || (*pszTargets == 0)) { + if ((pszTargets == nullptr) || (*pszTargets == 0)) { return *this; } PCXSTR psz = this->GetString(); - while ((*psz != 0) && (StringTraits::StringFindChar(pszTargets, *psz) != NULL)) { + while ((*psz != 0) && (StringTraits::StringFindChar(pszTargets, *psz) != nullptr)) { psz = StringTraits::CharNext(psz); } @@ -1380,7 +1380,7 @@ typename CMStringT::PCXSTR CMStringT BOOL CMStringT::GetEnvironmentVariable(PCXSTR pszVar) { - ULONG nLength = StringTraits::GetEnvironmentVariable(pszVar, NULL, 0); + ULONG nLength = StringTraits::GetEnvironmentVariable(pszVar, nullptr, 0); BOOL bRetVal = FALSE; if (nLength == 0) diff --git a/include/m_system.h b/include/m_system.h index a2f877e085..cc3be9a6bf 100644 --- a/include/m_system.h +++ b/include/m_system.h @@ -93,7 +93,7 @@ EXTERN_C MIR_APP_DLL(void) Miranda_GetVersionText(char *pDest, size_t cbSize); // when a handle gets triggered, an appopriate stub gets called typedef void (CALLBACK *MWaitableStub)(void); -EXTERN_C MIR_APP_DLL(void) Miranda_WaitOnHandle(MWaitableStub pFunc, HANDLE hEvent = NULL); +EXTERN_C MIR_APP_DLL(void) Miranda_WaitOnHandle(MWaitableStub pFunc, HANDLE hEvent = nullptr); // wParam = 0 (ignored) // lParam = 0 (ignored) diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h index 500dd1d3c2..eed0bcc8e6 100644 --- a/include/m_system_cpp.h +++ b/include/m_system_cpp.h @@ -41,7 +41,7 @@ protected: T* data; public: - __inline explicit mir_ptr() : data(NULL) {} + __inline explicit mir_ptr() : data(nullptr) {} __inline explicit mir_ptr(T *_p) : data(_p) {} __inline ~mir_ptr() { mir_free(data); } __inline T* get() const { return data; } @@ -49,7 +49,7 @@ public: __inline T* operator->() const { return data; } __inline operator T*() const { return data; } __inline operator INT_PTR() const { return (INT_PTR)data; } - __inline T* detach() { T *res = data; data = NULL; return res; } + __inline T* detach() { T *res = data; data = nullptr; return res; } }; typedef mir_ptr ptrA; @@ -133,10 +133,13 @@ class MZeroedObject { public: __inline void* operator new( size_t size ) - { return calloc( 1, size ); + { + return calloc( 1, size ); } + __inline void operator delete( void* p ) - { free( p ); + { + free( p ); } }; @@ -151,21 +154,23 @@ template struct LIST { typedef int (*FTSortFunc)(const T* p1, const T* p2); - __inline LIST(int aincr, FTSortFunc afunc = NULL) - { memset(this, 0, sizeof(*this)); + __inline LIST(int aincr, FTSortFunc afunc = nullptr) + { + memset(this, 0, sizeof(*this)); increment = aincr; sortFunc = afunc; } __inline LIST(int aincr, INT_PTR id) - { memset(this, 0, sizeof(*this)); + { + memset(this, 0, sizeof(*this)); increment = aincr; sortFunc = FTSortFunc(id); } __inline LIST(const LIST& x) { - items = NULL; + items = nullptr; List_Copy((SortedList*)&x, (SortedList*)this, sizeof(T)); } @@ -181,12 +186,13 @@ template struct LIST destroy(); } - __inline T* operator[](int idx) const { return (idx >= 0 && idx < count) ? items[idx] : NULL; } + __inline T* operator[](int idx) const { return (idx >= 0 && idx < count) ? items[idx] : nullptr; } __inline int getCount(void) const { return count; } __inline T** getArray(void) const { return items; } __inline int getIndex(T *p) const - { int idx; + { + int idx; return (!List_GetIndex((SortedList*)this, p, &idx)) ? -1 : idx; } @@ -214,7 +220,7 @@ template struct OBJLIST : public LIST { typedef int (*FTSortFunc)(const T* p1, const T* p2); - __inline OBJLIST(int aincr, FTSortFunc afunc = NULL) : + __inline OBJLIST(int aincr, FTSortFunc afunc = nullptr) : LIST(aincr, afunc) {} @@ -224,12 +230,14 @@ template struct OBJLIST : public LIST __inline OBJLIST(const OBJLIST& x) : LIST(x.increment, x.sortFunc) - { this->items = NULL; + { + this->items = nullptr; List_ObjCopy((SortedList*)&x, (SortedList*)this, sizeof(T)); } __inline OBJLIST& operator = (const OBJLIST& x) - { destroy(); + { + destroy(); List_ObjCopy((SortedList*)&x, (SortedList*)this, sizeof(T)); return *this; } diff --git a/include/m_timezones.h b/include/m_timezones.h index a45471fa7a..57ff780cd6 100644 --- a/include/m_timezones.h +++ b/include/m_timezones.h @@ -64,27 +64,27 @@ EXTERN_C MIR_CORE_DLL(LPCTSTR) TimeZone_GetDescription(LPCTSTR TZname); __forceinline int printDateTimeByContact (MCONTACT hContact, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags) { - return TimeZone_PrintDateTime(TimeZone_CreateByContact(hContact, 0, dwFlags), szFormat, szDest, cbDest, dwFlags); + return TimeZone_PrintDateTime(TimeZone_CreateByContact(hContact, nullptr, dwFlags), szFormat, szDest, cbDest, dwFlags); } __forceinline int printTimeStampByContact(MCONTACT hContact, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags) { - return TimeZone_PrintTimeStamp(TimeZone_CreateByContact(hContact, 0, dwFlags), ts, szFormat, szDest, cbDest, dwFlags); + return TimeZone_PrintTimeStamp(TimeZone_CreateByContact(hContact, nullptr, dwFlags), ts, szFormat, szDest, cbDest, dwFlags); } __forceinline LPTIME_ZONE_INFORMATION getTziByContact(MCONTACT hContact) { - return TimeZone_GetInfo(TimeZone_CreateByContact(hContact, 0, 0)); + return TimeZone_GetInfo(TimeZone_CreateByContact(hContact, nullptr, 0)); } __forceinline int getTimeZoneTimeByContact(MCONTACT hContact, SYSTEMTIME *st) { - return TimeZone_GetTimeZoneTime(TimeZone_CreateByContact(hContact, 0, 0), st); + return TimeZone_GetTimeZoneTime(TimeZone_CreateByContact(hContact, nullptr, 0), st); } __forceinline mir_time timeStampToTimeZoneTimeStampByContact(MCONTACT hContact, mir_time ts) { - return TimeZone_UtcToLocal(TimeZone_CreateByContact(hContact, 0, 0), ts); + return TimeZone_UtcToLocal(TimeZone_CreateByContact(hContact, nullptr, 0), ts); } #endif diff --git a/include/m_utils.h b/include/m_utils.h index 13de0e6ffd..bd07c2ac9e 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -254,8 +254,8 @@ EXTERN_C MIR_CORE_DLL(void) Bitmap_GetFilter(wchar_t *dest, size_t destLen); // Returns number of chars copied. #if defined( __cplusplus ) -EXTERN_C MIR_CORE_DLL(int) PathToRelative(const char *pszSrc, char *pszOut, const char* pszBase = 0); -EXTERN_C MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase = 0); +EXTERN_C MIR_CORE_DLL(int) PathToRelative(const char *pszSrc, char *pszOut, const char* pszBase = nullptr); +EXTERN_C MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase = nullptr); #else EXTERN_C MIR_CORE_DLL(int) PathToRelative(const char *pszSrc, char *pszOut, const char* pszBase); EXTERN_C MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase); @@ -273,8 +273,8 @@ EXTERN_C MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pwszSrc, wchar_t *pwsz // Returns numbers of chars copied. #if defined( __cplusplus ) -EXTERN_C MIR_CORE_DLL(int) PathToAbsolute(const char *pszSrc, char *pszOut, const char* pszBase = 0); -EXTERN_C MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase = 0); +EXTERN_C MIR_CORE_DLL(int) PathToAbsolute(const char *pszSrc, char *pszOut, const char* pszBase = nullptr); +EXTERN_C MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase = nullptr); #else EXTERN_C MIR_CORE_DLL(int) PathToAbsolute(const char *pszSrc, char *pszOut, const char* pszBase); EXTERN_C MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase); @@ -353,8 +353,8 @@ struct REPLACEVARSARRAY MAllStrings key, value; }; -EXTERN_C MIR_APP_DLL(char*) Utils_ReplaceVars(const char *szData, MCONTACT hContact = 0, REPLACEVARSARRAY *vars = NULL); -EXTERN_C MIR_APP_DLL(wchar_t*) Utils_ReplaceVarsW(const wchar_t *szData, MCONTACT hContact = 0, REPLACEVARSARRAY *vars = NULL); +EXTERN_C MIR_APP_DLL(char*) Utils_ReplaceVars(const char *szData, MCONTACT hContact = 0, REPLACEVARSARRAY *vars = nullptr); +EXTERN_C MIR_APP_DLL(wchar_t*) Utils_ReplaceVarsW(const wchar_t *szData, MCONTACT hContact = 0, REPLACEVARSARRAY *vars = nullptr); #if defined(__cplusplus) #if !defined(M_SYSTEM_CPP_H__) diff --git a/plugins/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h index e0938155ad..14bdbf935e 100644 --- a/plugins/AVS/src/stdafx.h +++ b/plugins/AVS/src/stdafx.h @@ -132,13 +132,13 @@ void UnloadCache(void); int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *szProto); void DeleteAvatarFromCache(MCONTACT hContact, bool bForever); void PicLoader(LPVOID param); -void NotifyMetaAware(MCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY *ace = (AVATARCACHEENTRY*)-1); +void NotifyMetaAware(MCONTACT hContact, CacheNode *node = nullptr, AVATARCACHEENTRY *ace = (AVATARCACHEENTRY*)-1); void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bmHeight, DWORD dwFlags); int ChangeAvatar(MCONTACT hContact, bool fLoad, bool fNotifyHist = false, int pa_format = 0); void DeleteGlobalUserAvatar(); -int FetchAvatarFor(MCONTACT hContact, char *szProto = NULL); +int FetchAvatarFor(MCONTACT hContact, char *szProto = nullptr); CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny = false); void PushAvatarRequest(CacheNode *cc); int SetAvatarAttribute(MCONTACT hContact, DWORD attrib, int mode); diff --git a/plugins/Alarms/src/alarmlist.h b/plugins/Alarms/src/alarmlist.h index a18b8a4aa1..f1bb2f61d0 100755 --- a/plugins/Alarms/src/alarmlist.h +++ b/plugins/Alarms/src/alarmlist.h @@ -20,7 +20,7 @@ static bool operator<(const ALARM &a1, const ALARM &a2) { class AlarmList { public: - AlarmList(): head(0), tail(0), count(0) {} + AlarmList(): head(nullptr), tail(nullptr), count(0) {} virtual ~AlarmList() {clear();} @@ -50,7 +50,7 @@ public: delete current; } count = 0; - tail = 0; + tail = nullptr; reset(); } @@ -67,7 +67,7 @@ public: } void reset() {it_current = head;} - ALARM *current() {return (it_current ? &it_current->alarm : 0);} + ALARM *current() {return (it_current ? &it_current->alarm : nullptr);} void next() {it_current = it_current->next;} void erase() { if (it_current) { @@ -101,7 +101,7 @@ public: protected: class Node { public: - Node(): next(0), prev(0) {} + Node(): next(nullptr), prev(nullptr) {} ALARM alarm; Node *next, *prev; }; diff --git a/plugins/AvatarHistory/src/popup.h b/plugins/AvatarHistory/src/popup.h index bc12bfc544..4ae896d0c7 100644 --- a/plugins/AvatarHistory/src/popup.h +++ b/plugins/AvatarHistory/src/popup.h @@ -61,7 +61,7 @@ void ShowDebugPopup(MCONTACT hContact, const wchar_t *title, const wchar_t *desc void ShowTestPopup(MCONTACT hContact,const wchar_t *title, const wchar_t *description, const Options *op); // Show an error popup -void ShowErrPopup(const char *description, const char *title = NULL); +void ShowErrPopup(const char *description, const char *title = nullptr); void ShowPopupEx(MCONTACT hContact, const wchar_t *title, const wchar_t *description, void *plugin_data, int type, const Options *op); diff --git a/plugins/BasicHistory/src/ExportManager.h b/plugins/BasicHistory/src/ExportManager.h index 73cd4ca1b7..212f76f2ea 100644 --- a/plugins/BasicHistory/src/ExportManager.h +++ b/plugins/BasicHistory/src/ExportManager.h @@ -54,7 +54,7 @@ public: void SetDeleteWithoutExportEvents(int deltaTime, DWORD now); void DeleteExportedEvents(); int Import(IImport::ImportType type, const std::vector &contacts); - bool Import(IImport::ImportType type, std::vector &eventList, std::wstring *err = NULL, bool *differentContact = NULL, std::vector *contacts = NULL); + bool Import(IImport::ImportType type, std::vector &eventList, std::wstring *err = nullptr, bool *differentContact = nullptr, std::vector *contacts = nullptr); static const wchar_t* GetExt(IImport::ImportType type); }; diff --git a/plugins/BasicHistory/src/ImageDataObject.h b/plugins/BasicHistory/src/ImageDataObject.h index 4909219683..2e0ef3dd3f 100644 --- a/plugins/BasicHistory/src/ImageDataObject.h +++ b/plugins/BasicHistory/src/ImageDataObject.h @@ -81,12 +81,12 @@ public: STDMETHOD(GetData)(FORMATETC*, STGMEDIUM *pmedium) { HANDLE hDst; hDst = ::OleDuplicateData(m_stgmed.hBitmap, CF_BITMAP, 0); - if (hDst == NULL) + if (hDst == nullptr) return E_HANDLE; pmedium->tymed = TYMED_GDI; pmedium->hBitmap = (HBITMAP)hDst; - pmedium->pUnkForRelease = NULL; + pmedium->pUnkForRelease = nullptr; return S_OK; } diff --git a/plugins/BasicHistory/src/Options.h b/plugins/BasicHistory/src/Options.h index 097eec73f7..acb27417f2 100644 --- a/plugins/BasicHistory/src/Options.h +++ b/plugins/BasicHistory/src/Options.h @@ -115,7 +115,7 @@ struct TaskOptions deltaTime = 24; orderNr = 0; wchar_t buf[MAX_PATH]; - if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, buf))) + if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PERSONAL, nullptr, SHGFP_TYPE_CURRENT, buf))) { filePath = buf; filePath += L"\\"; @@ -123,7 +123,7 @@ struct TaskOptions filePath += TranslateT("History"); filePath += L"__."; - lastExport = time(NULL); + lastExport = time(nullptr); } }; diff --git a/plugins/BasicHistory/src/codecvt_CodePage.h b/plugins/BasicHistory/src/codecvt_CodePage.h index 007af11434..1a6b7f3db1 100644 --- a/plugins/BasicHistory/src/codecvt_CodePage.h +++ b/plugins/BasicHistory/src/codecvt_CodePage.h @@ -52,7 +52,7 @@ protected: _Mid1 = _First1; _Mid2 = _First2; - int conv = WideCharToMultiByte(codePage, 0, _First1, _Last1 - _First1, _First2, _Last2 - _First2, NULL, NULL); + int conv = WideCharToMultiByte(codePage, 0, _First1, _Last1 - _First1, _First2, _Last2 - _First2, nullptr, nullptr); if (conv == 0) { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) diff --git a/plugins/Boltun/src/Engine/PerContactData.h b/plugins/Boltun/src/Engine/PerContactData.h index 71dcec126d..f573423bd3 100644 --- a/plugins/Boltun/src/Engine/PerContactData.h +++ b/plugins/Boltun/src/Engine/PerContactData.h @@ -40,7 +40,7 @@ class PerContactData } inline InternalData() - : data(NULL) + : data(nullptr) { assert(false); } @@ -78,7 +78,7 @@ PerContactData::~PerContactData() mir_cslock mlck(mapLock); if (timerID) { - KillTimer(NULL, timerID); + KillTimer(nullptr, timerID); perContactDataObjects.erase(timerID); } while (!datas.empty()) @@ -106,7 +106,7 @@ void PerContactData::PutData(ContactHandle Contact) ::time(&(datas[Contact]->time)); if (!timerID) { - timerID = SetTimer(NULL, 0, 30000, RunTimerProc); + timerID = SetTimer(nullptr, 0, 30000, RunTimerProc); assert(timerID); perContactDataObjects[timerID] = this; } @@ -138,7 +138,7 @@ void PerContactData::CleanupData() } if (timerID && datas.empty()) //timerID may become NULL before locking, so should check { - KillTimer(NULL, timerID); + KillTimer(nullptr, timerID); perContactDataObjects.erase(timerID); } } diff --git a/plugins/Boltun/src/Engine/ValueChooser.h b/plugins/Boltun/src/Engine/ValueChooser.h index acd63dfd8f..e442f14530 100644 --- a/plugins/Boltun/src/Engine/ValueChooser.h +++ b/plugins/Boltun/src/Engine/ValueChooser.h @@ -37,7 +37,7 @@ public: :data(vec), notifyOnReset(NotifyOnReset) { //randomize(); - numbers = NULL; + numbers = nullptr; UpdateLength(); } diff --git a/plugins/Boltun/src/config.h b/plugins/Boltun/src/config.h index 46fea99ffa..eeb697d4b0 100644 --- a/plugins/Boltun/src/config.h +++ b/plugins/Boltun/src/config.h @@ -84,7 +84,7 @@ private: public: PtrProperty(Getter g, Setter s) - :getter(g), setter(s), cacheValid(false), cached(NULL) + :getter(g), setter(s), cacheValid(false), cached(nullptr) { } diff --git a/plugins/CSList/src/stdafx.h b/plugins/CSList/src/stdafx.h index c6277a2111..f0ae5f985d 100644 --- a/plugins/CSList/src/stdafx.h +++ b/plugins/CSList/src/stdafx.h @@ -161,8 +161,8 @@ template< class T > struct ListItem ListItem() { - m_item = NULL; - m_next = NULL; + m_item = nullptr; + m_next = nullptr; } ~ListItem() @@ -173,13 +173,13 @@ template< class T > struct ListItem ListItem(StatusItem* si) { m_item = si; - m_next = NULL; + m_next = nullptr; } ListItem(const ListItem& p) { m_item = p.item; - m_next = NULL; + m_next = nullptr; } }; @@ -196,7 +196,7 @@ public: List(compareFunc compFnc) { - m_items = NULL; + m_items = nullptr; m_count = 0; m_compare = compFnc; } @@ -220,13 +220,13 @@ public: { int position = 0; ListItem< T >* item = new ListItem< T >(csi); - if (m_items == NULL) + if (m_items == nullptr) m_items = item; else { ListItem< T >* help = item; item->m_next = m_items; - while (help->m_next != NULL) + while (help->m_next != nullptr) { int cmp = m_compare(item->m_item, help->m_next->m_item); if (cmp == 1) diff --git a/plugins/Clist_nicer/src/rowheight_funcs.h b/plugins/Clist_nicer/src/rowheight_funcs.h index aa49af8a10..11e5d5b391 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.h +++ b/plugins/Clist_nicer/src/rowheight_funcs.h @@ -30,7 +30,7 @@ public: } // Avatar size - if (contact->cFlags & ECF_AVATAR && contact->type == CLCIT_CONTACT && contact->ace != NULL && !(contact->ace->dwFlags & AVS_HIDEONCLIST)) + if (contact->cFlags & ECF_AVATAR && contact->type == CLCIT_CONTACT && contact->ace != nullptr && !(contact->ace->dwFlags & AVS_HIDEONCLIST)) height = max(height, cfg::dat.avatarSize + cfg::dat.avatarPadding); } diff --git a/plugins/ContactsPlus/src/receive.h b/plugins/ContactsPlus/src/receive.h index 286f91ca13..967ae7c12b 100644 --- a/plugins/ContactsPlus/src/receive.h +++ b/plugins/ContactsPlus/src/receive.h @@ -38,7 +38,7 @@ struct TReceivedItem { wchar_t* mcaUIN; wchar_t* mcaNick; ~TReceivedItem() { mir_free(mcaUIN); mir_free(mcaNick); } - TReceivedItem() { mcaUIN = NULL; mcaNick = NULL; } + TReceivedItem() { mcaUIN = nullptr; mcaNick = nullptr; } }; struct TRecvContactsData diff --git a/plugins/ContactsPlus/src/send.h b/plugins/ContactsPlus/src/send.h index 1cd9f2ec04..3a63934ec0 100644 --- a/plugins/ContactsPlus/src/send.h +++ b/plugins/ContactsPlus/src/send.h @@ -73,7 +73,7 @@ struct TAckData MCONTACT hContact; // to whom was it sent MCONTACT* aContacts; // obj int nContacts; // how many - TAckData(MCONTACT contact) { hContact = contact; aContacts = NULL; nContacts = 0;}; + TAckData(MCONTACT contact) { hContact = contact; aContacts = nullptr; nContacts = 0;}; ~TAckData() { mir_free(aContacts); } }; @@ -94,10 +94,10 @@ struct gAckItem { // some shit here struct gAckList { gAckItem** Items; int Count; - TAckData* Get(HANDLE hProcc) { for (int i=0; ihProcc==hProcc) { return Items[i]->ackData; }; return NULL; }; + TAckData* Get(HANDLE hProcc) { for (int i=0; ihProcc==hProcc) { return Items[i]->ackData; }; return nullptr; }; TAckData* Add(HANDLE hProcc, TAckData* ackData) { Items=(gAckItem**)mir_realloc(Items, (Count+1)*sizeof(gAckItem*)); Items[Count]=new gAckItem(hProcc, ackData); Count++; return ackData; }; - TAckData* Remove(HANDLE hProcc) { for (int i=0; ihProcc==hProcc) { TAckData* data=Items[i]->ackData; delete Items[i]; memmove(Items+i, Items+i+1, (Count-i-1)*sizeof(gAckItem*)); Count--; return data; }; return NULL; }; - gAckList() { Count = 0; Items = NULL; } + TAckData* Remove(HANDLE hProcc) { for (int i=0; ihProcc==hProcc) { TAckData* data=Items[i]->ackData; delete Items[i]; memmove(Items+i, Items+i+1, (Count-i-1)*sizeof(gAckItem*)); Count--; return data; }; return nullptr; }; + gAckList() { Count = 0; Items = nullptr; } ~gAckList() { if (Count) { for (int i=0; iusesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), 0, sttChangePassword, (LPARAM)¶m); + DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)¶m); return 0; } diff --git a/plugins/ExternalAPI/m_account.h b/plugins/ExternalAPI/m_account.h index edffef8d91..c6a342fd3d 100644 --- a/plugins/ExternalAPI/m_account.h +++ b/plugins/ExternalAPI/m_account.h @@ -44,7 +44,7 @@ enum typedef struct CNotification { //#define YAMN_NOTIFICATIONVERSION is not implemented, use YAMN_ACCOUNTVERSION instead - CNotification(): PopupB(0), PopupT(0), PopupTime(0), App(NULL), AppParam(NULL), Sound(NULL), TrayIcon1(NULL), TrayIcon2(NULL) {} + CNotification(): PopupB(0), PopupT(0), PopupTime(0), App(nullptr), AppParam(nullptr), Sound(nullptr), TrayIcon1(nullptr), TrayIcon2(nullptr) {} #define YAMN_ACC_SND 0x00000001 //Plays sound (1) #define YAMN_ACC_MSG 0x00000002 //Shows dialog @@ -75,7 +75,7 @@ typedef struct CNotification typedef struct CServer { - CServer(): Name(NULL),Login(NULL),Passwd(NULL) {} + CServer(): Name(nullptr), Login(nullptr), Passwd(nullptr) {} char *Name; DWORD Port; diff --git a/plugins/ExternalAPI/m_assocmgr.h b/plugins/ExternalAPI/m_assocmgr.h index 64331c368b..eabe570455 100644 --- a/plugins/ExternalAPI/m_assocmgr.h +++ b/plugins/ExternalAPI/m_assocmgr.h @@ -258,7 +258,7 @@ static __inline char *Netlib_UrlDecode(char *str) if (!psz[1] || !psz[2]) break; MoveMemory(psz,&psz[1],2); psz[2]=0; - *psz=(char)strtol(psz,NULL,16); + *psz=(char)strtol(psz, nullptr,16); MoveMemory(&psz[1],&psz[3],mir_strlen(&psz[3])+1); break; } diff --git a/plugins/ExternalAPI/m_flags.h b/plugins/ExternalAPI/m_flags.h index c3b9a2a5d6..663e61ccbd 100644 --- a/plugins/ExternalAPI/m_flags.h +++ b/plugins/ExternalAPI/m_flags.h @@ -28,17 +28,17 @@ To retrieve the country number from a locale, call GetLocaleInfo(). with LOCALE_ICOUNTRY. wParam=countryNumber lParam=(BOOL)fReturnHandle (nonzero to to retrieve the icolib handle instead of the icon) -Returns a icon handle (HICON) on success, NULL on error. +Returns a icon handle (HICON) on success, nullptr on error. */ #define MS_FLAGS_LOADFLAGICON "Flags/LoadFlagIcon" #if !defined(FLAGS_NOHELPERFUNCTIONS) __inline static HICON LoadFlagIcon(int countryNumber) { - if (!ServiceExists(MS_FLAGS_LOADFLAGICON)) return NULL; + if (!ServiceExists(MS_FLAGS_LOADFLAGICON)) return nullptr; return (HICON)CallService(MS_FLAGS_LOADFLAGICON,countryNumber,0); } __inline static HANDLE LoadFlagIconHandle(int countryNumber) { - if (!ServiceExists(MS_FLAGS_LOADFLAGICON)) return NULL; + if (!ServiceExists(MS_FLAGS_LOADFLAGICON)) return nullptr; return (HICON)CallService(MS_FLAGS_LOADFLAGICON,countryNumber,1); } #endif diff --git a/plugins/ExternalAPI/m_folders.h b/plugins/ExternalAPI/m_folders.h index 85173bf7dd..c6b26f0d26 100644 --- a/plugins/ExternalAPI/m_folders.h +++ b/plugins/ExternalAPI/m_folders.h @@ -141,7 +141,9 @@ typedef struct{ __inline static HANDLE FoldersRegisterCustomPath(const char *section, const char *name, const char *defaultPath) { - if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0; + if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) + return nullptr; + FOLDERSDATA fd = { sizeof(fd) }; fd.szSection = section; fd.szName = name; @@ -150,9 +152,11 @@ __inline static HANDLE FoldersRegisterCustomPath(const char *section, const char } #ifdef _UNICODE -__inline static HANDLE FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW, const wchar_t *userNameW = NULL) +__inline static HANDLE FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW, const wchar_t *userNameW = nullptr) { - if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0; + if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) + return nullptr; + FOLDERSDATA fd = { sizeof(fd) }; fd.szSection = section; fd.szName = name; diff --git a/plugins/ExternalAPI/m_mails.h b/plugins/ExternalAPI/m_mails.h index d597769b88..e5ef0cc692 100644 --- a/plugins/ExternalAPI/m_mails.h +++ b/plugins/ExternalAPI/m_mails.h @@ -68,7 +68,7 @@ struct CMimeItem char *name; char *value; struct CMimeItem *Next; - CMimeItem(): name(NULL), value(NULL), Next(NULL){} + CMimeItem(): name(nullptr), value(nullptr), Next(nullptr){} }; typedef struct CMailData //this is plugin-independent @@ -82,7 +82,7 @@ typedef struct CMailData //this is plugin-independent struct CMimeItem *Additional; //MIME items not read from server (custom, for filter plugins etc.) char *Body; //Message body - CMailData(): CP(-1), Size(0), TranslatedHeader(NULL), Body(NULL){} + CMailData(): CP(-1), Size(0), TranslatedHeader(nullptr), Body(nullptr) {} } MAILDATA,*PMAILDATA; typedef struct CMimeMsgQueue @@ -146,12 +146,12 @@ typedef struct CMimeMsgQueue //plugins can store here its own data void *PluginData; - CMimeMsgQueue(): ID(NULL), Number(0), Flags(0), MailData(NULL), MsgWindow(NULL), PluginData(NULL), Next(NULL){} + CMimeMsgQueue(): ID(nullptr), Number(0), Flags(0), MailData(nullptr), MsgWindow(nullptr), PluginData(nullptr), Next(nullptr){} ~CMimeMsgQueue() {} struct CMimeMsgQueue *Next; } YAMNMAIL,*HYAMNMAIL; -#define LoadedMailData(x) (x->MailData!=NULL) +#define LoadedMailData(x) (x->MailData!=nullptr) // //================================== YAMN MAIL SERVICES ================================== diff --git a/plugins/ExternalAPI/m_notify.h b/plugins/ExternalAPI/m_notify.h index 27d92f842e..e286cd4c13 100644 --- a/plugins/ExternalAPI/m_notify.h +++ b/plugins/ExternalAPI/m_notify.h @@ -86,7 +86,7 @@ typedef struct tagMNNOTIFYLINK static void __inline MNotifyGetLink() { - notifyLink = ServiceExists(MS_NOTIFY_GETLINK) ? (MNOTIFYLINK *)CallService(MS_NOTIFY_GETLINK,0,0) : 0; + notifyLink = ServiceExists(MS_NOTIFY_GETLINK) ? (MNOTIFYLINK *)CallService(MS_NOTIFY_GETLINK,0,0) : nullptr; } // get helpers diff --git a/plugins/ExternalAPI/m_skin_eng.h b/plugins/ExternalAPI/m_skin_eng.h index 8c70226143..af1f8fe347 100644 --- a/plugins/ExternalAPI/m_skin_eng.h +++ b/plugins/ExternalAPI/m_skin_eng.h @@ -334,7 +334,7 @@ int __inline SkinEngInvalidateImageFrame(HWND hwnd, CONST RECT * rcUpdate, DWORD int __inline SkinInvalidateFrame(HWND hWnd, CONST RECT* lpRect) { - return SkinEngInvalidateImageFrame(hWnd, lpRect, 0, 0); + return SkinEngInvalidateImageFrame(hWnd, lpRect, 0, nullptr); } // Alpha channel GDI replacements/helpers diff --git a/plugins/ExternalAPI/m_statusplugins.h b/plugins/ExternalAPI/m_statusplugins.h index 85e2ab1b84..b47a5fd572 100644 --- a/plugins/ExternalAPI/m_statusplugins.h +++ b/plugins/ExternalAPI/m_statusplugins.h @@ -104,7 +104,7 @@ typedef struct { __inline static int announce_status_change(char *szProto, int newstatus, TCHAR *szMsg) { PROTOCOLSETTINGEX ps = { 0 }; - ps.m_lastStatus = szProto != NULL ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0); + ps.m_lastStatus = szProto != nullptr ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0); ps.m_status = newstatus; ps.m_szMsg = szMsg; ps.m_szName = szProto; diff --git a/plugins/ExternalAPI/m_synchro.h b/plugins/ExternalAPI/m_synchro.h index 429c791ca4..33d605bf50 100644 --- a/plugins/ExternalAPI/m_synchro.h +++ b/plugins/ExternalAPI/m_synchro.h @@ -26,7 +26,7 @@ typedef struct SynchronisedCounter SynchronisedCounter(): Number(0) { InitializeCriticalSection(&CounterCS); - Event=CreateEvent(NULL,FALSE,TRUE,NULL); + Event = CreateEvent(nullptr, FALSE, TRUE, nullptr); SetEvent(Event); } diff --git a/plugins/ExternalAPI/m_text.h b/plugins/ExternalAPI/m_text.h index 315f6c950c..b098e2dce8 100644 --- a/plugins/ExternalAPI/m_text.h +++ b/plugins/ExternalAPI/m_text.h @@ -104,7 +104,7 @@ typedef struct tagMTEXTCREATE #ifdef __cplusplus tagMTEXTCREATE(): - text(0), hContact(0), flags(0) + text(nullptr), hContact(0), flags(0) { cbSize = sizeof(*this); } @@ -122,7 +122,7 @@ typedef struct tagMTEXTDISPLAY #ifdef __cplusplus tagMTEXTDISPLAY(): - dc(0), text(0) + dc(nullptr), text(nullptr) { cbSize = sizeof(*this); pos.x = pos.y = 0; @@ -140,7 +140,7 @@ typedef struct tagMTEXTSETPARENT #ifdef __cplusplus tagMTEXTSETPARENT(): - hwnd(0), text(0) + hwnd(nullptr), text(nullptr) { } #endif @@ -157,7 +157,7 @@ typedef struct tagMTEXTMESSAGE #ifdef __cplusplus tagMTEXTMESSAGE(): - hwnd(0), text(0), msg(0), wParam(0), lParam(0) + hwnd(nullptr), text(nullptr), msg(0), wParam(0), lParam(0) { } #endif diff --git a/plugins/ExternalAPI/m_variables.h b/plugins/ExternalAPI/m_variables.h index daadc28c60..6277c84a2e 100644 --- a/plugins/ExternalAPI/m_variables.h +++ b/plugins/ExternalAPI/m_variables.h @@ -507,18 +507,16 @@ __inline static int variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags, ch #ifndef VARIABLES_NOHELPER __inline static int variables_skin_helpbutton(HWND hwndDlg, UINT uIDButton) { - int res; - HICON hIcon; TCHAR tszClass[32]; - hIcon = NULL; - res = 0; + HICON hIcon = nullptr; + int res = 0; if (ServiceExists(MS_VARS_GETSKINITEM)) hIcon = (HICON)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPICON); GetClassName(GetDlgItem(hwndDlg, uIDButton), tszClass, _countof(tszClass)); if (!mir_wstrcmp(tszClass, L"Button")) { - if (hIcon != NULL) { + if (hIcon != nullptr) { SetWindowLongPtr(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, uIDButton), GWL_STYLE)|BS_ICON); SendMessage(GetDlgItem(hwndDlg, uIDButton), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon); } @@ -528,14 +526,14 @@ __inline static int variables_skin_helpbutton(HWND hwndDlg, UINT uIDButton) { } } else if (!mir_wstrcmp(tszClass, MIRANDABUTTONCLASS)) { - if (hIcon != NULL) { - char *szTipInfo = NULL; + if (hIcon != nullptr) { + char *szTipInfo = nullptr; SendMessage(GetDlgItem(hwndDlg, uIDButton), BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon); if (ServiceExists(MS_VARS_GETSKINITEM)) szTipInfo = (char *)CallService(MS_VARS_GETSKINITEM, 0, (LPARAM)VSI_HELPTIPTEXT); - if (szTipInfo == NULL) + if (szTipInfo == nullptr) szTipInfo = Translate("Open String Formatting Help"); SendMessage(GetDlgItem(hwndDlg, uIDButton), BUTTONADDTOOLTIP, (WPARAM)szTipInfo, 0); diff --git a/plugins/FTPFileYM/src/deletetimer.h b/plugins/FTPFileYM/src/deletetimer.h index 59159aa3da..1daec28b3b 100644 --- a/plugins/FTPFileYM/src/deletetimer.h +++ b/plugins/FTPFileYM/src/deletetimer.h @@ -28,7 +28,7 @@ private: UINT timerId; DeleteTimer() { }; - ~DeleteTimer() { instance = NULL; }; + ~DeleteTimer() { instance = nullptr; }; static void CALLBACK AutoDeleteTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); diff --git a/plugins/FTPFileYM/src/job_generic.h b/plugins/FTPFileYM/src/job_generic.h index ffc370958d..b81c6e5f5e 100644 --- a/plugins/FTPFileYM/src/job_generic.h +++ b/plugins/FTPFileYM/src/job_generic.h @@ -28,7 +28,7 @@ private: HANDLE handle; public: - Event() { handle = CreateEvent (0, FALSE, FALSE, 0); } + Event() { handle = CreateEvent(nullptr, FALSE, FALSE, nullptr); } ~Event() { CloseHandle (handle); } operator HANDLE () { return handle; } diff --git a/plugins/FTPFileYM/src/manager.h b/plugins/FTPFileYM/src/manager.h index 52983d6f5a..6eb3a541a9 100644 --- a/plugins/FTPFileYM/src/manager.h +++ b/plugins/FTPFileYM/src/manager.h @@ -70,7 +70,7 @@ public: ~Manager(); - void AddRoot(HTREEITEM h) { m_rootItems.push_back(new TreeItem(h,NULL,0)); } + void AddRoot(HTREEITEM h) { m_rootItems.push_back(new TreeItem(h, nullptr, 0)); } void AddLeaf(HTREEITEM h, HTREEITEM p, int id) { m_items.push_back(new TreeItem(h,p,id)); } static Manager *getInstance() diff --git a/plugins/FTPFileYM/src/options.h b/plugins/FTPFileYM/src/options.h index 802f3c1e3c..e4bd98fbc8 100644 --- a/plugins/FTPFileYM/src/options.h +++ b/plugins/FTPFileYM/src/options.h @@ -27,7 +27,7 @@ private: static Options *instance; Options() { }; - ~Options() { instance = NULL; }; + ~Options() { instance = nullptr; }; public: enum ETimeRange diff --git a/plugins/FTPFileYM/src/serverlist.h b/plugins/FTPFileYM/src/serverlist.h index 05b2e66724..0b41d0b4e7 100644 --- a/plugins/FTPFileYM/src/serverlist.h +++ b/plugins/FTPFileYM/src/serverlist.h @@ -25,7 +25,7 @@ class ServerList private: static ServerList *instance; ServerList() { }; - ~ServerList() { instance = NULL; }; + ~ServerList() { instance = nullptr; }; public: class FTP diff --git a/plugins/FavContacts/src/favlist.h b/plugins/FavContacts/src/favlist.h index c9ed5bc2c3..394c7fb747 100644 --- a/plugins/FavContacts/src/favlist.h +++ b/plugins/FavContacts/src/favlist.h @@ -20,7 +20,7 @@ public: name = mir_wstrdup(pcli->pfnGetContactDisplayName(hContact, 0)); if (g_Options.bUseGroups) { - if ((group = db_get_wsa(hContact, "CList", "Group")) == NULL) + if ((group = db_get_wsa(hContact, "CList", "Group")) == nullptr) group = mir_wstrdup(TranslateT("")); } else group = mir_wstrdup(TranslateT("Favorite Contacts")); @@ -72,7 +72,7 @@ private: int addContact(MCONTACT hContact, bool bManual) { DBCachedContact *cc = db->m_cache->GetCachedContact(hContact); - if (cc == NULL) + if (cc == nullptr) return 0; if (db_mc_isEnabled()) { @@ -107,7 +107,7 @@ public: void build() { - prevGroup = NULL; + prevGroup = nullptr; nGroups = 1; diff --git a/plugins/FavContacts/src/stdafx.h b/plugins/FavContacts/src/stdafx.h index c0a65e1908..b66f0242b4 100644 --- a/plugins/FavContacts/src/stdafx.h +++ b/plugins/FavContacts/src/stdafx.h @@ -84,8 +84,8 @@ extern CContactCache *g_contactCache; #include "favlist.h" -BOOL MenuDrawItem(LPDRAWITEMSTRUCT lpdis, Options *options = NULL); -BOOL MenuMeasureItem(LPMEASUREITEMSTRUCT lpmis, Options *options = NULL); +BOOL MenuDrawItem(LPDRAWITEMSTRUCT lpdis, Options *options = nullptr); +BOOL MenuMeasureItem(LPMEASUREITEMSTRUCT lpmis, Options *options = nullptr); int ProcessOptInitialise(WPARAM, LPARAM); int ProcessModulesLoaded(WPARAM, LPARAM); diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index e935b2204e..5011cb57f8 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -124,7 +124,7 @@ int getMsgId(char *msg) int RetrieveFileSize(wchar_t *filename) { FILE *hFile = _wfopen(filename, L"rb"); - if (hFile != NULL) { + if (hFile != nullptr) { fseek(hFile, 0, SEEK_END); int size = ftell(hFile); fclose(hFile); diff --git a/plugins/FloatingContacts/src/bitmap_funcs.h b/plugins/FloatingContacts/src/bitmap_funcs.h index 46b749289b..690578dabf 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.h +++ b/plugins/FloatingContacts/src/bitmap_funcs.h @@ -43,18 +43,18 @@ private: bool loadFromFile_pixel(const char *fn); bool loadFromFile_gradient(const char *fn); - bool loadFromFile_png(const char *fn, const char *fnAlpha = 0); - bool loadFromFile_default(const char *fn, const char *fnAlpha = 0); + bool loadFromFile_png(const char *fn, const char *fnAlpha = nullptr); + bool loadFromFile_default(const char *fn, const char *fnAlpha = nullptr); void premultipleChannels(); public: MyBitmap(); MyBitmap(int w, int h); - MyBitmap(const char *fn, const char *fnAlpha = 0); + MyBitmap(const char *fn, const char *fnAlpha = nullptr); ~MyBitmap(); void allocate(int w, int h); - bool loadFromFile(const char *fn, const char *fnAlpha = 0); + bool loadFromFile(const char *fn, const char *fnAlpha = nullptr); int getWidth() { return width; } int getHeight() { return height; } diff --git a/plugins/HTTPServer/src/FileShareNode.h b/plugins/HTTPServer/src/FileShareNode.h index 7c40bcced1..032bc34510 100644 --- a/plugins/HTTPServer/src/FileShareNode.h +++ b/plugins/HTTPServer/src/FileShareNode.h @@ -61,7 +61,7 @@ public://, DWORD dwAllowedIP, DWORD dwAllowedMask, int nMaxDownloads ); bool bAddUser(CLShareUser * pclUser); bool bRemoveUser(CLShareUser * pclUser); bool bAnyUsers() { - return pclCurrentUsers != 0; + return pclCurrentUsers != nullptr; } void CloseAllTransfers(); CLShareUser *pclGetUsers() { diff --git a/plugins/HTTPServer/src/HttpUser.h b/plugins/HTTPServer/src/HttpUser.h index a5a7b2d24c..f44c9a8e71 100644 --- a/plugins/HTTPServer/src/HttpUser.h +++ b/plugins/HTTPServer/src/HttpUser.h @@ -63,8 +63,8 @@ private: HANDLE hFile; char *apszParam[eLastParam]; - void SendError(int iErrorCode, const char * pszError, const char * pszDescription = NULL); - void SendRedir(int iErrorCode, const char * pszError, const char * pszDescription = NULL, const char * pszRedirect = NULL); + void SendError(int iErrorCode, const char * pszError, const char * pszDescription = nullptr); + void SendRedir(int iErrorCode, const char * pszError, const char * pszDescription = nullptr, const char * pszRedirect = nullptr); }; #endif \ No newline at end of file diff --git a/plugins/HistoryStats/src/bandctrl.h b/plugins/HistoryStats/src/bandctrl.h index 4917545c87..a94544b358 100644 --- a/plugins/HistoryStats/src/bandctrl.h +++ b/plugins/HistoryStats/src/bandctrl.h @@ -16,7 +16,7 @@ private: HWND m_hBandWnd; public: - explicit BandCtrl(HWND hBandWnd = NULL) : m_hBandWnd(hBandWnd) { } + explicit BandCtrl(HWND hBandWnd = nullptr) : m_hBandWnd(hBandWnd) { } ~BandCtrl() { } public: @@ -25,7 +25,7 @@ public: public: void setLayout(int nLayout); - HANDLE addButton(DWORD dwFlags, HICON hIcon, INT_PTR dwData, const wchar_t* szTooltip = NULL, const wchar_t* szText = NULL); + HANDLE addButton(DWORD dwFlags, HICON hIcon, INT_PTR dwData, const wchar_t* szTooltip = nullptr, const wchar_t* szText = nullptr); bool isButtonChecked(HANDLE hButton); void checkButton(HANDLE hButton, bool bCheck); DWORD getButtonData(HANDLE hButton); diff --git a/plugins/HistoryStats/src/column.h b/plugins/HistoryStats/src/column.h index acd99f933e..6586beacb5 100644 --- a/plugins/HistoryStats/src/column.h +++ b/plugins/HistoryStats/src/column.h @@ -139,7 +139,7 @@ public: Column() : m_bEnabled(true), m_CustomTitle(L""), m_nContactDataSlot(-1), m_nContactDataTransformSlot(-1), - m_pStatistic(NULL), m_pSettings(NULL), m_pCharMapper(NULL), + m_pStatistic(nullptr), m_pSettings(nullptr), m_pCharMapper(nullptr), m_bUsePNG(false) { } diff --git a/plugins/HistoryStats/src/message.h b/plugins/HistoryStats/src/message.h index 686ee103ee..39e8af549e 100644 --- a/plugins/HistoryStats/src/message.h +++ b/plugins/HistoryStats/src/message.h @@ -43,7 +43,7 @@ private: public: explicit Message(bool bStripRawRTF, bool bStripBBCodes) - : m_RawSource(NULL), m_Available(0), + : m_RawSource(nullptr), m_Available(0), m_bStripRawRTF(bStripRawRTF), m_bStripBBCodes(bStripBBCodes), m_bOutgoing(false), m_Timestamp(0), m_nLength(0) { diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index 11905e187d..875fbfa01d 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -13,7 +13,7 @@ namespace mu namespace clist { - HGENMENU addMainMenuItem(const wchar_t* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, HGENMENU hRoot = 0); + HGENMENU addMainMenuItem(const wchar_t* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, HGENMENU hRoot = nullptr); HGENMENU addContactMenuItem(const wchar_t* pszName, DWORD flags, int position, HICON hIcon, const char* pszService); } diff --git a/plugins/HistoryStats/src/optionsctrl.h b/plugins/HistoryStats/src/optionsctrl.h index 629249e99b..13889ed564 100644 --- a/plugins/HistoryStats/src/optionsctrl.h +++ b/plugins/HistoryStats/src/optionsctrl.h @@ -31,7 +31,7 @@ private: const OptionsCtrl& operator =(const OptionsCtrl& other); // no implementation public: - explicit OptionsCtrl(HWND hOptWnd = NULL) : m_hOptWnd(hOptWnd) { } + explicit OptionsCtrl(HWND hOptWnd = nullptr) : m_hOptWnd(hOptWnd) { } ~OptionsCtrl() { } public: @@ -78,7 +78,7 @@ public: void setScrollPos(int nBar, int nPos); bool isDateTimeNone(HANDLE hDateTime); void setDateTimeNone(HANDLE hDateTime); - DWORD getDateTime(HANDLE hDateTime, bool* pbNone = NULL); + DWORD getDateTime(HANDLE hDateTime, bool* pbNone = nullptr); void setDateTime(HANDLE hDateTime, DWORD dwDateTime); ext::string getDateTimeStr(HANDLE hDateTime); void setDateTimeStr(HANDLE hDateTime, const ext::string& strDateTime); diff --git a/plugins/HistoryStats/src/statistic.h b/plugins/HistoryStats/src/statistic.h index b3dbe6fc2a..e05254b5d7 100644 --- a/plugins/HistoryStats/src/statistic.h +++ b/plugins/HistoryStats/src/statistic.h @@ -167,14 +167,14 @@ public: ~Statistic(); public: - static void run(const Settings& settings, InvocationSource invokedFrom, HINSTANCE hInst, HWND hWndParent = NULL); + static void run(const Settings& settings, InvocationSource invokedFrom, HINSTANCE hInst, HWND hWndParent = nullptr); int countContacts() const { return m_Contacts.size(); } const Contact& getContact(int index) const; const Contact& getTotals() const { assert(m_pTotals); return *m_pTotals; } const Contact& getOmitted() const { assert(m_pOmitted); return *m_pOmitted; } - bool hasTotals() const { return (m_pTotals != NULL) && m_Settings.m_CalcTotals; } // MEMO: only makes sense after 'calc totals'-step - bool hasOmitted() const { return (m_pOmitted != NULL) && m_Settings.m_OmitContacts && m_Settings.m_OmittedInExtraRow && m_bActuallyOmitted; } // MEMO: only makes sense after 'omit'-step + bool hasTotals() const { return (m_pTotals != nullptr) && m_Settings.m_CalcTotals; } // MEMO: only makes sense after 'calc totals'-step + bool hasOmitted() const { return (m_pOmitted != nullptr) && m_Settings.m_OmitContacts && m_Settings.m_OmittedInExtraRow && m_bActuallyOmitted; } // MEMO: only makes sense after 'omit'-step DWORD getFirstTime(); // MEMO: only makes sense after 'calc totals'-step DWORD getLastTime(); // MEMO: only makes sense after 'calc totals'-step DWORD getHistoryTime(); // MEMO: only makes sense after 'calc totals'-step diff --git a/plugins/HistoryStats/src/utf8buffer.h b/plugins/HistoryStats/src/utf8buffer.h index 56342adbf7..8f7d3cdddc 100644 --- a/plugins/HistoryStats/src/utf8buffer.h +++ b/plugins/HistoryStats/src/utf8buffer.h @@ -48,7 +48,7 @@ protected: { return _Tr::not_eof(_C); } - else if (pptr() != 0 && pptr() < epptr()) + else if (pptr() != nullptr && pptr() < epptr()) { *pptr() = _Tr::to_char_type(_C); pbump(1); diff --git a/plugins/HistoryStats/src/utils.h b/plugins/HistoryStats/src/utils.h index 884b1c7302..daae031316 100644 --- a/plugins/HistoryStats/src/utils.h +++ b/plugins/HistoryStats/src/utils.h @@ -96,7 +96,7 @@ namespace utils ext::string getGUID(); // window positioning - void centerDialog(HWND hDlg, HWND hParent = NULL); + void centerDialog(HWND hDlg, HWND hParent = nullptr); RECT getWindowRect(HWND hParent, HWND hWnd); inline RECT getWindowRect(HWND hParent, int nID) { return getWindowRect(hParent, GetDlgItem(hParent, nID)); } void moveWindow(HWND hWnd, const RECT& rWnd); diff --git a/plugins/ListeningTo/src/stdafx.h b/plugins/ListeningTo/src/stdafx.h index c8b4d5ca1f..9aa52d28ea 100644 --- a/plugins/ListeningTo/src/stdafx.h +++ b/plugins/ListeningTo/src/stdafx.h @@ -100,18 +100,18 @@ void m_log(const wchar_t *function, const wchar_t *fmt, ...); static bool IsEmpty(const char *str) { - return str == NULL || str[0] == 0; + return str == nullptr || str[0] == 0; } static bool IsEmpty(const WCHAR *str) { - return str == NULL || str[0] == 0; + return str == nullptr || str[0] == 0; } -#define DUP(_X_) ( IsEmpty(_X_) ? NULL : mir_wstrdup(_X_)) +#define DUP(_X_) ( IsEmpty(_X_) ? nullptr : mir_wstrdup(_X_)) #define DUPD(_X_, _DEF_) ( IsEmpty(_X_) ? mir_wstrdup(_DEF_) : mir_wstrdup(_X_)) -#define U2T(_X_) ( IsEmpty(_X_) ? NULL : mir_wstrdup(_X_)) +#define U2T(_X_) ( IsEmpty(_X_) ? nullptr : mir_wstrdup(_X_)) #define U2TD(_X_, _DEF_) ( IsEmpty(_X_) ? mir_wstrdup(_DEF_) : mir_wstrdup(_X_)) -#define UNKNOWN(_X_) ( _X_ == NULL || _X_[0] == '\0' ? opts.unknown : _X_ ) +#define UNKNOWN(_X_) ( _X_ == nullptr || _X_[0] == '\0' ? opts.unknown : _X_ ) void InitServices(); diff --git a/plugins/MirLua/src/mlua.h b/plugins/MirLua/src/mlua.h index 06f4fe2287..21ace43dc6 100644 --- a/plugins/MirLua/src/mlua.h +++ b/plugins/MirLua/src/mlua.h @@ -6,7 +6,7 @@ struct HandleRefParam HANDLE h; int ref; lua_State *L; - HandleRefParam(HANDLE h) : L(NULL), h(h), ref(0) { } + HandleRefParam(HANDLE h) : L(nullptr), h(h), ref(0) { } HandleRefParam(lua_State *L, HANDLE h, int ref = 0) : L(L), h(h), ref(ref) { } }; diff --git a/plugins/MirLua/src/mlua_metatable.h b/plugins/MirLua/src/mlua_metatable.h index 7fb8c27578..c46d397dbb 100644 --- a/plugins/MirLua/src/mlua_metatable.h +++ b/plugins/MirLua/src/mlua_metatable.h @@ -120,7 +120,7 @@ private: static void Free(lua_State* /*L*/, T **obj) { - *obj = NULL; + *obj = nullptr; } static int lua__new(lua_State *L) @@ -128,7 +128,7 @@ private: T **udata = (T**)lua_newuserdata(L, sizeof(T*)); *udata = Init(L); - if (*udata == NULL) + if (*udata == nullptr) { lua_pushnil(L); return 1; @@ -319,7 +319,7 @@ public: static void Apply(lua_State *L, T *obj) { - if (obj == NULL) { + if (obj == nullptr) { lua_pushnil(L); return; } diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.h b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.h index 9ac2288262..cc43966413 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.h +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.h @@ -45,7 +45,7 @@ public: BITMAPINFO *GetBitmapInfo(void); HBITMAP GetHBITMAP(void); - void StartTransition(ETransitionType eType = TRANSITION_RANDOM,LPRECT rect = NULL); + void StartTransition(ETransitionType eType = TRANSITION_RANDOM,LPRECT rect = nullptr); protected: void Cache(); diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDList.h b/plugins/MirandaG15/src/LCDFramework/CLCDList.h index 93284ba71a..84be7da53a 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDList.h +++ b/plugins/MirandaG15/src/LCDFramework/CLCDList.h @@ -15,9 +15,9 @@ public: { m_iIndex = -1; m_iEntryCount = 0; - m_Position = NULL; + m_Position = nullptr; m_pParent = pParent; - if(pParent == NULL) + if(pParent == nullptr) { m_iLevel = 0; m_eType = ROOT; @@ -39,28 +39,28 @@ public: virtual CListEntry *GetNextEntry() { - if(m_pParent == NULL) - return NULL; + if(m_pParent == nullptr) + return nullptr; return m_pParent->GetNextEntry(this); } virtual CListEntry *GetPreviousEntry() { - if(m_pParent == NULL) - return NULL; + if(m_pParent == nullptr) + return nullptr; return m_pParent->GetPreviousEntry(this); } virtual CListEntry *GetNextEntry(CListEntry*) { - return NULL; + return nullptr; } virtual CListEntry *GetPreviousEntry(CListEntry*) { - return NULL; + return nullptr; } EListEntryType GetType() @@ -175,7 +175,7 @@ public: CListContainer(CListEntry *pParent) : CListEntry(pParent) { - if(m_pParent != NULL) + if(m_pParent != nullptr) { m_eType = CONTAINER; m_bOpen = false; @@ -186,7 +186,7 @@ public: ~CListContainer() { - if(m_pRoot != NULL) { + if(m_pRoot != nullptr) { m_pRoot->DeleteGroup(GetGroupData()); } Clear(); @@ -202,7 +202,7 @@ public: if(m_pRoot && m_pRoot->GetPosition() == *iter) { if(GetType() == ROOT) - m_pRoot->SetPosition(NULL); + m_pRoot->SetPosition(nullptr); else m_pRoot->SetPosition(this); } @@ -225,7 +225,7 @@ public: CListEntry *GetLastOwnEntry() { if(m_Entrys.empty()) - return NULL; + return nullptr; return *(--m_Entrys.end()); } @@ -240,14 +240,14 @@ public: return pEntry; return ((CListContainer*)pEntry)->GetLastEntry(); } - return NULL; + return nullptr; } CListEntry *GetFirstEntry() { if(!m_Entrys.empty()) return *(m_Entrys.begin()); - return NULL; + return nullptr; } CListEntry *GetNextEntry() @@ -255,7 +255,7 @@ public: if(!IsOpen() || m_Entrys.empty()) { if(!m_pParent) - return NULL; + return nullptr; return m_pParent->GetNextEntry(this); } @@ -271,8 +271,8 @@ public: { if(++iter == m_Entrys.end()) { - if(m_pParent == NULL) - return NULL; + if(m_pParent == nullptr) + return nullptr; return m_pParent->GetNextEntry(this); } else @@ -280,7 +280,7 @@ public: } iter++; } - return NULL; + return nullptr; } CListEntry *GetPreviousEntry(CListEntry *pEntry) @@ -293,8 +293,8 @@ public: { if(iter == m_Entrys.begin()) { - if(m_pParent == NULL) - return NULL; + if(m_pParent == nullptr) + return nullptr; return this; } else @@ -311,7 +311,7 @@ public: } iter++; } - return NULL; + return nullptr; } virtual CListItem *InsertItem(iterator _Where,T Entry) @@ -352,7 +352,7 @@ public: virtual void RemoveGroup(G Group) { list< CListEntry* >::iterator iter = m_Entrys.begin(); - CListContainer *pContainer = NULL; + CListContainer *pContainer = nullptr; while(iter != m_Entrys.end()) { if((*iter)->GetType() == CONTAINER) @@ -382,7 +382,7 @@ public: virtual void RemoveItem(T Entry) { list< CListEntry* >::iterator iter = m_Entrys.begin(); - CListItem *pItem = NULL; + CListItem *pItem = nullptr; while(iter != m_Entrys.end()) { if((*iter)->GetType() == ITEM) @@ -412,7 +412,7 @@ public: CListContainer *GetGroup(G Group) { list< CListEntry* >::iterator iter = m_Entrys.begin(); - CListContainer *pContainer = NULL; + CListContainer *pContainer = nullptr; while(iter != m_Entrys.end()) { if((*iter)->GetType() == CONTAINER) @@ -423,7 +423,7 @@ public: } iter++; } - return NULL; + return nullptr; } G GetGroupData() @@ -462,7 +462,7 @@ public: void CollapseAll() { list< CListEntry* >::iterator iter = m_Entrys.begin(); - CListContainer* pContainer = NULL; + CListContainer* pContainer = nullptr; while(iter != m_Entrys.end()) { if((*iter)->GetType() == CONTAINER) @@ -478,7 +478,7 @@ public: void ExpandAll() { list< CListEntry* >::iterator iter = m_Entrys.begin(); - CListContainer* pContainer = NULL; + CListContainer* pContainer = nullptr; while(iter != m_Entrys.end()) { if((*iter)->GetType() == CONTAINER) @@ -512,7 +512,7 @@ public: if(GetType() == ROOT) { - if(GetPosition() == NULL && !m_Entrys.empty()) + if(GetPosition() == nullptr && !m_Entrys.empty()) SetPosition(*m_Entrys.begin()); else SetPosition(GetPosition()); @@ -541,9 +541,9 @@ public: //************************************************************************ // Constructor //************************************************************************ - CLCDList() : CListContainer(NULL) + CLCDList() : CListContainer(nullptr) { - m_pScrollbar = NULL; + m_pScrollbar = nullptr; m_iIndention = 10; m_iColumns = 1; m_bDrawTreeLines = true; @@ -613,7 +613,7 @@ public: CListEntry *pPosition = m_Position; // if nothing is selected, skip drawing - if(pPosition == NULL) + if(pPosition == nullptr) return true; bool bDrawGroup = false; @@ -642,7 +642,7 @@ public: } // bottom selection - while(pPosition != NULL ) + while(pPosition != nullptr) { iYOffset = iHeight; @@ -757,7 +757,7 @@ public: { CListContainer::SetPosition(pEntry); - if(pEntry == NULL) + if(pEntry == nullptr) return; int iPerPage = (GetHeight()/m_iEntryHeight)*m_iColumns; @@ -773,10 +773,10 @@ public: //************************************************************************ bool ScrollUp() { - if(m_Position != NULL) + if(m_Position != nullptr) { CListEntry *pEntry = m_Position->GetPreviousEntry(); - if(pEntry != NULL) + if(pEntry != nullptr) { m_Position = pEntry; @@ -793,10 +793,10 @@ public: //************************************************************************ bool ScrollDown() { - if(m_Position != NULL) + if(m_Position != nullptr) { CListEntry *pEntry = m_Position->GetNextEntry(); - if(pEntry != NULL) + if(pEntry != nullptr) { m_Position = pEntry; @@ -825,8 +825,8 @@ public: m_pScrollbar = pScrollbar; if(m_pScrollbar) { - m_pScrollbar->SetRange(0,m_iEntryCount-1); - m_pScrollbar->ScrollTo(m_Position != NULL?m_Position->GetIndex():0); + m_pScrollbar->SetRange(0, m_iEntryCount - 1); + m_pScrollbar->ScrollTo(m_Position != nullptr ? m_Position->GetIndex() : 0); m_pScrollbar->SetAlignment(TOP); } @@ -892,7 +892,7 @@ protected: if(m_pScrollbar) { m_pScrollbar->SetRange(0,m_iEntryCount-1); - if(GetPosition() != NULL) + if(GetPosition() != nullptr) m_pScrollbar->ScrollTo(GetPosition()->GetIndex()); } } diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.h b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.h index 1011e5d551..adb338c7c6 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.h +++ b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.h @@ -49,7 +49,7 @@ public: void SetButtonRepeatDelay(DWORD dwDelay); // starts a screen transition - void StartTransition(ETransitionType eTransition = TRANSITION_RANDOM,LPRECT rect = NULL); + void StartTransition(ETransitionType eTransition = TRANSITION_RANDOM,LPRECT rect = nullptr); // called by CLCDConnection when connected to a device void OnDeviceConnected(); diff --git a/plugins/MirandaG15/src/LCDFramework/misc.h b/plugins/MirandaG15/src/LCDFramework/misc.h index c5f2bb4f06..0ff1a01668 100644 --- a/plugins/MirandaG15/src/LCDFramework/misc.h +++ b/plugins/MirandaG15/src/LCDFramework/misc.h @@ -52,7 +52,7 @@ inline std::string toNarrowString( const std::string& str ) } inline std::tstring toTstring( const wchar_t* p , int len=-1 ) { - return p == NULL?L"":((len < 0) ? p : std::wstring(p,len)); + return p == nullptr ?L"":((len < 0) ? p : std::wstring(p,len)); } extern tstring Utf8_Decode(const char *str); @@ -75,7 +75,7 @@ inline std::string toNarrowString( const std::string& str ) } inline std::tstring toTstring( const char* p , int len=-1 ) { - if(p == NULL) + if(p == nullptr) return ""; return (len < 0) ? p : std::string(p,len) ; } diff --git a/plugins/MyDetails/src/stdafx.h b/plugins/MyDetails/src/stdafx.h index 0417f65813..1b0a10892e 100644 --- a/plugins/MyDetails/src/stdafx.h +++ b/plugins/MyDetails/src/stdafx.h @@ -84,7 +84,7 @@ static __inline int DRAW_TEXT(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRe return DrawText(hDC, lpString, nCount, lpRect, uFormat); return Smileys_DrawText(hDC, lpString, nCount, lpRect, uFormat | (opts.resize_smileys ? DT_RESIZE_SMILEYS : 0), - opts.use_contact_list_smileys ? "clist" : protocol, NULL); + opts.use_contact_list_smileys ? "clist" : protocol, nullptr); } #endif // __COMMONS_H__ diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index 3ded4b59c6..0b413d290e 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -31,7 +31,7 @@ CIconList g_IconList; // Set window size and center its controls void MySetPos(HWND hwndParent) { - HWND hWndTab = FindWindowEx(GetParent(hwndParent), NULL, L"SysTabControl32", L""); + HWND hWndTab = FindWindowEx(GetParent(hwndParent), nullptr, L"SysTabControl32", L""); if (!hWndTab) { _ASSERT(0); return; @@ -64,7 +64,7 @@ void MySetPos(HWND hwndParent) // ================================================ Message options ================================================ -COptPage g_MessagesOptPage(MOD_NAME, NULL); +COptPage g_MessagesOptPage(MOD_NAME, nullptr); void EnableMessagesOptDlgControls(CMsgTree* MsgTree) { @@ -318,7 +318,7 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DESTROY: delete MsgTree; MsgTree = nullptr; - g_MessagesOptPage.SetWnd(NULL); + g_MessagesOptPage.SetWnd(nullptr); break; } return 0; @@ -326,7 +326,7 @@ static INT_PTR CALLBACK MessagesOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LP // ================================================ Main options ================================================ -COptPage g_MoreOptPage(MOD_NAME, NULL); +COptPage g_MoreOptPage(MOD_NAME, nullptr); void EnableMoreOptDlgControls() { @@ -337,7 +337,7 @@ void EnableMoreOptDlgControls() g_MoreOptPage.Enable(IDC_MOREOPTDLG_USEDEFMSG, bEnabled); g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS) != 0); g_MoreOptPage.Enable(IDC_MOREOPTDLG_UPDATEMSGSPERIOD, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_UPDATEMSGS) != 0); - InvalidateRect(GetDlgItem(g_MoreOptPage.GetWnd(), IDC_MOREOPTDLG_UPDATEMSGSPERIOD_SPIN), NULL, false); // update spin control + InvalidateRect(GetDlgItem(g_MoreOptPage.GetWnd(), IDC_MOREOPTDLG_UPDATEMSGSPERIOD_SPIN), nullptr, false); // update spin control g_MoreOptPage.MemToPage(true); } @@ -438,7 +438,7 @@ static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case WM_DESTROY: - g_MoreOptPage.SetWnd(NULL); + g_MoreOptPage.SetWnd(nullptr); break; } return 0; @@ -446,7 +446,7 @@ static INT_PTR CALLBACK MoreOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // ================================================ Autoreply options ================================================ -COptPage g_AutoreplyOptPage(MOD_NAME, NULL); +COptPage g_AutoreplyOptPage(MOD_NAME, nullptr); void EnableAutoreplyOptDlgControls() { @@ -464,7 +464,7 @@ void EnableAutoreplyOptDlgControls() } } g_AutoreplyOptPage.MemToPage(true); - InvalidateRect(GetDlgItem(g_AutoreplyOptPage.GetWnd(), IDC_REPLYDLG_SENDCOUNT_SPIN), NULL, 0); // update spin control + InvalidateRect(GetDlgItem(g_AutoreplyOptPage.GetWnd(), IDC_REPLYDLG_SENDCOUNT_SPIN), nullptr, 0); // update spin control } static struct { @@ -549,7 +549,7 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l IDC_MOREOPTDLG_EVNTURL, LPGENW("URL"), IDC_MOREOPTDLG_EVNTFILE, LPGENW("File") }; - hWndTooltips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP | TTS_NOPREFIX, 0, 0, 0, 0, NULL, NULL, GetModuleHandleA("mir_app.mir"), NULL); + hWndTooltips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP | TTS_NOPREFIX, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandleA("mir_app.mir"), nullptr); TOOLINFO ti = { 0 }; ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; @@ -637,7 +637,7 @@ INT_PTR CALLBACK AutoreplyOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case WM_DESTROY: - g_AutoreplyOptPage.SetWnd(NULL); + g_AutoreplyOptPage.SetWnd(nullptr); if (s_hDrawFont) DeleteObject(s_hDrawFont); @@ -1048,8 +1048,8 @@ int OptsDlgInit(WPARAM wParam, LPARAM) return 0; } -COptPage g_SetAwayMsgPage(MOD_NAME, NULL); -COptPage g_MsgTreePage(MOD_NAME, NULL); +COptPage g_SetAwayMsgPage(MOD_NAME, nullptr); +COptPage g_MsgTreePage(MOD_NAME, nullptr); void InitOptions() { @@ -1057,15 +1057,15 @@ void InitOptions() g_MessagesOptPage.Items.AddElem(new COptItem_Generic(IDC_MESSAGEDLG_DEL)); g_MessagesOptPage.Items.AddElem(new COptItem_Generic(IDC_MESSAGEDLG_MSGTITLE)); g_MessagesOptPage.Items.AddElem(new COptItem_Generic(IDC_MESSAGEDLG_MSGDATA)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_ONL, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_AWAY, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_NA, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_OCC, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_DND, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_FFC, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_INV, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_OTP, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); - g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_OTL, NULL, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_ONL, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_AWAY, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_NA, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_OCC, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_DND, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_FFC, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_INV, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_OTP, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); + g_MessagesOptPage.Items.AddElem(new COptItem_Checkbox(IDC_MESSAGEDLG_DEF_OTL, nullptr, DBVT_BYTE, 0, 0, IDC_MESSAGEDLG_MSGTREE)); TreeItemArray DefMsgTree; int ParentID1; int ID = 0; diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index eef50f0655..fd339acc69 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -107,16 +107,16 @@ TCString GetDynamicStatMsg(MCONTACT hContact, char *szProto, DWORD UIN, int iSta { // hContact is the contact that requests the status message if (hContact != INVALID_CONTACT_ID) - VarParseData.Message = CContactSettings(iStatus, hContact).GetMsgFormat(GMF_ANYCURRENT, NULL, szProto); + VarParseData.Message = CContactSettings(iStatus, hContact).GetMsgFormat(GMF_ANYCURRENT, nullptr, szProto); else // contact is unknown VarParseData.Message = CProtoSettings(szProto, iStatus).GetMsgFormat(iStatus ? GMF_LASTORDEFAULT : GMF_ANYCURRENT); TCString sTime; - VarParseData.szProto = szProto ? szProto : ((hContact && hContact != INVALID_CONTACT_ID) ? GetContactProto(hContact) : NULL); + VarParseData.szProto = szProto ? szProto : ((hContact && hContact != INVALID_CONTACT_ID) ? GetContactProto(hContact) : nullptr); VarParseData.UIN = UIN; VarParseData.Flags = 0; if (ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) { - wchar_t *szResult = variables_parse(VarParseData.Message, 0, hContact); + wchar_t *szResult = variables_parse(VarParseData.Message, nullptr, hContact); if (szResult) { VarParseData.Message = szResult; mir_free(szResult); @@ -155,7 +155,7 @@ int StatusMsgReq(WPARAM wParam, LPARAM lParam, CString &szProto) hContactForSettings = INVALID_CONTACT_ID; // INVALID_HANDLE_VALUE means the contact is not-on-list if (g_SetAwayMsgPage.GetWnd()) { - CallAllowedPS_SETAWAYMSG(szProto, iMode, NULL); // we can set status messages to NULL here, as they'll be changed again when the SAM dialog closes. + CallAllowedPS_SETAWAYMSG(szProto, iMode, nullptr); // we can set status messages to NULL here, as they'll be changed again when the SAM dialog closes. return 0; } if (CContactSettings(iMode, hContactForSettings).Ignore) { @@ -345,10 +345,10 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM) case 0: hIcon = iconList[0].hIcolib; break; default: iAutoreply = 1; hIcon = iconList[1].hIcolib; break; } - Menu_ModifyItem(g_hToggleSOEContactMenuItem, NULL, hIcon, 0); - Menu_ModifyItem(g_hAutoreplyOnContactMenuItem, NULL, iconList[1].hIcolib, (iAutoreply == 1) ? CMIF_CHECKED : 0); - Menu_ModifyItem(g_hAutoreplyOffContactMenuItem, NULL, iconList[0].hIcolib, (iAutoreply == 0) ? CMIF_CHECKED : 0); - Menu_ModifyItem(g_hAutoreplyUseDefaultContactMenuItem, NULL, iconList[5].hIcolib, (iAutoreply == VAL_USEDEFAULT) ? CMIF_CHECKED : 0); + Menu_ModifyItem(g_hToggleSOEContactMenuItem, nullptr, hIcon, 0); + Menu_ModifyItem(g_hAutoreplyOnContactMenuItem, nullptr, iconList[1].hIcolib, (iAutoreply == 1) ? CMIF_CHECKED : 0); + Menu_ModifyItem(g_hAutoreplyOffContactMenuItem, nullptr, iconList[0].hIcolib, (iAutoreply == 0) ? CMIF_CHECKED : 0); + Menu_ModifyItem(g_hAutoreplyUseDefaultContactMenuItem, nullptr, iconList[5].hIcolib, (iAutoreply == VAL_USEDEFAULT) ? CMIF_CHECKED : 0); } else // hide the Autoreply menu item Menu_ShowItem(g_hToggleSOEContactMenuItem, false); @@ -389,7 +389,7 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM) INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM) { // used only for the global setting - CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : NULL].m_status, hContact).Autoreply.Toggle(); + CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : nullptr].m_status, hContact).Autoreply.Toggle(); if (hContact == NULL) { int SendOnEvent = CContactSettings(g_ProtoStates[(LPSTR)NULL].m_status).Autoreply; @@ -490,7 +490,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) Result.ReleaseBuffer(); } else if (!mir_wstrcmp(ai->targv[0], VAR_AWAYSINCE_DATE)) { - GetDateFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].m_awaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : NULL, Result.GetBuffer(256), 256); + GetDateFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].m_awaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : nullptr, Result.GetBuffer(256), 256); Result.ReleaseBuffer(); } else if (!mir_wstrcmp(ai->targv[0], VAR_STATDESC)) { @@ -498,12 +498,12 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) } else if (!mir_wstrcmp(ai->targv[0], VAR_MYNICK)) { if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_MYNICKPERPROTO) && VarParseData.szProto) - Result = db_get_s(NULL, VarParseData.szProto, "Nick", (wchar_t*)NULL); + Result = db_get_s(NULL, VarParseData.szProto, "Nick", (wchar_t*)nullptr); - if (Result == NULL) + if (Result == nullptr) Result = pcli->pfnGetContactDisplayName(NULL, 0); - if (Result == NULL) + if (Result == nullptr) Result = TranslateT("Stranger"); } else if (!mir_wstrcmp(ai->targv[0], VAR_REQUESTCOUNT)) { @@ -546,7 +546,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) break; } } - if (Result == NULL) // if we didn't find a message with specified title + if (Result == nullptr) // if we didn't find a message with specified title return NULL; // return it now, as later we change NULL to "" } else if (!mir_wstrcmp(ai->targv[0], VAR_PROTOCOL)) { @@ -556,14 +556,14 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) AnsiResult.ReleaseBuffer(); Result = _A2T(AnsiResult); } - if (Result == NULL) // if we didn't find a message with specified title + if (Result == nullptr) // if we didn't find a message with specified title return NULL; // return it now, as later we change NULL to "" } wchar_t *szResult = (wchar_t*)malloc((Result.GetLen() + 1) * sizeof(wchar_t)); if (!szResult) return NULL; - mir_wstrcpy(szResult, (Result != NULL) ? Result : L""); + mir_wstrcpy(szResult, (Result != nullptr) ? Result : L""); return (INT_PTR)szResult; } @@ -657,7 +657,7 @@ int MirandaLoaded(WPARAM, LPARAM) memset(&mi, 0, sizeof(mi)); SET_UID(mi, 0x47a3c631, 0x8ca9, 0x4b7e, 0x84, 0x6e, 0x29, 0xbf, 0x53, 0x30, 0x6f, 0x83); mi.flags = CMIF_UNICODE; - mi.hIcolibItem = NULL; + mi.hIcolibItem = nullptr; mi.position = 1000020000; mi.name.w = LPGENW("Autoreply"); g_hToggleSOEContactMenuItem = Menu_AddContactMenuItem(&mi); diff --git a/plugins/NewAwaySysMod/src/CString.cpp b/plugins/NewAwaySysMod/src/CString.cpp index 727ea9fb41..5a61b36edb 100644 --- a/plugins/NewAwaySysMod/src/CString.cpp +++ b/plugins/NewAwaySysMod/src/CString.cpp @@ -38,7 +38,7 @@ void TString::Free() { // HeapFree(GetProcessHeap(), 0, pBuf); free(pBuf); - pBuf = NULL; + pBuf = nullptr; nBufSize = 0; nAllocSize = 0; } diff --git a/plugins/NewAwaySysMod/src/CString.h b/plugins/NewAwaySysMod/src/CString.h index decedaaac7..22cb0dd4c3 100644 --- a/plugins/NewAwaySysMod/src/CString.h +++ b/plugins/NewAwaySysMod/src/CString.h @@ -45,9 +45,9 @@ template class TString { public: - TString(): pBuf(NULL), nBufSize(0), nAllocSize(0) {} - TString(const T *pStr): pBuf(NULL), nBufSize(0), nAllocSize(0) {*this = pStr;} - TString(const TString &Str): pBuf(NULL), nBufSize(0), nAllocSize(0) {*this = Str.pBuf;} + TString(): pBuf(nullptr), nBufSize(0), nAllocSize(0) {} + TString(const T *pStr): pBuf(nullptr), nBufSize(0), nAllocSize(0) {*this = pStr;} + TString(const TString &Str): pBuf(nullptr), nBufSize(0), nAllocSize(0) {*this = Str.pBuf;} ~TString() {Free();} int GetLen() const {return (nBufSize) ? (nBufSize - 1) : 0;}; @@ -183,7 +183,7 @@ private: class UTF8DecodeA { public: - UTF8DecodeA(const char *str) { p = mir_strdup(str); mir_utf8decode(p, NULL); } + UTF8DecodeA(const char *str) { p = mir_strdup(str); mir_utf8decode(p, nullptr); } ~UTF8DecodeA() { mir_free(p); } operator char*() { return p; } diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index 92dbffb9c4..a062efb8ac 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -76,7 +76,7 @@ void InitUpdateMsgs() } else if (!g_hUpdateMsgsThread && UpdateMsgs) { g_hTerminateUpdateMsgsThread = CreateEvent(nullptr, TRUE, FALSE, nullptr); - g_hUpdateMsgsThread = (HANDLE)mir_forkthread(UpdateMsgsThreadProc, NULL); + g_hUpdateMsgsThread = (HANDLE)mir_forkthread(UpdateMsgsThreadProc, nullptr); } } @@ -85,7 +85,7 @@ void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg) { TCString CurMsg(Msg); if (szProto) { - if (Msg == NULL) + if (Msg == nullptr) CurMsg = GetDynamicStatMsg(INVALID_CONTACT_ID, szProto); CallAllowedPS_SETAWAYMSG(szProto, iMode, CurMsg); @@ -98,7 +98,7 @@ void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg) for (int i = 0; i < numAccs; i++) { PROTOACCOUNT *p = accs[i]; if (!db_get_b(NULL, p->szModuleName, "LockMainStatus", 0)) { - if (Msg == NULL) + if (Msg == nullptr) CurMsg = GetDynamicStatMsg(INVALID_CONTACT_ID, p->szModuleName); CallAllowedPS_SETAWAYMSG(p->szModuleName, iMode, CurMsg); diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp index 99a50335fa..464a2881cf 100644 --- a/plugins/NewAwaySysMod/src/ContactList.cpp +++ b/plugins/NewAwaySysMod/src/ContactList.cpp @@ -176,7 +176,7 @@ LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA break; case INTM_INVALIDATE: - InvalidateRect(hWnd, NULL, true); + InvalidateRect(hWnd, nullptr, true); break; case WM_RBUTTONDOWN: @@ -317,7 +317,7 @@ LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPA HMENU hMenu = Menu_BuildContactMenu(hContact); if (hMenu) { ClientToScreen(hWnd, &pt); - Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL), MPCF_CONTACTMENU, hContact); + Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, nullptr), MPCF_CONTACTMENU, hContact); DestroyMenu(hMenu); return 0; } diff --git a/plugins/NewAwaySysMod/src/ContactList.h b/plugins/NewAwaySysMod/src/ContactList.h index b85df45a01..e6467c282f 100644 --- a/plugins/NewAwaySysMod/src/ContactList.h +++ b/plugins/NewAwaySysMod/src/ContactList.h @@ -51,7 +51,7 @@ public: HTREEITEM AddContact(MCONTACT hContact); HTREEITEM AddGroup(TCString GroupName); - HTREEITEM AddInfo(TCString Title, HTREEITEM hParent, HTREEITEM hInsertAfter, LPARAM lParam = NULL, HICON hIcon = NULL); + HTREEITEM AddInfo(TCString Title, HTREEITEM hParent, HTREEITEM hInsertAfter, LPARAM lParam = NULL, HICON hIcon = nullptr); void SetInfoIcon(HTREEITEM hItem, HICON hIcon); int GetExtraImage(HTREEITEM hItem, int iColumn); // returns iImage, or CLC_EXTRAICON_EMPTY void SetExtraImage(HTREEITEM hItem, int iColumn, int iImage); // set iImage to CLC_EXTRAICON_EMPTY to reset image @@ -61,7 +61,7 @@ public: void SortContacts(); MCONTACT GethContact(HTREEITEM hItem); // returns hContact, hGroup or hInfo HTREEITEM HitTest(LPPOINT pt, PDWORD hitFlags); // pt is relative to control; returns hItem or NULL - void EnsureVisible(HTREEITEM hItem) {TreeView_EnsureVisible(hTreeView, hItem); InvalidateRect(hTreeView, NULL, false);} // sometimes horizontal scrollbar position changes too, so we must redraw extra icons - that's why here is InvalidateRect. TODO: try to find a way to invalidate it on _every_ horizontal scrollbar position change, instead of just here - unfortunately the scrollbar doesn't notify the tree control of its position change through WM_HSCROLL in some cases + void EnsureVisible(HTREEITEM hItem) {TreeView_EnsureVisible(hTreeView, hItem); InvalidateRect(hTreeView, nullptr, false);} // sometimes horizontal scrollbar position changes too, so we must redraw extra icons - that's why here is InvalidateRect. TODO: try to find a way to invalidate it on _every_ horizontal scrollbar position change, instead of just here - unfortunately the scrollbar doesn't notify the tree control of its position change through WM_HSCROLL in some cases int SelectItem(HTREEITEM hItem) {return TreeView_SelectItem(hTreeView, hItem);} void SetItemParam(HTREEITEM hItem, LPARAM lParam) {GetItemData(hItem).lParam = lParam;} LPARAM GetItemParam(HTREEITEM hItem) {return GetItemData(hItem).lParam;} diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index 6316a5d50f..0fee8edf25 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -69,7 +69,7 @@ void __cdecl AutoreplyDelayThread(void *_ad) dbeo.eventType = EVENTTYPE_MESSAGE; dbeo.flags = DBEF_SENT | DBEF_UTF; dbeo.szModule = szProto; - dbeo.timestamp = time(NULL); + dbeo.timestamp = time(nullptr); dbeo.cbBlob = ReplyLen; dbeo.pBlob = (PBYTE)(char*)pszReply; @@ -114,7 +114,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) if (dbei->flags & DBEF_SENT || (dbei->eventType != EVENTTYPE_MESSAGE && dbei->eventType != EVENTTYPE_URL && dbei->eventType != EVENTTYPE_FILE)) return 0; - if (time(NULL) - dbei->timestamp > MAX_REPLY_TIMEDIFF) // don't reply to offline messages + if (time(nullptr) - dbei->timestamp > MAX_REPLY_TIMEDIFF) // don't reply to offline messages return 0; char *szProto = GetContactProto(hContact); @@ -222,7 +222,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) db_set_b(hContact, MOD_NAME, DB_SENDCOUNT, db_get_b(hContact, MOD_NAME, DB_SENDCOUNT, 0) + 1); GetDynamicStatMsg(hContact); // it updates VarParseData.Message needed for %extratext% in the format TCString Reply(*(TCString*)AutoreplyOptData.GetValue(IDC_REPLYDLG_PREFIX)); - if (Reply != NULL && ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) { + if (Reply != nullptr && ServiceExists(MS_VARS_FORMATSTRING) && !g_SetAwayMsgPage.GetDBValueCopy(IDS_SAWAYMSG_DISABLEVARIABLES)) { wchar_t *szResult = variables_parse(Reply, VarParseData.Message, hContact); if (szResult != nullptr) { Reply = szResult; diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp index 3dc99705b2..647f6bbff4 100644 --- a/plugins/NewAwaySysMod/src/MsgTree.cpp +++ b/plugins/NewAwaySysMod/src/MsgTree.cpp @@ -176,7 +176,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L int x = rc.left - iSize - 5; for (int i = 0; i < _countof(SettingsList); i++) { if (lpNMCD->nmcd.lItemlParam == (LPARAM)dat->MsgTreePage.GetValue(SettingsList[i].DBSetting)) { - DrawIconEx(lpNMCD->nmcd.hdc, x, rc.top, Skin_LoadProtoIcon(NULL, SettingsList[i].Status), iSize, iSize, 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL); + DrawIconEx(lpNMCD->nmcd.hdc, x, rc.top, Skin_LoadProtoIcon(nullptr, SettingsList[i].Status), iSize, iSize, 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL); x -= iSize + 1; } } @@ -506,7 +506,7 @@ bool CMsgTree::SetSelection(int ID, int Flags) // set ID = -1 to unselect; retur if (Order == -1 && ID != -1) return false; - TreeView_SelectItem(hTreeView, (Order == -1) ? NULL : ((Order <= TREECTRL_ROOTORDEROFFS) ? TreeCtrl->RootItems[ROOT_ORDER_TO_INDEX(Order)].hItem : TreeCtrl->m_value[Order].hItem)); + TreeView_SelectItem(hTreeView, (Order == -1) ? nullptr : ((Order <= TREECTRL_ROOTORDEROFFS) ? TreeCtrl->RootItems[ROOT_ORDER_TO_INDEX(Order)].hItem : TreeCtrl->m_value[Order].hItem)); return true; } diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp index 56ee9cf2cd..27445ccb66 100644 --- a/plugins/NewAwaySysMod/src/Notification.cpp +++ b/plugins/NewAwaySysMod/src/Notification.cpp @@ -25,7 +25,7 @@ void ShowMsg(wchar_t *FirstLine, wchar_t *SecondLine, bool IsErrorMsg, int Timeo { if (ServiceExists(MS_POPUP_ADDPOPUPT)) { POPUPDATAT ppd = { 0 }; - ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION); + ppd.lchIcon = LoadIcon(nullptr, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION); mir_wstrncpy(ppd.lptzContactName, FirstLine, MAX_CONTACTNAME); mir_wstrncpy(ppd.lptzText, SecondLine, MAX_SECONDLINE); ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD; @@ -33,7 +33,7 @@ void ShowMsg(wchar_t *FirstLine, wchar_t *SecondLine, bool IsErrorMsg, int Timeo ppd.iSeconds = Timeout; PUAddPopupT(&ppd); } - else MessageBox(NULL, SecondLine, FirstLine, MB_OK | (IsErrorMsg ? MB_ICONEXCLAMATION : MB_ICONINFORMATION)); + else MessageBox(nullptr, SecondLine, FirstLine, MB_OK | (IsErrorMsg ? MB_ICONEXCLAMATION : MB_ICONINFORMATION)); } @@ -53,12 +53,12 @@ static int CALLBACK MenuWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar static VOID CALLBACK ShowContactMenu(MCONTACT hContact) { POINT pt; - HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", MOD_NAMEW L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInstance, NULL); + HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", MOD_NAMEW L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInstance, nullptr); SetWindowLongPtr(hMenuWnd, GWLP_WNDPROC, (LONG_PTR)MenuWndProc); HMENU hMenu = Menu_BuildContactMenu(hContact); GetCursorPos(&pt); SetForegroundWindow(hMenuWnd); - Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, NULL), MPCF_CONTACTMENU, hContact); + Clist_MenuProcessCommand(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, nullptr), MPCF_CONTACTMENU, hContact); PostMessage(hMenuWnd, WM_NULL, 0, 0); DestroyMenu(hMenu); DestroyWindow(hMenuWnd); @@ -66,7 +66,7 @@ static VOID CALLBACK ShowContactMenu(MCONTACT hContact) void ShowLog(TCString &LogFilePath) { - INT_PTR Result = (INT_PTR)ShellExecute(NULL, L"open", LogFilePath, NULL, NULL, SW_SHOW); + INT_PTR Result = (INT_PTR)ShellExecute(nullptr, L"open", LogFilePath, nullptr, nullptr, SW_SHOW); if (Result <= 32) { wchar_t szError[64]; mir_snwprintf(szError, TranslateT("Error #%d"), Result); diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp index 9b4ead3136..f0cac57fb3 100644 --- a/plugins/NewAwaySysMod/src/Options.cpp +++ b/plugins/NewAwaySysMod/src/Options.cpp @@ -116,7 +116,7 @@ COptPage& COptPage::operator = (const COptPage& Page) int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*) { // default procedure for reading value from DB; used only for integral types - if (sDBSetting != NULL) { + if (sDBSetting != nullptr) { _ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD); DBVARIANT dbv; if (db_get(NULL, sModule, sDBSetting, &dbv)) @@ -129,7 +129,7 @@ int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*) void COptItem::SetIntDBVal(const CString &sModule, int m_value, CString*) { // default procedure for writing value to the DB; used only for integral types - if (sDBSetting != NULL && !m_bReadOnly) { + if (sDBSetting != nullptr && !m_bReadOnly) { _ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD); DBVARIANT dbv; @@ -141,7 +141,7 @@ void COptItem::SetIntDBVal(const CString &sModule, int m_value, CString*) TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix) { - if (sDBSetting != NULL) { + if (sDBSetting != nullptr) { _ASSERT(GetDefValue()); return db_get_s(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue()); } @@ -150,7 +150,7 @@ TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix void COptItem::SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix) { - if (sDBSetting != NULL && !m_bReadOnly) { + if (sDBSetting != nullptr && !m_bReadOnly) { db_set_ws(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str); } } @@ -284,9 +284,9 @@ int TreeReadEnum(const char *szSetting, void *lParam) pItem.Flags = Flags; pItem.hItem = nullptr; pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L""); - pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == NULL) ? NULL : + pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == nullptr) ? nullptr : db_get_s(NULL, pData->sModule, - *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (wchar_t*)NULL); + *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (wchar_t*)nullptr); } } return 0; @@ -306,7 +306,7 @@ void COptItem_TreeCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi } else { for (int i = 0; i < m_value.GetSize(); i++) { - if (m_value[i].Title == NULL) { + if (m_value[i].Title == nullptr) { m_value.RemoveElem(i); i--; } @@ -334,7 +334,7 @@ void COptItem_TreeCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefi if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) || TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES) db_set_b(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, m_value[i].Flags); - if (User_Str1_DBName != NULL && m_value[i].User_Str1 != NULL) + if (User_Str1_DBName != nullptr && m_value[i].User_Str1 != nullptr) db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, m_value[i].User_Str1); } COptItem::MemToDB(sModule, sDBSettingPrefix); @@ -414,7 +414,7 @@ void COptItem_TreeCtrl::MemToWnd(HWND hWnd) i--; } } - TreeView_SelectItem(hTreeView, (SelectOrder >= 0) ? m_value[SelectOrder].hItem : ((SelectOrder <= TREECTRL_ROOTORDEROFFS) ? RootItems[ROOT_ORDER_TO_INDEX(SelectOrder)].hItem : NULL)); + TreeView_SelectItem(hTreeView, (SelectOrder >= 0) ? m_value[SelectOrder].hItem : ((SelectOrder <= TREECTRL_ROOTORDEROFFS) ? RootItems[ROOT_ORDER_TO_INDEX(SelectOrder)].hItem : nullptr)); SendMessage(hTreeView, WM_SETREDRAW, true, 0); SCROLLBARINFO sbi; sbi.cbSize = sizeof(sbi); @@ -460,7 +460,7 @@ int TreeDeleteEnum(const char *szSetting, void *lParam) if (!strncmp(szSetting, CurSetting, CurSetting.GetLen())) TreeDeleteEnumData->TreeSettings.AddElem(szSetting); - if (TreeDeleteEnumData->TreeCtrl->User_Str1_DBName != NULL) { + if (TreeDeleteEnumData->TreeCtrl->User_Str1_DBName != nullptr) { CurSetting = *TreeDeleteEnumData->sDBSettingPrefix + TreeDeleteEnumData->TreeCtrl->sDBSetting + TreeDeleteEnumData->TreeCtrl->User_Str1_DBName; if (!strncmp(szSetting, CurSetting, CurSetting.GetLen())) TreeDeleteEnumData->TreeSettings.AddElem(szSetting); @@ -668,7 +668,7 @@ void COptItem_ListCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefi m_value = m_defValue; else { for (int i = 0; i < m_value.GetSize(); i++) { - if (m_value[i].Text == NULL) { + if (m_value[i].Text == nullptr) { m_value.RemoveElem(i); i--; } diff --git a/plugins/NewAwaySysMod/src/Options.h b/plugins/NewAwaySysMod/src/Options.h index aac3e9d1c0..2b06244c44 100644 --- a/plugins/NewAwaySysMod/src/Options.h +++ b/plugins/NewAwaySysMod/src/Options.h @@ -33,23 +33,23 @@ public: virtual ~COptItem() {} - virtual void DBToMem(const CString&, CString* = NULL) { m_bModified = false; } - virtual void MemToDB(const CString&, CString* = NULL) { m_bModified = false; } + virtual void DBToMem(const CString&, CString* = nullptr) { m_bModified = false; } + virtual void MemToDB(const CString&, CString* = nullptr) { m_bModified = false; } virtual void WndToMem(HWND) {} virtual void MemToWnd(HWND hWnd) { EnableWindow(GetDlgItem(hWnd, m_dlgItemID), m_bEnabled); } - void DBToMemToWnd(const CString &sModule, HWND hWnd, CString *sDBSettingPrefix = NULL) { DBToMem(sModule, sDBSettingPrefix); MemToWnd(hWnd); } - void WndToMemToDB(HWND hWnd, const CString &sModule, CString *sDBSettingPrefix = NULL) { WndToMem(hWnd); MemToDB(sModule, sDBSettingPrefix); } - virtual void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL) { db_unset(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting); }; // TODO: also set m_value to m_defValue? + void DBToMemToWnd(const CString &sModule, HWND hWnd, CString *sDBSettingPrefix = nullptr) { DBToMem(sModule, sDBSettingPrefix); MemToWnd(hWnd); } + void WndToMemToDB(HWND hWnd, const CString &sModule, CString *sDBSettingPrefix = nullptr) { WndToMem(hWnd); MemToDB(sModule, sDBSettingPrefix); } + virtual void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = nullptr) { db_unset(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting); }; // TODO: also set m_value to m_defValue? virtual void SetValue(INT_PTR) { m_bModified = true; } virtual void SetDefValue(INT_PTR) {} virtual INT_PTR GetValue() { return 0; } virtual INT_PTR GetDefValue() { return 0; } - INT_PTR GetDBValue(const CString &sModule, CString *sDBSettingPrefix = NULL) { DBToMem(sModule, sDBSettingPrefix); return GetValue(); } - void SetDBValue(const CString &sModule, INT_PTR m_value, CString *sDBSettingPrefix = NULL) { SetValue(m_value); MemToDB(sModule, sDBSettingPrefix); } - INT_PTR GetDBValueCopy(const CString &sModule, CString *sDBSettingPrefix = NULL) { COptItem* Item = Copy(); Item->DBToMem(sModule, sDBSettingPrefix); INT_PTR m_value = Item->GetValue(); delete Item; return m_value; } // retrieves DB value, but doesn't affect current page/item state; beware! it doesn't work with string values / other dynamic pointers - void SetDBValueCopy(const CString &sModule, INT_PTR m_value, CString *sDBSettingPrefix = NULL) { COptItem* Item = Copy(); Item->SetValue(m_value); Item->MemToDB(sModule, sDBSettingPrefix); delete Item; } + INT_PTR GetDBValue(const CString &sModule, CString *sDBSettingPrefix = nullptr) { DBToMem(sModule, sDBSettingPrefix); return GetValue(); } + void SetDBValue(const CString &sModule, INT_PTR m_value, CString *sDBSettingPrefix = nullptr) { SetValue(m_value); MemToDB(sModule, sDBSettingPrefix); } + INT_PTR GetDBValueCopy(const CString &sModule, CString *sDBSettingPrefix = nullptr) { COptItem* Item = Copy(); Item->DBToMem(sModule, sDBSettingPrefix); INT_PTR m_value = Item->GetValue(); delete Item; return m_value; } // retrieves DB value, but doesn't affect current page/item state; beware! it doesn't work with string values / other dynamic pointers + void SetDBValueCopy(const CString &sModule, INT_PTR m_value, CString *sDBSettingPrefix = nullptr) { COptItem* Item = Copy(); Item->SetValue(m_value); Item->MemToDB(sModule, sDBSettingPrefix); delete Item; } INT_PTR GetWndValue(HWND hWnd) { WndToMem(hWnd); return GetValue(); } void SetWndValue(HWND hWnd, INT_PTR m_value) { SetValue(m_value); MemToWnd(hWnd); } @@ -62,15 +62,15 @@ public: int GetID() { return m_dlgItemID; } // virtual COptItem& operator = (const COptItem& Item) {return *this;}; - virtual COptItem* Copy() { _ASSERT(0); return NULL; } // Attention! Free Copy() result when it's not needed anymore! + virtual COptItem* Copy() { _ASSERT(0); return nullptr; } // Attention! Free Copy() result when it's not needed anymore! CString sDBSetting; protected: - int GetIntDBVal(const CString &sModule, int bSigned = false, CString *sDBSettingPrefix = NULL); - void SetIntDBVal(const CString &sModule, int m_value, CString *sDBSettingPrefix = NULL); - TCString GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix = NULL); - void SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix = NULL); + int GetIntDBVal(const CString &sModule, int bSigned = false, CString *sDBSettingPrefix = nullptr); + void SetIntDBVal(const CString &sModule, int m_value, CString *sDBSettingPrefix = nullptr); + TCString GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix = nullptr); + void SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix = nullptr); int m_dlgItemID; bool m_bEnabled; @@ -84,7 +84,7 @@ class COptItem_Generic : public COptItem { public: COptItem_Generic() {} - COptItem_Generic(int m_dlgItemID, int lParam = 0) : COptItem(m_dlgItemID, NULL, 0, lParam) {} + COptItem_Generic(int m_dlgItemID, int lParam = 0) : COptItem(m_dlgItemID, nullptr, 0, lParam) {} virtual COptItem* Copy() { return new COptItem_Generic(*this); } }; @@ -96,8 +96,8 @@ public: : COptItem(m_dlgItemID, szDBSetting, nMaxLen, lParam, m_bReadOnly), sDefValue(szDefValue) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } void WndToMem(HWND hWnd) { GetDlgItemText(hWnd, m_dlgItemID, sValue.GetBuffer(nValueSize), nValueSize); sValue.ReleaseBuffer(); COptItem::MemToWnd(hWnd); } void MemToWnd(HWND hWnd) { SetDlgItemText(hWnd, m_dlgItemID, sValue); COptItem::MemToWnd(hWnd); } @@ -123,9 +123,9 @@ public: : COptItem(m_dlgItemID, szDBSetting, nValueSize, lParam, m_bReadOnly), m_defValue(m_defValue), m_value(0), bSigned(bSigned) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { m_value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } - void WndToMem(HWND hWnd) { m_value = GetDlgItemInt(hWnd, m_dlgItemID, NULL, bSigned); COptItem::WndToMem(hWnd); } + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr) { m_value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } + void WndToMem(HWND hWnd) { m_value = GetDlgItemInt(hWnd, m_dlgItemID, nullptr, bSigned); COptItem::WndToMem(hWnd); } void MemToWnd(HWND hWnd) { SetDlgItemInt(hWnd, m_dlgItemID, m_value, bSigned); COptItem::MemToWnd(hWnd); } virtual void SetValue(INT_PTR _Value) { this->m_value = _Value; COptItem::SetValue(_Value); } @@ -149,8 +149,8 @@ public: : COptItem(m_dlgItemID, szDBSetting, nValueSize, lParam, m_bReadOnly), m_defValue(m_defValue), m_value(0), m_valueMask(m_valueMask) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL); - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL); + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr); + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr); void WndToMem(HWND hWnd); void MemToWnd(HWND hWnd); @@ -175,8 +175,8 @@ public: : COptItem(m_dlgItemID, szDBSetting, nValueSize, lParam, m_bReadOnly), m_defValue(m_defValue), m_value(0), m_valueMask(m_valueMask) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { m_value = (GetIntDBVal(sModule, false, sDBSettingPrefix) == m_valueMask) ? BST_CHECKED : BST_UNCHECKED; COptItem::DBToMem(sModule, sDBSettingPrefix); } - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { if ((m_value == BST_CHECKED)) SetIntDBVal(sModule, m_valueMask, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr) { m_value = (GetIntDBVal(sModule, false, sDBSettingPrefix) == m_valueMask) ? BST_CHECKED : BST_UNCHECKED; COptItem::DBToMem(sModule, sDBSettingPrefix); } + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr) { if ((m_value == BST_CHECKED)) SetIntDBVal(sModule, m_valueMask, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } void WndToMem(HWND hWnd) { m_value = IsDlgButtonChecked(hWnd, m_dlgItemID); COptItem::WndToMem(hWnd); } void MemToWnd(HWND hWnd) { CheckDlgButton(hWnd, m_dlgItemID, m_value ? BST_CHECKED : BST_UNCHECKED); COptItem::MemToWnd(hWnd); } @@ -201,8 +201,8 @@ public: : COptItem(m_dlgItemID, szDBSetting, nValueSize, lParam, m_bReadOnly), m_defValue(m_defValue), m_value(0) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { m_value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr) { m_value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } void WndToMem(HWND hWnd) { m_value = SendDlgItemMessage(hWnd, m_dlgItemID, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hWnd, m_dlgItemID, CB_GETCURSEL, 0, 0), 0); COptItem::WndToMem(hWnd); } void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, m_dlgItemID, CB_SETCURSEL, m_value, 0); COptItem::MemToWnd(hWnd); } @@ -226,8 +226,8 @@ public: : COptItem(m_dlgItemID, szDBSetting, DBVT_DWORD, lParam, m_bReadOnly), m_defValue(m_defValue), m_value(0) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { m_value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr) { m_value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } void WndToMem(HWND hWnd) { m_value = SendDlgItemMessage(hWnd, m_dlgItemID, CPM_GETCOLOUR, 0, 0); COptItem::WndToMem(hWnd); } void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, m_dlgItemID, CPM_SETCOLOUR, 0, m_value); COptItem::MemToWnd(hWnd); } @@ -252,8 +252,8 @@ public: : COptItem(m_dlgItemID, szDBSetting, nValueSize, lParam, m_bReadOnly), m_defValue(m_defValue), m_value(0) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { m_value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr) { m_value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } void WndToMem(HWND hWnd) { m_value = SendDlgItemMessage(hWnd, m_dlgItemID, TBM_GETPOS, 0, 0); COptItem::WndToMem(hWnd); } void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, m_dlgItemID, TBM_SETPOS, true, m_value); COptItem::MemToWnd(hWnd); } @@ -277,8 +277,8 @@ public: : COptItem(m_dlgItemID, szDBSetting, nValueSize, lParam, m_bReadOnly), m_defValue(m_defValue), m_value(0), bSigned(bSigned) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { m_value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr) { m_value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr) { SetIntDBVal(sModule, m_value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); } void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); } @@ -301,8 +301,8 @@ public: COptItem_BitDBSetting() {} COptItem_BitDBSetting(int m_dlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int m_defValue = 0, int m_valueMask = 0, int lParam = 0, bool m_bReadOnly = false) : COptItem(m_dlgItemID, szDBSetting, nValueSize, lParam, m_bReadOnly), m_defValue(m_defValue), m_value(0), m_valueMask(m_valueMask) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL); - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL); + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr); + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr); void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); } void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); } @@ -324,8 +324,8 @@ class COptItem_StrDBSetting : public COptItem public: COptItem_StrDBSetting() {} COptItem_StrDBSetting(int m_dlgItemID, char *szDBSetting, int nMaxLen, wchar_t *szDefValue, int lParam = 0, bool m_bReadOnly = false) : COptItem(m_dlgItemID, szDBSetting, nMaxLen, lParam, m_bReadOnly), sDefValue(szDefValue) {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); } void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); } @@ -352,7 +352,7 @@ class CBaseTreeItem { public: CBaseTreeItem(); - CBaseTreeItem(TCString Title, int ID, int Flags) : Title(Title), ID(ID), Flags(Flags), hItem(NULL) {} + CBaseTreeItem(TCString Title, int ID, int Flags) : Title(Title), ID(ID), Flags(Flags), hItem(nullptr) {} TCString Title; int ID; @@ -364,7 +364,7 @@ class CTreeItem : public CBaseTreeItem { public: CTreeItem(); - CTreeItem(TCString Title, int ParentID, int ID, int Flags = 0, TCString User_Str1 = NULL) : + CTreeItem(TCString Title, int ParentID, int ID, int Flags = 0, TCString User_Str1 = nullptr) : CBaseTreeItem(Title, ID, Flags & ~TIF_ROOTITEM), ParentID(ParentID), User_Str1(User_Str1) { } @@ -402,7 +402,7 @@ class COptItem_TreeCtrl : public COptItem { public: COptItem_TreeCtrl() {} - COptItem_TreeCtrl(int m_dlgItemID, char *szDBSetting, TreeItemArray &m_defValue, TreeRootItemArray RootItems, int lParam = 0, CString User_Str1_DBName = NULL, bool m_bReadOnly = false, int TreeFlags = 0) : COptItem(m_dlgItemID, szDBSetting, DBVT_DWORD, lParam, m_bReadOnly), m_defValue(m_defValue), RootItems(RootItems), User_Str1_DBName(User_Str1_DBName), TreeFlags(TreeFlags) + COptItem_TreeCtrl(int m_dlgItemID, char *szDBSetting, TreeItemArray &m_defValue, TreeRootItemArray RootItems, int lParam = 0, CString User_Str1_DBName = nullptr, bool m_bReadOnly = false, int TreeFlags = 0) : COptItem(m_dlgItemID, szDBSetting, DBVT_DWORD, lParam, m_bReadOnly), m_defValue(m_defValue), RootItems(RootItems), User_Str1_DBName(User_Str1_DBName), TreeFlags(TreeFlags) { if (TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) { _ASSERT(!RootItems.GetSize()); // there can't be any root items when the tree is a plain list @@ -411,11 +411,11 @@ public: } } ~COptItem_TreeCtrl() {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL); - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL); + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr); + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr); void WndToMem(HWND hWnd); void MemToWnd(HWND hWnd); - void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL); + void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = nullptr); virtual void SetValue(INT_PTR _Value) { this->m_value = *(TreeItemArray*)_Value; COptItem::SetValue(_Value); } virtual void SetDefValue(INT_PTR _DefValue) { this->m_defValue = *(TreeItemArray*)_DefValue; COptItem::SetDefValue(_DefValue); } @@ -463,11 +463,11 @@ public: COptItem_ListCtrl() {} COptItem_ListCtrl(int m_dlgItemID, char *szDBSetting, ListItemArray &m_defValue, int lParam = 0, bool m_bReadOnly = false) : COptItem(m_dlgItemID, szDBSetting, DBVT_DWORD, lParam, m_bReadOnly), m_defValue(m_defValue) {} ~COptItem_ListCtrl() {} - void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL); - void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL); + void DBToMem(const CString &sModule, CString *sDBSettingPrefix = nullptr); + void MemToDB(const CString &sModule, CString *sDBSettingPrefix = nullptr); void WndToMem(HWND hWnd); void MemToWnd(HWND hWnd); - void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL); + void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = nullptr); virtual void SetValue(INT_PTR _Value) { this->m_value = *(ListItemArray*)_Value; COptItem::SetValue(_Value); } virtual void SetDefValue(INT_PTR _DefValue) { this->m_defValue = *(ListItemArray*)_DefValue; COptItem::SetDefValue(_DefValue); } @@ -490,7 +490,7 @@ public: class COptPage { public: - COptPage() : hWnd(NULL), sDBSettingPrefix("") {} + COptPage() : hWnd(nullptr), sDBSettingPrefix("") {} COptPage(char *szModule, HWND hWnd, CString sDBSettingPrefix = "") : sModule(szModule), hWnd(hWnd), sDBSettingPrefix(sDBSettingPrefix) {} COptPage(const COptPage &Item); ~COptPage(); diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index a48da5b3ee..7fc0fa32a5 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -40,7 +40,7 @@ void ResetSettingsOnStatusChange(const char *szProto = nullptr, int bResetPerson if (!szProto || ((szCurProto = GetContactProto(hContact)) && !mir_strcmp(szProto, szCurProto))) { ResetContactSettingsOnStatusChange(hContact); if (bResetPersonalMsgs) { - CContactSettings(Status, hContact).SetMsgFormat(SMF_PERSONAL, NULL); // TODO: delete only when SAM dialog opens? + CContactSettings(Status, hContact).SetMsgFormat(SMF_PERSONAL, nullptr); // TODO: delete only when SAM dialog opens? } } hContact = db_find_next(hContact); @@ -83,7 +83,7 @@ CProtoState::CStatus& CProtoState::CStatus::operator = (int Status) bModified = true; } if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RESETPROTOMSGS)) - CProtoSettings(State.m_szProto, Status).SetMsgFormat(SMF_PERSONAL, NULL); + CProtoSettings(State.m_szProto, Status).SetMsgFormat(SMF_PERSONAL, nullptr); } } if (bStatusModified) @@ -107,12 +107,12 @@ void CProtoState::CAwaySince::Reset() void CContactSettings::SetMsgFormat(int Flags, TCString Message) { if (Flags & SMF_PERSONAL) { // set a personal message for a contact. also it's used to set global status message (hContact = NULL). - // if Message == NULL, then the function deletes the message. + // if Message == nullptr, then the function deletes the message. CString DBSetting(StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL)); if (g_AutoreplyOptPage.GetDBValueCopy(IDC_REPLYDLG_RESETCOUNTERWHENSAMEICON) && GetMsgFormat(SMF_PERSONAL) != (const wchar_t*)Message) ResetContactSettingsOnStatusChange(m_hContact); - if (Message != NULL) + if (Message != nullptr) db_set_ws(m_hContact, MOD_NAME, DBSetting, Message); else db_unset(m_hContact, MOD_NAME, DBSetting); @@ -130,7 +130,7 @@ TCString CContactSettings::GetMsgFormat(int Flags, int *pOrder, char *szProtoOve // szProtoOverride is needed only to get status message of the right protocol when the ICQ contact is on list, but not with the same // protocol on which it requests the message - this way we can still get contact details. { - TCString Message = NULL; + TCString Message = nullptr; if (pOrder) *pOrder = -1; @@ -138,7 +138,7 @@ TCString CContactSettings::GetMsgFormat(int Flags, int *pOrder, char *szProtoOve Message = db_get_s(m_hContact, MOD_NAME, StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL), (wchar_t*)NULL); if (Flags & (GMF_LASTORDEFAULT | GMF_PROTOORGLOBAL | GMF_TEMPORARY) && Message.IsEmpty()) { - char *szProto = szProtoOverride ? szProtoOverride : (m_hContact ? GetContactProto(m_hContact) : NULL); + char *szProto = szProtoOverride ? szProtoOverride : (m_hContact ? GetContactProto(m_hContact) : nullptr); // we mustn't pass here by GMF_TEMPORARY flag, as otherwise we'll handle GMF_TEMPORARY | GMF_PERSONAL combination incorrectly, // which is supposed to get only per-contact messages, and at the same time also may be used with NULL contact to get the global status message @@ -159,18 +159,18 @@ void CProtoSettings::SetMsgFormat(int Flags, TCString Message) if (Flags & SMF_TEMPORARY) { _ASSERT(!Status || Status == g_ProtoStates[szProto].m_status); - g_ProtoStates[szProto].TempMsg = (szProto || Message != NULL) ? Message : CProtoSettings(NULL, Status).GetMsgFormat(GMF_LASTORDEFAULT); + g_ProtoStates[szProto].TempMsg = (szProto || Message != nullptr) ? Message : CProtoSettings(nullptr, Status).GetMsgFormat(GMF_LASTORDEFAULT); } if (Flags & SMF_PERSONAL) { // set a "personal" message for a protocol. also it's used to set global status message (hContact = NULL). // if Message == NULL, then we'll use the "default" message - i.e. it's either the global message for szProto != NULL (we delete the per-proto DB setting), or it's just a default message for a given status for szProto == NULL. g_ProtoStates[szProto].TempMsg.Unset(); CString DBSetting(ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS)); - if (Message != NULL) + if (Message != nullptr) db_set_ws(NULL, MOD_NAME, DBSetting, Message); else { if (!szProto) - db_set_ws(NULL, MOD_NAME, DBSetting, CProtoSettings(NULL, Status).GetMsgFormat(GMF_LASTORDEFAULT)); // global message can't be NULL; we can use an empty string instead if it's really necessary + db_set_ws(NULL, MOD_NAME, DBSetting, CProtoSettings(nullptr, Status).GetMsgFormat(GMF_LASTORDEFAULT)); // global message can't be NULL; we can use an empty string instead if it's really necessary else db_unset(NULL, MOD_NAME, DBSetting); } @@ -254,7 +254,7 @@ void CProtoSettings::SetMsgFormat(int Flags, TCString Message) // returns the requested message; sets Order to the order of the message in the message tree, if available; or to -1 otherwise. TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) { - TCString Message = NULL; + TCString Message = nullptr; if (pOrder) *pOrder = -1; @@ -265,23 +265,23 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) Flags &= ~GMF_PERSONAL; // don't allow personal message to overwrite our NULL temporary message } } - if (Flags & GMF_PERSONAL && Message == NULL) // try getting personal message (it overrides global) - Message = db_get_s(NULL, MOD_NAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)NULL); + if (Flags & GMF_PERSONAL && Message == nullptr) // try getting personal message (it overrides global) + Message = db_get_s(NULL, MOD_NAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr); - if (Flags & GMF_PROTOORGLOBAL && Message == NULL) { + if (Flags & GMF_PROTOORGLOBAL && Message == nullptr) { Message = CProtoSettings().GetMsgFormat(GMF_PERSONAL | (Flags & GMF_TEMPORARY), pOrder); - return (Message == NULL) ? L"" : Message; // global message can't be NULL + return (Message == nullptr) ? L"" : Message; // global message can't be NULL } - if (Flags & GMF_LASTORDEFAULT && Message == NULL) { // try to get the last or default message, depending on current settings + if (Flags & GMF_LASTORDEFAULT && Message == nullptr) { // try to get the last or default message, depending on current settings COptPage MsgTreeData(g_MsgTreePage); COptItem_TreeCtrl *TreeCtrl = (COptItem_TreeCtrl*)MsgTreeData.Find(IDV_MSGTREE); TreeCtrl->DBToMem(CString(MOD_NAME)); - Message = NULL; + Message = nullptr; if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USELASTMSG)) { // if using last message by default... - Message = db_get_s(NULL, MOD_NAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)NULL); // try per-protocol message first + Message = db_get_s(NULL, MOD_NAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr); // try per-protocol message first if (Message.IsEmpty()) { - Message = NULL; // to be sure it's NULL, not "" - as we're checking 'Message == NULL' later + Message = nullptr; // to be sure it's NULL, not "" - as we're checking 'Message == NULL' later int RecentGroupID = GetRecentGroupID(Status); if (RecentGroupID != -1) { for (int i = 0; i < TreeCtrl->m_value.GetSize(); i++) { // find first message in the group @@ -296,7 +296,7 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) } } // else, if using default message by default... - if (Message == NULL) { // ...or we didn't succeed retrieving the last message + if (Message == nullptr) { // ...or we didn't succeed retrieving the last message // get default message for this status int DefMsgID = -1; static struct { @@ -330,7 +330,7 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) if (pOrder) *pOrder = Order; } - if (Message == NULL) + if (Message == nullptr) Message = L""; // last or default message can't be NULL.. otherwise ICQ won't reply to status message requests and won't notify us of status message requests at all } return Message; diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index e31053ef42..64180a6405 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -33,7 +33,7 @@ class _CWndUserData { public: - _CWndUserData(): MsgTree(NULL), CList(NULL) {} + _CWndUserData(): MsgTree(nullptr), CList(nullptr) {} CMsgTree *MsgTree; CCList *CList; @@ -129,7 +129,7 @@ public: if (Icons[i] & IL_SKINICON) IconList.SetAtGrow(i) = (HICON)CopyImage(Skin_LoadIcon(Icons[i] & ~IL_SKINICON), IMAGE_ICON, cxIcon, cyIcon, LR_COPYFROMRESOURCE); else if (Icons[i] & IL_PROTOICON) - IconList.SetAtGrow(i) = (HICON)CopyImage(Skin_LoadProtoIcon(NULL, Icons[i] & ~IL_PROTOICON), IMAGE_ICON, cxIcon, cyIcon, LR_COPYFROMRESOURCE); + IconList.SetAtGrow(i) = (HICON)CopyImage(Skin_LoadProtoIcon(nullptr, Icons[i] & ~IL_PROTOICON), IMAGE_ICON, cxIcon, cyIcon, LR_COPYFROMRESOURCE); else IconList.SetAtGrow(i) = (HICON)GetIcon(Icons[i]); } @@ -178,7 +178,7 @@ public: class CCurStatusMsg { public: - CCurStatusMsg() {*this = NULL;} + CCurStatusMsg() {*this = nullptr;} CCurStatusMsg& operator = (TCString Msg) { CurStatusMsg = Msg; @@ -306,7 +306,7 @@ class CProtoSettings LPCSTR szProto; public: - CProtoSettings(LPCSTR szProto = NULL, int iStatus = 0) : + CProtoSettings(LPCSTR szProto = nullptr, int iStatus = 0) : szProto(szProto), Status(iStatus, szProto) { @@ -349,7 +349,7 @@ public: { _ASSERT(Parent->szProto); int m_value = *this; - return (m_value == VAL_USEDEFAULT) ? CProtoSettings(NULL).Autoreply : m_value; + return (m_value == VAL_USEDEFAULT) ? CProtoSettings(nullptr).Autoreply : m_value; } friend class CProtoSettings; private: @@ -359,7 +359,7 @@ public: class CStatus { public: - CStatus(int iStatus = 0, const char *szProto = NULL): Status(iStatus), szProto(szProto) {} + CStatus(int iStatus = 0, const char *szProto = nullptr): Status(iStatus), szProto(szProto) {} CStatus& operator = (int _Status) {this->Status = _Status; return *this;} operator int() { @@ -373,7 +373,7 @@ public: } Status; void SetMsgFormat(int Flags, TCString Message); - TCString GetMsgFormat(int Flags, int *pOrder = NULL); + TCString GetMsgFormat(int Flags, int *pOrder = nullptr); }; @@ -458,7 +458,7 @@ public: return *this; } operator int() {return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MOD_NAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);} - int IncludingParents(const char *szProtoOverride = NULL) // takes into account protocol and global data also, if per-contact setting is not defined + int IncludingParents(const char *szProtoOverride = nullptr) // takes into account protocol and global data also, if per-contact setting is not defined { _ASSERT((Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol int m_value = *this; @@ -491,7 +491,7 @@ public: { if (!Status) { _ASSERT(m_hContact != INVALID_CONTACT_ID); - char *szProto = m_hContact ? GetContactProto(m_hContact) : NULL; + char *szProto = m_hContact ? GetContactProto(m_hContact) : nullptr; Status = (szProto || !m_hContact) ? g_ProtoStates[szProto].m_status : ID_STATUS_AWAY; } return Status; @@ -504,5 +504,5 @@ public: } Status; void SetMsgFormat(int Flags, TCString Message); - TCString GetMsgFormat(int Flags, int *pOrder = NULL, char *szProtoOverride = NULL); + TCString GetMsgFormat(int Flags, int *pOrder = nullptr, char *szProtoOverride = nullptr); }; diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 75c0c05758..dbe67a24b5 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -30,7 +30,7 @@ struct READAWAYMSGDATA #define RAMDLGSIZESETTING "ReadAwayMsgDlg" -MWindowList g_hReadWndList = NULL; +MWindowList g_hReadWndList = nullptr; static int ReadAwayMsgDlgResize(HWND, LPARAM, UTILRESIZECONTROL *urc) { diff --git a/plugins/NewAwaySysMod/src/Services.cpp b/plugins/NewAwaySysMod/src/Services.cpp index 9f5ea5db36..c807905c73 100644 --- a/plugins/NewAwaySysMod/src/Services.cpp +++ b/plugins/NewAwaySysMod/src/Services.cpp @@ -53,7 +53,7 @@ __inline void PSSetStatus(char *szProto, WORD Status, int bNoClistSetStatusMode INT_PTR GetStatusMsgW(WPARAM wParam, LPARAM) { LogMessage("MS_AWAYMSG_GETSTATUSMSGW called. status=%d", wParam); - WCHAR *szMsg = mir_wstrdup(GetDynamicStatMsg(INVALID_CONTACT_ID, NULL, 0, wParam)); + WCHAR *szMsg = mir_wstrdup(GetDynamicStatMsg(INVALID_CONTACT_ID, nullptr, 0, wParam)); LogMessage("returned szMsgW:\n%S", szMsg ? szMsg : L"NULL"); return (INT_PTR)szMsg; } @@ -66,10 +66,10 @@ INT_PTR SetStatusMode(WPARAM wParam, LPARAM lParam) // called by GamerStatus and g_fNoProcessing = true; Clist_SetStatusMode(wParam); - _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].m_status == wParam); + _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)nullptr].m_status == wParam); g_fNoProcessing = false; - CProtoSettings(NULL, wParam).SetMsgFormat(SMF_TEMPORARY, lParam ? (wchar_t*)_A2T((char*)lParam) : CProtoSettings(NULL, wParam).GetMsgFormat(GMF_LASTORDEFAULT)); - ChangeProtoMessages(NULL, wParam, TCString()); + CProtoSettings(nullptr, wParam).SetMsgFormat(SMF_TEMPORARY, lParam ? (wchar_t*)_A2T((char*)lParam) : CProtoSettings(nullptr, wParam).GetMsgFormat(GMF_LASTORDEFAULT)); + ChangeProtoMessages(nullptr, wParam, TCString()); return 0; } @@ -88,18 +88,18 @@ int GetState(WPARAM wParam, LPARAM lParam, int Widechar) LogMessage("%d (received): cbSize=%d, status=%d, szProto=%s, Flags=0x%x", i + 1, pi->cbSize, pi->status, pi->szProto ? pi->szProto : "NULL", Flags); if ((pi->status >= ID_STATUS_ONLINE && pi->status <= ID_STATUS_OUTTOLUNCH) || !pi->status) { TCString Msg(pi->status ? CProtoSettings(pi->szProto, pi->status).GetMsgFormat(GMF_LASTORDEFAULT) : CProtoSettings(pi->szProto).GetMsgFormat(((Flags & PIF_NOTTEMPORARY) ? 0 : GMF_TEMPORARY) | GMF_PERSONAL)); - if (Msg != NULL) { + if (Msg != nullptr) { if (Widechar) pi->tszMsg = mir_wstrdup(Msg); else pi->szMsg = mir_strdup(_T2A(Msg)); } - else pi->szMsg = NULL; + else pi->szMsg = nullptr; if (!pi->status) pi->status = g_ProtoStates[pi->szProto].m_status; } - else pi->szMsg = NULL; + else pi->szMsg = nullptr; LogMessage("%d (returned): status=%d, Flags=0x%x, szMsg:\n%s", i + 1, pi->status, (pi->cbSize > sizeof(NAS_PROTOINFOv1)) ? pi->Flags : 0, pi->szMsg ? (Widechar ? _T2A(pi->wszMsg) : pi->szMsg) : "NULL"); *(char**)&pi += pi->cbSize; diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 56aedf56e1..26fb5a2db7 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -259,7 +259,7 @@ void SetExtraIcon(CCList *CList, int nColumn, HTREEITEM hItem, int nIcon) } } if (nColumn == EXTRACOLUMN_IGNORE && nIcon != EXTRAIMGLIST_IGNORE) - nIcon = (CContactSettings(0, hContact).GetMsgFormat(GMF_PERSONAL) == NULL) ? EXTRAIMGLIST_DOT : EXTRAIMGLIST_MSG; + nIcon = (CContactSettings(0, hContact).GetMsgFormat(GMF_PERSONAL) == nullptr) ? EXTRAIMGLIST_DOT : EXTRAIMGLIST_MSG; } else if (ItemType == MCLCIT_INFO) { char *szProto = (char*)CList->GetItemParam(hItem); @@ -272,7 +272,7 @@ void SetExtraIcon(CCList *CList, int nColumn, HTREEITEM hItem, int nIcon) if (!szProto && nIcon == EXTRAIMGLIST_DOT) nIcon = EXTRAIMGLIST_AUTOREPLY_OFF; } - else nIcon = (CProtoSettings(szProto).GetMsgFormat(GMF_TEMPORARY | GMF_PERSONAL) == NULL) ? EXTRAIMGLIST_DOT : EXTRAIMGLIST_MSG; + else nIcon = (CProtoSettings(szProto).GetMsgFormat(GMF_TEMPORARY | GMF_PERSONAL) == nullptr) ? EXTRAIMGLIST_DOT : EXTRAIMGLIST_MSG; } int Ignore = (nColumn == EXTRACOLUMN_IGNORE) ? (nIcon == EXTRAIMGLIST_IGNORE) : ((ItemType == MCLCIT_CONTACT) ? CContactSettings(0, hContact).Ignore : ((ItemType == MCLCIT_GROUP) ? CList->GetExtraImage(hItem, EXTRACOLUMN_IGNORE) : false)); @@ -369,7 +369,7 @@ void ApplySelContactsMessage(SetAwayMsgData* dat, CCList *CList, PTREEITEMARRAY GetDlgItemText(hwndDlg, IDC_SAWAYMSG_MSGDATA, Message.GetBuffer(AWAY_MSGDATA_MAX), AWAY_MSGDATA_MAX); Message.ReleaseBuffer(); if (!mir_wstrlen(Message)) - Message = NULL; // delete personal message if it's empty + Message = nullptr; // delete personal message if it's empty if (CList) { if (!Selection) @@ -384,7 +384,7 @@ void ApplySelContactsMessage(SetAwayMsgData* dat, CCList *CList, PTREEITEMARRAY } else if (ItemType == MCLCIT_INFO) { char *szProto = (char*)CList->GetItemParam(hItem); - CProtoSettings(szProto).SetMsgFormat(SMF_PERSONAL, (szProto || Message != NULL) ? Message : L""); // "szProto || Message != NULL..." means that we'll set an empty message instead of NULL for the global status, if the message is empty (NULL for the global status has a special meaning - SetMsgFormat will set the default message instead of NULL) + CProtoSettings(szProto).SetMsgFormat(SMF_PERSONAL, (szProto || Message != nullptr) ? Message : L""); // "szProto || Message != NULL..." means that we'll set an empty message instead of NULL for the global status, if the message is empty (NULL for the global status has a special meaning - SetMsgFormat will set the default message instead of NULL) } else continue; @@ -395,7 +395,7 @@ void ApplySelContactsMessage(SetAwayMsgData* dat, CCList *CList, PTREEITEMARRAY if (dat->hInitContact) CContactSettings(0, dat->hInitContact).SetMsgFormat(SMF_PERSONAL, Message); else - CProtoSettings(dat->szProtocol).SetMsgFormat(SMF_PERSONAL, (dat->szProtocol || Message != NULL) ? Message : L""); + CProtoSettings(dat->szProtocol).SetMsgFormat(SMF_PERSONAL, (dat->szProtocol || Message != nullptr) ? Message : L""); } SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_MSGDATA, EM_SETMODIFY, false, 0); SetDlgItemText(hwndDlg, IDC_OK, TranslateT("OK")); @@ -579,7 +579,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (Order >= 0) // so just select an appropriate message tree item; MSGDATA text is filled automatically through SELCHANGED notification MsgTree->SetSelection(Order, MTSS_BYORDER); - if (dat->Message != NULL) { // this allows to override the default message + if (dat->Message != nullptr) { // this allows to override the default message SetDlgItemText(hwndDlg, IDC_SAWAYMSG_MSGDATA, dat->Message); SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_MSGDATA, EM_SETMODIFY, true, 0); } @@ -603,7 +603,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // init tooltips TOOLINFO ti = { 0 }; - hWndTooltips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandleA("mir_app.mir"), NULL); + hWndTooltips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, GetModuleHandleA("mir_app.mir"), nullptr); ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; for (int i = 0; i < _countof(Tooltips); i++) { @@ -707,7 +707,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA for (int i = 0; i < pnm->NewSelection->GetSize(); i++) { HTREEITEM hItem = (*pnm->NewSelection)[i]; MCONTACT hContact = 0; - char *szProto = NULL; + char *szProto = nullptr; int ItemType = CList->GetItemType(hItem); if (ItemType == MCLCIT_CONTACT) { hContact = CList->GethContact(hItem); @@ -722,10 +722,10 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA int CurStatus = g_ProtoStates[szProto].m_status; if (!MessageDetermined) { TCString CurMessage((ItemType == MCLCIT_CONTACT) ? CContactSettings(0, hContact).GetMsgFormat(GMF_PERSONAL) : CProtoSettings(szProto).GetMsgFormat(GMF_TEMPORARY | GMF_PERSONAL)); - if (CurMessage == NULL) + if (CurMessage == nullptr) CurMessage = L""; - if (Message == NULL) + if (Message == nullptr) Message = CurMessage; else if (CurMessage != (const wchar_t*)Message) { Message = L""; @@ -750,7 +750,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } if (!bLeaveOldMessage) - SetDlgItemText(hwndDlg, IDC_SAWAYMSG_MSGDATA, (Message == NULL) ? L"" : Message); + SetDlgItemText(hwndDlg, IDC_SAWAYMSG_MSGDATA, (Message == nullptr) ? L"" : Message); SetDlgItemText(hwndDlg, IDC_OK, BtnTitle); TCString WindowTitle(TranslateT("Set message for")); @@ -863,7 +863,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA CList->SetExtraImageList(hil); HTREEITEM hSelItem; - HTREEITEM hItem = hSelItem = CList->AddInfo(TranslateT("** All contacts **"), CLC_ROOT, CLC_ROOT, NULL, Skin_LoadProtoIcon(NULL, g_ProtoStates[(char*)NULL].m_status)); + HTREEITEM hItem = hSelItem = CList->AddInfo(TranslateT("** All contacts **"), CLC_ROOT, CLC_ROOT, NULL, Skin_LoadProtoIcon(nullptr, g_ProtoStates[(char*)nullptr].m_status)); int numAccs; PROTOACCOUNT **accs; Proto_EnumAccounts(&numAccs, &accs); @@ -927,13 +927,13 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA PROTOACCOUNT *p = accs[i]; if (CallProtoService(p->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) { TCString Message(CProtoSettings(p->szModuleName).GetMsgFormat(GMF_PERSONAL)); // yes, we don't specify GMF_TEMPORARY here, because we don't need to save it - if (Message != NULL) + if (Message != nullptr) CProtoSettings(p->szModuleName).SetMsgFormat(SMF_LAST, Message); // if the user set a message for this protocol, save it to the recent messages - ChangeProtoMessages(p->szModuleName, g_ProtoStates[p->szModuleName].m_status, TCString(NULL)); // and actual setting of a status message for the protocol + ChangeProtoMessages(p->szModuleName, g_ProtoStates[p->szModuleName].m_status, TCString(nullptr)); // and actual setting of a status message for the protocol } } TCString Message(CProtoSettings().GetMsgFormat(GMF_PERSONAL)); - if (Message != NULL) + if (Message != nullptr) CProtoSettings().SetMsgFormat(SMF_LAST, Message); // save the global message to the recent messages if (g_SetAwayMsgPage.GetValue(IDS_SAWAYMSG_AUTOSAVEDLGSETTINGS)) diff --git a/plugins/NewAwaySysMod/src/TMyArray.h b/plugins/NewAwaySysMod/src/TMyArray.h index 68ca908fe1..45eeaf1563 100644 --- a/plugins/NewAwaySysMod/src/TMyArray.h +++ b/plugins/NewAwaySysMod/src/TMyArray.h @@ -41,7 +41,7 @@ public: void MoveElem(int nIndex, int nMoveTo); T& SetAtGrow(int nIndex); int Find(ARG_T pElem); // returns an index of the specified item, or -1 if the array doesn't contain the item - int BinarySearch(int (*CmpFunc)(ARG_T pItem, LPARAM lParam), LPARAM lParam, int *pIndex = NULL); // returns an index of the specified item, or -1 if the array doesn't contain the item; + int BinarySearch(int (*CmpFunc)(ARG_T pItem, LPARAM lParam), LPARAM lParam, int *pIndex = nullptr); // returns an index of the specified item, or -1 if the array doesn't contain the item; // also it's possible to specify pIndex so that even if the array doesn't contain the item, the function will set *pIndex to a position where the item can be inserted; // CmpFunc must return -1, 0 and 1 depending whether pItem is lesser, equal or greater than needed; // BinarySearch() requires the array to be sorted in an ascending order @@ -65,7 +65,7 @@ TMyArray::TMyArray() { nElemNum = 0; nAllocNum = 0; - pData = NULL; + pData = nullptr; } template @@ -73,7 +73,7 @@ TMyArray::TMyArray(const TMyArray __forceinline int TMyArray::SetAllocNum(int nNewAllocNum) { _ASSERT(nNewAllocNum >= nElemNum); - T*pNewData = (nNewAllocNum) ? (T*)malloc(sizeof(T) * nNewAllocNum) : NULL; + T*pNewData = (nNewAllocNum) ? (T*)malloc(sizeof(T) * nNewAllocNum) : nullptr; if (pData) { if (pNewData) diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h index b64cb3a13f..8596cf2377 100644 --- a/plugins/NewAwaySysMod/src/stdafx.h +++ b/plugins/NewAwaySysMod/src/stdafx.h @@ -277,7 +277,7 @@ extern bool g_fNoProcessing; extern int g_bIsIdle; // AwaySys.cpp -TCString GetDynamicStatMsg(MCONTACT hContact, char *szProto = NULL, DWORD UIN = 0, int iStatus = 0); +TCString GetDynamicStatMsg(MCONTACT hContact, char *szProto = nullptr, DWORD UIN = 0, int iStatus = 0); int IsAnICQProto(char *szProto); // Client.cpp @@ -319,7 +319,7 @@ static __inline int LogMessage(const char *Format, ...) va_start(va, Format); mir_vsnprintf(szText + (_countof(LOG_PREFIX) - 1), sizeof(szText) - (_countof(LOG_PREFIX) - 1), Format, va); va_end(va); - return Netlib_Log(NULL, szText); + return Netlib_Log(nullptr, szText); } __inline int CallAllowedPS_SETAWAYMSG(const char *szProto, int iMode, const wchar_t *szMsg) @@ -328,7 +328,7 @@ __inline int CallAllowedPS_SETAWAYMSG(const char *szProto, int iMode, const wcha return CallProtoService(szProto, PS_SETAWAYMSG, iMode, (LPARAM)szMsg); } -static __inline int my_variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags = 0, char *szSubjectDesc = NULL, char *szExtraDesc = NULL) +static __inline int my_variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags = 0, char *szSubjectDesc = nullptr, char *szExtraDesc = NULL) { if (ServiceExists(MS_VARS_SHOWHELPEX)) { return variables_showhelp(hwndDlg, uIDEdit, flags, szSubjectDesc,szExtraDesc); diff --git a/plugins/NewXstatusNotify/src/popup.h b/plugins/NewXstatusNotify/src/popup.h index 1ffc9b7875..5e0c70d00e 100644 --- a/plugins/NewXstatusNotify/src/popup.h +++ b/plugins/NewXstatusNotify/src/popup.h @@ -58,7 +58,7 @@ static struct { LPGENW("Do nothing"), PCA_DONOTHING }; -void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const wchar_t *stzText, PLUGINDATA *pdp = NULL); +void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const wchar_t *stzText, PLUGINDATA *pdp = nullptr); LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); #endif \ No newline at end of file diff --git a/plugins/NotesAndReminders/src/miscutils.h b/plugins/NotesAndReminders/src/miscutils.h index a9ac99f318..692de31a1f 100644 --- a/plugins/NotesAndReminders/src/miscutils.h +++ b/plugins/NotesAndReminders/src/miscutils.h @@ -31,6 +31,6 @@ static void __inline SAFE_FREE(void** p) if (*p) { free(*p); - *p = NULL; + *p = nullptr; } } diff --git a/plugins/Ping/src/collection.h b/plugins/Ping/src/collection.h index 73e36fe704..e19c5874d4 100644 --- a/plugins/Ping/src/collection.h +++ b/plugins/Ping/src/collection.h @@ -28,7 +28,7 @@ template class ListNode : public Node < T > public: ListNode *next, *prev; - ListNode(const T &v) : Node(v), next(0), prev(0) {} + ListNode(const T &v) : Node(v), next(nullptr), prev(nullptr) {} virtual ~ListNode() { if (next) next->prev = prev; @@ -57,8 +57,8 @@ public: virtual const bool has_val() { return (n ? true : false); } }; - LinkedList() : Collection(), head(0), tail(0) {}; - LinkedList(const LinkedList &other) : Collection(), head(0), tail(0) + LinkedList() : Collection(), head(nullptr), tail(nullptr) {}; + LinkedList(const LinkedList &other) : Collection(), head(nullptr), tail(nullptr) { for (Iterator i = other.begin(); i.has_val(); i.next()) add(i.val()); @@ -81,7 +81,7 @@ public: head = head->next; delete n; } - tail = 0; + tail = nullptr; Collection::count = 0; } @@ -160,7 +160,7 @@ public: ListNode *n = head; if (head) { head = head->next; - if (n == tail) tail = 0; + if (n == tail) tail = nullptr; val = n->val; delete n; Collection::count--; @@ -399,7 +399,7 @@ protected: n->left->parent = n->parent; } else { - if (n == root) root = 0; + if (n == root) root = nullptr; } delete n; Collection::count--; @@ -407,7 +407,7 @@ protected: virtual void insert_node(N *n) { - N *current = root, *parent = 0; + N *current = root, *parent = nullptr; while (current) { parent = current; if (n->val < current->val) @@ -482,8 +482,8 @@ public: virtual const bool has_val() { return (n ? true : false); } }; - BinaryTree() : Collection(), root(0) {}; - BinaryTree(BinaryTree &other) : Collection(), root(0) + BinaryTree() : Collection(), root(nullptr) {}; + BinaryTree(BinaryTree &other) : Collection(), root(nullptr) { for (Iterator i = other.begin(); i != pl.end(); ++i) add(i.val()); @@ -500,7 +500,7 @@ public: virtual void clear() { - N *current = root, *parent = 0; + N *current = root, *parent = nullptr; while (current) { if (current->left) current = current->left; else if (current->right) current = current->right; @@ -511,7 +511,7 @@ public: } } - root = 0; + root = nullptr; Collection::count = 0; } @@ -569,12 +569,12 @@ public: ColouredTreeNode *parent, *left, *right; char color; - ColouredTreeNode(const T &v, ColouredTreeNode *par) : Node(v), parent(par), left(0), right(0), color(BLACK) {} + ColouredTreeNode(const T &v, ColouredTreeNode *par) : Node(v), parent(par), left(nullptr), right(nullptr), color(BLACK) {} virtual ~ColouredTreeNode() { if (parent) { - if (parent->left == this) parent->left = 0; - if (parent->right == this)parent->right = 0; + if (parent->left == this) parent->left = nullptr; + if (parent->right == this)parent->right = nullptr; } } }; diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 2efd9cb392..e3a4f0a354 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -183,7 +183,7 @@ public: { if (m_handle) { ::CloseHandle(m_handle); - m_handle = 0; + m_handle = nullptr; } } }; diff --git a/plugins/Popup/src/common.h b/plugins/Popup/src/common.h index ca632bac41..e09dc23f61 100644 --- a/plugins/Popup/src/common.h +++ b/plugins/Popup/src/common.h @@ -42,7 +42,7 @@ inline void GetBmpSize(HBITMAP hbm, SIZE *sz) inline void DebugMsg(LPTSTR msg){ if (PopupOptions.debug){ - MessageBox(NULL, msg, L"debug", MB_OK); + MessageBox(nullptr, msg, L"debug", MB_OK); } } diff --git a/plugins/Popup/src/formula.h b/plugins/Popup/src/formula.h index 6de6ac625d..fdb4612bc1 100644 --- a/plugins/Popup/src/formula.h +++ b/plugins/Popup/src/formula.h @@ -36,12 +36,12 @@ public: int value; Item *next; - Item(char *aName, int aValue, Item *aNext) : value(aValue), next(aNext) { name = aName ? mir_strdup(aName) : 0; } + Item(char *aName, int aValue, Item *aNext) : value(aValue), next(aNext) { name = aName ? mir_strdup(aName) : nullptr; } ~Item() { if (name) mir_free(name); } }; Item *items; public: - Args() :items(0){} + Args() :items(nullptr){} ~Args(){ clear(); } void add(char *name, int value) { @@ -83,7 +83,7 @@ public: Formula(wchar_t *s) :m_str(mir_wstrdup(s)) {} ~Formula() { mir_free(m_str); } void set(wchar_t *s){ mir_free(m_str); m_str = mir_wstrdup(s); } - int eval(Args *args, bool *vars = 0) const; + int eval(Args *args, bool *vars = nullptr) const; }; #endif // __formula_h__ \ No newline at end of file diff --git a/plugins/Popup/src/opt_gen.h b/plugins/Popup/src/opt_gen.h index f97d056306..41e2d245b8 100644 --- a/plugins/Popup/src/opt_gen.h +++ b/plugins/Popup/src/opt_gen.h @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __opt_gen_h__ void LoadOption_General(); -void Check_ReorderPopups(HWND hwnd = 0); +void Check_ReorderPopups(HWND hwnd = nullptr); INT_PTR CALLBACK DlgProcPopupGeneral(HWND, UINT, WPARAM, LPARAM); void ErrorMSG(int minValue, int maxValue); diff --git a/plugins/Popup/src/opttree.h b/plugins/Popup/src/opttree.h index 3dd63d3e0d..c13087b072 100644 --- a/plugins/Popup/src/opttree.h +++ b/plugins/Popup/src/opttree.h @@ -38,8 +38,8 @@ typedef struct { } OPTTREE_OPTION; BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL *result, int idcTree, OPTTREE_OPTION *options, int optionCount); -DWORD OptTree_GetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, LPTSTR pszSettingName = NULL); -void OptTree_SetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, DWORD dwOptions, LPTSTR pszSettingName = NULL); +DWORD OptTree_GetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, LPTSTR pszSettingName = nullptr); +void OptTree_SetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, DWORD dwOptions, LPTSTR pszSettingName = nullptr); void OptTree_Translate(HWND hwndTree); HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, LPCTSTR name); diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h index 57061569ee..bed4bd7ba2 100644 --- a/plugins/Popup/src/popup_wnd2.h +++ b/plugins/Popup/src/popup_wnd2.h @@ -107,7 +107,7 @@ private: int fixActions(POPUPACTION *theActions, int count, int additional); public: - PopupWnd2(POPUPDATA2 *ppd, POPUPOPTIONS *theCustomOptions = NULL, bool renderOnly = false); + PopupWnd2(POPUPDATA2 *ppd, POPUPOPTIONS *theCustomOptions = nullptr, bool renderOnly = false); ~PopupWnd2(); void startThread(); @@ -174,7 +174,7 @@ public: this->m_sz = sz; if (m_hwnd) { - SetWindowPos(m_hwnd, 0, 0, 0, sz.cx, sz.cy, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING); + SetWindowPos(m_hwnd, nullptr, 0, 0, sz.cx, sz.cy, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING); if (!m_customPopup) PopupThreadUpdateWindow(this); } @@ -189,7 +189,7 @@ public: if (m_bSlide) m_ptPosition1 = pt; else - SetWindowPos(m_hwnd, 0, pt.x, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING); + SetWindowPos(m_hwnd, nullptr, pt.x, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING); } // Thread-related methods diff --git a/plugins/Popup/src/skin.h b/plugins/Popup/src/skin.h index 8c903a9ca8..7b410151db 100644 --- a/plugins/Popup/src/skin.h +++ b/plugins/Popup/src/skin.h @@ -124,7 +124,7 @@ private: void drawActionBar(MyBitmap *bmp, PopupWnd2 *wnd, int x, int y) const; public: - PopupSkin(LPCTSTR aName = 0); + PopupSkin(LPCTSTR aName = nullptr); ~PopupSkin(); void measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options) const; diff --git a/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h b/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h index 98fed3c44e..e2efab157a 100644 --- a/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h +++ b/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h @@ -7,7 +7,7 @@ __inline LPVOID MemoryFindByte(size_t dwFrom,LPCVOID lpcSource,size_t dwSourceSi if (dwFrom < dwSourceSize) return memchr((BYTE*)lpcSource + dwFrom, chWhatFind, dwSourceSize-dwFrom); - return NULL; + return nullptr; } #endif // !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_) diff --git a/plugins/SendScreenshotPlus/src/CSend.h b/plugins/SendScreenshotPlus/src/CSend.h index 534a96e7cc..15d92a5572 100644 --- a/plugins/SendScreenshotPlus/src/CSend.h +++ b/plugins/SendScreenshotPlus/src/CSend.h @@ -99,7 +99,7 @@ class CSend { wchar_t* m_ErrorMsg; wchar_t* m_ErrorTitle; - void Unhook(){if(m_hOnSend) {UnhookEvent(m_hOnSend);m_hOnSend = NULL;}} + void Unhook(){if(m_hOnSend) {UnhookEvent(m_hOnSend);m_hOnSend = nullptr;}} void DB_EventAdd(WORD EventType); static INT_PTR CALLBACK ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h index 3a0a7435bd..995a56b4dd 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.h +++ b/plugins/SendScreenshotPlus/src/UMainForm.h @@ -87,7 +87,7 @@ public: void Close(){ SendMessage(m_hWnd, WM_CLOSE, 0, 0); } void Show(){ ShowWindow(m_hWnd, SW_SHOW); } void Hide(){ ShowWindow(m_hWnd, SW_HIDE); } - void SetTargetWindow(HWND hwnd = NULL); + void SetTargetWindow(HWND hwnd = nullptr); void btnCaptureClick(); void cboxSendByChange(void *param); diff --git a/plugins/SendScreenshotPlus/src/Utils.h b/plugins/SendScreenshotPlus/src/Utils.h index bd2d38f240..7d5f051ff9 100644 --- a/plugins/SendScreenshotPlus/src/Utils.h +++ b/plugins/SendScreenshotPlus/src/Utils.h @@ -49,7 +49,7 @@ int ComboBox_SelectItemData(HWND hwndCtl, LPARAM data); size_t MonitorInfoEnum(MONITORINFOEX* &myMonitors, RECT &virtualScreen); FIBITMAP* CaptureWindow(HWND hCapture, BOOL bClientArea, BOOL bIndirectCapture); -FIBITMAP* CaptureMonitor(const wchar_t *pwszDevice, const RECT *cropRect = NULL); +FIBITMAP* CaptureMonitor(const wchar_t *pwszDevice, const RECT *cropRect = nullptr); char* GetFileNameA(const wchar_t *pwszPath); @@ -64,7 +64,7 @@ class EventHandle { HANDLE _hEvent; public: - inline EventHandle() { _hEvent = CreateEvent(NULL, 0, 0, NULL); } + inline EventHandle() { _hEvent = CreateEvent(nullptr, 0, 0, nullptr); } inline ~EventHandle() { CloseHandle(_hEvent); } inline void Set() { SetEvent(_hEvent); } inline void Wait() { WaitForSingleObject(_hEvent, INFINITE); } diff --git a/plugins/SmileyAdd/src/imagecache.h b/plugins/SmileyAdd/src/imagecache.h index cc0ef2cf3b..229af79a27 100644 --- a/plugins/SmileyAdd/src/imagecache.h +++ b/plugins/SmileyAdd/src/imagecache.h @@ -38,7 +38,7 @@ public: virtual void GetSize(SIZE&) {}; virtual int GetFrameCount(void) const { return 0; } virtual int GetFrameDelay(void) const { return 0; } - virtual HICON GetIcon(void) { return NULL; }; + virtual HICON GetIcon(void) { return nullptr; }; virtual void DrawInternal(HDC, int, int, int, int) {}; virtual void SelectFrame(int) {} diff --git a/plugins/SmileyAdd/src/services.h b/plugins/SmileyAdd/src/services.h index 113485429b..6a877d63e8 100644 --- a/plugins/SmileyAdd/src/services.h +++ b/plugins/SmileyAdd/src/services.h @@ -39,7 +39,7 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam); int DbSettingChanged(WPARAM wParam, LPARAM lParam); int ReloadColour(WPARAM, LPARAM); -SmileyPackType* GetSmileyPack(const char* proto, MCONTACT hContact = NULL, SmileyPackCType** smlc = NULL); +SmileyPackType* GetSmileyPack(const char* proto, MCONTACT hContact = NULL, SmileyPackCType** smlc = nullptr); #endif // SMILEYADD_SERVICES_H_ diff --git a/plugins/SmileyAdd/src/smileys.h b/plugins/SmileyAdd/src/smileys.h index c44f1858fb..4f02daed07 100644 --- a/plugins/SmileyAdd/src/smileys.h +++ b/plugins/SmileyAdd/src/smileys.h @@ -143,7 +143,7 @@ public: }; typedef SMOBJLIST SmileyLocVecType; - SmileyLookup() : m_pattern(L"") { m_ind = 0; m_valid = false; m_pattern = NULL; }; + SmileyLookup() : m_pattern(L"") { m_ind = 0; m_valid = false; m_pattern = nullptr; }; SmileyLookup(const CMStringW &str, const bool regexs, const int ind, const CMStringW &smpt); ~SmileyLookup(); @@ -251,7 +251,7 @@ private: bool visible; public: - SmileyCategoryType() { type = smcNone; m_pSmileyPackStore = NULL; visible = true; }; + SmileyCategoryType() { type = smcNone; m_pSmileyPackStore = nullptr; visible = true; }; SmileyCategoryType(SmileyPackListType *pSPS, const CMStringW &name, const CMStringW &displayName, const CMStringW &defaultFilename, SmcType typ); const CMStringW& GetDisplayName(void) const { return m_DisplayName; } diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 3e1c95e655..535a800174 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -84,7 +84,7 @@ void DeleteCListGroupsByName(wchar_t* szGroupName) int RemoveTmp(WPARAM, LPARAM) { - CleanThread(0); + CleanThread(nullptr); return 0; } diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index 21e3779c30..b322848628 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -104,8 +104,8 @@ struct CContactCache : public MZeroedObject bool updateNick(); void updateMeta(); bool updateUIN(); - void updateStatusMsg(const char *szKey = 0); - void setWindowData(CSrmmWindow *dat = 0); + void updateStatusMsg(const char *szKey = nullptr); + void setWindowData(CSrmmWindow *dat = nullptr); void resetMeta(); void closeWindow(); void deletedHandler(); diff --git a/plugins/TabSRMM/src/controls.h b/plugins/TabSRMM/src/controls.h index daf9174c7b..1bd0d75847 100644 --- a/plugins/TabSRMM/src/controls.h +++ b/plugins/TabSRMM/src/controls.h @@ -42,7 +42,7 @@ public: const RECT& getClientRect(); void Resize(WORD wWidth) const { - ::SetWindowPos(m_hwndToolbar, 0, 4, 0, wWidth, m_size_y, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW); + ::SetWindowPos(m_hwndToolbar, nullptr, 4, 0, wWidth, m_size_y, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW); } LONG getHeight() const; diff --git a/plugins/TabSRMM/src/infopanel.h b/plugins/TabSRMM/src/infopanel.h index cb9966d9a4..d449b02874 100644 --- a/plugins/TabSRMM/src/infopanel.h +++ b/plugins/TabSRMM/src/infopanel.h @@ -75,12 +75,12 @@ public: LEFT_BAR_WIDTH = 20 }; - CTip(const HWND hwndParent, const MCONTACT hContact, const wchar_t *pszText = 0, const CInfoPanel *panel = 0); + CTip(const HWND hwndParent, const MCONTACT hContact, const wchar_t *pszText = nullptr, const CInfoPanel *panel = nullptr); ~CTip() { mir_free(m_pszText); } - void show(const RECT& rc, POINT& pt, const HICON hIcon = 0, const wchar_t *szTitle = 0); + void show(const RECT& rc, POINT& pt, const HICON hIcon = nullptr, const wchar_t *szTitle = nullptr); const HWND getHwnd() const { return(m_hwnd); } static void registerClass(); diff --git a/plugins/TabSRMM/src/mim.h b/plugins/TabSRMM/src/mim.h index 91d3b13f67..0aea60b9e5 100644 --- a/plugins/TabSRMM/src/mim.h +++ b/plugins/TabSRMM/src/mim.h @@ -84,9 +84,9 @@ public: ~CMimAPI() { if (m_haveBufferedPaint) m_pfnBufferedPaintUninit(); - if (m_hUxTheme != 0) + if (m_hUxTheme != nullptr) FreeLibrary(m_hUxTheme); - if (m_hDwmApi != 0) + if (m_hDwmApi != nullptr) FreeLibrary(m_hDwmApi); if (m_hChatLogLock != INVALID_HANDLE_VALUE) @@ -150,7 +150,7 @@ public: INT_PTR foldersPathChanged(); void startTimer(); - void stopTimer(const char *szMsg = 0); + void stopTimer(const char *szMsg = nullptr); __forceinline __int64 getTimerStart() const { return m_tStart; } __forceinline __int64 getTimerStop() const { return m_tStop; } diff --git a/plugins/TabSRMM/src/muchighlight.h b/plugins/TabSRMM/src/muchighlight.h index 340b9e53f6..51bcd3ec79 100644 --- a/plugins/TabSRMM/src/muchighlight.h +++ b/plugins/TabSRMM/src/muchighlight.h @@ -41,8 +41,8 @@ public: CMUCHighlight() { m_fInitialized = false; - m_TextPatternString = m_NickPatternString = 0; - m_NickPatterns = m_TextPatterns = 0; + m_TextPatternString = m_NickPatternString = nullptr; + m_NickPatterns = m_TextPatterns = nullptr; m_iNickPatterns = m_iTextPatterns = 0; m_dwFlags = 0; m_Valid = true; diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h index 4d3cc13762..4380ca0a4f 100644 --- a/plugins/TabSRMM/src/sidebar.h +++ b/plugins/TabSRMM/src/sidebar.h @@ -135,7 +135,7 @@ public: void updateSession(CTabBaseDlg *dat); void processScrollerButtons(UINT cmd); - void Layout(const RECT *rc = 0, bool fOnlyCalc = false); + void Layout(const RECT *rc = nullptr, bool fOnlyCalc = false); void setVisible(bool fNewVisibility); void showAll(int showCmd); @@ -180,7 +180,7 @@ public: uLayoutCount = NR_LAYOUTS; return(m_layouts); } - void scrollIntoView(const CSideBarButton *item = 0); + void scrollIntoView(const CSideBarButton *item = nullptr); void resizeScrollWnd(LONG x, LONG y, LONG width, LONG height) const; private: diff --git a/plugins/TabSRMM/src/taskbar.h b/plugins/TabSRMM/src/taskbar.h index d9a3d7935d..ad29335aed 100644 --- a/plugins/TabSRMM/src/taskbar.h +++ b/plugins/TabSRMM/src/taskbar.h @@ -138,14 +138,14 @@ class CTaskbarInteract public: CTaskbarInteract() { - m_pTaskbarInterface = 0; + m_pTaskbarInterface = nullptr; m_IconSize = 0; m_isEnabled = IsWinVer7Plus() ? true : false; if (m_isEnabled) { ::CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&m_pTaskbarInterface); updateMetrics(); - if (0 == m_pTaskbarInterface) + if (nullptr == m_pTaskbarInterface) m_isEnabled = false; } @@ -165,7 +165,7 @@ public: { if (m_isEnabled && m_pTaskbarInterface) { m_pTaskbarInterface->Release(); - m_pTaskbarInterface = 0; + m_pTaskbarInterface = nullptr; m_isEnabled = false; } ::UnregisterClass(PROXYCLASSNAME, g_hInst); diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h index 22d61dacf0..a626a1936a 100644 --- a/plugins/TabSRMM/src/themes.h +++ b/plugins/TabSRMM/src/themes.h @@ -146,7 +146,7 @@ public: CImageItem(const CImageItem& From) { *this = From; - m_nextItem = 0; + m_nextItem = nullptr; } CImageItem(const wchar_t *szName) { @@ -183,8 +183,8 @@ public: void Clear() { - m_hdc = 0; m_hbm = 0; m_hbmOld = 0; - m_fillBrush = (HBRUSH)0; + m_hdc = nullptr; m_hbm = nullptr; m_hbmOld = nullptr; + m_fillBrush = nullptr; } void setBitmap(const HBITMAP hbm) @@ -354,7 +354,7 @@ public: */ const CImageItem* getGlyphItem() const { - return(m_fHaveGlyph ? &m_glyphItem : 0); + return(m_fHaveGlyph ? &m_glyphItem : nullptr); } bool warnToClose() const; COLORREF getColorKey() const { return(m_ContainerColorKey); } diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index 5b3bf33b18..229c379285 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -57,8 +57,8 @@ public: static void DoubleAmpersands(wchar_t *pszText, size_t len); static void RTF_CTableInit(); static void RTF_ColorAdd(const wchar_t *tszColname); - static int ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey = 0); - static int WriteContainerSettingsToDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey = 0); + static int ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey = nullptr); + static int WriteContainerSettingsToDB(const MCONTACT hContact, TContainerSettings *cs, const char *szKey = nullptr); static void SettingsToContainer(TContainerData *pContainer); static void ContainerToSettings(TContainerData *pContainer); static void ReadPrivateContainerSettings(TContainerData *pContainer, bool fForce = false); @@ -154,7 +154,7 @@ public: public: // static function to construct and show the dialog, returns the user's choice - static LRESULT show(const int uId, DWORD dwFlags = 0, const wchar_t* tszTxt = 0); + static LRESULT show(const int uId, DWORD dwFlags = 0, const wchar_t* tszTxt = nullptr); static void destroyAll(); LRESULT ShowDialog() const; diff --git a/plugins/TopToolBar/src/stdafx.h b/plugins/TopToolBar/src/stdafx.h index bc9169318e..ba188f3836 100644 --- a/plugins/TopToolBar/src/stdafx.h +++ b/plugins/TopToolBar/src/stdafx.h @@ -116,7 +116,7 @@ void RemoveFromOptions(int id); //append string char *AS(char *str, const char *setting, char *addstr) { - if (str != NULL) { + if (str != nullptr) { mir_strcpy(str, setting); mir_strcat(str, addstr); } @@ -125,7 +125,7 @@ char *AS(char *str, const char *setting, char *addstr) #define TTB_LAUNCHSERVICE "TTB/LaunchService" -TopButtonInt* idtopos(int id, int* pPos=NULL); +TopButtonInt* idtopos(int id, int* pPos = nullptr); INT_PTR TTBAddButton(WPARAM, LPARAM); INT_PTR TTBRemoveButton(WPARAM, LPARAM); diff --git a/plugins/UserInfoEx/src/classMAnnivDate.h b/plugins/UserInfoEx/src/classMAnnivDate.h index e6f328b0c0..987408cb63 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.h +++ b/plugins/UserInfoEx/src/classMAnnivDate.h @@ -89,14 +89,14 @@ public: int CompareDays(MTime mt) const; MZodiac Zodiac(); - int Age(MTime *pNow = NULL); + int Age(MTime *pNow = nullptr); void Clear(); // read date from database int DBGetDate(MCONTACT hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear); int DBGetDateStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); int DBGetAnniversaryDate(MCONTACT hContact, WORD iIndex); - int DBGetBirthDate(MCONTACT hContact, LPSTR pszProto = NULL); + int DBGetBirthDate(MCONTACT hContact, LPSTR pszProto = nullptr); int DBGetReminderOpts(MCONTACT hContact); // write date to database @@ -109,7 +109,7 @@ public: int DBDeleteBirthDate(MCONTACT hContact); int DBMoveBirthDate(MCONTACT hContact, BYTE bOld, BYTE bNew); - int BackupBirthday (MCONTACT hContact, LPSTR pszProto = NULL, const BYTE bDontIgnoreAnything = FALSE, PWORD lastAnswer = NULL); + int BackupBirthday (MCONTACT hContact, LPSTR pszProto = nullptr, const BYTE bDontIgnoreAnything = FALSE, PWORD lastAnswer = nullptr); // setting values void SetDate(const SYSTEMTIME &st); diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.h b/plugins/UserInfoEx/src/ctrl_annivedit.h index 2c0045d00f..f8656aefc3 100644 --- a/plugins/UserInfoEx/src/ctrl_annivedit.h +++ b/plugins/UserInfoEx/src/ctrl_annivedit.h @@ -53,7 +53,7 @@ class CAnnivEditCtrl : public CBaseCtrl public: - MAnnivDate* Current() { return CurrentItemValid() ? _pDates[_curDate] : NULL; }; + MAnnivDate* Current() { return CurrentItemValid() ? _pDates[_curDate] : nullptr; }; WORD CurrentIndex() const { return _curDate; }; WORD NumDates() const { return _numDates; }; BYTE ReminderEnabled() const { return _ReminderEnabled; }; diff --git a/plugins/UserInfoEx/src/dlg_propsheet.h b/plugins/UserInfoEx/src/dlg_propsheet.h index 4de3112d21..a71addd386 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.h +++ b/plugins/UserInfoEx/src/dlg_propsheet.h @@ -151,7 +151,7 @@ public: ~CPsTree(); __inline void BeginDrag(HTREEITEM hDragItem) { _isDragging = TRUE; _hDragItem = hDragItem; }; - __inline void EndDrag() { _isDragging = FALSE; _hDragItem = NULL; }; + __inline void EndDrag() { _isDragging = FALSE; _hDragItem = nullptr; }; __inline BYTE IsDragging() const { return _isDragging; }; __inline HTREEITEM DragItem() const { return _hDragItem; }; @@ -165,8 +165,8 @@ public: __inline HIMAGELIST ImageList() const { return _hImages; }; __inline BYTE IsIndexValid(const int index) const { return (index >= 0 && index < _numItems); }; - __inline CPsTreeItem* TreeItem(int index) const { return (IsIndexValid(index) ? _pItems[index] : NULL); }; - __inline HTREEITEM TreeItemHandle(int index) const { return (IsIndexValid(index) ? _pItems[index]->Hti() : NULL); }; + __inline CPsTreeItem* TreeItem(int index) const { return (IsIndexValid(index) ? _pItems[index] : nullptr); }; + __inline HTREEITEM TreeItemHandle(int index) const { return (IsIndexValid(index) ? _pItems[index]->Hti() : nullptr); }; __inline int CurrentItemIndex() const { return _curItem; }; __inline CPsTreeItem* CurrentItem() const { return TreeItem(CurrentItemIndex()); }; diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h index d24ffd5f8d..ad89480259 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h @@ -49,12 +49,12 @@ public: __inline DBVARIANT& uid() { return _dbvUID; } __inline MCONTACT handle() const { return _hContact; } - __inline void disp(LPCSTR val) { _pszDisp = val ? mir_strdup(val): NULL; } - __inline void group(LPCSTR val) { _pszGroup = val ? mir_strdup(val): NULL; } - __inline void nick(LPCSTR val) { _pszNick = val ? mir_strdup(val): NULL; } - __inline void proto(LPCSTR val) { _pszProto = val ? mir_strdup(val): NULL; } - __inline void ampro(LPCSTR val) { _pszAMPro = val ? mir_strdup(val): NULL; } - __inline void uidk(LPCSTR val) { _pszUIDKey = val ? mir_strdup(val): NULL; } + __inline void disp(LPCSTR val) { _pszDisp = val ? mir_strdup(val): nullptr; } + __inline void group(LPCSTR val) { _pszGroup = val ? mir_strdup(val): nullptr; } + __inline void nick(LPCSTR val) { _pszNick = val ? mir_strdup(val): nullptr; } + __inline void proto(LPCSTR val) { _pszProto = val ? mir_strdup(val): nullptr; } + __inline void ampro(LPCSTR val) { _pszAMPro = val ? mir_strdup(val): nullptr; } + __inline void uidk(LPCSTR val) { _pszUIDKey = val ? mir_strdup(val): nullptr; } __inline void uid(BYTE val) { _dbvUID.type = DBVT_BYTE; _dbvUID.bVal = val; } __inline void uid(WORD val) { _dbvUID.type = DBVT_WORD; _dbvUID.wVal = val; } __inline void uid(DWORD val) { _dbvUID.type = DBVT_DWORD; _dbvUID.dVal = val; } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h index 36fd2b265e..0636d37dd4 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h @@ -75,13 +75,13 @@ private: BYTE _useUtf8; WORD _hasUtf8; - size_t packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *cbRew = NULL); + size_t packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *cbRew = nullptr); BYTE GetSetting(const CHAR *pszModule, const CHAR *pszSetting, DBVARIANT *dbv); - size_t packDB(const CHAR *pszModule, const CHAR *pszSetting, size_t *cbRew = NULL); - size_t packDBList(const CHAR *pszModule, const CHAR *pszSetting, MIRANDASERVICE GetList, BYTE bSigned = FALSE, size_t *cbRew = NULL); + size_t packDB(const CHAR *pszModule, const CHAR *pszSetting, size_t *cbRew = nullptr); + size_t packDBList(const CHAR *pszModule, const CHAR *pszSetting, MIRANDASERVICE GetList, BYTE bSigned = FALSE, size_t *cbRew = nullptr); - void writeLine(const CHAR *szSet, size_t *cbRew = NULL); - void writeLineEncoded(const CHAR *szSet, size_t *cbRew = NULL); + void writeLine(const CHAR *szSet, size_t *cbRew = nullptr); + void writeLineEncoded(const CHAR *szSet, size_t *cbRew = nullptr); int readLine(LPSTR szVCFSetting, WORD cchSetting); public: diff --git a/plugins/UserInfoEx/src/mir_contactqueue.h b/plugins/UserInfoEx/src/mir_contactqueue.h index 9d224a91f3..ce1e388f80 100644 --- a/plugins/UserInfoEx/src/mir_contactqueue.h +++ b/plugins/UserInfoEx/src/mir_contactqueue.h @@ -75,7 +75,7 @@ public: * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ - BOOL Add(int waitTime, MCONTACT hContact, void *param = NULL); + BOOL Add(int waitTime, MCONTACT hContact, void *param = nullptr); /** * This method adds the desired new item only, if the queue does not yet contain @@ -88,7 +88,7 @@ public: * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ - BOOL AddIfDontHave(int waitTime, MCONTACT hContact, void *param = NULL); + BOOL AddIfDontHave(int waitTime, MCONTACT hContact, void *param = nullptr); /** * This method removes all existing queue items for the contact and adds a new queue item @@ -101,7 +101,7 @@ public: * * @return nothing **/ - BOOL AddUnique(int waitTime, MCONTACT hContact, void *param = NULL); + BOOL AddUnique(int waitTime, MCONTACT hContact, void *param = nullptr); /** * This method removes all existing queue items for the contact with the same parameter as @e param @@ -114,7 +114,7 @@ public: * * @return nothing **/ - BOOL AddUniqueConsiderParam (int waitTime, MCONTACT hContact, void *param = NULL); + BOOL AddUniqueConsiderParam (int waitTime, MCONTACT hContact, void *param = nullptr); // This method resumes the worker thread and immitiatly goes on with the next entry. void ContinueWithNext(); diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index bbf6328c1e..f085c8b87d 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -66,11 +66,11 @@ namespace Setting { static FORCEINLINE BYTE GetAsIsEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) { return GetEx(hContact, pszModule, szProto, pszSetting, dbv, 0); } static FORCEINLINE LPSTR GetAStringEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) - { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_ASCIIZ) && dbv.type == DBVT_ASCIIZ) ? dbv.pszVal : NULL; } + { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_ASCIIZ) && dbv.type == DBVT_ASCIIZ) ? dbv.pszVal : nullptr; } static FORCEINLINE LPWSTR GetWStringEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) - { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_WCHAR) && dbv.type == DBVT_WCHAR) ? dbv.pwszVal : NULL; } + { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_WCHAR) && dbv.type == DBVT_WCHAR) ? dbv.pwszVal : nullptr; } static FORCEINLINE LPSTR GetUStringEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) - { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_UTF8) && dbv.type == DBVT_UTF8) ? dbv.pszVal : NULL; } + { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_UTF8) && dbv.type == DBVT_UTF8) ? dbv.pszVal : nullptr; } WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE nType); static FORCEINLINE WORD GetAsIsCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) diff --git a/plugins/YAMN/src/proto/netclient.h b/plugins/YAMN/src/proto/netclient.h index 2414dbdef1..55e0fb0d7d 100644 --- a/plugins/YAMN/src/proto/netclient.h +++ b/plugins/YAMN/src/proto/netclient.h @@ -5,9 +5,9 @@ class CNetClient { public: CNetClient(): Stopped(FALSE) {} - virtual void Connect(const char* servername,const int port)=0; + virtual void Connect(const char* servername, const int port)=0; virtual void Send(const char *query)=0; - virtual char* Recv(char *buf=NULL,int buflen=65536)=0; + virtual char* Recv(char *buf= nullptr, int buflen=65536)=0; virtual void Disconnect()=0; virtual BOOL Connected()=0; virtual void SSLify()=0; diff --git a/plugins/YAMN/src/proto/netlib.h b/plugins/YAMN/src/proto/netlib.h index de41a6ad04..fd00ed6b84 100644 --- a/plugins/YAMN/src/proto/netlib.h +++ b/plugins/YAMN/src/proto/netlib.h @@ -4,14 +4,14 @@ class CNLClient: public CNetClient { public: - CNLClient(): hConnection(NULL) {} - void Connect(const char* servername,const int port) throw(DWORD); + CNLClient(): hConnection(nullptr) {} + void Connect(const char* servername, const int port) throw(DWORD); void Send(const char *query) throw(DWORD); - char* Recv(char *buf=NULL,int buflen=65536) throw(DWORD); + char* Recv(char *buf= nullptr, int buflen = 65536) throw(DWORD); void Disconnect(); void SSLify()throw(DWORD); - inline BOOL Connected() {return hConnection!=NULL;} + inline BOOL Connected() {return hConnection != nullptr;} protected: HNETLIBCONN hConnection; diff --git a/plugins/YAMN/src/proto/pop3/pop3.h b/plugins/YAMN/src/proto/pop3/pop3.h index c65dc2ee26..82e1a2c17e 100644 --- a/plugins/YAMN/src/proto/pop3/pop3.h +++ b/plugins/YAMN/src/proto/pop3/pop3.h @@ -19,8 +19,8 @@ class CPop3Client { public: - CPop3Client(): NetClient(NULL), Stopped(FALSE) {} - ~CPop3Client() {if (NetClient != NULL) delete NetClient;} + CPop3Client(): NetClient(nullptr), Stopped(FALSE) {} + ~CPop3Client() {if (NetClient != nullptr) delete NetClient;} char* Connect(const char* servername,const int port=110,BOOL UseSSL=FALSE, BOOL NoTLS=FALSE); char* RecvRest(char* prev,int mode,int size=65536); diff --git a/plugins/YAMN/src/stdafx.h b/plugins/YAMN/src/stdafx.h index e932de1d2e..98cff20363 100644 --- a/plugins/YAMN/src/stdafx.h +++ b/plugins/YAMN/src/stdafx.h @@ -177,8 +177,8 @@ void WINAPI g_ReleaseIcon(HICON hIcon); //From synchro.cpp void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account, HYAMNMAIL From); -DWORD WINAPI WaitToWriteFcn(PSWMRG SObject, PSCOUNTER SCounter = NULL); -void WINAPI WriteDoneFcn(PSWMRG SObject, PSCOUNTER SCounter = NULL); +DWORD WINAPI WaitToWriteFcn(PSWMRG SObject, PSCOUNTER SCounter = nullptr); +void WINAPI WriteDoneFcn(PSWMRG SObject, PSCOUNTER SCounter = nullptr); DWORD WINAPI WaitToReadFcn(PSWMRG SObject); void WINAPI ReadDoneFcn(PSWMRG SObject); DWORD WINAPI SCIncFcn(PSCOUNTER SCounter); diff --git a/plugins/mTextControl/src/FormattedTextDraw.h b/plugins/mTextControl/src/FormattedTextDraw.h index 8f318717e6..c44d1f25e5 100644 --- a/plugins/mTextControl/src/FormattedTextDraw.h +++ b/plugins/mTextControl/src/FormattedTextDraw.h @@ -59,10 +59,10 @@ public: { HDC hdcScreen; - hdcScreen = GetDC(NULL); + hdcScreen = GetDC(nullptr); nPixelsPerInchX = GetDeviceCaps(hdcScreen, LOGPIXELSX); nPixelsPerInchY = GetDeviceCaps(hdcScreen, LOGPIXELSY); - ReleaseDC(NULL, hdcScreen); + ReleaseDC(nullptr, hdcScreen); SetRectEmpty(&m_rcClient); SetRectEmpty(&m_rcViewInset); @@ -71,8 +71,8 @@ public: InitDefaultCharFormat(); InitDefaultParaFormat(); - m_spTextServices = NULL; - m_spTextDocument = NULL; + m_spTextServices = nullptr; + m_spTextDocument = nullptr; m_dwPropertyBits = TXTBIT_RICHTEXT | TXTBIT_MULTILINE | TXTBIT_WORDWRAP | TXTBIT_USECURRENTBKG; m_dwScrollbar = 0; @@ -82,9 +82,9 @@ public: ~CFormattedTextDraw() { free(m_pCF); - if (m_spTextServices != NULL) + if (m_spTextServices != nullptr) m_spTextServices->Release(); - if (m_spTextDocument != NULL) + if (m_spTextDocument != nullptr) m_spTextDocument->Release(); } @@ -93,7 +93,7 @@ public: /* [in] */ REFIID, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) { - *ppvObject = NULL; + *ppvObject = nullptr; return S_FALSE; } diff --git a/protocols/EmLanProto/src/mlan.h b/protocols/EmLanProto/src/mlan.h index a314c054cd..d3f879bc2a 100644 --- a/protocols/EmLanProto/src/mlan.h +++ b/protocols/EmLanProto/src/mlan.h @@ -129,7 +129,7 @@ private: char* strAwayMessage; // NULL means no away message int idAckAwayMessage; }; - u_char* CreatePacket(TPacket& pak, int* pBufLen = NULL); + u_char* CreatePacket(TPacket& pak, int* pBufLen = nullptr); void ParsePacket(TPacket& pak, u_char* buf, int len = 65536); void SendPacketExt(TPacket& pak, u_long addr); diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 999ca5b704..03c3920150 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -74,9 +74,9 @@ public: inline int IdleSeconds() { if ((m_iStatus == ID_STATUS_AWAY || m_iStatus == ID_STATUS_INVISIBLE) && m_awayTS) - return time(0) - m_awayTS; + return time(nullptr) - m_awayTS; - return m_idleTS ? time(0) - m_idleTS : 0; + return m_idleTS ? time(nullptr) - m_idleTS : 0; } bool m_invisible; diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 694b1d6b80..e74e1461ac 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -794,7 +794,7 @@ int GaduProto::options_init(WPARAM wParam, LPARAM) odp.szTab.w = LPGENW("Advanced"); odp.position = 2; - odp.pszTemplate = 0; + odp.pszTemplate = nullptr; odp.pDialog = new GaduOptionsDlgAdvanced(this); Options_AddPage(wParam, &odp); diff --git a/protocols/IRCG/src/irc_dlg.h b/protocols/IRCG/src/irc_dlg.h index b491278c39..75a4d341e5 100644 --- a/protocols/IRCG/src/irc_dlg.h +++ b/protocols/IRCG/src/irc_dlg.h @@ -172,7 +172,7 @@ struct CManagerDlg : public CCoolIrcDlg struct CQuestionDlg : public CCoolIrcDlg { - CQuestionDlg(CIrcProto* _pro, CManagerDlg* owner = NULL); + CQuestionDlg(CIrcProto* _pro, CManagerDlg* owner = nullptr); virtual void OnInitDialog(); virtual void OnClose(); diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index 14da73d80a..16f753c395 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -495,7 +495,7 @@ struct CIrcProto : public PROTO int NLReceive(unsigned char* buf, int cbBuf); void InsertIncomingEvent(wchar_t* pszRaw); - __inline bool IsConnected() const { return con != NULL; } + __inline bool IsConnected() const { return con != nullptr; } // send-to-stream operators int getCodepage() const; diff --git a/protocols/IcqOscarJ/src/changeinfo.h b/protocols/IcqOscarJ/src/changeinfo.h index 4c90b617f4..b487f75a64 100644 --- a/protocols/IcqOscarJ/src/changeinfo.h +++ b/protocols/IcqOscarJ/src/changeinfo.h @@ -85,7 +85,7 @@ struct ChangeInfoData : public MZeroedObject HANDLE hAckHook; HANDLE hUpload[2]; - ChangeInfoData() { settingData = (SettingItemData*)SAFE_MALLOC(sizeof(SettingItemData) * settingCount); hAckHook = NULL; hUpload[0] = NULL; hUpload[1] = NULL;} + ChangeInfoData() { settingData = (SettingItemData*)SAFE_MALLOC(sizeof(SettingItemData) * settingCount); hAckHook = nullptr; hUpload[0] = nullptr; hUpload[1] = nullptr;} ~ChangeInfoData() { SAFE_FREE((void**)&settingData); } char* GetItemSettingText(int i, char *buf, size_t buf_size); diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 5599fc409e..294fea1da5 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -588,8 +588,8 @@ struct CIcqProto : public PROTO void servlistPendingAddContactOperation(MCONTACT hContact, LPARAM param, PENDING_CONTACT_CALLBACK callback, DWORD flags); void servlistPendingAddGroupOperation(const char *pszGroup, LPARAM param, PENDING_GROUP_CALLBACK callback, DWORD flags); - int servlistPendingAddContact(MCONTACT hContact, WORD wContactID, WORD wGroupID, LPARAM param, PENDING_CONTACT_CALLBACK callback, int bDoInline, LPARAM operationParam = 0, PENDING_CONTACT_CALLBACK operationCallback = NULL); - int servlistPendingAddGroup(const char *pszGroup, WORD wGroupID, LPARAM param, PENDING_GROUP_CALLBACK callback, int bDoInline, LPARAM operationParam = 0, PENDING_GROUP_CALLBACK operationCallback = NULL); + int servlistPendingAddContact(MCONTACT hContact, WORD wContactID, WORD wGroupID, LPARAM param, PENDING_CONTACT_CALLBACK callback, int bDoInline, LPARAM operationParam = 0, PENDING_CONTACT_CALLBACK operationCallback = nullptr); + int servlistPendingAddGroup(const char *pszGroup, WORD wGroupID, LPARAM param, PENDING_GROUP_CALLBACK callback, int bDoInline, LPARAM operationParam = 0, PENDING_GROUP_CALLBACK operationCallback = nullptr); void servlistPendingRemoveContact(MCONTACT hContact, WORD wContactID, WORD wGroupID, int nResult); void servlistPendingRemoveGroup(const char *pszGroup, WORD wGroupID, int nResult); void servlistPendingFlushOperations(); @@ -673,7 +673,7 @@ struct CIcqProto : public PROTO void icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HNETLIBCONN hConn, char* cookie, size_t cookieLen)); void icq_setidle(int bAllow); - void icq_setstatus(WORD wStatus, const char *szStatusNote = NULL); + void icq_setstatus(WORD wStatus, const char *szStatusNote = nullptr); DWORD icq_sendGetInfoServ(MCONTACT hContact, DWORD, int); DWORD icq_sendGetAimProfileServ(MCONTACT hContact, char *szUid); DWORD icq_sendGetAwayMsgServ(MCONTACT hContact, DWORD, int, WORD); diff --git a/protocols/IcqOscarJ/src/icq_rates.h b/protocols/IcqOscarJ/src/icq_rates.h index 73c12d01ba..500acfa8fb 100644 --- a/protocols/IcqOscarJ/src/icq_rates.h +++ b/protocols/IcqOscarJ/src/icq_rates.h @@ -101,7 +101,7 @@ protected: WORD wGroup; virtual BOOL isEqual(rates_queue_item *pItem); - virtual rates_queue_item* copyItem(rates_queue_item *pDest = NULL); + virtual rates_queue_item* copyItem(rates_queue_item *pDest = nullptr); public: rates_queue_item(CIcqProto *ppro, WORD wGroup); virtual ~rates_queue_item(); diff --git a/protocols/JabberG/src/jabber_notes.h b/protocols/JabberG/src/jabber_notes.h index eebd31fa4f..30ec4e5c04 100644 --- a/protocols/JabberG/src/jabber_notes.h +++ b/protocols/JabberG/src/jabber_notes.h @@ -38,7 +38,7 @@ private: public: CNoteItem(); - CNoteItem(HXML hXml, wchar_t *szFrom = 0); + CNoteItem(HXML hXml, wchar_t *szFrom = nullptr); ~CNoteItem(); void SetData(wchar_t *title, wchar_t *from, wchar_t *text, wchar_t *tags); @@ -76,7 +76,7 @@ public: OBJLIST::remove(p); } - void AddNote(HXML hXml, wchar_t *szFrom = 0); + void AddNote(HXML hXml, wchar_t *szFrom = nullptr); void LoadXml(HXML hXml); void SaveXml(HXML hXmlParent); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 700512d631..b5954585cc 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1066,8 +1066,8 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (!m_options.EnableCarbons) return; - HXML forwarded = NULL; - HXML message = NULL; + HXML forwarded = nullptr; + HXML message = nullptr; //Carbons MUST have forwarded/message content if (!(forwarded = XmlGetChildByTag(carbon, "forwarded", "xmlns", JABBER_XMLNS_FORWARD)) || !(message = XmlGetChild(forwarded, "message"))) diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 86da122f9d..a9a95fbc07 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -198,8 +198,8 @@ struct CMraProto : public PROTO DWORD MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &wszMessage, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize); DWORD MraMessageAsk(DWORD dwMsgID, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &wszMessage, const CMStringW &wszMessageRTF); DWORD MraMessageRecv(const CMStringA &szFrom, DWORD dwMsgID); - DWORD MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones = 0, const CMStringW *wszAuthMessage = 0); - DWORD MraModifyContact(MCONTACT hContact, DWORD *pdwID = 0, DWORD *pdwContactFlag = 0, DWORD *pdwGroupID = 0, const CMStringA *pszEmail = 0, const CMStringW *pwszCustomName = 0, const CMStringA *pszPhones = 0); + DWORD MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones = nullptr, const CMStringW *wszAuthMessage = nullptr); + DWORD MraModifyContact(MCONTACT hContact, DWORD *pdwID = nullptr, DWORD *pdwContactFlag = nullptr, DWORD *pdwGroupID = nullptr, const CMStringA *pszEmail = nullptr, const CMStringW *pwszCustomName = nullptr, const CMStringA *pszPhones = nullptr); DWORD MraOfflineMessageDel(DWORDLONG dwMsgUIDL); DWORD MraMoveContactToGroup(MCONTACT hContact, DWORD dwGroupID, LPCTSTR ptszGroup); DWORD MraAuthorize(const CMStringA &szEmail); diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 54352926ac..8e26f28364 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -8,7 +8,7 @@ class OutBuffer size_t m_max, m_actual; public: - OutBuffer() : m_buf(0), m_max(0), m_actual(0) {} + OutBuffer() : m_buf(nullptr), m_max(0), m_actual(0) {} ~OutBuffer() { if (m_buf) free(m_buf); } void* Allocate(size_t len) @@ -77,7 +77,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType DWORD dwRet = 0; LPSTR lpszMessageConverted = (LPSTR)lpwszMessage.GetString(); - LPSTR lpszMessageRTF = NULL; + LPSTR lpszMessageRTF = nullptr; size_t dwMessageConvertedSize = lpwszMessage.GetLength()*sizeof(WCHAR), dwMessageRTFSize = 0; if (MraIsMessageFlashAnimation(lpwszMessage)) @@ -136,8 +136,8 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType } } - if (lpszMessageRTF == NULL || dwMessageRTFSize == 0) dwFlags &= ~(MESSAGE_FLAG_RTF | MESSAGE_FLAG_FLASH); - if (lpbMultiChatData == NULL || dwMultiChatDataSize == 0) dwFlags &= ~MESSAGE_FLAG_MULTICHAT; + if (lpszMessageRTF == nullptr || dwMessageRTFSize == 0) dwFlags &= ~(MESSAGE_FLAG_RTF | MESSAGE_FLAG_FLASH); + if (lpbMultiChatData == nullptr || dwMultiChatDataSize == 0) dwFlags &= ~MESSAGE_FLAG_MULTICHAT; OutBuffer buf; buf.SetUL(dwFlags); @@ -148,7 +148,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType buf.SetLPS(CMStringA((LPSTR)lpbMultiChatData, (int)dwMultiChatDataSize)); if (bAddToQueue) - dwRet = MraSendQueueCMD(hSendQueueHandle, 0, hContact, dwAckType, NULL, 0, MRIM_CS_MESSAGE, buf.Data(), buf.Len()); + dwRet = MraSendQueueCMD(hSendQueueHandle, 0, hContact, dwAckType, nullptr, 0, MRIM_CS_MESSAGE, buf.Data(), buf.Len()); else dwRet = MraSendCMD(MRIM_CS_MESSAGE, buf.Data(), buf.Len()); @@ -198,18 +198,18 @@ DWORD CMraProto::MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwG buf.SetUL(dwGroupID); buf.SetLPSLowerCase(szEmail); buf.SetLPSW(wszCustomName); - buf.SetLPS((szPhones == NULL) ? "" : *szPhones); + buf.SetLPS((szPhones == nullptr) ? "" : *szPhones); // pack auth message OutBuffer buf2; buf2.SetUL(2); buf2.SetLPSW(L"");//***deb possible nick here - buf2.SetLPSW((wszAuthMessage == NULL) ? L"" : *wszAuthMessage); + buf2.SetLPSW((wszAuthMessage == nullptr) ? L"" : *wszAuthMessage); buf.SetLPS(CMStringA(ptrA(mir_base64_encode(buf2.Data(), buf2.Len())))); buf.SetUL(0); - return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, NULL, 0, MRIM_CS_ADD_CONTACT, buf.Data(), buf.Len()); + return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, nullptr, 0, MRIM_CS_ADD_CONTACT, buf.Data(), buf.Len()); } // change contact @@ -219,7 +219,7 @@ DWORD CMraProto::MraModifyContact(MCONTACT hContact, DWORD *pdwID, DWORD *pdwCon CMStringW wszNick, wszCustomName; DWORD dwID, dwGroupID, dwContactFlag; if (hContact) - GetContactBasicInfoW(hContact, &dwID, &dwGroupID, &dwContactFlag, NULL, NULL, &szEmail, &wszNick, &szPhones); + GetContactBasicInfoW(hContact, &dwID, &dwGroupID, &dwContactFlag, nullptr, nullptr, &szEmail, &wszNick, &szPhones); else dwID = dwGroupID = dwContactFlag = 0; @@ -241,7 +241,7 @@ DWORD CMraProto::MraModifyContact(MCONTACT hContact, DWORD *pdwID, DWORD *pdwCon buf.SetLPSW(wszCustomName); buf.SetLPS(szPhones); - return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, NULL, 0, MRIM_CS_MODIFY_CONTACT, buf.Data(), buf.Len()); + return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, nullptr, 0, MRIM_CS_MODIFY_CONTACT, buf.Data(), buf.Len()); } // remove stored message @@ -377,7 +377,7 @@ HANDLE CMraProto::MraWPRequestW(MCONTACT hContact, DWORD dwAckType, DWORD dwRequ buf.SetLPS(tmp); } - return (HANDLE)MraSendQueueCMD(hSendQueueHandle, dwRequestFlags, hContact, dwAckType, NULL, 0, MRIM_CS_WP_REQUEST, buf.Data(), buf.Len()); + return (HANDLE)MraSendQueueCMD(hSendQueueHandle, dwRequestFlags, hContact, dwAckType, nullptr, 0, MRIM_CS_WP_REQUEST, buf.Data(), buf.Len()); } // Поиск контакта по EMail @@ -407,7 +407,7 @@ DWORD CMraProto::MraGame(const CMStringA &szEmail, DWORD dwGameSessionID, DWORD buf.SetUL(dwGameSessionID); buf.SetUL(dwGameMsg); buf.SetUL(dwGameMsgID); - buf.SetUL(_time32(NULL)); + buf.SetUL(_time32(nullptr)); buf.SetLPS(szData); return MraSendCMD(MRIM_CS_GAME, buf.Data(), buf.Len()); } @@ -449,7 +449,7 @@ DWORD CMraProto::MraSMSW(MCONTACT hContact, const CMStringA &lpszPhone, const CM /* Save phone number for ack notify after send. */ LPBYTE lpbData = (LPBYTE)mir_calloc(lpszPhone.GetLength() + sizeof(size_t)); - if (NULL == lpbData) + if (nullptr == lpbData) return (0); memcpy(lpbData, lpszPhone, lpszPhone.GetLength()); return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ICQACKTYPE_SMS, lpbData, lpszPhone.GetLength(), MRIM_CS_SMS, buf.Data(), buf.Len()); diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 7acb2c8b80..da0902c387 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -114,7 +114,7 @@ DWORD MraAddrListGetFromBuff(const CMStringA &szAddresses, MRA_ADDR_LIST *pmalAd while (TRUE) { LPSTR lpszEndItem = strchr(lpszCurrentItem, ';'); - if (lpszEndItem == NULL) + if (lpszEndItem == nullptr) lpszEndItem = buf + szAddresses.GetLength(); if (!lpszEndItem) break; @@ -189,7 +189,7 @@ bool DB_GetStaticStringA(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueN if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0) { size_t dwRetBuffSizeLocal, dwReadedStringLen = mir_wstrlen(dbv.pwszVal); if (lpszRetBuff && (dwRetBuffSize > dwReadedStringLen)) { - dwRetBuffSizeLocal = WideCharToMultiByte(MRA_CODE_PAGE, 0, dbv.pwszVal, (int)dwReadedStringLen, lpszRetBuff, (int)dwRetBuffSize, NULL, NULL); + dwRetBuffSizeLocal = WideCharToMultiByte(MRA_CODE_PAGE, 0, dbv.pwszVal, (int)dwReadedStringLen, lpszRetBuff, (int)dwRetBuffSize, nullptr, nullptr); (*((CHAR*)(lpszRetBuff + dwRetBuffSizeLocal))) = 0; bRet = true; } @@ -305,7 +305,7 @@ bool DB_GetContactSettingBlob(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszV DWORD CMraProto::MraMoveContactToGroup(MCONTACT hContact, DWORD dwGroupID, LPCTSTR ptszName) { - MraGroupItem *p = NULL; + MraGroupItem *p = nullptr; for (auto &it : m_groups) if (it->m_name == ptszName) { @@ -313,13 +313,13 @@ DWORD CMraProto::MraMoveContactToGroup(MCONTACT hContact, DWORD dwGroupID, LPCTS break; } - if (p == NULL) { + if (p == nullptr) { if (m_groups.getCount() == 20) return 0; DWORD id; for (id = 0; id < 20; id++) - if (m_groups.find((MraGroupItem*)&id) == NULL) + if (m_groups.find((MraGroupItem*)&id) == nullptr) break; DWORD dwContactFlags = CONTACT_FLAG_UNICODE_NAME | CONTACT_FLAG_GROUP | (id << 24); @@ -448,7 +448,7 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D if (dwFlags & SCBIF_ID) setDword(hContact, "ContactID", dwID); - if ((dwFlags & SCBIF_EMAIL) && szEmail != NULL && !szEmail->IsEmpty()) + if ((dwFlags & SCBIF_EMAIL) && szEmail != nullptr && !szEmail->IsEmpty()) mraSetStringExA(hContact, "e-mail", *szEmail); // поля изменения которых отслеживаются @@ -463,14 +463,14 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D } } - if ((dwFlags & SCBIF_NICK) && wszNick != NULL && !wszNick->IsEmpty()) { + if ((dwFlags & SCBIF_NICK) && wszNick != nullptr && !wszNick->IsEmpty()) { if ((dwFlags & SCBIF_FLAG) && ((dwContactFlag & CONTACT_FLAG_UNICODE_NAME) == 0)) DB_SetStringExA(hContact, "CList", "MyHandle", CMStringA(*wszNick)); else DB_SetStringExW(hContact, "CList", "MyHandle", *wszNick); } - if ((dwFlags & SCBIF_PHONES) && szPhones != NULL && !szPhones->IsEmpty()) { + if ((dwFlags & SCBIF_PHONES) && szPhones != nullptr && !szPhones->IsEmpty()) { int iStart = 0, i = 0; while (true) { CMStringA szPhone = szPhones->Tokenize(",", iStart); @@ -525,7 +525,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe if (IsEMailChatAgent(szEmail)) { CMStringW wszEMail = szEmail; GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, wszEMail); - if (si != 0) { + if (si != nullptr) { bool bChatAdded = (si->hContact != NULL); if (bChatAdded == FALSE) hContact = NULL; @@ -538,12 +538,12 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe if (hContact) { if (IsEMailChatAgent(szEmail)) - SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_ONLINE, &szEmail, 0, 0); + SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_ONLINE, &szEmail, nullptr, nullptr); else { if (bTemporary) db_set_b(hContact, "CList", "NotOnList", 1); mraSetStringExA(hContact, "MirVer", MIRVER_UNKNOWN); - SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_OFFLINE, &szEmail, 0, 0); + SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS | SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_OFFLINE, &szEmail, nullptr, nullptr); } } } @@ -608,7 +608,7 @@ DWORD CMraProto::MraSetContactStatus(MCONTACT hContact, DWORD dwNewStatus) } else { if (dwOldStatus == ID_STATUS_OFFLINE) { - DWORD dwTime = (DWORD)_time32(NULL); + DWORD dwTime = (DWORD)_time32(nullptr); setDword(hContact, "LogonTS", dwTime); if (bChatAgent) @@ -639,7 +639,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & if (!pszFrom.IsEmpty() || !pszSubject.IsEmpty()) { CMStringA szFrom, szSubject; if (GetEMailFromString(szFrom, szEmail)) - hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL); + hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, nullptr); mir_snwprintf(szStatusText, TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus); } @@ -675,7 +675,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & if (bTrayIconNewMailNotify) pcli->pfnRemoveEvent(0, (LPARAM)m_szModuleName); PUDeletePopup(hWndEMailPopupStatus); - hWndEMailPopupStatus = NULL; + hWndEMailPopupStatus = nullptr; } else { mir_snwprintf(szStatusText, TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal); @@ -861,7 +861,7 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode if (dwErrorCode == NO_ERROR) wcsncpy_s(szErrorText, TranslateW(lpwszErrText), _TRUNCATE); else { - dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), NULL) - 2); + dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), nullptr) - 2); szErrDescription[dwErrDescriptionSize] = 0; mir_snwprintf(szErrorText, L"%s %lu: %s", TranslateW(lpwszErrText), dwErrorCode, szErrDescription); } @@ -996,7 +996,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP SetDlgItemText(hWndDlg, IDC_XMSG, L""); SendMessage(hWndDlg, WM_TIMER, 0, 0); - SetTimer(hWndDlg, 1, 1000, 0); + SetTimer(hWndDlg, 1, 1000, nullptr); iRet = TRUE; } break; @@ -1065,7 +1065,7 @@ bool CMraProto::MraRequestXStatusDetails(DWORD dwXStatus) SetXStatusData *dat = (SetXStatusData*)mir_calloc(sizeof(SetXStatusData)); dat->dwXStatus = dwXStatus; dat->ppro = this; - return DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), NULL, SetXStatusDlgProc, (LPARAM)dat) != -1; + return DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)dat) != -1; } return false; @@ -1181,7 +1181,7 @@ bool CMraProto::MraSendReplyBlogStatus(MCONTACT hContact) SetBlogStatusData* dat = (SetBlogStatusData*)mir_calloc(sizeof(SetBlogStatusData)); dat->ppro = this; dat->hContact = hContact; - return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MINIBLOG), NULL, SendReplyBlogStatusDlgProc, (LPARAM)dat) != NULL; + return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MINIBLOG), nullptr, SendReplyBlogStatusDlgProc, (LPARAM)dat) != nullptr; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1238,7 +1238,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwRetErrorCode = ERROR_FILE_NOT_FOUND; prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0; - prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0); + prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, nullptr, 0); if (prdsiItems[dwRecDeepCurPos].hFind != INVALID_HANDLE_VALUE) { do { dwPathLen -= prdsiItems[dwRecDeepCurPos].dwFileNameLen; @@ -1256,13 +1256,13 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD if (dwRecDeepCurPos == dwRecDeepAllocated) { // need more space dwRecDeepAllocated += RECURSION_DATA_STACK_ITEMS_MIN; prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_realloc(prdsiItems, dwRecDeepAllocated * sizeof(RECURSION_DATA_STACK_ITEM)); - if (prdsiItems == NULL) { + if (prdsiItems == nullptr) { dwRecDeepCurPos = 0; dwRetErrorCode = GetLastError(); break; } } - prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0); + prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, nullptr, 0); } } else {// file @@ -1375,7 +1375,7 @@ static DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplac while (dwFoundCount) { for (i = 0; i < dwReplaceItemsCount; i++) - if (plpbtFounded[i] && (plpbtFounded[i] < plpbtFounded[dwFirstFoundIndex] || plpbtFounded[dwFirstFoundIndex] == NULL)) + if (plpbtFounded[i] && (plpbtFounded[i] < plpbtFounded[dwFirstFoundIndex] || plpbtFounded[dwFirstFoundIndex] == nullptr)) dwFirstFoundIndex = i; if (plpbtFounded[dwFirstFoundIndex]) {// in found @@ -1388,7 +1388,7 @@ static DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplac for (i = 0; i < dwReplaceItemsCount; i++) {// looking for in next time if (plpbtFounded[i] && plpbtFounded[i] < lpbtInBuffCurPrev) { plpbtFounded[i] = (LPBYTE)MemoryFind((lpbtInBuffCurPrev - (LPBYTE)lpInBuff), lpInBuff, dwInBuffSize, plpInReplaceItems[i], pdwInReplaceItemsCounts[i]); - if (plpbtFounded[i] == NULL) dwFoundCount--; + if (plpbtFounded[i] == nullptr) dwFoundCount--; } } } diff --git a/protocols/MRA/src/Sdk/ListMT.h b/protocols/MRA/src/Sdk/ListMT.h index 4c3f6dd5b2..ed9b8cfec9 100644 --- a/protocols/MRA/src/Sdk/ListMT.h +++ b/protocols/MRA/src/Sdk/ListMT.h @@ -76,7 +76,7 @@ typedef CONST PLIST_MT_ITERATOR PCLIST_MT_ITERATOR, LPCLIST_MT_ITERATOR; __inline size_t ListMTGetCount(PCLIST_MT pclmtListMT) { - return((size_t)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount,NULL,NULL)); + return((size_t)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount, nullptr, nullptr)); } @@ -89,12 +89,12 @@ __inline size_t ListMTItemAdd(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTIt if (pclmtListMT->plmtiLast) {// add node to end of list pclmtListMTItem->plmtiPrev=pclmtListMT->plmtiLast; - pclmtListMTItem->plmtiNext=NULL; + pclmtListMTItem->plmtiNext= nullptr; pclmtListMT->plmtiLast->plmtiNext=pclmtListMTItem; pclmtListMT->plmtiLast=pclmtListMTItem; }else{// add the first node to the linked list - pclmtListMTItem->plmtiPrev=NULL; - pclmtListMTItem->plmtiNext=NULL; + pclmtListMTItem->plmtiPrev= nullptr; + pclmtListMTItem->plmtiNext= nullptr; pclmtListMT->plmtiFirst=pclmtListMTItem; pclmtListMT->plmtiLast=pclmtListMTItem; } @@ -113,16 +113,16 @@ __inline DWORD ListMTItemDelete(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMT if (plmtiPrevNode || plmtiNextNode) { - if (plmtiPrevNode && plmtiNextNode==NULL) + if (plmtiPrevNode && plmtiNextNode == nullptr) {// This is the start node in the list to delete // отключился последний подключившийся - plmtiPrevNode->plmtiNext=NULL; + plmtiPrevNode->plmtiNext = nullptr; pclmtListMT->plmtiLast=plmtiPrevNode; }else{ - if (plmtiPrevNode==NULL && plmtiNextNode) + if (plmtiPrevNode == nullptr && plmtiNextNode) {// This is the end node in the list to delete // отключился первый подключившийся - plmtiNextNode->plmtiPrev=NULL; + plmtiNextNode->plmtiPrev = nullptr; pclmtListMT->plmtiFirst=plmtiNextNode; }else{// оключился клиент не первый и не последний //if (plmtiPrev && plmtiNext) @@ -133,11 +133,11 @@ __inline DWORD ListMTItemDelete(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMT } } }else{// This is the only node in the list to delete - pclmtListMT->plmtiFirst=NULL; - pclmtListMT->plmtiLast=NULL; + pclmtListMT->plmtiFirst = nullptr; + pclmtListMT->plmtiLast = nullptr; } - pclmtListMTItem->lpListMT=NULL; + pclmtListMTItem->lpListMT = nullptr; InterlockedDecrementPointer(&pclmtListMT->nCount);// pclmtListMT->nCount--; dwRetErrorCode=NO_ERROR; }else{// попытались удалить элемент не относящийся к данному списку diff --git a/protocols/MRA/src/Sdk/MemoryFind.h b/protocols/MRA/src/Sdk/MemoryFind.h index 75072540bd..f41ea64b6d 100644 --- a/protocols/MRA/src/Sdk/MemoryFind.h +++ b/protocols/MRA/src/Sdk/MemoryFind.h @@ -34,7 +34,7 @@ __inline void *MemoryFind(size_t dwFrom,const void *pBuff,size_t dwBuffSize,const void *pWhatFind,size_t dwWhatFindSize) { - void *pRet=NULL; + void *pRet = nullptr; if (pBuff && dwBuffSize && pWhatFind && dwWhatFindSize && (dwFrom+dwWhatFindSize)<=dwBuffSize) { diff --git a/protocols/MRA/src/Sdk/MemoryFindByte.h b/protocols/MRA/src/Sdk/MemoryFindByte.h index 27a3b96149..146fd74b30 100644 --- a/protocols/MRA/src/Sdk/MemoryFindByte.h +++ b/protocols/MRA/src/Sdk/MemoryFindByte.h @@ -34,7 +34,7 @@ __inline void *MemoryFindByte(size_t dwFrom,const void *pBuff,size_t dwBuffSize,unsigned char chWhatFind) { - void *pRet=NULL; + void *pRet = nullptr; if (pBuff && dwBuffSize && dwFrom ///////////////////////////////////////////////////////////////////////////////////////// // MSN message queue support - int MsgQueue_Add(const char* wlid, int msgType, const char* msg, int msglen, filetransfer* ft = NULL, int flags = 0, STRLIST *cnt = NULL); + int MsgQueue_Add(const char* wlid, int msgType, const char* msg, int msglen, filetransfer* ft = nullptr, int flags = 0, STRLIST *cnt = nullptr); const char* MsgQueue_CheckContact(const char* wlid, time_t tsc = 0); const char* MsgQueue_GetNextRecipient(void); bool MsgQueue_GetNext(const char* wlid, MsgQueueEntry& retVal); int MsgQueue_NumMsg(const char* wlid); - void MsgQueue_Clear(const char* wlid = NULL, bool msg = false); + void MsgQueue_Clear(const char* wlid = nullptr, bool msg = false); void MsgQueue_Init(void); void MsgQueue_Uninit(void); @@ -321,7 +321,7 @@ struct CMsnProto : public PROTO ///////////////////////////////////////////////////////////////////////////////////////// // MSN contact list - int Lists_Add(int list, int netId, const char* email, MCONTACT hContact = NULL, const char* nick = NULL, const char* invite = NULL); + int Lists_Add(int list, int netId, const char* email, MCONTACT hContact = NULL, const char* nick = nullptr, const char* invite = nullptr); bool Lists_IsInList(int list, const char* email); int Lists_GetMask(const char* email); int Lists_GetNetId(const char* email); @@ -346,11 +346,11 @@ struct CMsnProto : public PROTO bool MSN_RefreshContactList(void); bool MSN_IsMyContact(MCONTACT hContact); - bool MSN_IsMeByContact(MCONTACT hContact, char* szEmail = NULL); - bool MSN_AddUser(MCONTACT hContact, const char* email, int netId, int flags, const char *msg = NULL); + bool MSN_IsMeByContact(MCONTACT hContact, char* szEmail = nullptr); + bool MSN_AddUser(MCONTACT hContact, const char* email, int netId, int flags, const char *msg = nullptr); void MSN_AddAuthRequest(const char *email, const char *nick, const char *reason); void MSN_SetContactDb(MCONTACT hContact, const char *szEmail); - MCONTACT MSN_HContactFromEmail(const char* msnEmail, const char* msnNick = NULL, bool addIfNeeded = false, bool temporary = false); + MCONTACT MSN_HContactFromEmail(const char* msnEmail, const char* msnNick = nullptr, bool addIfNeeded = false, bool temporary = false); MCONTACT MSN_HContactFromChatID(const char* wlid); MCONTACT AddToListByEmail(const char *email, const char *nick, DWORD flags); diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index 13aa98cb49..df61064891 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -214,7 +214,7 @@ char* GetGlobalIp(void); template void UrlDecode(chartype* str); -char* MSN_GetAvatarHash(char* szContext, char** pszUrl = NULL); +char* MSN_GetAvatarHash(char* szContext, char** pszUrl = nullptr); bool MSN_MsgWndExist(MCONTACT hContact); #define MSN_SendNickname(a) MSN_SendNicknameUtf(UTF8(a)) @@ -238,7 +238,7 @@ time_t MsnTSToUnixtime(const char *pszTS); wchar_t* EscapeChatTags(const wchar_t* pszText); -void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def = NULL); +void overrideStr(wchar_t*& dest, const wchar_t* src, bool unicode, const wchar_t* def = nullptr); char* arrayToHex(BYTE* data, size_t datasz); @@ -692,7 +692,7 @@ public: bool Load(); void Save(); virtual bool Refresh(bool = false) { return false; } - bool Expired(time_t t = time(NULL)); + bool Expired(time_t t = time(nullptr)); void Clear(); const char *Token(); __forceinline operator char*() const { return m_pszToken; } @@ -767,7 +767,7 @@ struct MsnContact OBJLIST places; - MsnContact() : email(0), invite(0), nick(0), + MsnContact() : email(nullptr), invite(nullptr), nick(nullptr), hContact(0), list(0), netId(0), p2pMsgId(0), cap1(0), cap2(0), places(1, CompareId) { } diff --git a/protocols/MinecraftDynmap/src/proto.h b/protocols/MinecraftDynmap/src/proto.h index cc5b296c48..15327988f5 100644 --- a/protocols/MinecraftDynmap/src/proto.h +++ b/protocols/MinecraftDynmap/src/proto.h @@ -70,7 +70,7 @@ public: // Chat handling void AddChat(const char *id, const char *name); - void UpdateChat(const char *name, const char *message, const time_t timestamp = time(NULL), bool addtochat = true); + void UpdateChat(const char *name, const char *message, const time_t timestamp = time(nullptr), bool addtochat = true); void AddChatContact(const char *nick); void DeleteChatContact(const char *name); void SetChatStatus(int); @@ -110,8 +110,8 @@ public: void __inline reset_error() { error_count_ = 0; } // HTTP communication - http::response sendRequest(const int request_type, std::string *post_data = NULL, std::string *get_data = NULL); - std::string chooseAction(int, std::string *get_data = NULL); + http::response sendRequest(const int request_type, std::string *post_data = nullptr, std::string *get_data = nullptr); + std::string chooseAction(int, std::string *get_data = nullptr); NETLIBHTTPHEADER *get_request_headers(int request_type, int *headers_count); // Requests and processing diff --git a/protocols/MinecraftDynmap/src/utils.h b/protocols/MinecraftDynmap/src/utils.h index 1944ec41e0..fd9e0c7616 100644 --- a/protocols/MinecraftDynmap/src/utils.h +++ b/protocols/MinecraftDynmap/src/utils.h @@ -56,7 +56,7 @@ public: void Unlock() { ReleaseMutex(handle_); - handle_ = 0; + handle_ = nullptr; } private: HANDLE handle_; diff --git a/protocols/Omegle/src/client.h b/protocols/Omegle/src/client.h index db44086101..60acaf0623 100644 --- a/protocols/Omegle/src/client.h +++ b/protocols/Omegle/src/client.h @@ -41,7 +41,7 @@ public: // Client definition Omegle_client() { - nick_ = NULL; + nick_ = nullptr; //msgid_ = 0; state_ = STATE_INACTIVE; @@ -49,12 +49,12 @@ public: error_count_ = 0; - parent = NULL; - handle_ = NULL; - hConnection = NULL; - hEventsConnection = NULL; - connection_lock_ = NULL; - chatHandle_ = NULL; + parent = nullptr; + handle_ = nullptr; + hConnection = nullptr; + hEventsConnection = nullptr; + connection_lock_ = nullptr; + chatHandle_ = nullptr; } HNETLIBCONN hConnection; @@ -108,10 +108,10 @@ public: bool send_message(const std::string &message_text); // HTTP communication - http::response flap(const int request_type, std::string *post_data = NULL, std::string *get_data = NULL); + http::response flap(const int request_type, std::string *post_data = nullptr, std::string *get_data = nullptr); std::string choose_server(int); - std::string choose_action(int, std::string *get_data = NULL); + std::string choose_action(int, std::string *get_data = nullptr); NETLIBHTTPHEADER *get_request_headers(int request_type, int *headers_count); diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 23a96e44c5..4eac66f67e 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -95,7 +95,7 @@ public: void DeleteChatContact(const wchar_t *name); void SetChatStatus(int); void ClearChat(); - void SetTopic(const wchar_t *topic = NULL); + void SetTopic(const wchar_t *topic = nullptr); MCONTACT GetChatHandle(); // Connection client diff --git a/protocols/Omegle/src/stdafx.h b/protocols/Omegle/src/stdafx.h index 19412d8a2b..f216b4932c 100644 --- a/protocols/Omegle/src/stdafx.h +++ b/protocols/Omegle/src/stdafx.h @@ -93,7 +93,7 @@ public: void Unlock() { ReleaseMutex(handle_); - handle_ = 0; + handle_ = nullptr; } private: HANDLE handle_; diff --git a/protocols/Tox/src/http_request.h b/protocols/Tox/src/http_request.h index 18b8228f63..d51aab289f 100644 --- a/protocols/Tox/src/http_request.h +++ b/protocols/Tox/src/http_request.h @@ -27,14 +27,14 @@ private: cbSize = sizeof(NETLIBHTTPREQUEST); requestType = type; flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT; - szUrl = NULL; - headers = NULL; + szUrl = nullptr; + headers = nullptr; headersCount = 0; - pData = NULL; + pData = nullptr; dataLength = 0; resultCode = 0; - szResultDescr = NULL; - nlc = NULL; + szResultDescr = nullptr; + nlc = nullptr; timeout = 0; } @@ -90,7 +90,7 @@ public: void SetData(const char *data, size_t size) { - if (pData != NULL) + if (pData != nullptr) mir_free(pData); dataLength = (int)size; diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 77f9285050..a5ced0c8f9 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -184,7 +184,7 @@ INT_PTR CToxProto::OnChangePassword(WPARAM, LPARAM) INT_PTR CToxProto::OnRemovePassword(WPARAM, LPARAM) { const wchar_t *message = TranslateT("Removing the password will lead to decryption of the profile.\r\nAre you sure to remove password?"); - int result = MessageBox(NULL, message, TranslateT("Remove password"), MB_YESNO | MB_ICONQUESTION); + int result = MessageBox(nullptr, message, TranslateT("Remove password"), MB_YESNO | MB_ICONQUESTION); if (result == IDYES) { delSetting(TOX_SETTINGS_PASSWORD); SaveToxProfile(m_toxThread->Tox()); diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index cfbee1b4ec..3971d76a72 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -161,7 +161,7 @@ private: ToxHexAddress GetContactPublicKey(const Tox *tox, const int friendNumber); - MCONTACT AddContact(const char *address, const char *nick = NULL, const char *dnsId = NULL, bool isTemporary = false); + MCONTACT AddContact(const char *address, const char *nick = nullptr, const char *dnsId = nullptr, bool isTemporary = false); MCONTACT GetContactFromAuthEvent(MEVENT hEvent); diff --git a/protocols/Tox/src/tox_thread.h b/protocols/Tox/src/tox_thread.h index 37372177dc..d47138822e 100644 --- a/protocols/Tox/src/tox_thread.h +++ b/protocols/Tox/src/tox_thread.h @@ -7,8 +7,8 @@ private: Tox *tox; public: - CToxThread(Tox_Options *options, TOX_ERR_NEW *error = NULL) - : tox(NULL) + CToxThread(Tox_Options *options, TOX_ERR_NEW *error = nullptr) + : tox(nullptr) { tox = tox_new(options, error); } @@ -19,7 +19,7 @@ public: if (tox) { tox_kill(tox); - tox = NULL; + tox = nullptr; } } diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index e1e7dd051e..46facedcc2 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -98,7 +98,7 @@ private: static void CALLBACK APC_callback(ULONG_PTR p); void UpdateChat(const twitter_user &update); - void AddChatContact(const char *name,const char *nick=0); + void AddChatContact(const char *name,const char *nick = nullptr); void DeleteChatContact(const char *name); void SetChatStatus(int); diff --git a/protocols/Twitter/src/utility.h b/protocols/Twitter/src/utility.h index 525e99428c..da2b4eb4a0 100644 --- a/protocols/Twitter/src/utility.h +++ b/protocols/Twitter/src/utility.h @@ -30,7 +30,7 @@ uint64_t str2int(const std::string &str); class mir_twitter : public twitter { public: - mir_twitter() : twitter(), handle_(NULL), httpPOST_(NULL) {} + mir_twitter() : twitter(), handle_(nullptr), httpPOST_(nullptr) {} void set_handle(PROTO_INTERFACE *ppro, HNETLIBUSER h) { ppro_ = ppro; @@ -73,7 +73,7 @@ public: std::wstring OAuthConcatenateRequestElements( const std::wstring& httpMethod, std::wstring url, const std::wstring& parameters ); std::map CrackURL(std::wstring ); std::wstring brook_httpsend(std::wstring, std::wstring, std::wstring, std::wstring); - void Disconnect(void) { if (httpPOST_) Netlib_CloseHandle(httpPOST_); httpPOST_ = NULL; } + void Disconnect(void) { if (httpPOST_) Netlib_CloseHandle(httpPOST_); httpPOST_ = nullptr; } std::wstring OAuthNormalizeUrl( const std::wstring& url ); std::wstring OAuthNormalizeRequestParameters( const OAuthParameters& requestParameters ); OAuthParameters ParseQueryString( const std::wstring& url ); diff --git a/utils/mir_buffer.h b/utils/mir_buffer.h index f8cfd41fa4..fae75e2d08 100644 --- a/utils/mir_buffer.h +++ b/utils/mir_buffer.h @@ -85,7 +85,7 @@ inline void __bcopy(WCHAR *dest, const char *orig, size_t len) inline void __bcopy(char *dest, const WCHAR *orig, size_t len) { - WideCharToMultiByte(CallService("LangPack/GetCodePage", 0, 0), 0, orig, (int)len, dest, (int)len, NULL, NULL); + WideCharToMultiByte(CallService("LangPack/GetCodePage", 0, 0), 0, orig, (int)len, dest, (int)len, nullptr, nullptr); } @@ -97,13 +97,13 @@ class Buffer size_t len; T *str; - Buffer() : str(NULL), size(0), len(0) + Buffer() : str(nullptr), size(0), len(0) { alloc(1); pack(); } - Buffer(T in) : str(NULL), size(0), len(0) + Buffer(T in) : str(nullptr), size(0), len(0) { if (in == NULL) { @@ -124,7 +124,7 @@ class Buffer void pack() { - if (str != NULL) + if (str != nullptr) memset(&str[len], 0, sizeof(str[len])); } @@ -133,7 +133,7 @@ class Buffer if (total > size) { size = total + 256 - total % 256; - if (str == NULL) + if (str == nullptr) str = (T *) mir_alloc(size * sizeof(T)); else str = (T *) mir_realloc(str, size * sizeof(T)); @@ -142,10 +142,10 @@ class Buffer void free() { - if (str != NULL) + if (str != nullptr) { mir_free(str); - str = NULL; + str = nullptr; len = size = 0; } } @@ -179,7 +179,7 @@ class Buffer void append(const char *app, size_t appLen = -1) { - if (app == NULL) + if (app == nullptr) return; if (appLen == -1) appLen = __blen(app); @@ -194,7 +194,7 @@ class Buffer void append(const WCHAR *app, size_t appLen = -1) { - if (app == NULL) + if (app == nullptr) return; if (appLen == -1) appLen = __blen(app); @@ -209,7 +209,7 @@ class Buffer void append(const Buffer &app) { - if (app.str == NULL) + if (app.str == nullptr) return; size_t appLen = app.len; @@ -304,7 +304,7 @@ class Buffer void translate() { - if (str == NULL || len == 0) + if (str == nullptr || len == 0) return; str[len] = 0; @@ -347,14 +347,14 @@ class Buffer T *detach() { T *ret = str; - str = NULL; + str = nullptr; len = 0; return ret; } void trimRight() { - if (str == NULL) + if (str == nullptr) return; int e; @@ -368,7 +368,7 @@ class Buffer void trimLeft() { - if (str == NULL) + if (str == nullptr) return; int s; diff --git a/utils/std_string_utils.h b/utils/std_string_utils.h index 6608d7a0d9..ad130d12b1 100644 --- a/utils/std_string_utils.h +++ b/utils/std_string_utils.h @@ -56,7 +56,7 @@ namespace utils namespace number { - int random(int min, int max, unsigned int *value = NULL); + int random(int min, int max, unsigned int *value = nullptr); }; namespace text @@ -72,7 +72,7 @@ namespace utils std::string source_get_value(std::string* data, unsigned int argument_count, ...); std::string source_get_value2(std::string* data, const char *term, const char *endings, bool wholeString = false); std::string source_get_form_data(std::string* data, bool hiddenOnly = false); - std::string rand_string(int len, const char *chars = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz", unsigned int *number = NULL); + std::string rand_string(int len, const char *chars = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz", unsigned int *number = nullptr); std::string truncate_utf8(const std::string &text, size_t maxLength); void explode(std::string str, const std::string &separator, std::vector* results); void append_ordinal(unsigned long value, std::string* data); diff --git a/utils/utf8_helpers.h b/utils/utf8_helpers.h index 34ebfd5104..d41baa3168 100644 --- a/utils/utf8_helpers.h +++ b/utils/utf8_helpers.h @@ -29,14 +29,14 @@ Boston, MA 02111-1307, USA. class TcharToUtf8 { public: - TcharToUtf8(const char *str) : utf8(NULL) + TcharToUtf8(const char *str) : utf8(nullptr) { - int size = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + int size = MultiByteToWideChar(CP_ACP, 0, str, -1, nullptr, 0); if (size <= 0) throw L"Could not convert string to WCHAR"; WCHAR *tmp = (WCHAR *) mir_alloc(size * sizeof(WCHAR)); - if (tmp == NULL) + if (tmp == nullptr) throw L"mir_alloc returned NULL"; MultiByteToWideChar(CP_ACP, 0, str, -1, tmp, size); @@ -47,7 +47,7 @@ public: } - TcharToUtf8(const WCHAR *str) : utf8(NULL) + TcharToUtf8(const WCHAR *str) : utf8(nullptr) { init(str); } @@ -55,14 +55,14 @@ public: ~TcharToUtf8() { - if (utf8 != NULL) + if (utf8 != nullptr) mir_free(utf8); } char *detach() { char *ret = utf8; - utf8 = NULL; + utf8 = nullptr; return ret; } @@ -86,15 +86,15 @@ private: void init(const WCHAR *str) { - int size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL); + int size = WideCharToMultiByte(CP_UTF8, 0, str, -1, nullptr, 0, nullptr, nullptr); if (size <= 0) throw L"Could not convert string to UTF8"; utf8 = (char *) mir_alloc(size); - if (utf8 == NULL) + if (utf8 == nullptr) throw L"mir_alloc returned NULL"; - WideCharToMultiByte(CP_UTF8, 0, str, -1, utf8, size, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, str, -1, utf8, size, nullptr, nullptr); } }; @@ -103,17 +103,17 @@ private: class Utf8ToTchar { public: - Utf8ToTchar(const char *str) : tchar(NULL) + Utf8ToTchar(const char *str) : tchar(nullptr) { - if (str == NULL) + if (str == nullptr) return; - int size = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); + int size = MultiByteToWideChar(CP_UTF8, 0, str, -1, nullptr, 0); if (size <= 0) throw L"Could not convert string to WCHAR"; WCHAR *tmp = (WCHAR *) mir_alloc(size * sizeof(WCHAR)); - if (tmp == NULL) + if (tmp == nullptr) throw L"mir_alloc returned NULL"; MultiByteToWideChar(CP_UTF8, 0, str, -1, tmp, size); @@ -124,7 +124,7 @@ public: #else - size = WideCharToMultiByte(CP_ACP, 0, tmp, -1, NULL, 0, NULL, NULL); + size = WideCharToMultiByte(CP_ACP, 0, tmp, -1, nullptr, 0, nullptr, nullptr); if (size <= 0) { mir_free(tmp); @@ -132,13 +132,13 @@ public: } tchar = (wchar_t *) mir_alloc(size * sizeof(char)); - if (tchar == NULL) + if (tchar == nullptr) { mir_free(tmp); throw L"mir_alloc returned NULL"; } - WideCharToMultiByte(CP_ACP, 0, tmp, -1, tchar, size, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, tmp, -1, tchar, size, nullptr, nullptr); mir_free(tmp); @@ -147,14 +147,14 @@ public: ~Utf8ToTchar() { - if (tchar != NULL) + if (tchar != nullptr) mir_free(tchar); } wchar_t *detach() { wchar_t *ret = tchar; - tchar = NULL; + tchar = nullptr; return ret; } @@ -181,9 +181,9 @@ private: class CharToTchar { public: - CharToTchar(const char *str) : tchar(NULL) + CharToTchar(const char *str) : tchar(nullptr) { - if (str == NULL) + if (str == nullptr) return; #ifdef UNICODE @@ -201,7 +201,7 @@ public: ~CharToTchar() { #ifdef UNICODE - if (tchar != NULL) + if (tchar != nullptr) mir_free(tchar); #endif } @@ -211,10 +211,10 @@ public: #ifdef UNICODE wchar_t *ret = tchar; #else - wchar_t *ret = (tchar == NULL ? NULL : mir_strdup(tchar)); + wchar_t *ret = (tchar == nullptr ? nullptr : mir_strdup(tchar)); #endif - tchar = NULL; + tchar = nullptr; return ret; } @@ -245,9 +245,9 @@ private: class WcharToTchar { public: - WcharToTchar(const WCHAR *str) : tchar(NULL) + WcharToTchar(const WCHAR *str) : tchar(nullptr) { - if (str == NULL) + if (str == nullptr) return; #ifdef UNICODE @@ -265,7 +265,7 @@ public: ~WcharToTchar() { #ifndef UNICODE - if (tchar != NULL) + if (tchar != nullptr) mir_free(tchar); #endif } @@ -273,12 +273,12 @@ public: wchar_t *detach() { #ifdef UNICODE - wchar_t *ret = (tchar == NULL ? NULL : mir_wstrdup(tchar)); + wchar_t *ret = (tchar == nullptr ? nullptr : mir_wstrdup(tchar)); #else wchar_t *ret = tchar; #endif - tchar = NULL; + tchar = nullptr; return ret; } @@ -311,9 +311,9 @@ private: class CharToWchar { public: - CharToWchar(const char *str) : wchar(NULL) + CharToWchar(const char *str) : wchar(nullptr) { - if (str == NULL) + if (str == nullptr) return; wchar = mir_a2u(str); @@ -322,14 +322,14 @@ public: ~CharToWchar() { - if (wchar != NULL) + if (wchar != nullptr) mir_free(wchar); } WCHAR *detach() { WCHAR *ret = wchar; - wchar = NULL; + wchar = nullptr; return ret; } @@ -357,9 +357,9 @@ private: class TcharToChar { public: - TcharToChar(const wchar_t *str) : val(NULL) + TcharToChar(const wchar_t *str) : val(nullptr) { - if (str == NULL) + if (str == nullptr) return; #ifdef UNICODE @@ -377,7 +377,7 @@ public: ~TcharToChar() { #ifdef UNICODE - if (val != NULL) + if (val != nullptr) mir_free(val); #endif } @@ -387,10 +387,10 @@ public: #ifdef UNICODE char *ret = val; #else - char *ret = (val == NULL ? NULL : mir_strdup(val)); + char *ret = (val == nullptr ? nullptr : mir_strdup(val)); #endif - val = NULL; + val = nullptr; return ret; } @@ -421,9 +421,9 @@ private: class TcharToWchar { public: - TcharToWchar(const wchar_t *str) : val(NULL) + TcharToWchar(const wchar_t *str) : val(nullptr) { - if (str == NULL) + if (str == nullptr) return; #ifdef UNICODE @@ -441,7 +441,7 @@ public: ~TcharToWchar() { #ifndef UNICODE - if (val != NULL) + if (val != nullptr) mir_free(val); #endif } @@ -449,12 +449,12 @@ public: WCHAR *detach() { #ifdef UNICODE - WCHAR *ret = (val == NULL ? NULL : mir_wstrdup(val)); + WCHAR *ret = (val == nullptr ? nullptr : mir_wstrdup(val)); #else WCHAR *ret = val; #endif - val = NULL; + val = nullptr; return ret; } @@ -487,30 +487,30 @@ private: class BstrToTchar { public: - BstrToTchar() : bstr(NULL) + BstrToTchar() : bstr(nullptr) #ifndef UNICODE , tchar(NULL) #endif { } - BstrToTchar(const WCHAR *str) : bstr(NULL) + BstrToTchar(const WCHAR *str) : bstr(nullptr) #ifndef UNICODE - , tchar(NULL) + , tchar(nullptr) #endif { - if (str == NULL) + if (str == nullptr) return; bstr = SysAllocString(str); } - BstrToTchar(const char *str) : bstr(NULL) + BstrToTchar(const char *str) : bstr(nullptr) #ifndef UNICODE - , tchar(NULL) + , tchar(nullptr) #endif { - if (str == NULL) + if (str == nullptr) return; bstr = SysAllocString(CharToWchar(str)); @@ -519,7 +519,7 @@ public: ~BstrToTchar() { - if (bstr != NULL) + if (bstr != nullptr) SysFreeString(bstr); #ifndef UNICODE @@ -530,7 +530,7 @@ public: BSTR detach() { BSTR ret = bstr; - bstr = NULL; + bstr = nullptr; return ret; } @@ -542,7 +542,7 @@ public: #else - if (tchar == NULL) + if (tchar == nullptr) tchar = mir_u2a(bstr); return tchar; @@ -573,10 +573,10 @@ private: void freeTchar() { - if (tchar != NULL) + if (tchar != nullptr) { mir_free(tchar); - tchar = NULL; + tchar = nullptr; } } -- cgit v1.2.3