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 --- 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 ++++++-------- 11 files changed, 31 insertions(+), 29 deletions(-) (limited to 'plugins/ExternalAPI') 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); -- cgit v1.2.3