From 22985cfd94e02d1308b1facd22359c863dcf8aba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 29 Jan 2020 20:26:01 +0300 Subject: unneded checks removed --- protocols/SkypeWeb/src/skype_avatars.cpp | 3 --- protocols/SkypeWeb/src/skype_chatrooms.cpp | 5 ----- protocols/SkypeWeb/src/skype_contacts.cpp | 9 --------- protocols/SkypeWeb/src/skype_history_sync.cpp | 6 ------ protocols/SkypeWeb/src/skype_profile.cpp | 5 ----- protocols/SkypeWeb/src/skype_proto.cpp | 3 --- protocols/SkypeWeb/src/skype_search.cpp | 12 +----------- protocols/SkypeWeb/src/skype_trouter.cpp | 14 ++++---------- 8 files changed, 5 insertions(+), 52 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 2c71902fc4..82ffb3ca73 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -80,9 +80,6 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) void CSkypeProto::OnSentAvatar(const NETLIBHTTPREQUEST *response) { - if (response == nullptr) - return; - JsonReply root(response); if (root.error()) return; diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 3491416078..990d1d6cee 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -56,9 +56,6 @@ void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname) void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response) { - if (response == nullptr) - return; - JsonReply reply(response); if (reply.error()) return; @@ -367,8 +364,6 @@ void CSkypeProto::AddMessageToChat(const char *chat_id, const char *from, const void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p) { ptrW topic((wchar_t*)p); // memory must be freed in any case - if (response == nullptr || response->pData == nullptr) - return; JsonReply reply(response); if (reply.error()) diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 0b6131a422..a0b117a7f9 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -92,9 +92,6 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary) void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) { - if (response == nullptr) - return; - JsonReply reply(response); if (reply.error()) return; @@ -130,9 +127,6 @@ 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 == nullptr) - return; - JsonReply root(response); if (root.error()) return; @@ -153,9 +147,6 @@ void CSkypeProto::LoadContactsInfo(const NETLIBHTTPREQUEST *response) void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) { - if (response == nullptr) - return; - JsonReply reply(response); if (reply.error()) return; diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 23392313b4..7b31729bb4 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -21,9 +21,6 @@ along with this program. If not, see . void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) { - if (response == nullptr) - return; - JsonReply reply(response); if (reply.error()) return; @@ -114,9 +111,6 @@ INT_PTR CSkypeProto::GetContactHistory(WPARAM hContact, LPARAM) void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) { - if (response == nullptr || response->pData == nullptr) - return; - JsonReply reply(response); if (reply.error()) return; diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 5d9c1cf8da..adad8300e0 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -401,11 +401,6 @@ void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response, void *arg) { MCONTACT hContact = (DWORD_PTR)arg; - if (response == nullptr) { - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0); - return; - } - JsonReply reply(response); if (reply.error()) { ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 581bee884c..6ebe23a08d 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -134,9 +134,6 @@ int CSkypeProto::SetAwayMsg(int, const wchar_t *msg) HANDLE CSkypeProto::GetAwayMsg(MCONTACT hContact) { PushRequest(new GetProfileRequest(this, Contacts[hContact]), [this, hContact](const NETLIBHTTPREQUEST *response) { - if (!response || !response->pData) - return; - JsonReply reply(response); if (reply.error()) return; diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 31b460aa62..2a738a6317 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -33,17 +33,7 @@ void CSkypeProto::SearchBasicThread(void* id) void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response) { debugLogA(__FUNCTION__); - if (response == nullptr) { - ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); - return; - } - - debugLogA("CSkypeProto::OnSearch %d", response->resultCode); - if (response->resultCode != 200) { - ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); - return; - } - + JsonReply reply(response); if (reply.error()) { ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index b3452e8ce8..cfc41f7b8c 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -19,16 +19,13 @@ along with this program. If not, see . void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response) { - if (response == nullptr || response->pData == nullptr) { + JsonReply reply(response); + if (reply.error()) { LBL_Error: debugLogA("Failed to establish a TRouter connection."); return; } - JsonReply reply(response); - if (reply.error()) - goto LBL_Error; - auto &root = reply.data(); const JSONNode &ccid = root["ccid"]; const JSONNode &connId = root["connId"]; @@ -50,16 +47,13 @@ LBL_Error: void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response) { - if (response == nullptr || response->pData == nullptr) { + JsonReply reply(response); + if (reply.error()) { LBL_Error: debugLogA("Failed to establish a TRouter connection."); return; } - JsonReply reply(response); - if (reply.error()) - goto LBL_Error; - auto &root = reply.data(); const JSONNode &st = root["st"]; const JSONNode &se = root["se"]; -- cgit v1.2.3