diff options
author | George Hazan <george.hazan@gmail.com> | 2015-12-21 15:02:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-12-21 15:02:42 +0000 |
commit | d46978c9ba808711f7b196382c4469050d8efa21 (patch) | |
tree | 16754e689e5b591025261f8e17f03e698f14989c | |
parent | 6e06694f2fdda33eb3237fe1a3aa7f6df94ad61c (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@15927 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | src/mir_app/src/dll_sniffer.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/menu_options.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/menu_utils.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 25 | ||||
-rw-r--r-- | src/mir_app/src/pluginopts.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/plugins.h | 5 |
6 files changed, 21 insertions, 27 deletions
diff --git a/src/mir_app/src/dll_sniffer.cpp b/src/mir_app/src/dll_sniffer.cpp index b19451eb55..ffd92074fd 100644 --- a/src/mir_app/src/dll_sniffer.cpp +++ b/src/mir_app/src/dll_sniffer.cpp @@ -138,7 +138,7 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) __leave;
int nLength = 1; // one for MIID_LAST
- for (MUUID* p = pIds; !equalUUID(*p, miid_last); p++)
+ for (MUUID* p = pIds; *p != miid_last; p++)
nLength++;
pResult = (MUUID*)mir_alloc( sizeof(MUUID)*nLength);
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 8501dcfe68..eb68f2ddca 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -86,7 +86,7 @@ class CGenMenuOptionsPage : public CDlgBase m_menuItems.GetItem(&tvi); MenuItemOptData *iod = (MenuItemOptData*)tvi.lParam; if (TMO_IntMenuItem *pimi = iod->pimi) { - if (!equalUUID(pimi->mi.uid, miid_last)) { + if (pimi->mi.uid != miid_last) { char menuItemName[256]; bin2hex(&pimi->mi.uid, sizeof(pimi->mi.uid), menuItemName); @@ -510,7 +510,7 @@ public: m_customName.SetText(iod->name); - if (!equalUUID(iod->pimi->mi.uid, miid_last)) { + if (iod->pimi->mi.uid != miid_last) { char szText[100]; bin2hex(&iod->pimi->mi.uid, sizeof(iod->pimi->mi.uid), szText); m_service.SetTextA(szText); diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index 5572157cad..5e2dd18262 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -732,7 +732,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs pRoot->iconId = p->iconId;
// if parent menu has no uid, copy our id instead
- if (!equalUUID(pmi->uid, miid_last) && equalUUID(pRoot->mi.uid, miid_last)) {
+ if (pmi->uid != miid_last && pRoot->mi.uid == miid_last) {
char szUid[100];
bin2hex(&pmi->uid, sizeof(pmi->uid), szUid);
Netlib_Logf("[MENU]: fake UUID added to menu item %s", szUid);
@@ -883,7 +883,7 @@ static int sttReadOldItem(TMO_IntMenuItem *pmi, void *szModule) static int sttDumpItem(TMO_IntMenuItem *pmi, void *szModule)
{
- if (!equalUUID(pmi->mi.uid, miid_last)) {
+ if (pmi->mi.uid != miid_last) {
char menuItemName[200];
bin2hex(&pmi->mi.uid, sizeof(pmi->mi.uid), menuItemName);
@@ -972,7 +972,7 @@ static int sttFindMenuItemByUid(TMO_IntMenuItem *pimi, void *pUid) int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule)
{
- if ((pimi->mi.flags & CMIF_SYSTEM) || equalUUID(pimi->mi.uid, miid_last))
+ if ((pimi->mi.flags & CMIF_SYSTEM) || pimi->mi.uid == miid_last)
return 0;
char menuItemName[256];
@@ -1201,7 +1201,7 @@ int OnIconLibChanges(WPARAM, LPARAM) static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)
{
TCHAR *descr = GetMenuItemText(pmi);
- if (!descr || pmi->hIcolibItem != NULL || equalUUID(pmi->mi.uid, miid_last))
+ if (!descr || pmi->hIcolibItem != NULL || pmi->mi.uid == miid_last)
return FALSE;
HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index f44872363c..1b7bf48244 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -74,18 +74,13 @@ static pluginEntry *plugin_freeimg, *plugin_crshdmp, *serviceModePlugin, *plugin /////////////////////////////////////////////////////////////////////////////////////////
// basic functions
-int equalUUID(const MUUID& u1, const MUUID& u2)
-{
- return memcmp(&u1, &u2, sizeof(MUUID)) ? 0 : 1;
-}
-
bool hasMuuid(const MUUID* p, const MUUID& uuid)
{
if (p == NULL)
return false;
- for (int i = 0; !equalUUID(miid_last, p[i]); i++)
- if (equalUUID(uuid, p[i]))
+ for (int i = 0; p[i] != miid_last; i++)
+ if (p[i] == uuid)
return true;
return false;
@@ -121,7 +116,7 @@ static const MUUID pluginBannedList[] = static bool isPluginBanned(const MUUID& u1)
{
for (int i = 0; i < _countof(pluginBannedList); i++)
- if (equalUUID(pluginBannedList[i], u1))
+ if (pluginBannedList[i] == u1)
return true;
return false;
@@ -150,7 +145,7 @@ static MuuidReplacement pluginDefault[] = int getDefaultPluginIdx(const MUUID &muuid)
{
for (int i = 0; i < _countof(pluginDefault); i++)
- if (equalUUID(muuid, pluginDefault[i].uuid))
+ if (muuid == pluginDefault[i].uuid)
return i;
return -1;
@@ -203,7 +198,7 @@ MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInstance) MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang)
{
- if (equalUUID(uuid, miid_last))
+ if (uuid == miid_last)
return --sttFakeID;
for (int i = 0; i < pluginList.getCount(); i++) {
@@ -211,7 +206,7 @@ MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang) if (!p->bpi.hInst)
continue;
- if (equalUUID(p->bpi.pluginInfo->uuid, uuid))
+ if (p->bpi.pluginInfo->uuid == uuid)
return p->hLangpack = (_hLang) ? _hLang : --sttFakeID;
}
@@ -225,7 +220,7 @@ MIR_APP_DLL(int) IsPluginLoaded(const MUUID &uuid) if (!p->bpi.hInst)
continue;
- if (equalUUID(p->bpi.pluginInfo->uuid, uuid))
+ if (p->bpi.pluginInfo->uuid == uuid)
return true;
}
@@ -237,7 +232,7 @@ static bool validInterfaceList(MUUID *piface) if (piface == NULL)
return true;
- if (equalUUID(miid_last, piface[0]))
+ if (miid_last == piface[0])
return false;
return true;
@@ -523,7 +518,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) if (p->bpi.Interfaces) {
MUUID *piface = p->bpi.Interfaces;
- for (int i = 0; !equalUUID(miid_last, piface[i]); i++) {
+ for (int i = 0; piface[i] != miid_last; i++) {
int idx = getDefaultPluginIdx(piface[i]);
if (idx != -1 && pluginDefault[idx].pImpl) {
if (!bDynamic) { // this place is already occupied, skip & disable
@@ -545,7 +540,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) p->pclass |= PCLASS_LOADED;
if (p->bpi.Interfaces) {
MUUID *piface = p->bpi.Interfaces;
- for (int i = 0; !equalUUID(miid_last, piface[i]); i++) {
+ for (int i = 0; piface[i] != miid_last; i++) {
int idx = getDefaultPluginIdx(piface[i]);
if (idx != -1)
pluginDefault[idx].pImpl = p;
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index fb9d0c5e67..2d7e4541b7 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -75,7 +75,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM l dat->stdPlugin = 0;
if (pi.Interfaces) {
MUUID *piface = pi.Interfaces;
- for (int i = 0; !equalUUID(miid_last, piface[i]); i++) {
+ for (int i = 0; piface[i] != miid_last; i++) {
int idx = getDefaultPluginIdx(piface[i]);
if (idx != -1) {
dat->stdPlugin |= (1 << idx);
@@ -442,7 +442,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ptrT tszUrl(latin2t(sel ? dat->homepage : NULL));
SetDlgItemText(hwndDlg, IDC_PLUGINURL, tszUrl);
- if (!equalUUID(miid_last, dat->uuid)) {
+ if (dat->uuid != miid_last) {
char szUID[128];
uuidToString(dat->uuid, szUID, sizeof(szUID));
SetDlgItemTextA(hwndDlg, IDC_PLUGINPID, sel ? szUID : "");
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h index 35ae742b60..44d7a18ddd 100644 --- a/src/mir_app/src/plugins.h +++ b/src/mir_app/src/plugins.h @@ -57,11 +57,10 @@ void UnloadPluginOptions(); int isPluginOnWhiteList(const TCHAR* pluginname);
void SetPluginOnWhiteList(const TCHAR* pluginname, int allow);
-int getDefaultPluginIdx(const MUUID& muuid);
+int getDefaultPluginIdx(const MUUID& muuid);
bool hasMuuid(const BASIC_PLUGIN_INFO&, const MUUID&);
bool hasMuuid(const MUUID* pFirst, const MUUID&);
-int equalUUID(const MUUID& u1, const MUUID& u2);
-int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int checkTypeAPI);
+int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int checkTypeAPI);
pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path);
|