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/Sametime/src/sametime.cpp | 7 ++--- protocols/Sametime/src/sametime_proto.cpp | 6 ++-- protocols/Sametime/src/sametime_proto.h | 46 +++++++++++++++---------------- 3 files changed, 26 insertions(+), 33 deletions(-) (limited to 'protocols/Sametime') diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 6adc868b82..3246dccc53 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -186,7 +186,7 @@ int CSametimeProto::OnIdleChanged(WPARAM, LPARAM lParam) return 0; } -int CSametimeProto::OnModulesLoaded(WPARAM, LPARAM) +void CSametimeProto::OnModulesLoaded() { // register with chat module GCREGISTER gcr = {}; @@ -194,15 +194,12 @@ int CSametimeProto::OnModulesLoaded(WPARAM, LPARAM) gcr.ptszDispName = m_tszUserName; gcr.iMaxText = MAX_MESSAGE_SIZE; Chat_Register(&gcr); - return 0; } -int CSametimeProto::OnPreShutdown(WPARAM, LPARAM) +void CSametimeProto::OnShutdown() { if (m_iStatus != ID_STATUS_OFFLINE) LogOut(); - - return 0; } int CSametimeProto::OnSametimeContactDeleted(WPARAM hContact, LPARAM) diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 94eb1a97d2..3a814b932a 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -31,8 +31,6 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserN CreateProtoService(PS_GETNAME, &CSametimeProto::GetName); CreateProtoService(PS_LOADICON, &CSametimeProto::SametimeLoadIcon); - HookProtoEvent(ME_SYSTEM_MODULESLOADED, &CSametimeProto::OnModulesLoaded); - HookProtoEvent(ME_SYSTEM_PRESHUTDOWN, &CSametimeProto::OnPreShutdown); HookProtoEvent(ME_MSG_WINDOWEVENT, &CSametimeProto::OnWindowEvent); HookProtoEvent(ME_IDLE_CHANGED, &CSametimeProto::OnIdleChanged); HookProtoEvent(ME_DB_CONTACT_DELETED, &CSametimeProto::OnSametimeContactDeleted); @@ -112,7 +110,7 @@ int CSametimeProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** sz } -DWORD_PTR CSametimeProto::GetCaps(int type, MCONTACT hContact) +INT_PTR CSametimeProto::GetCaps(int type, MCONTACT hContact) { switch (type) { case PFLAGNUM_1: @@ -124,7 +122,7 @@ DWORD_PTR CSametimeProto::GetCaps(int type, MCONTACT hContact) case PFLAGNUM_4: return PF4_SUPPORTTYPING; case PFLAG_UNIQUEIDTEXT: - return (DWORD_PTR)Translate("ID"); + return (INT_PTR)Translate("ID"); case PFLAG_MAXLENOFMESSAGE: return MAX_MESSAGE_SIZE; default: diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index e22186b16e..09923eeed3 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -15,45 +15,43 @@ struct CSametimeProto : public PROTO //==================================================================================== - virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); + MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) 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); - virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename); + 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; + int FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename) 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 HWND __cdecl SearchAdvanced(HWND owner); - virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); + HANDLE SearchBasic(const wchar_t* id) override; + HWND SearchAdvanced(HWND owner) override; + HWND CreateExtendedSearchUI(HWND owner) override; - virtual int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILE*); - virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*); + int RecvFile(MCONTACT hContact, PROTORECVFILE*) override; + int RecvMsg(MCONTACT hContact, PROTORECVEVENT*) override; - virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles); - virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg); + 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 SetStatus(int iNewStatus); + int SetStatus(int iNewStatus) override; - virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact); - virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt); - virtual int __cdecl SetAwayMsg(int iStatus, const wchar_t* msg); - - virtual int __cdecl UserIsTyping(MCONTACT hContact, int type); - - virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam); + HANDLE GetAwayMsg(MCONTACT hContact) override; + int RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt) override; + int SetAwayMsg(int iStatus, const wchar_t* msg) override; + int UserIsTyping(MCONTACT hContact, int type) override; + int OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) override; + void OnModulesLoaded() override; + void OnShutdown() override; // sametime.cpp int __cdecl OnSametimeContactDeleted(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl GetName(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl SametimeLoadIcon(WPARAM wParam, LPARAM lParam); int __cdecl OnWindowEvent(WPARAM wParam, LPARAM lParam); - int __cdecl OnModulesLoaded(WPARAM wParam, LPARAM lParam); - int __cdecl OnPreShutdown(WPARAM wParam, LPARAM lParam); int __cdecl OnIdleChanged(WPARAM wParam, LPARAM lParam); void SetAllOffline(); void BroadcastNewStatus(int iNewStatus); -- cgit v1.2.3