diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-26 18:24:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-26 18:24:10 +0000 |
commit | ffeae3b58ae49397f62cb733c77f565ac4070223 (patch) | |
tree | 2c037284535c00a08069adcb1a1ef16e44889d4a | |
parent | 944753ba4f0e2b924215fab81e72abb933942df3 (diff) |
various code cleaning considering protocols' declarations
git-svn-id: http://svn.miranda-ng.org/main/trunk@2509 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
25 files changed, 33 insertions, 68 deletions
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<LPARAM>(&desc));
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ pd.szName = MODULE_NAME;
+ pd.type = PROTOTYPE_TRANSLATION;
+ CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast<LPARAM>(&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);
diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp index e7880dea40..c619194e18 100644 --- a/protocols/AimOscar/src/aim.cpp +++ b/protocols/AimOscar/src/aim.cpp @@ -102,13 +102,11 @@ static int protoUninit(PROTO_INTERFACE* ppro) extern "C" int __declspec(dllexport) Load(void)
{
-
mir_getLP(&pluginInfo);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "AIM";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp index 23e517d0fd..41d4a909f6 100644 --- a/protocols/FacebookRM/src/main.cpp +++ b/protocols/FacebookRM/src/main.cpp @@ -97,8 +97,7 @@ extern "C" int __declspec(dllexport) Load(void) pcli = reinterpret_cast<CLIST_INTERFACE*>( CallService(
MS_CLIST_RETRIEVE_INTERFACE,0,reinterpret_cast<LPARAM>(g_hInstance)));
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "Facebook";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index c6c5b9715a..a27b781590 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -372,8 +372,7 @@ extern "C" int __declspec(dllexport) Load(void) hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, gg_preshutdown);
// Prepare protocol name
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = GGDEF_PROTO;
pd.fnInit = (pfnInitProto)gg_proto_init;
pd.fnUninit = (pfnUninitProto)gg_proto_uninit;
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index ea802d43cd..0a2a5d70df 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -98,8 +98,7 @@ extern "C" int __declspec(dllexport) Load( ) InitContactMenus();
// register protocol
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof( pd );
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "IRC";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = ( pfnInitProto )ircProtoInit;
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 63b2b7fb21..6ee98fa8bb 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -91,8 +91,7 @@ extern "C" int __declspec(dllexport) Load(void) pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)hInst);
// Register the module
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = ICQ_PROTOCOL_NAME;
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = icqProtoInit;
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 055d67929d..7eae1eb6d4 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -233,8 +233,7 @@ extern "C" int __declspec(dllexport) Load() pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)hInst);
// Register protocol module
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(PROTOCOLDESCRIPTOR);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "JABBER";
pd.fnInit = (pfnInitProto)jabberProtoInit;
pd.fnUninit = (pfnUninitProto)jabberProtoUninit;
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index 082a2a9332..6a91a143c3 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -110,8 +110,7 @@ extern "C" MRA_API int Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "MRA";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)mraProtoInit;
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index 0b1dfbf957..ca1e2cd041 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -120,8 +120,7 @@ extern "C" int __declspec(dllexport) Load(void) hMooduleLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "MSN";
pd.fnInit = (pfnInitProto)msnProtoInit;
pd.fnUninit = (pfnUninitProto)msnProtoUninit;
diff --git a/protocols/NewsAggregator/Src/NewsAggregator.cpp b/protocols/NewsAggregator/Src/NewsAggregator.cpp index 3c05847739..3ab146ccbb 100644 --- a/protocols/NewsAggregator/Src/NewsAggregator.cpp +++ b/protocols/NewsAggregator/Src/NewsAggregator.cpp @@ -86,8 +86,7 @@ extern "C" __declspec(dllexport) int Load(void) hChangeFeedDlgList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
// register weather protocol
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = PROTOCOLDESCRIPTOR_V3_SIZE;
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = MODULE;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index 32771e22be..ac0ad7e466 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -97,8 +97,7 @@ extern "C" int __declspec(dllexport) Load(void) pcli = reinterpret_cast<CLIST_INTERFACE*>( CallService(
MS_CLIST_RETRIEVE_INTERFACE,0,reinterpret_cast<LPARAM>(g_hInstance)));
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "Omegle";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = protoInit;
diff --git a/protocols/Quotes/src/Forex.cpp b/protocols/Quotes/src/Forex.cpp index 063e812b04..d5cbf7eb42 100644 --- a/protocols/Quotes/src/Forex.cpp +++ b/protocols/Quotes/src/Forex.cpp @@ -421,8 +421,7 @@ extern "C" Quotes_IconsInit();
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = /*sizeof(pd)*/PROTOCOLDESCRIPTOR_V3_SIZE;
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = QUOTES_PROTOCOL_NAME;
pd.type = PROTOTYPE_PROTOCOL;
// pd.fnInit = protoInit;
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 0267dd5bb5..d8a0a00652 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -495,8 +495,6 @@ static int tlenProtoUninit( TlenProtocol* ppro ) extern "C" int __declspec(dllexport) Load(void)
{
- PROTOCOLDESCRIPTOR pd;
-
mir_getLP( &pluginInfoEx );
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0);
@@ -506,8 +504,7 @@ extern "C" int __declspec(dllexport) Load(void) TlenRegisterIcons();
// Register protocol module
- ZeroMemory(&pd, sizeof(PROTOCOLDESCRIPTOR));
- pd.cbSize = sizeof(PROTOCOLDESCRIPTOR);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "TLEN";
pd.fnInit = ( pfnInitProto )tlenProtoInit;
pd.fnUninit = ( pfnUninitProto )tlenProtoUninit;
diff --git a/protocols/Weather/src/weather.cpp b/protocols/Weather/src/weather.cpp index b1d34561fb..299f9ecde6 100644 --- a/protocols/Weather/src/weather.cpp +++ b/protocols/Weather/src/weather.cpp @@ -250,8 +250,7 @@ extern "C" int __declspec(dllexport) Load(void) hUpdateMutex = CreateMutex(NULL, FALSE, NULL);
// register weather protocol
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = PROTOCOLDESCRIPTOR_V3_SIZE;
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = WEATHERPROTONAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
diff --git a/protocols/YAMN/src/main.cpp b/protocols/YAMN/src/main.cpp index 0d05534f3c..4fa4991e8c 100644 --- a/protocols/YAMN/src/main.cpp +++ b/protocols/YAMN/src/main.cpp @@ -390,8 +390,7 @@ extern "C" int __declspec(dllexport) Load(void) } }
// Registering YAMN as protocol
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = PROTOCOLDESCRIPTOR_V3_SIZE;
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = YAMN_DBMODULE;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index df432b5223..2d3b3dd715 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -97,8 +97,7 @@ extern "C" int __declspec(dllexport)Load(void) {
mir_getLP( &pluginInfo );
- PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "YAHOO";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = ( pfnInitProto )yahooProtoInit;
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 7175e0f8b0..3604775adb 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -112,7 +112,7 @@ int fnGetProtocolVisibility(const char* accName); int fnConvertMenu(CLISTMENUITEM*, TMO_MenuItem*);
int fnGetAccountIndexByPos(int Pos);
-int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos);
+int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos);
void RebuildMenuOrder(void);
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index e88ca7aa46..01db784728 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -806,7 +806,7 @@ int fnGetProtocolVisibility(const char* accName) return FALSE;
}
-int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos)
+int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos)
{
int p;
char buf[10];
|