From 038f6cc65778c17300ce5c62bb25723f7fa16714 Mon Sep 17 00:00:00 2001
From: Tobias Weimer <wishmaster51@googlemail.com>
Date: Mon, 8 Jun 2015 19:41:14 +0000
Subject: UserInfoEx: - minor warnings fixed

git-svn-id: http://svn.miranda-ng.org/main/trunk@14067 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp    | 23 ++++---
 plugins/UserInfoEx/src/classPsTreeItem.cpp         |  7 +--
 plugins/UserInfoEx/src/commonheaders.h             |  2 +-
 plugins/UserInfoEx/src/ctrl_base.cpp               |  2 +-
 plugins/UserInfoEx/src/ctrl_button.cpp             |  5 --
 plugins/UserInfoEx/src/ctrl_contact.cpp            | 21 ++++---
 plugins/UserInfoEx/src/ctrl_edit.cpp               | 72 ++++++++++------------
 plugins/UserInfoEx/src/dlg_anniversarylist.cpp     |  4 +-
 .../src/ex_import/classExImContactBase.cpp         |  4 --
 .../src/ex_import/classExImContactXML.cpp          |  3 +-
 plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp   | 21 +++----
 plugins/UserInfoEx/src/init.cpp                    | 10 +--
 plugins/UserInfoEx/src/mir_string.cpp              |  4 +-
 plugins/UserInfoEx/src/psp_origin.cpp              |  4 +-
 plugins/UserInfoEx/src/psp_profile.cpp             |  2 +-
 15 files changed, 83 insertions(+), 101 deletions(-)

(limited to 'plugins')

diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
index 9774ac2f42..1a9ebac3b0 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
@@ -214,8 +214,8 @@ FIBITMAP* LoadResource(UINT ID, LPTSTR lpType)
 		FreeResource(hRes);
 	}
 	else {
-		HBITMAP hScrBM = 0;
-		if (NULL == (hScrBM = (HBITMAP)LoadImage(ghInst,MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED)))
+		HBITMAP hScrBM = (HBITMAP)LoadImage(ghInst,MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED);
+		if (hScrBM == NULL)
 			return dib;
 		dib = FIP->FI_CreateDIBFromHBITMAP(hScrBM);
 		DeleteObject(hScrBM);
@@ -239,29 +239,26 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam)
 static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam)
 {
 	//TODO: use freeimage to create merget icon and add RGB(A) support
-	HICON hUpperIcon,hLowerIcon;
 	ICONINFO icoi;
 	BITMAP bm;
-	HDC hdc;
-	POINT aptTriangle[3];
 	HICON hIcon=NULL;
-	HRGN hrgn;
-	HBITMAP hbmPrev;
 	/* load both icons */
-	if (NULL == (hLowerIcon=(HICON)ServiceLoadFlagIcon((WPARAM)lParam,0))) return NULL;
-	hUpperIcon=(HICON)ServiceLoadFlagIcon(wParam,0);
+	HICON hLowerIcon=(HICON)ServiceLoadFlagIcon((WPARAM)lParam,0);
+	if (hLowerIcon == NULL) return NULL;
+	HICON hUpperIcon=(HICON)ServiceLoadFlagIcon(wParam,0);
 	/* merge them */
 	if (GetIconInfo(hLowerIcon,&icoi)) {
 		if (hUpperIcon!=NULL && GetObject(icoi.hbmColor,sizeof(bm),&bm)) {
-			hdc=CreateCompatibleDC(NULL);
+			HDC hdc=CreateCompatibleDC(NULL);
 			if (hdc!=NULL) {
+				POINT aptTriangle[3];
 				memset(&aptTriangle, 0, sizeof(aptTriangle));
 				aptTriangle[1].y=bm.bmHeight-1;
 				aptTriangle[2].x=bm.bmWidth-1;
-				hrgn=CreatePolygonRgn(aptTriangle,SIZEOF(aptTriangle),WINDING);
+				HRGN hrgn=CreatePolygonRgn(aptTriangle,SIZEOF(aptTriangle),WINDING);
 				if (hrgn!=NULL) {
 					SelectClipRgn(hdc,hrgn);
-					hbmPrev=(HBITMAP)SelectObject(hdc,icoi.hbmColor);
+					HBITMAP hbmPrev=(HBITMAP)SelectObject(hdc,icoi.hbmColor);
 					if (hbmPrev!=NULL) {  /* error on select? */
 						if (DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_IMAGE)) {
 							if (SelectObject(hdc,icoi.hbmMask)!=NULL) /* error on select? */
@@ -304,12 +301,14 @@ void InitIcons()
 		return;
 	}
 
+/*
 	//	res = FIP->FI_IsTransparent(dib_ico);
 	if (bit < 32) {
 		//disable transparency
 		FIP->FI_SetTransparent(dib, FALSE);
 		FIP->FI_SetTransparent(dib_ico, FALSE);
 	}
+*/
 
 	UINT h = FIP->FI_GetHeight(dib_ico);
 	UINT w = FIP->FI_GetWidth(dib_ico);
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp
index 4aab90ed26..8882cc5cef 100644
--- a/plugins/UserInfoEx/src/classPsTreeItem.cpp
+++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp
@@ -276,7 +276,7 @@ HICON CPsTreeItem::ProtoIcon()
 {
 	PROTOACCOUNT **pa;
 	int ProtoCount;
-	if (!CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&ProtoCount, (LPARAM)&pa)) {
+	if (!ProtoEnumAccounts(&ProtoCount, &pa)) {
 		if (_pszName) {
 			for (int i = 0; i < ProtoCount; i++) {
 				if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) {
@@ -305,8 +305,6 @@ HICON CPsTreeItem::ProtoIcon()
  **/
 int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOnly)
 {
-	HICON hIcon;
-
 	// check parameter
 	if (!_pszName || !odp)
 		return 1;
@@ -315,7 +313,8 @@ int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOn
 	LPCSTR pszIconName = IconKey();
 
 	// use icolib to handle icons
-	if (!(hIcon = Skin_GetIcon(pszIconName))) {
+	HICON hIcon = Skin_GetIcon(pszIconName);
+	if (!hIcon) {
 		bool bNeedFree = false;
 
 		SKINICONDESC sid = { 0 };
diff --git a/plugins/UserInfoEx/src/commonheaders.h b/plugins/UserInfoEx/src/commonheaders.h
index 2645d39356..d16a2d558f 100644
--- a/plugins/UserInfoEx/src/commonheaders.h
+++ b/plugins/UserInfoEx/src/commonheaders.h
@@ -100,7 +100,7 @@ using namespace std;
 
 #define PtrIsValid(p)		(((p)!=0)&&(((HANDLE)(p))!=INVALID_HANDLE_VALUE))
 #define FREE(p)				{if (PtrIsValid(p)){free((void*)p);(p)=NULL;}}
-#define MIR_DELETE(p)		{LPVOID ptr = (LPVOID)(p);if (PtrIsValid(ptr)){delete(ptr);(ptr)=NULL;}}
+#define MIR_DELETE(p)		{if (PtrIsValid(p)){delete(p);(p)=NULL;}}
 #define MIR_FREE(p)			{if (PtrIsValid(p)){mir_free((void*)p);(p)=NULL;}}
 
 #define GetUserData(p)		GetWindowLongPtr((p), GWLP_USERDATA)
diff --git a/plugins/UserInfoEx/src/ctrl_base.cpp b/plugins/UserInfoEx/src/ctrl_base.cpp
index 35780b7fb4..9c82d728ad 100644
--- a/plugins/UserInfoEx/src/ctrl_base.cpp
+++ b/plugins/UserInfoEx/src/ctrl_base.cpp
@@ -282,7 +282,7 @@ INT_PTR CCtrlList::OnSetTextColour(HWND hCtrl, HDC hdc)
 	if (IsWindow(hCtrl) && myGlobals.ShowPropsheetColours)
 	{
 		CBaseCtrl* pCtrl = CBaseCtrl::GetObj(hCtrl);
-		if (PtrIsValid(pCtrl) && (pCtrl->_cbSize = sizeof(CBaseCtrl)))
+		if (PtrIsValid(pCtrl) && (pCtrl->_cbSize == sizeof(CBaseCtrl)))
 		{
 			return pCtrl->OnSetTextColour(hdc);
 		}
diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp
index 7bcb7980b6..6d85de3475 100644
--- a/plugins/UserInfoEx/src/ctrl_button.cpp
+++ b/plugins/UserInfoEx/src/ctrl_button.cpp
@@ -480,11 +480,6 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
 			bct->hBitmap = (HBITMAP)lParam;
 			InvalidateRect(bct->hwnd, NULL, TRUE);
 		}
-		else if (wParam == NULL && lParam == NULL) {
-			bct->hIcon = NULL;
-			bct->hBitmap = NULL;
-			InvalidateRect(bct->hwnd, NULL, TRUE);
-		}
 		break;
 	case BM_SETCHECK:
 		if (!(bct->dwStyle & MBS_PUSHBUTTON)) break;
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp
index c414a001a7..ccc30ead81 100644
--- a/plugins/UserInfoEx/src/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/src/ctrl_contact.cpp
@@ -186,17 +186,19 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
 
 	case WM_COMMAND:
 		switch (LOWORD(wParam)) {
-			if (HIWORD(wParam) == BN_CLICKED) {
-				case IDOK:
-				{
+			case IDOK: {
+				if (HIWORD(wParam) == BN_CLICKED) {
 					if (cbi->pszVal && cbi->ccVal > 0)
 						GetDlgItemText(hDlg, EDIT_EMAIL, cbi->pszVal, cbi->ccVal);
 					if (cbi->pszCat && cbi->ccCat > 0)
 						GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat);
 				}
-				case IDCANCEL:
+				break;
+			}
+			case IDCANCEL: {
+				if (HIWORD(wParam) == BN_CLICKED) 
 					EndDialog(hDlg, LOWORD(wParam));
-					break;
+				break;
 			}
 			case EDIT_EMAIL:
 				if (HIWORD(wParam) == EN_UPDATE) {
@@ -288,9 +290,8 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
 
 	case WM_COMMAND:
 		switch (LOWORD(wParam)) {
-			if (HIWORD(wParam) == BN_CLICKED) {
-				case IDOK:
-				{
+			case IDOK:
+				if (HIWORD(wParam) == BN_CLICKED) {
 					TCHAR szText[MAXDATASIZE];
 					int errorPos;
 
@@ -307,9 +308,9 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
 				}
 				//fall through
 			case IDCANCEL:
-				EndDialog(hDlg, wParam);
+				if (HIWORD(wParam) == BN_CLICKED) 
+					EndDialog(hDlg, wParam);
 				break;
-			}
 
 		case EDIT_COUNTRY:
 			if (HIWORD(wParam) != CBN_SELCHANGE)
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp
index 3ccc3d6fbf..01d6bb911c 100644
--- a/plugins/UserInfoEx/src/ctrl_edit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_edit.cpp
@@ -289,21 +289,21 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg)
 void CEditCtrl::OpenUrl()
 {
 	int lenUrl = 1 + Edit_GetTextLength(_hwnd);
-	LPSTR szUrl;
+	LPTSTR szUrl;
 	BYTE need_free = 0;
 
 	__try 
 	{
-		szUrl = (LPSTR)alloca((8 + lenUrl) * sizeof(CHAR));
+		szUrl = (LPTSTR)alloca((8 + lenUrl) * sizeof(TCHAR));
 	}
 	__except(EXCEPTION_EXECUTE_HANDLER) 
 	{
-		szUrl = (LPSTR)mir_alloc((8 + lenUrl) * sizeof(CHAR));
+		szUrl = (LPTSTR)mir_alloc((8 + lenUrl) * sizeof(TCHAR));
 		need_free = 1;
 	}
-	if (szUrl && (GetWindowTextA(_hwnd, szUrl, lenUrl) > 0))
+	if (szUrl && (GetWindowText(_hwnd, szUrl, lenUrl) > 0))
 	{
-		CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szUrl);
+		CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szUrl);
 	}
 	if (need_free)
 	{
@@ -313,6 +313,8 @@ void CEditCtrl::OpenUrl()
 
 LRESULT CEditCtrl::LinkNotificationHandler(ENLINK* lnk)
 {
+	if (lnk == NULL)
+		return FALSE;
 	switch (lnk->msg)
 	{
 	case WM_SETCURSOR:
@@ -324,46 +326,38 @@ LRESULT CEditCtrl::LinkNotificationHandler(ENLINK* lnk)
 
 	case WM_LBUTTONUP: 
 		{
-			if (lnk)
+			TEXTRANGE tr;
+			BYTE need_free = 0;
+
+			// do not call function if user selected some chars of the url string
+			SendMessage(_hwnd, EM_EXGETSEL, NULL, (LPARAM) &tr.chrg);
+			if (tr.chrg.cpMax == tr.chrg.cpMin)
 			{
-				TEXTRANGE tr;
-				BYTE need_free = 0;
+				// retrieve the url string
+				tr.chrg = lnk->chrg;
 
-				// do not call function if user selected some chars of the url string
-				SendMessage(_hwnd, EM_EXGETSEL, NULL, (LPARAM) &tr.chrg);
-				if (tr.chrg.cpMax == tr.chrg.cpMin)
+				__try 
 				{
-					// retrieve the url string
-					tr.chrg = lnk->chrg;
-
-					__try 
-					{
-						tr.lpstrText = (LPTSTR)alloca((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR));
-					}
-					__except(EXCEPTION_EXECUTE_HANDLER) 
+					tr.lpstrText = (LPTSTR)alloca((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR));
+				}
+				__except(EXCEPTION_EXECUTE_HANDLER) 
+				{
+					tr.lpstrText = (LPTSTR)mir_alloc((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR));
+					need_free = 1;
+				}
+				if (tr.lpstrText && (SendMessage(_hwnd, EM_GETTEXTRANGE, NULL, (LPARAM)&tr) > 0))
+				{
+					if (_tcschr(tr.lpstrText, '@') != NULL && _tcschr(tr.lpstrText, ':') == NULL && _tcschr(tr.lpstrText, '/') == NULL) 
 					{
-						tr.lpstrText = (LPTSTR)mir_alloc((tr.chrg.cpMax - tr.chrg.cpMin + 8) * sizeof(TCHAR));
-						need_free = 1;
+							memmove(tr.lpstrText + 7, tr.lpstrText, (tr.chrg.cpMax - tr.chrg.cpMin + 1)*sizeof(TCHAR));
+							memcpy(tr.lpstrText, _T("mailto:"), (7*sizeof(TCHAR)));
 					}
-					if (tr.lpstrText && (SendMessage(_hwnd, EM_GETTEXTRANGE, NULL, (LPARAM)&tr) > 0))
-					{
-						if (_tcschr(tr.lpstrText, '@') != NULL && _tcschr(tr.lpstrText, ':') == NULL && _tcschr(tr.lpstrText, '/') == NULL) 
-						{
-							 memmove(tr.lpstrText + (7*sizeof(TCHAR)), tr.lpstrText, (tr.chrg.cpMax - tr.chrg.cpMin + 1)*sizeof(TCHAR));
-							 memcpy(tr.lpstrText, _T("mailto:"), (7*sizeof(TCHAR)));
-						}
 
-						LPSTR pszUrl = mir_t2a(tr.lpstrText);
-						if (pszUrl)
-						{
-							CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)pszUrl);
-							mir_free(pszUrl);
-						}
-					}
-					if (need_free)
-					{
-						MIR_FREE(tr.lpstrText);
-					}
+					CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)tr.lpstrText);
+				}
+				if (need_free)
+				{
+					MIR_FREE(tr.lpstrText);
 				}
 			}
 		}
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index 4b05346c66..9e433a4f30 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -782,7 +782,7 @@ class CAnnivList
 		SetDlgItemInt(_hDlg, TXT_NUMCONTACT, numContacts, FALSE);
 		SetDlgItemInt(_hDlg, TXT_FEMALE, numFemale, FALSE);
 		SetDlgItemInt(_hDlg, TXT_MALE, numMale, FALSE);
-		SetDlgItemInt(_hDlg, TXT_AGE, numBirthContacts > 0 ? max(0, (age - (age % numBirthContacts)) / numBirthContacts) : 0, FALSE);
+		SetDlgItemInt(_hDlg, TXT_AGE, numBirthContacts > 0 ? (age - (age % numBirthContacts)) / numBirthContacts : 0, FALSE);
 	}
 
 	// This method deletes all items from the listview
@@ -925,7 +925,7 @@ public:
  *
  * @return	always 0
  **/
-INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam)
+INT_PTR DlgAnniversaryListShow(WPARAM, LPARAM)
 {
 	if (!gpDlg) {
 		try {
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
index e968284786..a85bff5d88 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
@@ -457,10 +457,6 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType)
 					return NULL;
 				memset(r, 0, baselen);
 				ptr = r;
-				if (bPrependType) { // XXX dead code.
-					ptr[0] = 'n';
-					ptr ++;
-				}
 				for (SIZE_T j = 0; j < _dbvUID.cpbVal; j ++, ptr += 3) {
 					mir_snprintf(ptr, ((r + baselen) - ptr), "%02X ", (BYTE)_dbvUID.pbVal[j]);
 				}
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index d73bcd334a..e210d536a1 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -701,8 +701,7 @@ int CExImContactXML::Import(BYTE keepMetaSubContact)
 					while (xContact = xContact->NextSiblingElement("CONTACT"));
 			}
 			// load metacontact information (after subcontact for faster import)
-			ImportContact();
-			return ERROR_OK;
+			return ImportContact();
 		}
 		// import sub contacts as normal contacts
 		return _pXmlFile->ImportContacts(_xmlNode);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
index 42aa54c2b4..e5c76ffa95 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
@@ -434,17 +434,16 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine)
  **/
 int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName)
 {
-	FILE	*file;
-	MCONTACT hNewContact = INVALID_CONTACT_ID;
-	DWORD	end,
-			numLines				= 0;
-	CHAR	szModule[MAXSETTING]	= {0};
-	WORD	numContactsInFile		= 0,		// number of contacts in the inifile
-			numContactsAdded		= 0;		// number of contacts, that were added to the database
-	CHAR	*strBuf					= (CHAR *) mir_alloc(1);
-			*strBuf					= 0;
-	
-	if (file = fopen(pszFileName, "rt")) {
+	FILE *file = fopen(pszFileName, "rt");
+	if (file) {
+		MCONTACT hNewContact = INVALID_CONTACT_ID;
+		DWORD	end,
+				numLines				= 0;
+		CHAR	szModule[MAXSETTING]	= {0};
+		WORD	numContactsInFile		= 0,		// number of contacts in the inifile
+				numContactsAdded		= 0;		// number of contacts, that were added to the database
+		CHAR	*strBuf					= (CHAR *) mir_alloc(1);
+				*strBuf					= 0;
 		SetCursor(LoadCursor(NULL, IDC_WAIT));
 
 		while (ImportreadLine(file, strBuf)) {
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp
index d0fc03cadd..ab35aa96e5 100644
--- a/plugins/UserInfoEx/src/init.cpp
+++ b/plugins/UserInfoEx/src/init.cpp
@@ -36,6 +36,7 @@ static PLUGININFOEX pluginInfo = {
 };
 
 int hLangpack;
+HMODULE hDwmApi;
 
 /*
 ============================================================================================
@@ -52,7 +53,7 @@ int hLangpack;
  *
  * @return	always 0
  **/
-static int OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam)
+static int OnTopToolBarLoaded(WPARAM, LPARAM)
 {
 	DlgAnniversaryListOnTopToolBarLoaded();
 	SvcReminderOnTopToolBarLoaded();
@@ -67,7 +68,7 @@ static int OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam)
  *
  * @return	always 0
  **/
-static int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
+static int OnModulesLoaded(WPARAM, LPARAM)
 {
 	myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS);
 
@@ -90,7 +91,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
 	return 0;
 }
 
-static int OnShutdown(WPARAM wParam, LPARAM lParam)
+static int OnShutdown(WPARAM, LPARAM)
 {
 	DlgContactInfoUnLoadModule();
 	SvcReminderUnloadModule();
@@ -145,6 +146,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {
  **/
 extern "C" int __declspec(dllexport) Unload(void)
 {
+	FreeLibrary(hDwmApi);
 	return 0;
 }
 
@@ -182,7 +184,7 @@ extern "C" int __declspec(dllexport) Load(void)
 	}
 
 	if (IsWinVerVistaPlus()) {
-		HMODULE hDwmApi = LoadLibraryA("dwmapi.dll");
+		hDwmApi = LoadLibraryA("dwmapi.dll");
 		if (hDwmApi)
 			dwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled)GetProcAddress(hDwmApi, "DwmIsCompositionEnabled");
 	}
diff --git a/plugins/UserInfoEx/src/mir_string.cpp b/plugins/UserInfoEx/src/mir_string.cpp
index a454bbdc9d..2f2dd7a62a 100644
--- a/plugins/UserInfoEx/src/mir_string.cpp
+++ b/plugins/UserInfoEx/src/mir_string.cpp
@@ -54,8 +54,8 @@ wchar_t* mir_wcsncat_c(wchar_t *pwszDest, const wchar_t wcSrc)
 char* mir_strnerase(char *pszDest, size_t sizeFrom, size_t sizeTo)
 {
 	char *pszReturn = NULL;
-	size_t sizeNew, sizeLen = mir_strlen(pszDest);
-	if (sizeFrom >= 0 && sizeFrom < sizeLen && sizeTo >= 0 && sizeTo <= sizeLen && sizeFrom < sizeTo) {
+	size_t sizeNew = 0, sizeLen = mir_strlen(pszDest);
+	if (sizeFrom < sizeLen && sizeTo <= sizeLen && sizeFrom < sizeTo) {
 		sizeNew = sizeLen - (sizeTo - sizeFrom);
 		size_t sizeCopy = sizeNew - sizeFrom;
 		pszReturn = (char *)mir_alloc(sizeNew + 1);
diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp
index cbc831f2ec..3badb81261 100644
--- a/plugins/UserInfoEx/src/psp_origin.cpp
+++ b/plugins/UserInfoEx/src/psp_origin.cpp
@@ -72,8 +72,6 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
 					switch (((LPNMHDR) lParam)->code) {
 					case PSN_INFOCHANGED:
 						{
-							BYTE bChanged = 0;
-
 							if (!PSGetBaseProto(hDlg, pszProto) || *pszProto == 0)
 								break;
 
@@ -101,7 +99,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
 								}
 							}
 						 
-							SetWindowLongPtr(hDlg, DWLP_MSGRESULT, bChanged ? PSP_CHANGED : 0);
+							SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0);
 						}
 						break;
 				
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp
index 52210dfc7f..b65f24b7f9 100644
--- a/plugins/UserInfoEx/src/psp_profile.cpp
+++ b/plugins/UserInfoEx/src/psp_profile.cpp
@@ -1198,7 +1198,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
 						for (iItem = lvi.iItem = lvi.iSubItem = 0; ListView_GetItem(hList, &lvi); lvi.iItem++) {
 							if (!PtrIsValid(pItem = (LPLCITEM)lvi.lParam)) {
 								// delete reluctant items
-								if (iFmt >= 0 && iFmt < SIZEOF(pFmt)) {
+								if (iFmt < SIZEOF(pFmt)) {
 									DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szCatFmt, iItem);
 									DB::Setting::DeleteArray(hContact, pszModule, pFmt[iFmt].szValFmt, iItem);
 								}
-- 
cgit v1.2.3