From ca5001026a94f702c4012c5e8d2093ad3f51c1fa Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 21 Apr 2018 12:33:31 +0300 Subject: code cleaning: - in conformance to C++'11 rules, we don't declare a method as virtual if it's declared as override; - cause this code isn't visible in Pascal anymore, there's no need to use __cdecl calling convention for virtual methods; - since PROTO_INTERFACE is a regular C++ class, there's no need to use old style service declarations for virtual methods like OnModulesLoaded / OnShutdown --- protocols/MRA/src/MraProto.cpp | 13 +++------- protocols/MRA/src/MraProto.h | 58 +++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 38 deletions(-) (limited to 'protocols/MRA') diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 9940b0365e..73698f42e0 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -79,7 +79,7 @@ INT_PTR CMraProto::MraCreateAccMgrUI(WPARAM, LPARAM lParam) (HWND)lParam, DlgProcAccount, LPARAM(this)); } -int CMraProto::OnModulesLoaded(WPARAM, LPARAM) +void CMraProto::OnModulesLoaded() { HookProtoEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &CMraProto::MraExtraIconsApply); HookProtoEvent(ME_OPT_INITIALISE, &CMraProto::OnOptionsInit); @@ -110,15 +110,13 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM) // destroy all chat sessions bChatExists = MraChatRegister(); - return 0; } -int CMraProto::OnShutdown(WPARAM, LPARAM) +void CMraProto::OnShutdown() { m_bShutdown = true; SetStatus(ID_STATUS_OFFLINE); MraAvatarsQueueSuspend(hAvatarsQueueHandle); - return 0; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -245,7 +243,7 @@ int CMraProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t*) ///////////////////////////////////////////////////////////////////////////////////////// -DWORD_PTR CMraProto::GetCaps(int type, MCONTACT) +INT_PTR CMraProto::GetCaps(int type, MCONTACT) { switch (type) { case PFLAGNUM_1: @@ -554,12 +552,9 @@ int CMraProto::UserIsTyping(MCONTACT hContact, int type) return 1; } -int CMraProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) +int CMraProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM, LPARAM) { switch (eventType) { - case EV_PROTO_ONLOAD: return OnModulesLoaded(0, 0); - case EV_PROTO_ONEXIT: return OnShutdown(0, 0); - case EV_PROTO_ONMENU: CListCreateMenu(2000060000, 500085000, TRUE, gdiMenuItems, MAIN_MENU_ITEMS_COUNT, hMainMenuItems); break; diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index be0302ea39..fa16b5fbcf 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -34,46 +34,48 @@ struct CMraProto : public PROTO CMraProto(const char*, const wchar_t*); ~CMraProto(); - // ==================================================================================== + //==================================================================================== // PROTO_INTERFACE - // ==================================================================================== - virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); + MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) override; + MCONTACT AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) override; - virtual int __cdecl Authorize(MEVENT hDBEvent); - virtual int __cdecl AuthDeny(MEVENT hDBEvent, const wchar_t* szReason); - virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); + int Authorize(MEVENT hDBEvent) override; + int AuthDeny(MEVENT hDBEvent, const wchar_t* szReason) override; + int AuthRecv(MCONTACT hContact, PROTORECVEVENT*) override; - virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath); - virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason); + HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath) override; + int FileCancel(MCONTACT hContact, HANDLE hTransfer) override; + int FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason) override; - virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL); - virtual int __cdecl GetInfo(MCONTACT hContact, int infoType); + INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override; + int GetInfo(MCONTACT hContact, int infoType) override; - virtual HANDLE __cdecl SearchBasic(const wchar_t* id); - virtual HANDLE __cdecl SearchByEmail(const wchar_t* email); - virtual HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName); - virtual HWND __cdecl SearchAdvanced(HWND owner); - virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); + HANDLE SearchBasic(const wchar_t* id) override; + HANDLE SearchByEmail(const wchar_t* email) override; + HANDLE SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) override; + HWND SearchAdvanced(HWND owner) override; + HWND CreateExtendedSearchUI(HWND owner) override; - virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*); + int RecvContacts(MCONTACT hContact, PROTORECVEVENT*) override; - virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList); - virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles); - virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); + int SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList) override; + HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override; + int SendMsg(MCONTACT hContact, int flags, const char* msg) override; - virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode); - virtual int __cdecl SetStatus(int iNewStatus); + int SetApparentMode(MCONTACT hContact, int mode) override; + int SetStatus(int iNewStatus) override; - virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact); - virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t* msg); + HANDLE GetAwayMsg(MCONTACT hContact) override; + int SetAwayMsg(int m_iStatus, const wchar_t* msg) override; - virtual int __cdecl UserIsTyping(MCONTACT hContact, int type); + int UserIsTyping(MCONTACT hContact, int type) override; - virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); + int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override; + void OnModulesLoaded() override; + void OnShutdown() override; + //==================================================================================== void ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode); void MraPopupShowW(MCONTACT hContact, DWORD dwType, LPWSTR lpszTitle, LPCWSTR lpszMessage); void MraPopupShowFromContactW(MCONTACT hContact, DWORD dwType, LPCWSTR lpszMessage); @@ -144,8 +146,6 @@ struct CMraProto : public PROTO INT_PTR __cdecl MraCreateAccMgrUI(WPARAM, LPARAM); // ====| Events |====================================================================== - int __cdecl OnModulesLoaded(WPARAM, LPARAM); - int __cdecl OnShutdown(WPARAM, LPARAM); int __cdecl OnOptionsInit(WPARAM, LPARAM); int __cdecl OnPopupOptInit(WPARAM, LPARAM); int __cdecl OnGroupChanged(WPARAM, LPARAM); -- cgit v1.2.3