diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:03:31 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:07:33 +0100 |
commit | a7c24ca48995cf2bf436156302f96b91bf135409 (patch) | |
tree | 953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/Exchange/src | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/Exchange/src')
-rw-r--r-- | plugins/Exchange/src/MirandaExchange.cpp | 234 | ||||
-rw-r--r-- | plugins/Exchange/src/dlg_handlers.cpp | 12 | ||||
-rw-r--r-- | plugins/Exchange/src/emails.cpp | 12 | ||||
-rw-r--r-- | plugins/Exchange/src/exchange.cpp | 4 | ||||
-rw-r--r-- | plugins/Exchange/src/hooked_events.cpp | 14 | ||||
-rw-r--r-- | plugins/Exchange/src/utils.cpp | 4 |
6 files changed, 140 insertions, 140 deletions
diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index a60992410f..acf53d85cf 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -46,9 +46,9 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code HRESULT hr = NOERROR;
HRESULT hrT = NOERROR;
SCODE sc = 0;
- LPMAPITABLE lpTable = NULL;
- LPSRowSet lpRows = NULL;
- LPENTRYID lpeid = NULL;
+ LPMAPITABLE lpTable = nullptr;
+ LPSRowSet lpRows = nullptr;
+ LPENTRYID lpeid = nullptr;
ULONG cbeid = 0;
ULONG cRows = 0;
ULONG i = 0;
@@ -68,12 +68,12 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code if (FAILED(hrT))
goto err_out;
// Go to the beginning of the recipient table for the envelope
- hrT = MAPICALL(lpTable)->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
+ hrT = MAPICALL(lpTable)->SeekRow( BOOKMARK_BEGINNING, 0, nullptr);
if (FAILED(hrT))
goto err_out;
// Read all the rows of the table
hrT = MAPICALL(lpTable)->QueryRows( cRows, 0, &lpRows);
- if (SUCCEEDED(hrT) && lpRows != NULL && lpRows->cRows == 0) {
+ if (SUCCEEDED(hrT) && lpRows != nullptr && lpRows->cRows == 0) {
hrT = MAPI_E_NOT_FOUND;
goto err_out;
}
@@ -87,7 +87,7 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code sc = MAPIAllocateBuffer(cbeid, (void **)&lpeid);
if (FAILED(sc)) {
cbeid = 0;
- lpeid = NULL;
+ lpeid = nullptr;
} else {
// Copy entry ID of message store
memcpy(lpeid, lpRows->aRow[i].lpProps[1].Value.bin.lpb, cbeid);
@@ -96,7 +96,7 @@ HRESULT HrMAPIFindDefaultMsgStore( // RETURNS: return code }
err_out:
- if (lpRows != NULL)
+ if (lpRows != nullptr)
FreeProws(lpRows);
UlRelease(lpTable);
*lpcbeid = cbeid;
@@ -108,28 +108,28 @@ err_out: CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID)
{
- m_szSender = NULL ;
- m_szSubject = NULL ;
- m_szEntryID = NULL ;
+ m_szSender = nullptr ;
+ m_szSubject = nullptr ;
+ m_szEntryID = nullptr ;
m_nSizeSender = 0 ;
m_nSizeSubject = 0 ;
m_nSizeEntryID = 0 ;
- if (NULL != szSender) {
+ if (nullptr != szSender) {
m_nSizeSender = (UINT)mir_wstrlen(szSender)+1;
m_szSender = new wchar_t[ m_nSizeSender ];
memset(m_szSender, 0, m_nSizeSender * sizeof(wchar_t));
mir_wstrcpy(m_szSender, szSender);
}
- if (NULL != szSubject) {
+ if (nullptr != szSubject) {
m_nSizeSubject = (UINT)mir_wstrlen(szSubject) +1;
m_szSubject = new wchar_t[m_nSizeSubject];
memset(m_szSubject, 0, m_nSizeSubject * sizeof(wchar_t));
mir_wstrcpy(m_szSubject, szSubject);
}
- if (NULL != szEntryID) {
+ if (nullptr != szEntryID) {
m_nSizeEntryID = (UINT)mir_strlen( szEntryID ) +1;
m_szEntryID = new char[m_nSizeEntryID];
memset(m_szEntryID, 0, m_nSizeEntryID * sizeof(char));
@@ -139,36 +139,36 @@ CKeeper::CKeeper( LPTSTR szSender, LPTSTR szSubject, LPSTR szEntryID) CKeeper::~CKeeper()
{
- if ( m_nSizeSender>0 && NULL != m_szSender )
+ if ( m_nSizeSender>0 && nullptr != m_szSender )
{
m_nSizeSender =0;
delete[] m_szSender;
- m_szSender = NULL;
+ m_szSender = nullptr;
}
- if ( m_nSizeSubject>0 && NULL != m_szSubject )
+ if ( m_nSizeSubject>0 && nullptr != m_szSubject )
{
m_nSizeSubject =0;
delete[] m_szSubject;
- m_szSubject = NULL;
+ m_szSubject = nullptr;
}
- if ( m_nSizeEntryID>0 && NULL != m_szEntryID )
+ if ( m_nSizeEntryID>0 && nullptr != m_szEntryID )
{
m_nSizeEntryID = 0;
delete[] m_szEntryID;
- m_szEntryID = NULL;
+ m_szEntryID = nullptr;
}
}
CMirandaExchange::CMirandaExchange()
{
- m_szUsername = NULL ;
- m_szPassword = NULL ;
- m_szExchangeServer = NULL ;
- m_lpMAPISession = NULL ;
- m_lpInbox = NULL ;
- m_lpMDB = NULL;
+ m_szUsername = nullptr ;
+ m_szPassword = nullptr ;
+ m_szExchangeServer = nullptr ;
+ m_lpMAPISession = nullptr ;
+ m_lpInbox = nullptr ;
+ m_lpMDB = nullptr;
m_bLoginOK = false ;
m_bFolderInboxOK = false ;
m_nNumberOfHeaders = 0 ;
@@ -176,51 +176,51 @@ CMirandaExchange::CMirandaExchange() CMirandaExchange::~CMirandaExchange()
{
- if ( NULL != m_szUsername )
+ if ( nullptr != m_szUsername )
{
delete[] m_szUsername;
- m_szUsername = NULL;
+ m_szUsername = nullptr;
}
- if ( NULL != m_szPassword )
+ if ( nullptr != m_szPassword )
{
delete[] m_szPassword;
- m_szPassword = NULL;
+ m_szPassword = nullptr;
}
- if ( NULL != m_szExchangeServer )
+ if ( nullptr != m_szExchangeServer )
{
delete[] m_szExchangeServer;
- m_szExchangeServer = NULL;
+ m_szExchangeServer = nullptr;
}
- if ( NULL != m_lpInbox )
+ if ( nullptr != m_lpInbox )
{
UlRelease(m_lpInbox);
- m_lpInbox = NULL;
+ m_lpInbox = nullptr;
}
- if ( NULL != m_lpMDB )
+ if ( nullptr != m_lpMDB )
{
UlRelease(m_lpMDB );
- m_lpMDB = NULL;
+ m_lpMDB = nullptr;
}
- if ( NULL!= m_lpMAPISession )
+ if ( nullptr!= m_lpMAPISession )
{
m_lpMAPISession->Logoff(NULL,NULL,NULL);
UlRelease(m_lpMAPISession );
- m_lpMAPISession = NULL;
+ m_lpMAPISession = nullptr;
}
if ( m_nNumberOfHeaders>0)
{
for( UINT i=0; i<m_nNumberOfHeaders; i++ )
{
- if ( NULL != m_HeadersKeeper[i])
+ if ( nullptr != m_HeadersKeeper[i])
{
delete m_HeadersKeeper[i];
- m_HeadersKeeper[i] = NULL;
+ m_HeadersKeeper[i] = nullptr;
}
}
@@ -237,10 +237,10 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (!lppUnk) return MAPI_E_INVALID_PARAMETER;
HRESULT hRes = S_OK;
ULONG ulObjType = NULL;
- LPUNKNOWN lpUnk = NULL;
+ LPUNKNOWN lpUnk = nullptr;
ULONG ulNoCacheFlags = NULL;
- *lppUnk = NULL;
+ *lppUnk = nullptr;
//ulFlags |= MAPI_NO_CACHE;
//in case we need to retry without MAPI_NO_CACHE - do not add MAPI_NO_CACHE to ulFlags after this point
@@ -253,7 +253,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, lpMDB->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulFlags,
&ulObjType,
&lpUnk);
@@ -261,11 +261,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, {
hRes = S_OK;
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
(lpMDB->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulNoCacheFlags,
&ulObjType,
&lpUnk));
@@ -273,7 +273,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes))
{
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
}
}
if (lpAB && !lpUnk)
@@ -283,7 +283,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpAB->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulFlags,
&ulObjType,
&lpUnk));
@@ -291,11 +291,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, {
hRes = S_OK;
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
(lpAB->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulNoCacheFlags,
&ulObjType,
&lpUnk));
@@ -303,7 +303,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes))
{
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
}
}
@@ -314,7 +314,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpContainer->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulFlags,
&ulObjType,
&lpUnk));
@@ -322,11 +322,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, {
hRes = S_OK;
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
(lpContainer->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulNoCacheFlags,
&ulObjType,
&lpUnk));
@@ -334,7 +334,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes))
{
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
}
}
@@ -345,7 +345,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, (lpMAPISession->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulFlags,
&ulObjType,
&lpUnk));
@@ -353,11 +353,11 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, {
hRes = S_OK;
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
(lpMAPISession->OpenEntry(
cbEntryID,
lpEntryID,
- NULL,//no interface
+ nullptr,//no interface
ulNoCacheFlags,
&ulObjType,
&lpUnk));
@@ -365,7 +365,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, if (FAILED(hRes))
{
if (lpUnk) (lpUnk)->Release();
- lpUnk = NULL;
+ lpUnk = nullptr;
}
}
@@ -382,7 +382,7 @@ HRESULT CallOpenEntry( LPMDB lpMDB, LPADRBOOK lpAB, LPMAPICONTAINER lpContainer, LPSBinary lpSBinary, ULONG ulFlags, ULONG* ulObjTypeRet, LPUNKNOWN* lppUnk)
{
return CallOpenEntry( lpMDB, lpAB, lpContainer, lpMAPISession, lpSBinary?lpSBinary->cb:0,
- (LPENTRYID)(lpSBinary?lpSBinary->lpb:0), ulFlags, ulObjTypeRet, lppUnk);
+ (LPENTRYID)(lpSBinary?lpSBinary->lpb:nullptr), ulFlags, ulObjTypeRet, lppUnk);
}
HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPassword, LPCTSTR szExchangeServer )
@@ -391,7 +391,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass UINT nSize = 0;
short nSizeOfTCHAR = sizeof( wchar_t );
- if (m_szUsername == NULL && NULL != szUsername) {
+ if (m_szUsername == nullptr && nullptr != szUsername) {
nSize = (UINT)mir_wstrlen(szUsername);
if (nSize > 0) {
nSize++;
@@ -401,7 +401,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass }
}
- if (m_szPassword == NULL && NULL != szPassword) {
+ if (m_szPassword == nullptr && nullptr != szPassword) {
nSize = (UINT)mir_wstrlen(szPassword);
if (nSize > 0) {
nSize++;
@@ -411,7 +411,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass }
}
- if (m_szExchangeServer == NULL && NULL != szExchangeServer) {
+ if (m_szExchangeServer == nullptr && nullptr != szExchangeServer) {
nSize = (UINT)mir_wstrlen(szExchangeServer);
if (nSize > 0) {
nSize++;
@@ -421,7 +421,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass }
}
- if (!m_bLoginOK || m_lpInbox || NULL == m_lpMAPISession) {
+ if (!m_bLoginOK || m_lpInbox || nullptr == m_lpMAPISession) {
HRESULT hr = S_OK;
MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION , MAPI_MULTITHREAD_NOTIFICATIONS };
@@ -453,10 +453,10 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass return hr;
}
- LPPROFADMIN pProfAdmin = NULL;
+ LPPROFADMIN pProfAdmin = nullptr;
hr = MAPIAdminProfiles( 0, &pProfAdmin );
- if ((FAILED(hr)) || (NULL == pProfAdmin))
+ if ((FAILED(hr)) || (nullptr == pProfAdmin))
{
//Log("Admin profile interface creation failed: 0x%08X", hr);
}
@@ -479,21 +479,21 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass return hr;
// Open default message store
- LPMDB pDefMsgStore = NULL;
- hr = m_lpMAPISession->OpenMsgStore(0, cbDefStoreEid, pDefStoreEid, NULL,
+ LPMDB pDefMsgStore = nullptr;
+ hr = m_lpMAPISession->OpenMsgStore(0, cbDefStoreEid, pDefStoreEid, nullptr,
MAPI_BEST_ACCESS, &pDefMsgStore);
HRESULT hRes = S_OK;
ULONG cbInboxEID = NULL;
CMAPIBuffer< LPENTRYID> lpInboxEID = NULL;
- if (NULL == pDefMsgStore )
+ if (nullptr == pDefMsgStore )
return hr;
- hRes = pDefMsgStore->GetReceiveFolder( L"IPM", NULL, &cbInboxEID, &lpInboxEID, NULL);
+ hRes = pDefMsgStore->GetReceiveFolder( L"IPM", NULL, &cbInboxEID, &lpInboxEID, nullptr);
m_lpMDB = pDefMsgStore;
if (cbInboxEID && lpInboxEID) {
- hRes = CallOpenEntry( pDefMsgStore, NULL, NULL, NULL, cbInboxEID, lpInboxEID, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&m_lpInbox);
+ hRes = CallOpenEntry( pDefMsgStore, nullptr, nullptr, nullptr, cbInboxEID, lpInboxEID, MAPI_BEST_ACCESS, nullptr, (LPUNKNOWN*)&m_lpInbox);
if ( m_lpInbox && hRes == S_OK)
m_bFolderInboxOK = true;
@@ -510,7 +510,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) CMAPIInterface<LPPROFADMIN> pProfAdmin = NULL;
CMAPIInterface<LPSERVICEADMIN> pMsgSvcAdmin = NULL;
CMAPIInterface<LPMAPITABLE> pMsgSvcTable = NULL;
- LPSRowSet pRows = NULL;
+ LPSRowSet pRows = nullptr;
ULONG ulFlags = 0;
SRestriction sres;
SIZE_T nSize;
@@ -525,24 +525,24 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) };
ulFlags &= ~MAPI_UNICODE;
hr = MAPIAdminProfiles(ulFlags, &pProfAdmin);
- if (FAILED(hr) || pProfAdmin == NULL)
+ if (FAILED(hr) || pProfAdmin == nullptr)
return hr;
- hr = pProfAdmin->CreateProfile((LPTSTR)mir_u2a(szProfileName), NULL, NULL, ulFlags);
+ hr = pProfAdmin->CreateProfile((LPTSTR)mir_u2a(szProfileName), nullptr, NULL, ulFlags);
if (FAILED(hr)) {
pProfAdmin->DeleteProfile((LPTSTR)mir_u2a(szProfileName), ulFlags);
return hr;
}
- hr = pProfAdmin->AdminServices( (LPTSTR)mir_u2a(szProfileName), NULL, NULL, ulFlags, &pMsgSvcAdmin);
+ hr = pProfAdmin->AdminServices( (LPTSTR)mir_u2a(szProfileName), nullptr, NULL, ulFlags, &pMsgSvcAdmin);
- if (FAILED(hr) || pMsgSvcAdmin == NULL)
+ if (FAILED(hr) || pMsgSvcAdmin == nullptr)
return hr;
hr = pMsgSvcAdmin->CreateMsgService((LPTSTR)("MSEMS"), (LPTSTR)("")/*"Microsoft Exchange Server"*/, NULL, 0);
if (FAILED(hr))
return hr;
hr = pMsgSvcAdmin->GetMsgServiceTable(0, &pMsgSvcTable);
- if (FAILED(hr) || pMsgSvcTable == NULL)
+ if (FAILED(hr) || pMsgSvcTable == nullptr)
return hr;
sres.rt = RES_CONTENT;
@@ -556,7 +556,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) hr = HrQueryAllRows(pMsgSvcTable,
(LPSPropTagArray) &sptCols,
&sres,
- NULL,
+ nullptr,
0,
&pRows);
@@ -564,7 +564,7 @@ HRESULT CMirandaExchange::CreateProfile( LPTSTR szProfileName ) return hr;
nSize = mir_wstrlen(m_szUsername);
szUniqName = (wchar_t*)mir_alloc(sizeof(wchar_t) * (nSize + 4));
- if (szUniqName != NULL) {
+ if (szUniqName != nullptr) {
memcpy(szUniqName, L"=", sizeof(wchar_t));
memcpy((szUniqName + 1), m_szUsername, (sizeof(wchar_t) * (nSize + 1)));
// Set values for PR_PROFILE_UNRESOLVED_NAME and PR_PROFILE_UNRESOLVED_SERVER
@@ -593,14 +593,14 @@ HRESULT CMirandaExchange::isMapiSessionOK( LPMAPISESSION ) HRESULT CMirandaExchange::CheckForNewMails( int &nNewMails)
{
- if ( m_nNumberOfHeaders>0 && NULL != m_HeadersKeeper )
+ if ( m_nNumberOfHeaders>0 && nullptr != m_HeadersKeeper )
{
for( UINT i=0; i<m_nNumberOfHeaders; i++ )
{
- if ( NULL != m_HeadersKeeper[i])
+ if ( nullptr != m_HeadersKeeper[i])
{
delete m_HeadersKeeper[i];
- m_HeadersKeeper[i] = NULL;
+ m_HeadersKeeper[i] = nullptr;
}
}
@@ -612,14 +612,14 @@ HRESULT CMirandaExchange::CheckForNewMails( int &nNewMails) HRESULT hRes;
try
{
- if ( m_lpMAPISession != NULL && (isMapiSessionOK(m_lpMAPISession)== S_OK) && m_lpInbox != NULL && m_bFolderInboxOK )
+ if ( m_lpMAPISession != nullptr && (isMapiSessionOK(m_lpMAPISession)== S_OK) && m_lpInbox != nullptr && m_bFolderInboxOK )
{
hRes= CheckInFolder( m_lpInbox );
}
else
{
m_bLoginOK = 0;
- hRes = InitializeAndLogin(NULL,NULL,NULL);
+ hRes = InitializeAndLogin(nullptr,nullptr,nullptr);
if (hRes == S_OK)
{
@@ -644,33 +644,33 @@ HRESULT CMirandaExchange::LogOFF() {
try
{
- if (NULL != m_lpInbox)
+ if (nullptr != m_lpInbox)
{
UlRelease(m_lpInbox);
- m_lpInbox = NULL;
+ m_lpInbox = nullptr;
}
- if (NULL != m_lpMDB)
+ if (nullptr != m_lpMDB)
{
UlRelease(m_lpMDB);
- m_lpMDB = NULL;
+ m_lpMDB = nullptr;
}
- if ( NULL!= m_lpMAPISession )
+ if ( nullptr!= m_lpMAPISession )
{
m_lpMAPISession->Logoff( NULL, NULL, NULL );
m_lpMAPISession->Release();
- m_lpMAPISession = NULL;
+ m_lpMAPISession = nullptr;
}
- if ( m_nNumberOfHeaders>0 && NULL != m_HeadersKeeper )
+ if ( m_nNumberOfHeaders>0 && nullptr != m_HeadersKeeper )
{
for( UINT i=0; i<m_nNumberOfHeaders; i++ )
{
- if ( NULL != m_HeadersKeeper[i])
+ if ( nullptr != m_HeadersKeeper[i])
{
delete m_HeadersKeeper[i];
- m_HeadersKeeper[i] = NULL;
+ m_HeadersKeeper[i] = nullptr;
}
}
@@ -687,22 +687,22 @@ HRESULT CMirandaExchange::LogOFF() HRESULT CMirandaExchange::MarkAsRead( LPTSTR szEntryID )
{
- LPMESSAGE lpMessage = NULL ;
- LPBYTE lpData = NULL ;
+ LPMESSAGE lpMessage = nullptr ;
+ LPBYTE lpData = nullptr ;
ULONG ulC = 0 ;
HexToBin(szEntryID, ulC, lpData);
- CallOpenEntry( m_lpMDB, NULL, NULL, m_lpMAPISession, ulC, (LPENTRYID) lpData, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&lpMessage);
+ CallOpenEntry( m_lpMDB, nullptr, nullptr, m_lpMAPISession, ulC, (LPENTRYID) lpData, MAPI_BEST_ACCESS, nullptr, (LPUNKNOWN*)&lpMessage);
delete lpData;
- if ( NULL != lpMessage)
+ if ( nullptr != lpMessage)
{
lpMessage->SetReadFlag( 0 );
lpMessage->SaveChanges(FORCE_SAVE);
lpMessage->Release();
- lpMessage = NULL;
+ lpMessage = nullptr;
}
return 0;
@@ -713,14 +713,14 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) {
HRESULT hr = NOERROR;
CMAPIInterface<LPMAPITABLE> lpTable = NULL;
- LPSRowSet lpRow = NULL;
- LPSPropValue lpRowProp = NULL;
+ LPSRowSet lpRow = nullptr;
+ LPSPropValue lpRowProp = nullptr;
ULONG i = 0L;
- wchar_t* szSenderName = NULL;
- wchar_t* szSubject = NULL;
- LPSTR szEntryID = NULL;
+ wchar_t* szSenderName = nullptr;
+ wchar_t* szSubject = nullptr;
+ LPSTR szEntryID = nullptr;
- if ( lpFolder == NULL || !m_bFolderInboxOK )
+ if ( lpFolder == nullptr || !m_bFolderInboxOK )
return hr;
SizedSPropTagArray(5,sptaDETAILS) =
@@ -743,7 +743,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) return -1;
}
- LPSRowSet lpRowsR = NULL;
+ LPSRowSet lpRowsR = nullptr;
//////////////////////////////////////////////////////////////////////////
SRestriction srRoot;
@@ -771,7 +771,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) szSenderName = lpRowsR->aRow[i].lpProps[2].Value.lpszW;
}
- if ( NULL == szSenderName)
+ if ( nullptr == szSenderName)
{
if ( !FAILED(lpRowsR->aRow[i].lpProps[3].Value.err))
{
@@ -791,9 +791,9 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) delete[] szEntryID;
- szEntryID = NULL;
- szSubject = NULL;
- szSenderName = NULL;
+ szEntryID = nullptr;
+ szSubject = nullptr;
+ szSenderName = nullptr;
}
}
FreeProws(lpRowsR);
@@ -815,12 +815,12 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) hr = MAPICALL( lpFolder)->GetHierarchyTable( MAPI_DEFERRED_ERRORS, &lpTable);
if (!FAILED(hr)) {
- hr = HrQueryAllRows( lpTable, (LPSPropTagArray)&rgColProps, NULL, NULL, 0L, &lpRow);
+ hr = HrQueryAllRows( lpTable, (LPSPropTagArray)&rgColProps, nullptr, nullptr, 0L, &lpRow);
if (!FAILED(hr)) {
for(i = 0; i < lpRow->cRows; i ++) {
lpRowProp = lpRow->aRow[i].lpProps;
CMAPIInterface<LPMAPIFOLDER> lpSubFolder = NULL;
- hr = CallOpenEntry( m_lpMDB, NULL, NULL, NULL, lpRowProp[IENTRYID].Value.bin.cb, (LPENTRYID)lpRowProp[IENTRYID].Value.bin.lpb, MAPI_BEST_ACCESS, NULL, (LPUNKNOWN*)&lpSubFolder );
+ hr = CallOpenEntry( m_lpMDB, nullptr, nullptr, nullptr, lpRowProp[IENTRYID].Value.bin.cb, (LPENTRYID)lpRowProp[IENTRYID].Value.bin.lpb, MAPI_BEST_ACCESS, nullptr, (LPUNKNOWN*)&lpSubFolder );
if ( !FAILED(hr) )
{
hr = CheckInFolder( lpSubFolder );
@@ -828,7 +828,7 @@ HRESULT CMirandaExchange::CheckInFolder( LPMAPIFOLDER lpFolder ) }
}
FreeProws(lpRow);
- lpRow = NULL;
+ lpRow = nullptr;
}
}
}
@@ -853,7 +853,7 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) &hTheKey) == ERROR_SUCCESS
)
{
- LONG lResult = RegQueryValueEx( hTheKey, NULL, NULL, (LPDWORD)&dwType, (LPBYTE)szRegValue, &dwLength);
+ LONG lResult = RegQueryValueEx( hTheKey, nullptr, nullptr, (LPDWORD)&dwType, (LPBYTE)szRegValue, &dwLength);
RegCloseKey( hTheKey );
if ( lResult != ERROR_SUCCESS )
@@ -865,7 +865,7 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) wchar_t* szTheEnd = wcsstr( szRegValue,L".EXE" );
- if ( NULL != szTheEnd )
+ if ( nullptr != szTheEnd )
{
szRegValue[ mir_wstrlen(szRegValue) - mir_wstrlen(szTheEnd) +5 ] = '\0';
mir_wstrcat( szRegValue, L" /recycle" );
@@ -878,14 +878,14 @@ HRESULT CMirandaExchange::OpenTheMessage( LPTSTR ) si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWNORMAL;
- if ( CreateProcess ( NULL,
+ if ( CreateProcess ( nullptr,
szRegValue,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
0,
NORMAL_PRIORITY_CLASS,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&si,
&pi
))
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index 6a4d7cc15e..5bb8fab5e5 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -121,17 +121,17 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara db_set_ws(NULL, ModuleName, "Server", buffer);
GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer));
- db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, NULL, FALSE));
+ db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, nullptr, FALSE));
- db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, NULL, FALSE));
- db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, NULL, FALSE));
+ db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, nullptr, FALSE));
+ db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, nullptr, FALSE));
db_set_b(NULL, ModuleName, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
db_set_b(NULL, ModuleName, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
db_set_b(NULL, ModuleName, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
- db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, NULL, FALSE));
+ db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, nullptr, FALSE));
exchangeServer.Reconnect(); //login info may be changed
UpdateTimers(); //interval might get changed
@@ -148,7 +148,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOWPOS *wndPos, int anchors)
{
- if (NULL == window) /* Wine fix. */
+ if (nullptr == window) /* Wine fix. */
return;
RECT rChild = AnchorCalcPos(window, rParent, wndPos, anchors);
hdWnds = DeferWindowPos(hdWnds, window, HWND_NOTOPMOST, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, SWP_NOZORDER);
@@ -211,7 +211,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam return TRUE;
case WM_DESTROY:
- hEmailsDlg = NULL;
+ hEmailsDlg = nullptr;
break;
case WM_CLOSE:
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 51fdb00455..840885e687 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -134,7 +134,7 @@ void InitSocketAddr(sockaddr_in *addrServer, char *szServer) hostent *hp;
hp = gethostbyname(szServer);
addrServer->sin_family = AF_INET;
- if (hp == NULL)
+ if (hp == nullptr)
addrServer->sin_addr.s_addr = inet_addr(szServer);
else
memcpy(&(addrServer->sin_addr), hp->h_addr, hp->h_length);
@@ -204,14 +204,14 @@ int CExchangeServer::GetEmailHeader(int iUnreadEmail, TEmailHeader *emailInfo) #ifndef NO_EXCHANGE_TEST
- if (NULL != m_HeadersKeeper[iUnreadEmail]) {
+ if (nullptr != m_HeadersKeeper[iUnreadEmail]) {
wchar_t* szSender = m_HeadersKeeper[iUnreadEmail]->m_szSender;
wchar_t* szSubject = m_HeadersKeeper[iUnreadEmail]->m_szSubject;
- if (NULL == szSender)
+ if (nullptr == szSender)
szSender = L"";
- if (NULL == szSubject)
+ if (nullptr == szSubject)
szSubject = L"";
emailInfo->szSender = szSender;
@@ -317,7 +317,7 @@ int ShowPopupMessage(wchar_t *title, wchar_t *message, int cUnreadEmails) int ShowMessageBoxMessage(wchar_t *title, wchar_t *message, int cUnreadEmails)
{
- if (MessageBox(0, message, title, MB_YESNO) == IDYES)
+ if (MessageBox(nullptr, message, title, MB_YESNO) == IDYES)
ShowEmailsWindow(cUnreadEmails);
return 0;
}
@@ -326,7 +326,7 @@ int ShowEmailsWindow(int cUnreadEmails) {
if (cUnreadEmails > 0) { //show window only if there are unread emails
if (!hEmailsDlg)
- hEmailsDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails);
+ hEmailsDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), nullptr, DlgProcEmails);
SetWindowLongPtr(hEmailsDlg, GWLP_USERDATA, cUnreadEmails);
if (IsWindowVisible(hEmailsDlg))
diff --git a/plugins/Exchange/src/exchange.cpp b/plugins/Exchange/src/exchange.cpp index d2597ae298..8805bf42e5 100644 --- a/plugins/Exchange/src/exchange.cpp +++ b/plugins/Exchange/src/exchange.cpp @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char ModuleName[] = "ExchangeNotify";
HINSTANCE hInstance;
-HICON hiMailIcon = NULL;
-HWND hEmailsDlg = NULL;
+HICON hiMailIcon = nullptr;
+HWND hEmailsDlg = nullptr;
int hLangpack=0;
CExchangeServer exchangeServer;
diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp index 5f1b31b62a..fdb239a046 100644 --- a/plugins/Exchange/src/hooked_events.cpp +++ b/plugins/Exchange/src/hooked_events.cpp @@ -69,7 +69,7 @@ int OnModulesLoaded(WPARAM, LPARAM) mi.name.w = LPGENW("Check exchange mailbox");
Menu_AddMainMenuItem(&mi);
- hEmailsDlg = NULL; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window
+ hEmailsDlg = nullptr; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window
FirstTimeCheck();
// CheckEmail();
return 0;
@@ -104,7 +104,7 @@ int OnSystemPreShutdown(WPARAM, LPARAM) void FirstTimeCheck()
{
- hFirstCheckTimer = SetTimer(NULL, 0, 5 * 1000, OnFirstCheckTimer);
+ hFirstCheckTimer = SetTimer(nullptr, 0, 5 * 1000, OnFirstCheckTimer);
}
int UpdateTimers()
@@ -113,14 +113,14 @@ int UpdateTimers() int interval;
interval = db_get_dw(NULL, ModuleName, "Interval", DEFAULT_INTERVAL);
interval *= 1000; //go from miliseconds to seconds
- hCheckTimer = SetTimer(NULL, 0, interval, (TIMERPROC) OnCheckTimer);
+ hCheckTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnCheckTimer);
int bReconnect = db_get_b(NULL, ModuleName, "Reconnect", 0);
if (bReconnect) //user wants to forcefully reconnect every x minutes
{
interval = db_get_dw(NULL, ModuleName, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL);
interval *= 1000 * 60; //go from miliseconds to seconds to minutes
- hReconnectTimer = SetTimer(NULL, 0, interval, (TIMERPROC) OnReconnectTimer);
+ hReconnectTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnReconnectTimer);
}
return 0;
@@ -130,12 +130,12 @@ int KillTimers() {
if (hCheckTimer)
{
- KillTimer(NULL, hCheckTimer);
+ KillTimer(nullptr, hCheckTimer);
hCheckTimer = NULL;
}
if (hReconnectTimer)
{
- KillTimer(NULL, hReconnectTimer);
+ KillTimer(nullptr, hReconnectTimer);
hReconnectTimer = NULL;
}
return 0;
@@ -168,7 +168,7 @@ VOID CALLBACK OnReconnectTimer(HWND, UINT, UINT_PTR, DWORD) VOID CALLBACK OnFirstCheckTimer(HWND hWnd, UINT msg, UINT_PTR idEvent, DWORD dwTime)
{
- KillTimer(NULL, hFirstCheckTimer);
+ KillTimer(nullptr, hFirstCheckTimer);
OnCheckTimer(hWnd, msg, idEvent, dwTime);
hFirstCheckTimer = NULL;
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index 97fc4cca13..6f9fd24ae9 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -77,14 +77,14 @@ int Info(char *title, char *format, ...) str[tBytes] = 0;
va_end(vararg);
- return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION);
+ return MessageBoxA(nullptr, str, title, MB_OK | MB_ICONINFORMATION);
}
#define HEX_SIZE 8
char *BinToHex(int size, PBYTE data)
{
- char *szresult = NULL;
+ char *szresult = nullptr;
int maxSize = size * 2 + HEX_SIZE + 1;
szresult = (char *) new char[maxSize];
mir_snprintf(szresult, maxSize, "%0*X", HEX_SIZE, size);
|