From ffeae3b58ae49397f62cb733c77f565ac4070223 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 26 Nov 2012 18:24:10 +0000 Subject: various code cleaning considering protocols' declarations git-svn-id: http://svn.miranda-ng.org/main/trunk@2509 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/main.cpp | 2 +- plugins/CryptoPP/src/main.cpp | 4 +--- plugins/CyrTranslit/src/TransliterationProtocol.cpp | 9 ++++----- plugins/FileAsMessage/src/main.cpp | 4 +--- plugins/MetaContacts/src/meta_main.cpp | 16 ++++------------ plugins/MirOTR/MirOTR/src/dllmain.cpp | 3 +-- plugins/New_GPG/src/init.cpp | 7 +++---- plugins/SecureIM/src/main.cpp | 4 +--- 8 files changed, 16 insertions(+), 33 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 251c612c41..54eb6892a4 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -1949,7 +1949,7 @@ static void LoadDefaultInfo() g_ProtoPictures.insert(pce); } -static void LoadProtoInfo( PROTOCOLDESCRIPTOR* proto ) +static void LoadProtoInfo(PROTOCOLDESCRIPTOR* proto) { if ( proto->type == PROTOTYPE_PROTOCOL && proto->cbSize == sizeof( *proto )) { diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp index a5613db216..1efc2e7c4d 100644 --- a/plugins/CryptoPP/src/main.cpp +++ b/plugins/CryptoPP/src/main.cpp @@ -52,9 +52,7 @@ int Load() mir_getLP(&pluginInfoEx); // register plugin module - PROTOCOLDESCRIPTOR pd; - memset(&pd,0,sizeof(pd)); - pd.cbSize = sizeof(pd); + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; pd.szName = (char*)szModuleName; pd.type = PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); diff --git a/plugins/CyrTranslit/src/TransliterationProtocol.cpp b/plugins/CyrTranslit/src/TransliterationProtocol.cpp index 4fd3fb1b29..e261458934 100644 --- a/plugins/CyrTranslit/src/TransliterationProtocol.cpp +++ b/plugins/CyrTranslit/src/TransliterationProtocol.cpp @@ -31,11 +31,10 @@ char *TransliterationProtocol::MODULE_NAME = "ProtoCyrTranslitByIKR"; void TransliterationProtocol::initialize() { - PROTOCOLDESCRIPTOR desc; - desc.cbSize = sizeof(desc); - desc.szName = MODULE_NAME; - desc.type = PROTOTYPE_TRANSLATION; - CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast(&desc)); + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; + pd.szName = MODULE_NAME; + pd.type = PROTOTYPE_TRANSLATION; + CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast(&pd)); CreateProtoServiceFunction(MODULE_NAME, PSS_MESSAGE, sendMessageA); CreateProtoServiceFunction(MODULE_NAME, PSS_MESSAGE"W", sendMessageW); diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 044e1f4ace..14a905a9b8 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -256,9 +256,7 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(SERVICE_NAME "/FESendFile", OnSendFile); CreateServiceFunction(SERVICE_NAME "/FERecvFile", OnRecvFile); - PROTOCOLDESCRIPTOR pd; - memset(&pd, 0, sizeof( PROTOCOLDESCRIPTOR)); - pd.cbSize = sizeof(PROTOCOLDESCRIPTOR); + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; pd.szName = SERVICE_NAME; pd.type = PROTOTYPE_FILTER; CallService(MS_PROTO_REGISTERMODULE, 0, ( LPARAM ) &pd); diff --git a/plugins/MetaContacts/src/meta_main.cpp b/plugins/MetaContacts/src/meta_main.cpp index f307d800b6..9e04413983 100644 --- a/plugins/MetaContacts/src/meta_main.cpp +++ b/plugins/MetaContacts/src/meta_main.cpp @@ -150,9 +150,7 @@ BOOL IsUnicodeOS() */ extern "C" __declspec(dllexport) int Load(void) { - PROTOCOLDESCRIPTOR pd; DBVARIANT dbv; - mir_getLP(&pluginInfo); @@ -184,7 +182,6 @@ extern "C" __declspec(dllexport) int Load(void) DBWriteContactSettingDword(hContact, META_PROTO, "Default", DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", 0)); DBWriteContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1); } - } DBFreeVariant(&dbv); } @@ -222,17 +219,12 @@ extern "C" __declspec(dllexport) int Load(void) DBFreeVariant(&dbv); } - ZeroMemory(&pd,sizeof(pd)); - pd.cbSize=PROTOCOLDESCRIPTOR_V3_SIZE;//sizeof(pd); - - pd.szName=META_FILTER; - pd.type=PROTOTYPE_FILTER; + PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; + pd.szName = META_FILTER; + pd.type = PROTOTYPE_FILTER; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); - ZeroMemory(&pd,sizeof(pd)); - pd.cbSize=PROTOCOLDESCRIPTOR_V3_SIZE;//sizeof(pd); - - pd.szName=META_PROTO; + pd.szName = META_PROTO; pd.type = PROTOTYPE_PROTOCOL; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp index 80833c9b2e..e9d04647d6 100644 --- a/plugins/MirOTR/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp @@ -102,8 +102,7 @@ DLLFUNC int Load(void) ///////////// ////// init plugin - PROTOCOLDESCRIPTOR pd = {0}; - pd.cbSize = sizeof(pd); + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; pd.szName = MODULENAME; pd.type = PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index cedffd4925..fbfe9ad9fa 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -167,10 +167,9 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) g_hCLIcon = ExtraIcon_Register(szGPGModuleName, Translate("GPG encryption status"), "secured", (MIRANDAHOOK)onExtraImageListRebuilding, (MIRANDAHOOK)onExtraImageApplying); - PROTOCOLDESCRIPTOR pd = {0}; - pd.cbSize=sizeof(PROTOCOLDESCRIPTOR); - pd.szName=szGPGModuleName; - pd.type=PROTOTYPE_ENCRYPTION; + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; + pd.szName = szGPGModuleName; + pd.type = PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); CreateProtoServiceFunction(szGPGModuleName, PSR_MESSAGE, (MIRANDASERVICE)RecvMsgSvc); diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index de8015d342..d0ca0a56c1 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -126,9 +126,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) load_rtfconv(); // register plugin module - PROTOCOLDESCRIPTOR pd; - memset(&pd,0,sizeof(pd)); - pd.cbSize = sizeof(pd); + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; pd.szName = (char*)szModuleName; pd.type = PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); -- cgit v1.2.3