summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2012-08-15 20:29:48 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2012-08-15 20:29:48 +0000
commit446f5c32cc469350cf72db2f7f831522dd8a5301 (patch)
tree1c55798dcb9c4589ad58b5f6ba0849ef43e77737
parentec71f909084560e7eae20c1c67bc506164d22021 (diff)
Extra Icons: fix for using hImage NULL as not found (should be -1)
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@256 c086bb3d-8645-0410-b8da-73a8550f86e7
-rw-r--r--Plugins/extraicons/DefaultExtraIcons.cpp4
-rw-r--r--Plugins/extraicons/ExtraIcon.cpp2
-rw-r--r--Plugins/extraicons/ExtraIconGroup.cpp2
-rw-r--r--Plugins/extraicons/IcolibExtraIcon.cpp4
-rw-r--r--Plugins/extraicons/extraicons.cpp2
-rw-r--r--Plugins/extraicons/options.cpp2
-rw-r--r--Plugins/extraicons/usedIcons.cpp10
7 files changed, 12 insertions, 14 deletions
diff --git a/Plugins/extraicons/DefaultExtraIcons.cpp b/Plugins/extraicons/DefaultExtraIcons.cpp
index ebdaddf..d1a03b4 100644
--- a/Plugins/extraicons/DefaultExtraIcons.cpp
+++ b/Plugins/extraicons/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 == NULL)
+ if (hImage == (HANDLE) -1)
return NULL;
ProtoInfo tmp;
@@ -364,7 +364,7 @@ static int ProtocolApplyIcon(WPARAM wParam, LPARAM lParam)
ProtoInfo *pi = FindProto(proto);
- HANDLE hImage = NULL;
+ HANDLE hImage = (HANDLE) -1;
if (pi != NULL)
hImage = pi->hImage;
diff --git a/Plugins/extraicons/ExtraIcon.cpp b/Plugins/extraicons/ExtraIcon.cpp
index 1aaab01..a06fa6f 100644
--- a/Plugins/extraicons/ExtraIcon.cpp
+++ b/Plugins/extraicons/ExtraIcon.cpp
@@ -67,7 +67,7 @@ void ExtraIcon::applyIcons()
while (hContact != NULL)
{
// Clear to assert that it will be cleared
- Clist_SetExtraIcon(hContact, slot, NULL);
+ Clist_SetExtraIcon(hContact, slot, (HANDLE) -1);
applyIcon(hContact);
diff --git a/Plugins/extraicons/ExtraIconGroup.cpp b/Plugins/extraicons/ExtraIconGroup.cpp
index b7862e0..162086e 100644
--- a/Plugins/extraicons/ExtraIconGroup.cpp
+++ b/Plugins/extraicons/ExtraIconGroup.cpp
@@ -205,7 +205,7 @@ int ExtraIconGroup::getType() const
int ExtraIconGroup::ClistSetExtraIcon(HANDLE hContact, HANDLE hImage)
{
- if (hImage != NULL && hImage != (HANDLE) -1)
+ if (hImage != (HANDLE) -1)
setValidExtraIcon = true;
return Clist_SetExtraIcon(hContact, slot, hImage);
diff --git a/Plugins/extraicons/IcolibExtraIcon.cpp b/Plugins/extraicons/IcolibExtraIcon.cpp
index f7dc03c..66ade61 100644
--- a/Plugins/extraicons/IcolibExtraIcon.cpp
+++ b/Plugins/extraicons/IcolibExtraIcon.cpp
@@ -46,7 +46,7 @@ void IcolibExtraIcon::applyIcon(HANDLE hContact)
if (!isEnabled() || hContact == NULL)
return;
- HANDLE hImage = NULL;
+ HANDLE hImage = (HANDLE) -1;
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 = NULL;
+ hImage = (HANDLE) -1;
else
hImage = AddIcon(icolibName);
diff --git a/Plugins/extraicons/extraicons.cpp b/Plugins/extraicons/extraicons.cpp
index e71086b..bb97dbd 100644
--- a/Plugins/extraicons/extraicons.cpp
+++ b/Plugins/extraicons/extraicons.cpp
@@ -214,7 +214,7 @@ int Clist_SetExtraIcon(HANDLE hContact, int slot, HANDLE hImage)
IconExtraColumn iec = { 0 };
iec.cbSize = sizeof(iec);
iec.ColumnType = ConvertToClistSlot(slot);
- iec.hImage = (hImage == NULL ? (HANDLE) -1 : hImage);
+ iec.hImage = hImage;
return CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) hContact, (LPARAM) &iec);
}
diff --git a/Plugins/extraicons/options.cpp b/Plugins/extraicons/options.cpp
index bbfc826..0d9114e 100644
--- a/Plugins/extraicons/options.cpp
+++ b/Plugins/extraicons/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, NULL);
+ Clist_SetExtraIcon(hContact, slot, (HANDLE) -1);
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
}
diff --git a/Plugins/extraicons/usedIcons.cpp b/Plugins/extraicons/usedIcons.cpp
index de58069..27f88c7 100644
--- a/Plugins/extraicons/usedIcons.cpp
+++ b/Plugins/extraicons/usedIcons.cpp
@@ -26,7 +26,7 @@ struct Icon
HANDLE hImage;
Icon(const char *icolibName) :
- name(icolibName), refCount(0), hImage(NULL)
+ name(icolibName), refCount(0), hImage((HANDLE) -1)
{
}
};
@@ -53,15 +53,13 @@ static Icon * FindIcon(const char *icolibName)
icon = &usedIcons[usedIcons.size() - 1];
}
- if (icon->hImage == NULL)
+ if (icon->hImage == (HANDLE) -1)
{
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;
-
+
IcoLib_ReleaseIcon(hIcon);
}
}
@@ -105,6 +103,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 = NULL;
+ usedIcons[i].hImage = (HANDLE) -1;
}