From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- .../src/MirFoxCommons/MirFoxCommons_logger.cpp | 4 +- .../MirFoxCommons_messageQueueBySM.cpp | 6 +- .../MirFoxCommons/MirFoxCommons_sharedMemory.cpp | 4 +- plugins/MirFox/src/MirandaOptions.cpp | 12 ++-- plugins/MirFox/src/MirandaUtils.cpp | 66 +++++++++++----------- plugins/MirFox/src/MirfoxData.cpp | 32 +++++------ plugins/MirFox/src/MirfoxMiranda.cpp | 18 +++--- 7 files changed, 71 insertions(+), 71 deletions(-) (limited to 'plugins/MirFox/src') diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp index eec0c8b196..cb388d0681 100644 --- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp +++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_logger.cpp @@ -5,7 +5,7 @@ MFLogger::MFLogger() { - logFunction = NULL; + logFunction = nullptr; memcpy(m_prefix, L" ", PREFIX_SIZE * sizeof(m_prefix[0])); } @@ -21,7 +21,7 @@ void MFLogger::set6CharsPrefix(const wchar_t* prefix){ } void MFLogger::releaseLogger(){ - logFunction = NULL; + logFunction = nullptr; DeleteCriticalSection(&logCs); } diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_messageQueueBySM.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_messageQueueBySM.cpp index 96ac041006..10fe3c3763 100644 --- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_messageQueueBySM.cpp +++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_messageQueueBySM.cpp @@ -38,7 +38,7 @@ MessageQueueUtils::MessageQueueUtils() { unloadedMQProcessId = -1; //one mutex per all messagequeues schould be enough - smMutex = CreateMutex(NULL, FALSE, L"Local\\mirfoxMqMirSm"); + smMutex = CreateMutex(nullptr, FALSE, L"Local\\mirfoxMqMirSm"); } @@ -114,7 +114,7 @@ MessageQueueUtils::unloadMessageQueue(uint16_t unloadedMQProcessId) this->unloadedMQProcessId = unloadedMQProcessId; if (mqMirSm){ delete mqMirSm; - mqMirSm = NULL; + mqMirSm = nullptr; } else { logger->log(L"MessageQueueUtils::unloadMessageQueue - mqMirSm was NULL"); } @@ -231,7 +231,7 @@ MessageQueueUtils::sendMessage(int clientRecordId, char menuItemType, char userA getMqName(clientRecordId).c_str(), boost::interprocess::read_write); - if (sm == NULL){ + if (sm == nullptr){ logger->log(L"MessageQueueUtils::sendMessage (sm mode) sm == NULL"); return; //error } diff --git a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp index 18fafa241e..5696e7695a 100644 --- a/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp +++ b/plugins/MirFox/src/MirFoxCommons/MirFoxCommons_sharedMemory.cpp @@ -1230,7 +1230,7 @@ time_t SharedMemoryUtils::mfGetCurrentTimestamp() { - time_t currentTimestamp = time(NULL); + time_t currentTimestamp = time(nullptr); //logger->log_dp(L"mfGetCurrentTimestamp() [" SCNuPTR L"]", currentTimestamp); return currentTimestamp; @@ -1369,7 +1369,7 @@ SharedMemoryUtils::isTokenOnList(std::wstring& token, std::wstring& tokensList) void SharedMemoryUtils::unloadFromCSM(uint16_t processCsmId) { - if (csm == NULL){ + if (csm == nullptr){ logger->log(L"SharedMemoryUtils::unloadFromCSM: csm == NULL , return"); return; } diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp index 325ef6cd9b..ed6857ff96 100644 --- a/plugins/MirFox/src/MirandaOptions.cpp +++ b/plugins/MirFox/src/MirandaOptions.cpp @@ -364,7 +364,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM //set contacts and groups icons setListContactIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST)); - setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL); + setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr); mirfoxMiranda.getMirfoxData().tab2OptionsState = MFENUM_OPTIONS_WORK; @@ -392,7 +392,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM setListContactIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST)); //fall through case CLN_CONTACTMOVED: - setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL); + setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr); break; case CLN_OPTIONSCHANGED: resetListOptions(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST)); @@ -412,7 +412,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y)); // Nothing was clicked - if (hItem == NULL){ + if (hItem == nullptr){ break; } // It was not a visbility icon @@ -446,7 +446,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } // Update the all/none icons - setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL); + setListGroupIcons(GetDlgItem(hwndDlg, IDC2_CONTACTS_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr); // Activate Apply button SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -517,9 +517,9 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM // use DestroyIcon only witchout icolib DestroyIcon(icoHandle_ICON_OFF); - icoHandle_ICON_OFF = NULL; + icoHandle_ICON_OFF = nullptr; DestroyIcon(icoHandle_ICON_FF); - icoHandle_ICON_FF = NULL; + icoHandle_ICON_FF = nullptr; break; diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index caf5456467..0e0592b242 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -9,7 +9,7 @@ MirandaUtils::MirandaUtils() : logger(MFLogger::getInstance()) { - netlibHandle = NULL; + netlibHandle = nullptr; InitializeCriticalSection(&ackMapCs); } @@ -39,7 +39,7 @@ void MirandaUtils::netlibRegister(){ void MirandaUtils::netlibUnregister(){ Netlib_CloseHandle(netlibHandle); - netlibHandle = NULL; + netlibHandle = nullptr; } @@ -79,10 +79,10 @@ std::wstring& MirandaUtils::getDisplayName() void MirandaUtils::userActionThread(void* threadArg) { - Thread_Push(0); + Thread_Push(nullptr); ActionThreadArgStruct* actionThreadArgPtr = (ActionThreadArgStruct*)threadArg; - if (actionThreadArgPtr->mirfoxDataPtr == NULL){ + if (actionThreadArgPtr->mirfoxDataPtr == nullptr){ MFLogger::getInstance()->log(L"MirandaUtils::userActionThread: ERROR mirfoxDataPtr == NULL"); return; } @@ -114,7 +114,7 @@ void MirandaUtils::sendMessageToContact(ActionThreadArgStruct* args) { logger->log(L"MirandaUtils::sendMessageToContact: start"); - if (args->targetHandle == NULL){ + if (args->targetHandle == nullptr){ logger->log(L"MirandaUtils::sendMessageToContact: ERROR targetHandle == NULL"); return; } @@ -143,7 +143,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ // } char *targetHandleSzProto = GetContactProto((UINT_PTR)args->targetHandle); //targetHandleSzProto doesnt need mir_free or delete - if (targetHandleSzProto == NULL){ + if (targetHandleSzProto == nullptr){ logger->log(L"MirandaUtils::sendMessageToContact: ERROR targetHandleSzProto == NULL"); return; } @@ -155,9 +155,9 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ HANDLE hProcess = sendMessageMiranda((UINT_PTR)args->targetHandle, msgBuffer); logger->log_p(L"SMTC: hProcess = [" SCNuPTR L"]", hProcess); - MIRFOXACKDATA* myMfAck = NULL; + MIRFOXACKDATA* myMfAck = nullptr; - if (hProcess != NULL){ + if (hProcess != nullptr){ //if hProcess of sending process is null there will not be any ack EnterCriticalSection(&ackMapCs); @@ -178,26 +178,26 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ logger->log_p(L"SMTC: ACK break by Plugin_Terminated (=%d) or Miranda_IsTerminated()", args->mirfoxDataPtr->Plugin_Terminated); break; } - } while (myMfAck == NULL && counter <= MAX_ACK_WAIT_COUNTER); //TODO or Plugin_Terminated or Miranda_IsTerminated() + } while (myMfAck == nullptr && counter <= MAX_ACK_WAIT_COUNTER); //TODO or Plugin_Terminated or Miranda_IsTerminated() logger->log_p(L"SMTC: ACK found counter = [%d] myMfAck = [" SCNuPTR L"]", counter, myMfAck); } MirandaContact* mirandaContact = args->mirfoxDataPtr->getMirandaContactPtrByHandle((UINT_PTR)args->targetHandle); - const wchar_t* contactNameW = NULL; - wchar_t* tszAccountName = NULL; + const wchar_t* contactNameW = nullptr; + wchar_t* tszAccountName = nullptr; if (mirandaContact){ contactNameW = mirandaContact->contactNameW.c_str(); MirandaAccount* mirandaAccount = mirandaContact->mirandaAccountPtr; if (mirandaAccount) tszAccountName = mirandaAccount->tszAccountName; } - if(myMfAck != NULL && myMfAck->result == ACKRESULT_SUCCESS){ + if(myMfAck != nullptr && myMfAck->result == ACKRESULT_SUCCESS){ addMessageToDB((UINT_PTR)args->targetHandle, msgBuffer, bufSize, targetHandleSzProto); if (mode == MFENUM_SMM_ONLY_SEND){ //show notyfication popup (only in SMM_ONLY_SEND mode) wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)]; - if (contactNameW != NULL && tszAccountName != NULL) + if (contactNameW != nullptr && tszAccountName != nullptr) if (args->mirfoxDataPtr->getAddAccountToContactNameCheckbox()){ mir_snwprintf(buffer, 1024, TranslateT("Message sent to %s"), contactNameW); } else { @@ -215,7 +215,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ } else if (mode == MFENUM_SMM_SEND_AND_SHOW_MW){ //notify hook to open window - if (args->mirfoxDataPtr != NULL && args->mirfoxDataPtr->hhook_EventOpenMW != NULL){ + if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){ notifyHookToOpenMsgWindow(args, false); } else logger->log(L"SMTC: ERROR1 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL"); @@ -224,16 +224,16 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ else { //error - show error popup wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)]; - if (myMfAck != NULL){ + if (myMfAck != nullptr){ logger->log_p(L"SMTC: ERROR - Cannot send message - result = [%d] ", myMfAck->result); - if (myMfAck->errorDesc != NULL){ - if (contactNameW != NULL && tszAccountName != NULL){ + if (myMfAck->errorDesc != nullptr){ + if (contactNameW != nullptr && tszAccountName != nullptr){ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s) - %S"), contactNameW, tszAccountName, myMfAck->errorDesc); } else { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message - %S"), myMfAck->errorDesc); } } else { - if (contactNameW != NULL && tszAccountName != NULL){ + if (contactNameW != nullptr && tszAccountName != nullptr){ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName); } else { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message")); @@ -241,7 +241,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ } } else { logger->log(L"SMTC: ERROR - Cannot send message 2"); - if (contactNameW != NULL && tszAccountName != NULL){ + if (contactNameW != nullptr && tszAccountName != nullptr){ mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName); } else { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message")); @@ -256,7 +256,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ //if MFENUM_SMM_SEND_AND_SHOW_MW, even if error sending message - notify hook to open window if (mode == MFENUM_SMM_SEND_AND_SHOW_MW){ - if (args->mirfoxDataPtr != NULL && args->mirfoxDataPtr->hhook_EventOpenMW != NULL){ + if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){ notifyHookToOpenMsgWindow(args, true); } else logger->log(L"SMTC: ERROR2 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL"); @@ -265,8 +265,8 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ delete[] buffer; } - if (myMfAck != NULL){ //when we found ack, not when we exceed MAX_ACK_WAIT_COUNTER - if (myMfAck->errorDesc != NULL) delete myMfAck->errorDesc; + if (myMfAck != nullptr){ //when we found ack, not when we exceed MAX_ACK_WAIT_COUNTER + if (myMfAck->errorDesc != nullptr) delete myMfAck->errorDesc; delete myMfAck->szModule; delete myMfAck; } @@ -276,7 +276,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ } else if (mode == MFENUM_SMM_ONLY_SHOW_MW) { //notify hook to open msg window - if (args->mirfoxDataPtr != NULL && args->mirfoxDataPtr->hhook_EventOpenMW != NULL){ + if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){ notifyHookToOpenMsgWindow(args, true); } else logger->log(L"SMTC: ERROR3 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL"); @@ -294,7 +294,7 @@ void MirandaUtils::addMessageToDB(MCONTACT hContact, char* msgBuffer, std::size_ dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = targetHandleSzProto; - dbei.timestamp = (DWORD)time(NULL); + dbei.timestamp = (DWORD)time(nullptr); dbei.cbBlob = (DWORD)bufSize; dbei.pBlob = (PBYTE)msgBuffer; db_event_add(hContact, &dbei); @@ -311,7 +311,7 @@ void MirandaUtils::notifyHookToOpenMsgWindow(ActionThreadArgStruct* args, bool s msgBuffer->append(L"\r\n"); onHookOpenMv->msgBuffer = msgBuffer; } else { - onHookOpenMv->msgBuffer = NULL; + onHookOpenMv->msgBuffer = nullptr; } NotifyEventHooks(args->mirfoxDataPtr->hhook_EventOpenMW, (WPARAM)onHookOpenMv, 0); @@ -321,7 +321,7 @@ void MirandaUtils::notifyHookToOpenMsgWindow(ActionThreadArgStruct* args, bool s //http://www.shloemi.com/2012/09/solved-setforegroundwindow-win32-api-not-always-works/ void MirandaUtils::ForceForegroundWindow(HWND hWnd) { - DWORD foreThread = GetWindowThreadProcessId(GetForegroundWindow(), NULL); + DWORD foreThread = GetWindowThreadProcessId(GetForegroundWindow(), nullptr); DWORD appThread = GetCurrentThreadId(); if (foreThread != appThread) { @@ -339,7 +339,7 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) { OnHookOpenMvStruct* param = (OnHookOpenMvStruct*)wParam; - if (param->msgBuffer != NULL){ + if (param->msgBuffer != nullptr){ wchar_t *msgBuffer = mir_wstrdup(param->msgBuffer->c_str()); CallServiceSync(MS_MSG_SENDMESSAGEW, (WPARAM)param->targetHandle, (LPARAM)msgBuffer); mir_free(msgBuffer); @@ -360,7 +360,7 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) if (!Srmm_GetWindowData((WPARAM)param->targetHandle, mwd) && mwd.hwndWindow){ HWND parent; HWND hWnd = mwd.hwndWindow; - while((parent = GetParent(hWnd)) != 0) + while((parent = GetParent(hWnd)) != nullptr) hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm) ForceForegroundWindow(hWnd); } @@ -381,13 +381,13 @@ void MirandaUtils::setStatusOnAccount(ActionThreadArgStruct* args) result = CallProtoService(args->accountSzModuleName, PS_SETAWAYMSG, status, (LPARAM)args->userActionSelection); MirandaAccount* mirandaAccount = args->mirfoxDataPtr->getMirandaAccountPtrBySzModuleName(args->accountSzModuleName); - wchar_t* tszAccountName = NULL; + wchar_t* tszAccountName = nullptr; if (mirandaAccount) tszAccountName = mirandaAccount->tszAccountName; wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)]; if(result == 0){ - if (tszAccountName != NULL){ + if (tszAccountName != nullptr){ logger->log_p(L"SSOA: Status message set on [%s]", tszAccountName); mir_snwprintf(buffer, 1024, TranslateT("Status message set on %s"), tszAccountName); } else { @@ -401,7 +401,7 @@ void MirandaUtils::setStatusOnAccount(ActionThreadArgStruct* args) PUShowMessageT(buffer, SM_NOTIFY); } } else { - if (tszAccountName != NULL){ + if (tszAccountName != nullptr){ logger->log_p(L"SSOA: ERROR - Cannot set status message 2 on [%s] - result = [%d] ", tszAccountName, result); mir_snwprintf(buffer, 1024, TranslateT("Cannot set status message on %s"), tszAccountName); } else { @@ -427,7 +427,7 @@ int MirandaUtils::onProtoAck(WPARAM, LPARAM lParam) void MirandaUtils::onProtoAckOnInstance(ACKDATA* ack) { - if (ack == NULL || ack->type != ACKTYPE_MESSAGE){ + if (ack == nullptr || ack->type != ACKTYPE_MESSAGE){ //we are waiting for ACKTYPE_MESSAGE ack's return; } @@ -450,7 +450,7 @@ void MirandaUtils::onProtoAckOnInstance(ACKDATA* ack) strcpy_s(myMfSzLparamPtr, len2, (char*)ack->lParam); myMfAck->errorDesc = myMfSzLparamPtr; } else { - myMfAck->errorDesc = NULL; + myMfAck->errorDesc = nullptr; } ackMap[ack->hProcess] = myMfAck; diff --git a/plugins/MirFox/src/MirfoxData.cpp b/plugins/MirFox/src/MirfoxData.cpp index e6bcfb7c31..5e7bd0809e 100644 --- a/plugins/MirFox/src/MirfoxData.cpp +++ b/plugins/MirFox/src/MirfoxData.cpp @@ -28,8 +28,8 @@ MirfoxData::MirfoxData(void) middleClickSendMode = MFENUM_SMM_ONLY_SEND; processCsmId = 0; - hhook_EventOpenMW = NULL; - hhook_OpenMW = NULL; + hhook_EventOpenMW = nullptr; + hhook_OpenMW = nullptr; mirfoxAccountIdPool = 1; maxAccountIOrder = 0; @@ -105,7 +105,7 @@ MirfoxData::getMirandaContactPtrByHandle(MCONTACT contactHandle){ if (contactHandle == NULL){ logger->log(L"getMirandaContactPtrByHandle: return NULL for HANDLE: [NULL]"); - return NULL; + return nullptr; } boost::ptr_list* mirandaContactsPtr = getMirandaContacts(); @@ -118,7 +118,7 @@ MirfoxData::getMirandaContactPtrByHandle(MCONTACT contactHandle){ } logger->log_p(L"getMirandaContactPtrByHandle: return NULL for HANDLE: [" SCNuPTR L"]", contactHandle); - return NULL; //mirandaContact not found + return nullptr; //mirandaContact not found } @@ -126,7 +126,7 @@ MirfoxData::getMirandaContactPtrByHandle(MCONTACT contactHandle){ void MirfoxData::setContactDisplayName(MirandaContact* mirandaContact){ - if (mirandaContact->mirandaAccountPtr != NULL && strcmp(mirandaContact->mirandaAccountPtr->szProtoName, "Twitter") == 0){ + if (mirandaContact->mirandaAccountPtr != nullptr && strcmp(mirandaContact->mirandaAccountPtr->szProtoName, "Twitter") == 0){ // hack for Twitter protocol DBVARIANT dbv; if (!db_get_s(mirandaContact->contactHandle, mirandaContact->mirandaAccountPtr->szModuleName, "Username", &dbv, DBVT_WCHAR)) { @@ -144,7 +144,7 @@ MirfoxData::setContactDisplayName(MirandaContact* mirandaContact){ } MFLogger::getInstance()->log_p(L"initializeMirandaContacts: got name for hContact = [" SCNuPTR L"] is: [%s]", mirandaContact->contactHandle, - &(mirandaContact->contactNameW)==NULL ? L"" : mirandaContact->contactNameW.c_str()); + &(mirandaContact->contactNameW)==nullptr ? L"" : mirandaContact->contactNameW.c_str()); } @@ -210,7 +210,7 @@ MirfoxData::getAccountSzModuleNameById(uint64_t id) } logger->log_p(L"getAccountSzModuleNameById: return NULL for id = [%I64u]", id); - return NULL; //mirandaAccount not found + return nullptr; //mirandaAccount not found } @@ -221,9 +221,9 @@ MirfoxData::getMirandaAccountPtrBySzModuleName(char* szModuleName) MFLogger* logger = MFLogger::getInstance(); - if (szModuleName == NULL){ + if (szModuleName == nullptr){ logger->log(L"getMirandaAccountPtrBySzModuleName: return NULL for szModuleName: [NULL]"); - return NULL; + return nullptr; } boost::ptr_list* mirandaAccountsPtr = getMirandaAccounts(); @@ -236,7 +236,7 @@ MirfoxData::getMirandaAccountPtrBySzModuleName(char* szModuleName) } logger->log_p(L"getMirandaAccountPtrBySzModuleName: return NULL for szModuleName: [%S]", szModuleName); - return NULL; //mirandaAccount not found + return nullptr; //mirandaAccount not found } @@ -356,7 +356,7 @@ void MirfoxData::refreshContact_Add(SharedMemoryUtils& sharedMemoryUtils, MCONTA ); char *szModuleName = Proto_GetBaseAccountName(mirandaContactItemPtr->contactHandle); - if (szModuleName != NULL) + if (szModuleName != nullptr) mirandaContactItemPtr->mirandaAccountPtr = getMirandaAccountPtrBySzModuleName(szModuleName); // Always getting '(Unknown Contact)' here if called from HookEvent ME_DB_CONTACT_ADDED, (updated to proper via ME_DB_CONTACT_SETTINGCHANGED) @@ -492,7 +492,7 @@ MirfoxData::shouldProtoBeActiveByName(std::string protoName) int MirfoxData::getAccountDefaultState(MirandaAccount* account) { - if (account == NULL){ + if (account == nullptr){ return 2; } @@ -509,13 +509,13 @@ MirfoxData::getContactDefaultState(MirandaContact* contact) { MFLogger* logger = MFLogger::getInstance(); - if (contact == NULL) + if (contact == nullptr) return 2; - if (contact->mirandaAccountPtr == NULL) + if (contact->mirandaAccountPtr == nullptr) return 2; - if (contact->mirandaAccountPtr->szProtoName == NULL) + if (contact->mirandaAccountPtr->szProtoName == nullptr) return 2; if (!shouldProtoBeActiveByName(contact->mirandaAccountPtr->szProtoName)) @@ -811,7 +811,7 @@ MirandaContact::MirandaContact(MCONTACT contactHandleL) { contactState = MFENUM_MIRANDACONTACT_STATE_UNKNOWN; contactHandle = contactHandleL; - mirandaAccountPtr = NULL; + mirandaAccountPtr = nullptr; } MirandaContact::~MirandaContact(void) diff --git a/plugins/MirFox/src/MirfoxMiranda.cpp b/plugins/MirFox/src/MirfoxMiranda.cpp index 0a59139994..176929461c 100644 --- a/plugins/MirFox/src/MirfoxMiranda.cpp +++ b/plugins/MirFox/src/MirfoxMiranda.cpp @@ -64,7 +64,7 @@ void CMirfoxMiranda::onAccListChanged(WPARAM wParam, LPARAM lParam) switch (wParam) { case PRAC_ADDED: - if (acc != NULL) { + if (acc != nullptr) { //checking account if(acc->bIsEnabled == 0 || acc->bDynDisabled != 0){ return; @@ -75,7 +75,7 @@ void CMirfoxMiranda::onAccListChanged(WPARAM wParam, LPARAM lParam) case PRAC_UPGRADED: case PRAC_CHANGED: - if (acc != NULL) { + if (acc != nullptr) { //checking account if(acc->bIsEnabled == 0 || acc->bDynDisabled != 0){ return; @@ -89,7 +89,7 @@ void CMirfoxMiranda::onAccListChanged(WPARAM wParam, LPARAM lParam) break; case PRAC_CHECKED: - if (acc != NULL) { + if (acc != nullptr) { if (acc->bIsEnabled) { //checking account if(acc->bDynDisabled != 0){ @@ -109,7 +109,7 @@ void CMirfoxMiranda::onAccListChanged(WPARAM wParam, LPARAM lParam) void CMirfoxMiranda::onContactAdded_async(void* threadArg) { - Thread_Push(0); + Thread_Push(nullptr); OnContactAsyncThreadArgStruct* onContactAsyncThreadArgStruct = (OnContactAsyncThreadArgStruct*)threadArg; CMirfoxMiranda* mirfoxMiranda = onContactAsyncThreadArgStruct->mirfoxMiranda; MFLogger* logger = MFLogger::getInstance(); @@ -169,7 +169,7 @@ void CMirfoxMiranda::onContactSettingChanged(MCONTACT hContact, LPARAM lParam) void CMirfoxMiranda::onContactSettingChanged_async(void* threadArg){ - Thread_Push(0); + Thread_Push(nullptr); OnContactAsyncThreadArgStruct* onContactAsyncThreadArgStruct = (OnContactAsyncThreadArgStruct*)threadArg; CMirfoxMiranda* mirfoxMiranda = onContactAsyncThreadArgStruct->mirfoxMiranda; MFLogger* logger = MFLogger::getInstance(); @@ -260,10 +260,10 @@ void CMirfoxMiranda::initializeSharedMemoryData(MirfoxData& mirfoxData, SharedMe if(result.errorCode != 0){ //error if (result.errorCode == -3){ //existing csm version is too high -> i'm too old - MessageBox(NULL, TranslateT("This MirFox (Miranda) plugin is too old. Please update it."), TranslateT("MirFox (Miranda) - Error"), MB_OK | MB_ICONWARNING ); + MessageBox(nullptr, TranslateT("This MirFox (Miranda) plugin is too old. Please update it."), TranslateT("MirFox (Miranda) - Error"), MB_OK | MB_ICONWARNING ); } if (result.errorCode == -4){ //existing csm version is too low -> sb is too old - MessageBox(NULL, TranslateT("This MirFox (Miranda) plugin cannot start because some other MirFox component is too old. Please, check and update your MirFox components."), TranslateT("MirFox (Miranda) - Error"), MB_OK | MB_ICONWARNING ); + MessageBox(nullptr, TranslateT("This MirFox (Miranda) plugin cannot start because some other MirFox component is too old. Please, check and update your MirFox components."), TranslateT("MirFox (Miranda) - Error"), MB_OK | MB_ICONWARNING ); } mirfoxData.setPluginState(MFENUM_PLUGIN_STATE_ERROR); return; @@ -319,7 +319,7 @@ void CMirfoxMiranda::unloadSharedMemory() void CMirfoxMiranda::csmThread(void* threadArg) { - Thread_Push(0); + Thread_Push(nullptr); CMirfoxMiranda* mirfoxMirandaPtr = (CMirfoxMiranda*)threadArg; MirfoxData* mirfoxDataPtr = &(mirfoxMirandaPtr->getMirfoxData()); @@ -436,7 +436,7 @@ void CMirfoxMiranda::unloadMessageQueue(uint16_t unloadedMQProcessId) void CMirfoxMiranda::msgQueueThread(void* threadArg) { - Thread_Push(0); + Thread_Push(nullptr); CMirfoxMiranda* mirfoxMirandaPtr = (CMirfoxMiranda*)threadArg; MirfoxData* mirfoxDataPtr = &(mirfoxMirandaPtr->getMirfoxData()); -- cgit v1.2.3