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] --- protocols/SkypeWeb/src/main.cpp | 2 +- protocols/SkypeWeb/src/request_queue.cpp | 14 +++--- protocols/SkypeWeb/src/skype_accounts.cpp | 2 +- protocols/SkypeWeb/src/skype_avatars.cpp | 8 ++-- protocols/SkypeWeb/src/skype_chatrooms.cpp | 64 +++++++++++++-------------- protocols/SkypeWeb/src/skype_contacts.cpp | 14 +++--- protocols/SkypeWeb/src/skype_db.cpp | 2 +- protocols/SkypeWeb/src/skype_dialogs.cpp | 4 +- protocols/SkypeWeb/src/skype_events.cpp | 24 +++++----- protocols/SkypeWeb/src/skype_files.cpp | 2 +- protocols/SkypeWeb/src/skype_history_sync.cpp | 4 +- protocols/SkypeWeb/src/skype_icons.cpp | 4 +- protocols/SkypeWeb/src/skype_login.cpp | 16 +++---- protocols/SkypeWeb/src/skype_messages.cpp | 12 ++--- protocols/SkypeWeb/src/skype_mslogin.cpp | 10 ++--- protocols/SkypeWeb/src/skype_network.cpp | 2 +- protocols/SkypeWeb/src/skype_oauth.cpp | 6 +-- protocols/SkypeWeb/src/skype_polling.cpp | 4 +- protocols/SkypeWeb/src/skype_popups.cpp | 2 +- protocols/SkypeWeb/src/skype_profile.cpp | 2 +- protocols/SkypeWeb/src/skype_proto.cpp | 8 ++-- protocols/SkypeWeb/src/skype_request.cpp | 2 +- protocols/SkypeWeb/src/skype_search.cpp | 2 +- protocols/SkypeWeb/src/skype_timers.cpp | 6 +-- protocols/SkypeWeb/src/skype_trouter.cpp | 16 +++---- protocols/SkypeWeb/src/skype_utils.cpp | 18 ++++---- 26 files changed, 125 insertions(+), 125 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index db03720e5d..37b2ba5a97 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. int hLangpack; HINSTANCE g_hInstance; CLIST_INTERFACE *pcli; -FI_INTERFACE *fii = NULL; +FI_INTERFACE *fii = nullptr; char g_szMirVer[100]; HANDLE g_hCallEvent; CHAT_MANAGER *pci; diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp index 84d725aba4..e0c72c9cee 100644 --- a/protocols/SkypeWeb/src/request_queue.cpp +++ b/protocols/SkypeWeb/src/request_queue.cpp @@ -21,7 +21,7 @@ RequestQueue::RequestQueue(HNETLIBUSER _nlu) : nlu(_nlu), requests(1) { isTerminated = true; - hRequestQueueThread = NULL; + hRequestQueueThread = nullptr; } RequestQueue::~RequestQueue() @@ -40,7 +40,7 @@ void RequestQueue::Start() return; isTerminated = false; - if (hRequestQueueThread == NULL) + if (hRequestQueueThread == nullptr) hRequestQueueThread = mir_forkthread((pThreadFunc)&RequestQueue::WorkerThread, this); } @@ -70,13 +70,13 @@ void RequestQueue::Push(HttpRequest *request, HttpResponseCallback response, voi void RequestQueue::Send(HttpRequest *request, HttpResponseCallback response, void *arg) { RequestQueueItem *item = new RequestQueueItem(request, response, arg); - mir_forkthreadowner((pThreadFuncOwner)&RequestQueue::AsyncSendThread, this, item, 0); + mir_forkthreadowner((pThreadFuncOwner)&RequestQueue::AsyncSendThread, this, item, nullptr); } void RequestQueue::Execute(RequestQueueItem *item) { NETLIBHTTPREQUEST *response = item->request->Send(nlu); - if (item->responseCallback != NULL) + if (item->responseCallback != nullptr) item->responseCallback(response, item->arg); Netlib_FreeHttpRequest(response); requests.remove(item); @@ -103,7 +103,7 @@ unsigned int RequestQueue::WorkerThread(void *arg) break; while (true) { - RequestQueueItem *item = NULL; + RequestQueueItem *item = nullptr; { mir_cslock lock(queue->requestQueueLock); @@ -113,11 +113,11 @@ unsigned int RequestQueue::WorkerThread(void *arg) item = queue->requests[0]; queue->requests.remove(0); } - if (item != NULL) + if (item != nullptr) queue->Execute(item); } } - queue->hRequestQueueThread = NULL; + queue->hRequestQueueThread = nullptr; return 0; } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp index 92b58e2cc5..1e54acb021 100644 --- a/protocols/SkypeWeb/src/skype_accounts.cpp +++ b/protocols/SkypeWeb/src/skype_accounts.cpp @@ -46,7 +46,7 @@ CSkypeProto* CSkypeProto::GetContactAccount(MCONTACT hContact) for (int i = 0; i < Accounts.getCount(); i++) if (mir_strcmpi(GetContactProto(hContact), Accounts[i]->m_szModuleName) == 0) return Accounts[i]; - return NULL; + return nullptr; } int CSkypeProto::OnAccountLoaded(WPARAM, LPARAM) diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 594d843dce..279087960b 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -54,7 +54,7 @@ void CSkypeProto::ReloadAvatarInfo(MCONTACT hContact) void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) { - if (response == NULL || response->pData == NULL) + if (response == nullptr || response->pData == nullptr) return; MCONTACT hContact = (DWORD_PTR)arg; @@ -67,7 +67,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) GetAvatarFileName(hContact, ai.filename, _countof(ai.filename)); FILE *out = _wfopen(ai.filename, L"wb"); - if (out == NULL) { + if (out == nullptr) { ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0); return; } @@ -80,7 +80,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) void CSkypeProto::OnSentAvatar(const NETLIBHTTPREQUEST *response) { - if (response == NULL) + if (response == nullptr) return; JSONNode root = JSONNode::parse(response->pData); @@ -167,7 +167,7 @@ INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam) wchar_t *path = (wchar_t*)lParam; wchar_t avatarPath[MAX_PATH]; GetAvatarFileName(NULL, avatarPath, _countof(avatarPath)); - if (path != NULL) { + if (path != nullptr) { if (CopyFile(path, avatarPath, FALSE)) { FILE *hFile = _wfopen(path, L"rb"); if (hFile) { diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 85ffc6a5dc..9dbb8032a8 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -70,7 +70,7 @@ void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname) void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response) { - if (response == NULL) + if (response == nullptr) return; JSONNode root = JSONNode::parse(response->pData); @@ -214,7 +214,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) gce.ptszUID = gch->ptszUID; gce.ptszText = tnick_new; gce.dwFlags = GCEF_ADDTOLOG; - gce.time = time(NULL); + gce.time = time(nullptr); Chat_Event(&gce); if (!reset) @@ -243,7 +243,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM) if (!IsOnline()) return 1; - if (hContact && IDYES == MessageBox(NULL, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION)) { + if (hContact && IDYES == MessageBox(nullptr, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION)) { ptrW idT(getWStringA(hContact, "ChatRoomID")); Chat_Control(m_szModuleName, idT, SESSION_OFFLINE); Chat_Terminate(m_szModuleName, idT); @@ -283,13 +283,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget, initiator; //content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember> - HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"addmember"); - if (xml == NULL) + HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), nullptr, L"addmember"); + if (xml == nullptr) return; for (int i = 0; i < xmlGetChildCount(xml); i++) { HXML xmlNode = xmlGetNthChild(xml, L"target", i); - if (xmlNode == NULL) + if (xmlNode == nullptr) break; xtarget = mir_u2a(xmlGetText(xmlNode)); @@ -303,13 +303,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget; //content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember> - HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"deletemember"); - if (xml != NULL) { + HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), nullptr, L"deletemember"); + if (xml != nullptr) { HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0); - xinitiator = node != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL; + xinitiator = node != NULL ? mir_u2a(xmlGetText(xmlNode)) : nullptr; xmlNode = xmlGetChildByPath(xml, L"target", 0); - xtarget = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL; + xtarget = xmlNode != nullptr ? mir_u2a(xmlGetText(xmlNode)) : nullptr; xmlDestroyNode(xml); } @@ -324,13 +324,13 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) else if (messageType == "ThreadActivity/TopicUpdate") { //content=<topicupdate><eventtime>1429532702130</eventtime><initiator>8:user</initiator><value>test topic</value></topicupdate> ptrA xinitiator, value; - HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"topicupdate"); - if (xml != NULL) { + HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), nullptr, L"topicupdate"); + if (xml != nullptr) { HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0); - xinitiator = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL; + xinitiator = xmlNode != nullptr ? mir_u2a(xmlGetText(xmlNode)) : nullptr; xmlNode = xmlGetChildByPath(xml, L"value", 0); - value = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL; + value = xmlNode != nullptr ? mir_u2a(xmlGetText(xmlNode)) : nullptr; xmlDestroyNode(xml); } @@ -342,17 +342,17 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) else if (messageType == "ThreadActivity/RoleUpdate") { //content=<roleupdate><eventtime>1429551258363</eventtime><initiator>8:user</initiator><target><id>8:user1</id><role>admin</role></target></roleupdate> ptrA xinitiator, xId, xRole; - HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), 0, L"roleupdate"); - if (xml != NULL) { + HXML xml = xmlParseString(ptrW(mir_utf8decodeW(strContent.c_str())), nullptr, L"roleupdate"); + if (xml != nullptr) { HXML xmlNode = xmlGetChildByPath(xml, L"initiator", 0); - xinitiator = xmlNode != NULL ? mir_u2a(xmlGetText(xmlNode)) : NULL; + xinitiator = xmlNode != nullptr ? mir_u2a(xmlGetText(xmlNode)) : nullptr; xmlNode = xmlGetChildByPath(xml, L"target", 0); - if (xmlNode != NULL) { + if (xmlNode != nullptr) { HXML xmlId = xmlGetChildByPath(xmlNode, L"id", 0); HXML xmlRole = xmlGetChildByPath(xmlNode, L"role", 0); - xId = xmlId != NULL ? mir_u2a(xmlGetText(xmlId)) : NULL; - xRole = xmlRole != NULL ? mir_u2a(xmlGetText(xmlRole)) : NULL; + xId = xmlId != nullptr ? mir_u2a(xmlGetText(xmlId)) : nullptr; + xRole = xmlRole != nullptr ? mir_u2a(xmlGetText(xmlRole)) : nullptr; } xmlDestroyNode(xml); @@ -367,7 +367,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) gce.ptszNick = tszId; gce.ptszUID = tszId; gce.ptszText = tszInitiator; - gce.time = time(NULL); + gce.time = time(nullptr); gce.bIsMe = IsMe(id); gce.ptszStatus = TranslateT("Admin"); Chat_Event(&gce); @@ -388,9 +388,9 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM ptrA szMessage(mir_utf8encodeW(buf)); if (strncmp(szMessage, "/me ", 4) == 0) - SendRequest(new SendChatActionRequest(szChatId, time(NULL), szMessage, li)); + SendRequest(new SendChatActionRequest(szChatId, time(nullptr), szMessage, li)); else - SendRequest(new SendChatMessageRequest(szChatId, time(NULL), szMessage, li)); + SendRequest(new SendChatMessageRequest(szChatId, time(nullptr), szMessage, li)); } void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading) @@ -421,7 +421,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p) { ptrW topic((wchar_t*)p); // memory must be freed in any case - if (response == NULL || response->pData == NULL) + if (response == nullptr || response->pData == nullptr) return; JSONNode root = JSONNode::parse(response->pData); @@ -469,7 +469,7 @@ void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const bool CSkypeProto::IsChatContact(const wchar_t *chat_id, const char *id) { ptrA users(GetChatUsers(chat_id)); - return (users != NULL && strstr(users, id) != NULL); + return (users != NULL && strstr(users, id) != nullptr); } char *CSkypeProto::GetChatUsers(const wchar_t *chat_id) @@ -485,7 +485,7 @@ char *CSkypeProto::GetChatUsers(const wchar_t *chat_id) wchar_t* CSkypeProto::GetChatContactNick(const char *chat_id, const char *id, const char *name) { // Check if there is custom nick for this chat contact - if (chat_id != NULL) { + if (chat_id != nullptr) { if (wchar_t *tname = db_get_wsa(FindChatRoom(chat_id), "UsersNicks", id)) return tname; } @@ -510,7 +510,7 @@ wchar_t* CSkypeProto::GetChatContactNick(const char *chat_id, const char *id, co } // Return default value as nick - given name or user id - if (name != NULL) + if (name != nullptr) return mir_a2u_cp(name, CP_UTF8); else return mir_a2u(id); @@ -528,7 +528,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const gce.dwFlags = GCEF_ADDTOLOG; gce.ptszNick = tnick; gce.ptszUID = tid; - gce.time = !isChange ? time(NULL) : NULL; + gce.time = !isChange ? time(nullptr) : NULL; gce.bIsMe = IsMe(id); gce.ptszStatus = TranslateW(role); @@ -549,13 +549,13 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con gce.ptszUID = tid; gce.ptszNick = tnick; gce.ptszStatus = tinitiator; - gce.time = time(NULL); + gce.time = time(nullptr); } else { gce.dwFlags = GCEF_ADDTOLOG; gce.ptszNick = tnick; gce.ptszUID = tid; - gce.time = time(NULL); + gce.time = time(nullptr); gce.bIsMe = IsMe(id); } @@ -599,7 +599,7 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) static const struct gc_item Items[] = { { LPGENW("Kick &user"), 10, MENU_ITEM }, - { NULL, 0, MENU_SEPARATOR }, + { nullptr, 0, MENU_SEPARATOR }, { LPGENW("Set &role"), 20, MENU_NEWPOPUP }, { LPGENW("&Admin"), 30, MENU_POPUPITEM }, { LPGENW("&User"), 40, MENU_POPUPITEM }, @@ -617,7 +617,7 @@ CMStringW CSkypeProto::ChangeTopicForm() ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_MULTILINE; pForm.caption = caption; - pForm.ptszInitVal = NULL; + pForm.ptszInitVal = nullptr; pForm.szModuleName = m_szModuleName; return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult)); } diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index a7e24d8f28..58b7f8ea82 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -104,7 +104,7 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary) void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) { - if (response == NULL) + if (response == nullptr) return; JSONNode root = JSONNode::parse(response->pData); @@ -130,10 +130,10 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) db_set_dw(hContact, m_szModuleName, "LastAuthRequestTime", eventTime); delSetting(hContact, "Auth"); - DB_AUTH_BLOB blob(hContact, NULL, NULL, NULL, skypename.c_str(), reason.c_str()); + DB_AUTH_BLOB blob(hContact, nullptr, nullptr, nullptr, skypename.c_str(), reason.c_str()); PROTORECVEVENT pre = { 0 }; - pre.timestamp = time(NULL); + pre.timestamp = time(nullptr); pre.lParam = blob.size(); pre.szMessage = blob; @@ -146,7 +146,7 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) //[{"username":"echo123", "firstname" : "Echo \/ Sound Test Service", "lastname" : null, "avatarUrl" : null, "mood" : null, "richMood" : null, "displayname" : null, "country" : null, "city" : null},...] void CSkypeProto::LoadContactsInfo(const NETLIBHTTPREQUEST *response) { - if (response == NULL) + if (response == nullptr) return; JSONNode root = JSONNode::parse(response->pData); @@ -174,7 +174,7 @@ void CSkypeProto::LoadContactsInfo(const NETLIBHTTPREQUEST *response) void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) { - if (response == NULL) + if (response == nullptr) return; JSONNode root = JSONNode::parse(response->pData); @@ -314,7 +314,7 @@ INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM) void CSkypeProto::OnBlockContact(const NETLIBHTTPREQUEST *response, void *p) { MCONTACT hContact = (DWORD_PTR)p; - if (response == NULL) + if (response == nullptr) return; db_set_dw(hContact, "Ignore", "Mask1", 127); db_set_b(hContact, "CList", "Hidden", 1); @@ -329,7 +329,7 @@ INT_PTR CSkypeProto::UnblockContact(WPARAM hContact, LPARAM) void CSkypeProto::OnUnblockContact(const NETLIBHTTPREQUEST *response, void *p) { MCONTACT hContact = (DWORD_PTR)p; - if (response == NULL) + if (response == nullptr) return; db_set_dw(hContact, "Ignore", "Mask1", 0); db_set_b(hContact, "CList", "Hidden", 0); diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index 81d3fa434a..f5fd1519b6 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -32,7 +32,7 @@ struct SkypeDBType { int type; char *name; DWORD flags; } g_SkypeDBTypes[] = MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, LONGLONG timestamp) { - if (messageId == NULL) + if (messageId == nullptr) return NULL; timestamp -= 600; // we check events written 10 minutes ago diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 04645c8ee8..b85ab3ad27 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -82,7 +82,7 @@ void CSkypeGCCreateDlg::btnOk_OnOk(CCtrlButton*) if (HANDLE hItem = m_clc.FindContact(hContact)) { if (m_clc.GetCheck(hItem)) { char *szName = mir_strdup(m_proto->Contacts[hContact]); - if (szName != NULL) + if (szName != nullptr) m_ContactsList.insert(szName); } } @@ -104,7 +104,7 @@ void CSkypeGCCreateDlg::FilterList(CCtrlClc *) void CSkypeGCCreateDlg::ResetListOptions(CCtrlClc *) { - m_clc.SetBkBitmap(0, NULL); + m_clc.SetBkBitmap(0, nullptr); m_clc.SetBkColor(GetSysColor(COLOR_WINDOW)); m_clc.SetGreyoutFlags(0); m_clc.SetLeftMargin(4); diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 51b1f87b7c..09bebbf54c 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -52,18 +52,18 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) case SKYPE_DB_EVENT_TYPE_CALL_INFO: { - HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), 0, L"partlist"); - if (xml != NULL) { + HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), nullptr, L"partlist"); + if (xml != nullptr) { ptrA type(mir_u2a(xmlGetAttrValue(xml, L"type"))); bool bType = (!mir_strcmpi(type, "started")) ? 1 : 0; time_t callDuration = 0; for (int i = 0; i < xmlGetChildCount(xml); i++) { HXML xmlPart = xmlGetNthChild(xml, L"part", i); - if (xmlPart != NULL) { + if (xmlPart != nullptr) { HXML xmlDuration = xmlGetChildByPath(xmlPart, L"duration", 0); - if (xmlDuration != NULL) { + if (xmlDuration != nullptr) { callDuration = _wtol(xmlGetText(xmlDuration)); break; } @@ -92,15 +92,15 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) } case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO: { - HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), 0, L"files"); - if (xml != NULL) { + HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), nullptr, L"files"); + if (xml != nullptr) { for (int i = 0; i < xmlGetChildCount(xml); i++) { LONGLONG fileSize = 0; HXML xmlNode = xmlGetNthChild(xml, L"file", i); - if (xmlNode != NULL) { + if (xmlNode != nullptr) { fileSize = _wtol(xmlGetAttrValue(xmlNode, L"size")); char *fileName = _T2A(xmlGetText(xmlNode)); - if (fileName != NULL) { + if (fileName != nullptr) { szText.AppendFormat(Translate("File transfer:\n\tFile name: %s \n\tSize: %lld bytes \n"), fileName, fileSize); } @@ -118,11 +118,11 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) case SKYPE_DB_EVENT_TYPE_MOJI: case SKYPE_DB_EVENT_TYPE_URIOBJ: { - HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), 0, L"URIObject"); - if (xml != NULL) { + HXML xml = xmlParseString(ptrW(mir_utf8decodeW((char*)dbei->pBlob)), nullptr, L"URIObject"); + if (xml != nullptr) { //szText.Append(_T2A(xmlGetText(xml))); HXML xmlA = xmlGetChildByPath(xml, L"a", 0); - if (xmlA != NULL) { + if (xmlA != nullptr) { szText += T2Utf(xmlGetAttrValue(xmlA, L"href")); } xmlDestroyNode(xml); @@ -151,7 +151,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) INT_PTR CSkypeProto::EventGetIcon(WPARAM flags, LPARAM pEvent) { DBEVENTINFO *dbei = (DBEVENTINFO*)pEvent; - HICON icon = NULL; + HICON icon = nullptr; switch (dbei->eventType) { case SKYPE_DB_EVENT_TYPE_CALL_INFO: diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 17efd46bc0..1ce9e54808 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -37,7 +37,7 @@ void CSkypeProto::OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *ar std::string strObjectId = node["id"].as_string(); fup->uid = mir_strdup(strObjectId.c_str()); FILE *pFile = _wfopen(fup->tszFileName, L"rb"); - if (pFile == NULL) return; + if (pFile == nullptr) return; fseek(pFile, 0, SEEK_END); long lFileLen = ftell(pFile); diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 3b1f4d55a1..000007dbf3 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) { - if (response == NULL) + if (response == nullptr) return; JSONNode root = JSONNode::parse(response->pData); @@ -111,7 +111,7 @@ INT_PTR CSkypeProto::GetContactHistory(WPARAM hContact, LPARAM) void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) + if (response == nullptr || response->pData == nullptr) return; JSONNode root = JSONNode::parse(response->pData); diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index 9064f3c148..0275775124 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -40,7 +40,7 @@ HICON CSkypeProto::GetIcon(int iconId) for (size_t i = 0; i < _countof(Icons); i++) if (Icons[i].defIconID == iconId) return IcoLib_GetIconByHandle(Icons[i].hIcolib); - return 0; + return nullptr; } HANDLE CSkypeProto::GetIconHandle(int iconId) @@ -48,5 +48,5 @@ HANDLE CSkypeProto::GetIconHandle(int iconId) for (size_t i = 0; i < _countof(Icons); i++) if (Icons[i].defIconID == iconId) return Icons[i].hIcolib; - return 0; + return nullptr; } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 4420ef8f4f..d1b339cc29 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -35,7 +35,7 @@ void CSkypeProto::Login() } m_bHistorySynced = m_bThreadsTerminated = false; - if ((tokenExpires - 1800) > time(NULL)) + if ((tokenExpires - 1800) > time(nullptr)) OnLoginSuccess(); PushRequest(new OAuthRequest(), &CSkypeProto::OnOAuthStart); @@ -45,7 +45,7 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) { if (!IsStatusConnecting(m_iStatus)) return; - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -124,7 +124,7 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) m_iStatus++; - if (response == NULL) { + if (response == nullptr) { debugLogA(__FUNCTION__ ": failed to get create endpoint"); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); @@ -189,7 +189,7 @@ void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response) if (!IsStatusConnecting(m_iStatus)) return; - if (response == NULL) { + if (response == nullptr) { debugLogA(__FUNCTION__ ": failed to create subscription"); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); @@ -223,7 +223,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) if (!IsStatusConnecting(m_iStatus)) return; - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -244,7 +244,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) SendRequest(new LoadChatsRequest(li), &CSkypeProto::OnLoadChats); SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter); - PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList); + PushRequest(new GetContactListRequest(li, nullptr), &CSkypeProto::LoadContactList); PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL); if (m_opts.bAutoHistorySync) @@ -254,12 +254,12 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) if (root) setString("SelfEndpointName", UrlToSkypename(root["selfLink"].as_string().c_str())); - PushRequest(new GetProfileRequest(li), &CSkypeProto::LoadProfile, NULL); + PushRequest(new GetProfileRequest(li), &CSkypeProto::LoadProfile, nullptr); } void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { debugLogA(__FUNCTION__ ": failed to change status"); ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 4b92e06afe..c7245ca1a2 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -52,7 +52,7 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) SendMessageParam *param = new SendMessageParam(); param->hContact = hContact; - param->hMessage = time(NULL); + param->hMessage = time(nullptr); ptrA username(getStringA(hContact, "Skypename")); @@ -75,10 +75,10 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) HANDLE hMessage = (HANDLE)param->hMessage; delete param; - if (response != NULL) { + if (response != nullptr) { if (response->resultCode == 201) { if (m_OutMessages.getIndex(hMessage) != -1) { - if (response->pData != NULL) { + if (response->pData != nullptr) { JSONNode jRoot = JSONNode::parse(response->pData); if (m_mpOutMessages.find(hMessage) == m_mpOutMessages.end()) { m_mpOutMessages[hMessage] = std::stoull(jRoot["OriginalArrivalTime"].as_string()) / 1000; @@ -94,7 +94,7 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) else { std::string strError = Translate("Unknown error!"); - if (response->pData != NULL) { + if (response->pData != nullptr) { JSONNode jRoot = JSONNode::parse(response->pData); const JSONNode &jErr = jRoot["errorCode"]; @@ -245,7 +245,7 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent) void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const char *szContent, const char *szMessageId) { - HXML xmlNode = xmlParseString(mir_utf8decodeW(szContent), 0, L"contacts"); + HXML xmlNode = xmlParseString(mir_utf8decodeW(szContent), nullptr, L"contacts"); if (xmlNode) { int nCount = 0; PROTOSEARCHRESULT **psr; @@ -256,7 +256,7 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const nCount = 0; for (int i = 0; i < xmlGetChildCount(xmlNode); i++) { HXML xmlContact = xmlGetNthChild(xmlNode, L"c", i); - if (xmlContact != NULL) { + if (xmlContact != nullptr) { const wchar_t *tszContactId = xmlGetAttrValue(xmlContact, L"s"); //const wchar_t *tszContactName = xmlGetAttrValue(xmlContact, L"f"); diff --git a/protocols/SkypeWeb/src/skype_mslogin.cpp b/protocols/SkypeWeb/src/skype_mslogin.cpp index dd7a894319..73e05e8221 100644 --- a/protocols/SkypeWeb/src/skype_mslogin.cpp +++ b/protocols/SkypeWeb/src/skype_mslogin.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnMSLoginFirst(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -56,7 +56,7 @@ void CSkypeProto::OnMSLoginFirst(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnMSLoginSecond(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -106,7 +106,7 @@ void CSkypeProto::OnMSLoginSecond(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnMSLoginThird(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -130,7 +130,7 @@ void CSkypeProto::OnMSLoginThird(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnMSLoginEnd(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -165,7 +165,7 @@ CMStringW CSkypeProto::RunConfirmationCode() ENTER_STRING pForm = { sizeof(pForm) }; pForm.type = ESF_PASSWORD; pForm.caption = caption; - pForm.ptszInitVal = NULL; + pForm.ptszInitVal = nullptr; pForm.szModuleName = m_szModuleName; return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult)); } diff --git a/protocols/SkypeWeb/src/skype_network.cpp b/protocols/SkypeWeb/src/skype_network.cpp index 4f1e98454c..46a564599b 100644 --- a/protocols/SkypeWeb/src/skype_network.cpp +++ b/protocols/SkypeWeb/src/skype_network.cpp @@ -39,6 +39,6 @@ void CSkypeProto::ShutdownConnections() Netlib_CloseHandle(m_pollingConnection); Netlib_CloseHandle(m_TrouterConnection); - m_pollingConnection = m_TrouterConnection = 0; + m_pollingConnection = m_TrouterConnection = nullptr; //Netlib_Shutdown(m_hNetlibUser); } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_oauth.cpp b/protocols/SkypeWeb/src/skype_oauth.cpp index 99d73c7e0c..f198c160ae 100644 --- a/protocols/SkypeWeb/src/skype_oauth.cpp +++ b/protocols/SkypeWeb/src/skype_oauth.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnOAuthStart(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -58,7 +58,7 @@ void CSkypeProto::OnOAuthStart(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnOAuthAuthorize(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; @@ -80,7 +80,7 @@ void CSkypeProto::OnOAuthAuthorize(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnOAuthEnd(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); SetStatus(ID_STATUS_OFFLINE); return; diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index 00b6c4e57b..4325632571 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -64,8 +64,8 @@ void CSkypeProto::PollingThread(void*) SetStatus(ID_STATUS_OFFLINE); } } - m_hPollingThread = NULL; - m_pollingConnection = NULL; + m_hPollingThread = nullptr; + m_pollingConnection = nullptr; debugLogA(__FUNCTION__ ": leaving"); } diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 4babb8941c..b87d31c223 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -77,7 +77,7 @@ void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *messag } else { DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP; - MessageBox(NULL, message, caption, mtype); + MessageBox(nullptr, message, caption, mtype); } } diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 5fda01d573..d0f7304b0a 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -436,7 +436,7 @@ void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response, void *arg) { MCONTACT hContact = (DWORD_PTR)arg; - if (response == NULL) { + if (response == nullptr) { ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0); return; } diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index e1c3368f74..58406f4630 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -67,12 +67,12 @@ CSkypeProto::~CSkypeProto() if (m_hPollingThread) { WaitForSingleObject(m_hPollingThread, INFINITE); - m_hPollingThread = NULL; + m_hPollingThread = nullptr; } if (m_hTrouterThread) { WaitForSingleObject(m_hTrouterThread, INFINITE); - m_hTrouterThread = NULL; + m_hTrouterThread = nullptr; } SkypeUnsetTimer(); @@ -140,7 +140,7 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) { debugLogA(__FUNCTION__); - if (psr->id.a == NULL) + if (psr->id.a == nullptr) return NULL; MCONTACT hContact; @@ -158,7 +158,7 @@ MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) DBEVENTINFO dbei = {}; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) return NULL; - if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL) + if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == nullptr) return NULL; if (db_event_get(hDbEvent, &dbei)) return NULL; diff --git a/protocols/SkypeWeb/src/skype_request.cpp b/protocols/SkypeWeb/src/skype_request.cpp index 6be0271352..31ec15960f 100644 --- a/protocols/SkypeWeb/src/skype_request.cpp +++ b/protocols/SkypeWeb/src/skype_request.cpp @@ -43,7 +43,7 @@ void CSkypeProto::PushRequest(HttpRequest *request, SkypeResponseWithArgCallback void CSkypeProto::SendRequest(HttpRequest *request) { - requestQueue->Send(request, NULL, NULL); + requestQueue->Send(request, nullptr, nullptr); } void CSkypeProto::SendRequest(HttpRequest *request, SkypeResponseCallback response) diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 0bfcccbad6..e5a311388a 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -35,7 +35,7 @@ void CSkypeProto::SearchBasicThread(void* id) void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response) { debugLogA(__FUNCTION__); - if (response == NULL) { + if (response == nullptr) { ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); return; } diff --git a/protocols/SkypeWeb/src/skype_timers.cpp b/protocols/SkypeWeb/src/skype_timers.cpp index b3561f3613..3fc9bfb94f 100644 --- a/protocols/SkypeWeb/src/skype_timers.cpp +++ b/protocols/SkypeWeb/src/skype_timers.cpp @@ -23,7 +23,7 @@ mir_cs CSkypeProto::accountsLock; void CSkypeProto::ProcessTimer() { if (IsOnline()) { - PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList); + PushRequest(new GetContactListRequest(li, nullptr), &CSkypeProto::LoadContactList); SendPresence(false); } } @@ -39,13 +39,13 @@ void CSkypeProto::SkypeSetTimer() { mir_cslock lck(timerLock); if (!m_timer) - m_timer = SetTimer(NULL, 0, 600000, TimerProc); + m_timer = SetTimer(nullptr, 0, 600000, TimerProc); } void CSkypeProto::SkypeUnsetTimer() { mir_cslock lck(timerLock); if (m_timer && Accounts.getCount() == 0) - KillTimer(NULL, m_timer); + KillTimer(nullptr, m_timer); m_timer = 0; } diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index c5c055e213..c8aff831dc 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { LBL_Error: debugLogA("Failed to establish a TRouter connection."); return; @@ -49,7 +49,7 @@ LBL_Error: void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { LBL_Error: debugLogA("Failed to establish a TRouter connection."); return; @@ -82,7 +82,7 @@ LBL_Error: void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response) { - if (response == NULL || response->pData == NULL) { + if (response == nullptr || response->pData == nullptr) { debugLogA("Failed to establish a TRouter connection."); return; } @@ -95,9 +95,9 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response) m_hTrouterEvent.Set(); m_hTrouterHealthEvent.Set(); - if ((time(NULL) - TRouter.lastRegistrationTime) >= 3600) { + if ((time(nullptr) - TRouter.lastRegistrationTime) >= 3600) { SendRequest(new RegisterTrouterRequest(li, TRouter.url.c_str(), TRouter.sessId.c_str())); - TRouter.lastRegistrationTime = time(NULL); + TRouter.lastRegistrationTime = time(nullptr); } } @@ -166,8 +166,8 @@ void CSkypeProto::TRouterThread(void*) SetStatus(ID_STATUS_OFFLINE); } } - m_hTrouterThread = NULL; - m_TrouterConnection = NULL; + m_hTrouterThread = nullptr; + m_TrouterConnection = nullptr; debugLogA(__FUNCTION__": leaving"); } @@ -186,7 +186,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &) if (!uid.empty()) { MCONTACT hContact = AddContact(uid.c_str(), true); - MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(NULL), DBEF_READ, gp.c_str(), callId.c_str()); + MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(nullptr), DBEF_READ, gp.c_str(), callId.c_str()); Skin_PlaySound("skype_inc_call"); CLISTEVENT cle = {}; diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 2c36178f39..221e657342 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -24,7 +24,7 @@ time_t CSkypeProto::IsoToUnixTime(const char *stamp) char date[9]; int i, y; - if (stamp == NULL) + if (stamp == nullptr) return 0; char *p = NEWSTR_ALLOCA(stamp); @@ -379,7 +379,7 @@ char *CSkypeProto::RemoveHtml(const char *text) if (!entity.empty()) { found = true; errno = 0; - unsigned long value = strtoul(entity.c_str(), NULL, hex ? 16 : 10); + unsigned long value = strtoul(entity.c_str(), nullptr, hex ? 16 : 10); if (errno != 0) { // error with conversion in strtoul, ignore the result found = false; } @@ -471,12 +471,12 @@ bool CSkypeProto::IsFileExists(std::wstring path) CMStringA CSkypeProto::ParseUrl(const char *url, const char *token) { const char *start = strstr(url, token); - if (start == NULL) + if (start == nullptr) return CMStringA(); start = start + mir_strlen(token); const char *end = strchr(start, '/'); - if (end == NULL) + if (end == nullptr) return CMStringA(start); return CMStringA(start, end - start); } @@ -484,12 +484,12 @@ CMStringA CSkypeProto::ParseUrl(const char *url, const char *token) CMStringA CSkypeProto::GetStringChunk(const char *haystack, const char *start, const char *end) { const char *sstart = strstr(haystack, start); - if (sstart == NULL) + if (sstart == nullptr) return CMStringA(); sstart = sstart + mir_strlen(start); const char *send = strstr(sstart, end); - if (send == NULL) + if (send == nullptr) return CMStringA(sstart); return CMStringA(sstart, send - sstart); } @@ -516,14 +516,14 @@ CMStringA CSkypeProto::GetServerFromUrl(const char *url) INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) { wchar_t *arg = (wchar_t *)lParam; - if (arg == NULL) + if (arg == nullptr) return 1; // skip leading prefix wchar_t szUri[1024]; wcsncpy_s(szUri, arg, _TRUNCATE); wchar_t *szJid = wcschr(szUri, ':'); - if (szJid == NULL) + if (szJid == nullptr) return 1; // empty jid? @@ -537,7 +537,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) *(szCommand++) = 0; // parameters - wchar_t *szSecondParam = szCommand ? wcschr(szCommand, '&') : NULL; + wchar_t *szSecondParam = szCommand ? wcschr(szCommand, '&') : nullptr; if (szSecondParam) *(szSecondParam++) = 0; -- cgit v1.2.3