From cd4e43a5af4dcf660969bc5abada0d97cfd0cd03 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 3 Jan 2014 15:57:14 +0000 Subject: version related code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@7478 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CryptoPP/src/cpp_misc.cpp | 2 +- plugins/CryptoPP/src/version.h | 29 ++++++++--------- plugins/PasteIt/src/PasteIt.cpp | 8 +---- plugins/TabSRMM/src/msgs.cpp | 11 +++---- plugins/VersionInfo/src/CVersionInfo.cpp | 55 ++++++++------------------------ plugins/helpers/gen_helpers.cpp | 2 +- 6 files changed, 35 insertions(+), 72 deletions(-) (limited to 'plugins') diff --git a/plugins/CryptoPP/src/cpp_misc.cpp b/plugins/CryptoPP/src/cpp_misc.cpp index 77de159fcb..ec7a0ae043 100644 --- a/plugins/CryptoPP/src/cpp_misc.cpp +++ b/plugins/CryptoPP/src/cpp_misc.cpp @@ -14,7 +14,7 @@ int __cdecl cpp_get_error(HANDLE context) { int __cdecl cpp_get_version(void) { - return __VERSION_DWORD; + return PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM); } diff --git a/plugins/CryptoPP/src/version.h b/plugins/CryptoPP/src/version.h index 5b2341dd2e..82dcf64589 100644 --- a/plugins/CryptoPP/src/version.h +++ b/plugins/CryptoPP/src/version.h @@ -1,17 +1,16 @@ -#define __MAJOR_VERSION 1 -#define __MINOR_VERSION 0 -#define __RELEASE_NUM 4 -#define __BUILD_NUM 7 +#define __MAJOR_VERSION 1 +#define __MINOR_VERSION 0 +#define __RELEASE_NUM 4 +#define __BUILD_NUM 7 -#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM -#define __TOSTRING(x) #x -#define __VERSION_STRING __TOSTRING(__FILEVERSION_STRING) -#define __VERSION_DWORD ((__MAJOR_VERSION<<24) | (__MINOR_VERSION<<16) | (__RELEASE_NUM<<8) | __BUILD_NUM) +#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM +#define __TOSTRING(x) #x +#define __VERSION_STRING __TOSTRING(__FILEVERSION_STRING) -#define __PLUGIN_NAME "Crypto++" -#define __FILENAME "CryptoPP.dll" -#define __DESCRIPTION "Crypto++ library for SecureIM plugin." -#define __AUTHOR "Baloo" -#define __AUTHOREMAIL "baloo@bk.ru" -#define __AUTHORWEB "http://miranda-ng.org/p/CryptoPP/" -#define __COPYRIGHT "© 2006-09 Baloo" +#define __PLUGIN_NAME "Crypto++" +#define __FILENAME "CryptoPP.dll" +#define __DESCRIPTION "Crypto++ library for SecureIM plugin." +#define __AUTHOR "Baloo" +#define __AUTHOREMAIL "baloo@bk.ru" +#define __AUTHORWEB "http://miranda-ng.org/p/CryptoPP/" +#define __COPYRIGHT "© 2006-09 Baloo" diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 219c01f4b1..40510ee3b1 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -65,9 +65,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { gMirandaVersion = mirandaVersion; - if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 8, 0, 0)) - return NULL; - return &pluginInfo; } @@ -166,15 +163,12 @@ void PasteIt(HANDLE hContact, int mode) Miranda_Plugin_InfoEx infoEx = (Miranda_Plugin_InfoEx) GetProcAddress(hInst, "MirandaPluginInfoEx"); PLUGININFOEX* pi = NULL; if(infoEx != NULL) - { pi = infoEx(gMirandaVersion); - } + // If PLUGININFOEX flags contains UNICODE_AWARE, // this mean that protocol is unicode. if(pi != NULL && pi->cbSize == sizeof(PLUGININFOEX)) - { isUnicodePlugin = pi->flags & UNICODE_AWARE; - } } } diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index fb7fe23bb8..9e79d580cc 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -201,14 +201,11 @@ static INT_PTR GetMessageWindowFlags(WPARAM wParam, LPARAM lParam) if (hwndTarget == 0) hwndTarget = M.FindWindow((HANDLE)wParam); - if (hwndTarget) { - TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndTarget, GWLP_USERDATA); - if (dat) - return (dat->dwFlags); - else - return 0; - } else + if (hwndTarget == 0) return 0; + + TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndTarget, GWLP_USERDATA); + return (dat) ? dat->dwFlags : 0; } /* diff --git a/plugins/VersionInfo/src/CVersionInfo.cpp b/plugins/VersionInfo/src/CVersionInfo.cpp index bb6aad9b6c..2f0a0dcd0d 100644 --- a/plugins/VersionInfo/src/CVersionInfo.cpp +++ b/plugins/VersionInfo/src/CVersionInfo.cpp @@ -685,50 +685,23 @@ bool CVersionInfo::GetPluginLists() } //Let's get the info. - if (MirandaPluginInfo != NULL) {//a valid miranda plugin - if (pluginInfo != NULL) { - //We have loaded the informations into pluginInfo. - std::tstring timedate = GetPluginTimestamp(&fd.ftLastWriteTime); - CPlugin thePlugin(fd.cFileName, _A2T(pluginInfo->shortName), pluginInfo->uuid, /*(pluginInfo->flags & 1) ? _T("Unicode aware") :*/ _T(""), (DWORD) pluginInfo->version, timedate.c_str(), _T("")); - - if (PluginIsEnabled) - AddPlugin(thePlugin, listActivePlugins); - else { - if ((IsUUIDNull(pluginInfo->uuid)) && (mirandaVersion >= PLUGIN_MAKE_VERSION(0,8,0,9))) { - thePlugin.SetErrorMessage( _T(" Plugin does not have an UUID and will not work with Miranda 0.8.\r\n")); - AddPlugin(thePlugin, listUnloadablePlugins); - } - else AddPlugin(thePlugin, listInactivePlugins); - - FreeLibrary(hInstPlugin); //We don't need it anymore. - } - FreePluginInfo(pluginInfo); - MirandaPluginInfo = NULL; - #ifdef _DEBUG - if (verbose) { - TCHAR szMsg[4096] = { 0 }; - mir_sntprintf(szMsg, SIZEOF(szMsg), _T("Done with: %s"), fd.cFileName); - PUShowMessageT(szMsg, SM_NOTIFY); - } - #endif - } - else { //pluginINFO == NULL - pluginInfo = CopyPluginInfo(MirandaPluginInfo(PLUGIN_MAKE_VERSION(9, 9, 9, 9))); //let's see if the plugin likes this miranda version - char *szShortName = ""; - std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime); //get the plugin timestamp; - DWORD version = 0; - if (pluginInfo) { - szShortName = pluginInfo->shortName; - version = pluginInfo->version; - } + if (MirandaPluginInfo == NULL || pluginInfo == NULL) { + FreeLibrary(hInstPlugin); //We don't need it anymore. + continue; + } - CPlugin thePlugin(fd.cFileName, _A2T(szShortName), (pluginInfo) ? pluginInfo->uuid : UUID_NULL, (/*((pluginInfo) && (pluginInfo->flags & 1)) ? _T("Unicode aware") :*/ _T("")), version, time.c_str(), _T(" Plugin refuses to load. Miranda version too old.")); + //We have loaded the informations into pluginInfo. + std::tstring timedate = GetPluginTimestamp(&fd.ftLastWriteTime); + CPlugin thePlugin(fd.cFileName, _A2T(pluginInfo->shortName), pluginInfo->uuid, /*(pluginInfo->flags & 1) ? _T("Unicode aware") :*/ _T(""), (DWORD) pluginInfo->version, timedate.c_str(), _T("")); - AddPlugin(thePlugin, listUnloadablePlugins); - if (pluginInfo) - FreePluginInfo(pluginInfo); - } + if (PluginIsEnabled) + AddPlugin(thePlugin, listActivePlugins); + else { + AddPlugin(thePlugin, listInactivePlugins); + FreeLibrary(hInstPlugin); //We don't need it anymore. } + FreePluginInfo(pluginInfo); + MirandaPluginInfo = NULL; } while (FindNextFile(hFind,&fd)); FindClose(hFind); diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index ce19a5bd51..1174f1fdeb 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -2,7 +2,7 @@ Helper functions for Miranda-IM (www.miranda-im.org) Copyright 2006 P. Boon - This program is mir_free software; you can redistribute it and/or modify + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -- cgit v1.2.3