diff options
author | George Hazan <george.hazan@gmail.com> | 2012-08-16 09:45:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-08-16 09:45:49 +0000 |
commit | 130c2312fc836432ede2202f3ccb45624dca559f (patch) | |
tree | 9d91e9c032d86983f69c4d095eb9f8c2ae04b5ce | |
parent | d1b34f9184e45f402d87db5bd9371e15bee9c50b (diff) |
fix for icolib-based extra icons
git-svn-id: http://svn.miranda-ng.org/main/trunk@1478 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/ExtraIcons/src/DefaultExtraIcons.cpp | 4 | ||||
-rw-r--r-- | plugins/ExtraIcons/src/ExtraIcon.cpp | 2 | ||||
-rw-r--r-- | plugins/ExtraIcons/src/ExtraIconGroup.cpp | 7 | ||||
-rw-r--r-- | plugins/ExtraIcons/src/IcolibExtraIcon.cpp | 4 | ||||
-rw-r--r-- | plugins/ExtraIcons/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/ExtraIcons/src/usedIcons.cpp | 9 |
6 files changed, 12 insertions, 16 deletions
diff --git a/plugins/ExtraIcons/src/DefaultExtraIcons.cpp b/plugins/ExtraIcons/src/DefaultExtraIcons.cpp index d9bb6f951b..8da08d6b4b 100644 --- a/plugins/ExtraIcons/src/DefaultExtraIcons.cpp +++ b/plugins/ExtraIcons/src/DefaultExtraIcons.cpp @@ -343,7 +343,7 @@ static ProtoInfo *FindProto(const char * proto) return NULL;
HANDLE hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM) hIcon, 0);
- if (hImage == (HANDLE) -1)
+ if (hImage == INVALID_HANDLE_VALUE)
return NULL;
ProtoInfo tmp;
@@ -364,7 +364,7 @@ static int ProtocolApplyIcon(WPARAM wParam, LPARAM lParam) ProtoInfo *pi = FindProto(proto);
- HANDLE hImage = (HANDLE) -1;
+ HANDLE hImage = INVALID_HANDLE_VALUE;
if (pi != NULL)
hImage = pi->hImage;
diff --git a/plugins/ExtraIcons/src/ExtraIcon.cpp b/plugins/ExtraIcons/src/ExtraIcon.cpp index a06fa6f446..e681e3139d 100644 --- a/plugins/ExtraIcons/src/ExtraIcon.cpp +++ b/plugins/ExtraIcons/src/ExtraIcon.cpp @@ -67,7 +67,7 @@ void ExtraIcon::applyIcons() while (hContact != NULL)
{
// Clear to assert that it will be cleared
- Clist_SetExtraIcon(hContact, slot, (HANDLE) -1);
+ Clist_SetExtraIcon(hContact, slot, INVALID_HANDLE_VALUE);
applyIcon(hContact);
diff --git a/plugins/ExtraIcons/src/ExtraIconGroup.cpp b/plugins/ExtraIcons/src/ExtraIconGroup.cpp index 5d1a93541b..cfad5abea7 100644 --- a/plugins/ExtraIcons/src/ExtraIconGroup.cpp +++ b/plugins/ExtraIcons/src/ExtraIconGroup.cpp @@ -134,10 +134,9 @@ int ExtraIconGroup::setIcon(int id, HANDLE hContact, void *icon) }
if (storePos == items.size())
- {
return -1;
- }
- else if (storePos > currentPos)
+
+ if (storePos > currentPos)
{
items[storePos]->storeIcon(hContact, icon);
return 0;
@@ -205,7 +204,7 @@ int ExtraIconGroup::getType() const int ExtraIconGroup::ClistSetExtraIcon(HANDLE hContact, HANDLE hImage)
{
- if (hImage != (HANDLE) -1)
+ if (hImage != INVALID_HANDLE_VALUE)
setValidExtraIcon = true;
return Clist_SetExtraIcon(hContact, slot, hImage);
diff --git a/plugins/ExtraIcons/src/IcolibExtraIcon.cpp b/plugins/ExtraIcons/src/IcolibExtraIcon.cpp index 66ade61f2d..56718af753 100644 --- a/plugins/ExtraIcons/src/IcolibExtraIcon.cpp +++ b/plugins/ExtraIcons/src/IcolibExtraIcon.cpp @@ -46,7 +46,7 @@ void IcolibExtraIcon::applyIcon(HANDLE hContact) if (!isEnabled() || hContact == NULL)
return;
- HANDLE hImage = (HANDLE) -1;
+ HANDLE hImage = INVALID_HANDLE_VALUE;
DBVARIANT dbv = { 0 };
if (!DBGetContactSettingString(hContact, MODULE_NAME, name.c_str(), &dbv))
@@ -85,7 +85,7 @@ int IcolibExtraIcon::setIcon(int id, HANDLE hContact, void *icon) HANDLE hImage;
if (IsEmpty(icolibName))
- hImage = (HANDLE) -1;
+ hImage = INVALID_HANDLE_VALUE;
else
hImage = AddIcon(icolibName);
diff --git a/plugins/ExtraIcons/src/options.cpp b/plugins/ExtraIcons/src/options.cpp index ae0fa2620a..8d8d30c1fd 100644 --- a/plugins/ExtraIcons/src/options.cpp +++ b/plugins/ExtraIcons/src/options.cpp @@ -91,7 +91,7 @@ static void RemoveExtraIcons(int slot) HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact != NULL)
{
- Clist_SetExtraIcon(hContact, slot, (HANDLE) -1);
+ Clist_SetExtraIcon(hContact, slot, INVALID_HANDLE_VALUE);
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
}
diff --git a/plugins/ExtraIcons/src/usedIcons.cpp b/plugins/ExtraIcons/src/usedIcons.cpp index 7f7b84b5b7..1a7ccf7492 100644 --- a/plugins/ExtraIcons/src/usedIcons.cpp +++ b/plugins/ExtraIcons/src/usedIcons.cpp @@ -26,7 +26,7 @@ struct Icon HANDLE hImage;
Icon(const char *icolibName) :
- name(icolibName), refCount(0), hImage((HANDLE) -1)
+ name(icolibName), refCount(0), hImage(INVALID_HANDLE_VALUE)
{
}
};
@@ -53,15 +53,12 @@ static Icon * FindIcon(const char *icolibName) icon = &usedIcons[usedIcons.size() - 1];
}
- if (icon->hImage == NULL)
+ if (icon->hImage == INVALID_HANDLE_VALUE)
{
HICON hIcon = IcoLib_LoadIcon(icon->name.c_str());
if (hIcon != NULL)
{
icon->hImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM) hIcon, 0);
- if (icon->hImage == (HANDLE) -1)
- icon->hImage = NULL;
-
Skin_ReleaseIcon(hIcon);
}
}
@@ -105,6 +102,6 @@ void ResetIcons() usedIcons.erase(std::remove_if(usedIcons.begin(), usedIcons.end(), NotUsedIcon), usedIcons.end());
for (unsigned int i = 0; i < usedIcons.size(); ++i)
- usedIcons[i].hImage = (HANDLE) -1;
+ usedIcons[i].hImage = INVALID_HANDLE_VALUE;
}
|