summaryrefslogtreecommitdiff
path: root/plugins/FingerPrintModPlus
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-29 20:01:13 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-29 20:01:13 +0000
commitb642cdb1cd9e88d9ff4e0bf27a1232d6e56a3ec3 (patch)
tree03d5b580b3c970994d92e60734d56ba815196712 /plugins/FingerPrintModPlus
parentc17083c2062b6d62df3a073524505fd0f8cb3631 (diff)
correct options' processing
git-svn-id: http://svn.miranda-ng.org/main/trunk@1247 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FingerPrintModPlus')
-rw-r--r--plugins/FingerPrintModPlus/src/fingerprint.cpp178
1 files changed, 66 insertions, 112 deletions
diff --git a/plugins/FingerPrintModPlus/src/fingerprint.cpp b/plugins/FingerPrintModPlus/src/fingerprint.cpp
index ec6dfa0767..3c097951a7 100644
--- a/plugins/FingerPrintModPlus/src/fingerprint.cpp
+++ b/plugins/FingerPrintModPlus/src/fingerprint.cpp
@@ -466,75 +466,65 @@ BOOL __inline WildCompareProcW(LPWSTR wszName, LPWSTR wszMask)
}
}
-/* GetIconsIndexesA
-* Retrieves Icons indexes by Mirver
-*/
-void FASTCALL GetIconsIndexesA(LPSTR szMirVer, short *base, short *overlay,short *overlay2,short *overlay3)
+static void MatchMasks(TCHAR* szMirVer, short *base, short *overlay,short *overlay2,short *overlay3)
{
- LPTSTR tszMirVerUp;
- int iMirVerUpLen;
short i = 0, j = -1, k = -1, n = -1;
- if (strcmp(szMirVer, "?") == 0) {
- *base = UNKNOWN_MASK_NUMBER;
- *overlay = -1;
- *overlay2 = -1;
- *overlay3 = -1;
- return;
- }
-
- iMirVerUpLen = MultiByteToWideChar(g_LPCodePage, 0, szMirVer, -1, NULL, 0);
+ for (i=0; i < DEFAULT_KN_FP_MASK_COUNT; i++) {
+ KN_FP_MASK& p = def_kn_fp_mask[i];
+ if (p.hIcolibItem == NULL)
+ continue;
- tszMirVerUp = (LPTSTR)mir_alloc(iMirVerUpLen * sizeof(TCHAR));
+ if ( !WildCompareW(szMirVer, p.szMaskUpper))
+ continue;
- MultiByteToWideChar(g_LPCodePage, 0, szMirVer, -1, tszMirVerUp, iMirVerUpLen);
-
- _tcsupr_s(tszMirVerUp, iMirVerUpLen);
+ if (p.szIconFileName != _T("")) {
+ TCHAR destfile[MAX_PATH];
+ mir_sntprintf(destfile, SIZEOF(destfile), _T("%s\\%s.dll"), g_szSkinLib, p.szIconFileName);
+ struct _stat64i32 stFileInfo;
- while(i < DEFAULT_KN_FP_MASK_COUNT) {
- if (WildCompare(tszMirVerUp, def_kn_fp_mask[i].szMaskUpper)) {
- if (def_kn_fp_mask[i].szIconFileName != _T("")) {
- TCHAR destfile[MAX_PATH];
- mir_sntprintf(destfile, SIZEOF(destfile), _T("%s\\%s.dll"), g_szSkinLib, def_kn_fp_mask[i].szIconFileName);
- struct _stat64i32 stFileInfo;
-
- if (_tstat(destfile, &stFileInfo) == -1)
- i = NOTFOUND_MASK_NUMBER;
- }
- break;
+ if (_tstat(destfile, &stFileInfo) == -1)
+ i = NOTFOUND_MASK_NUMBER;
}
- i++;
+ break;
}
if (!def_kn_fp_mask[i].fNotUseOverlay && i < DEFAULT_KN_FP_MASK_COUNT) {
- j = 0;
- while(j < DEFAULT_KN_FP_OVERLAYS_COUNT) {
- if ( WildCompare(tszMirVerUp, def_kn_fp_overlays_mask[j].szMaskUpper)) {
- if (def_kn_fp_overlays_mask[j].szIconFileName != _T("ClientIcons_Packs"))
- break;
+ for (j = 0; j < DEFAULT_KN_FP_OVERLAYS_COUNT; j++) {
+ KN_FP_MASK& p = def_kn_fp_overlays_mask[j];
+ if (p.hIcolibItem == NULL)
+ continue;
- TCHAR destfile[MAX_PATH];
- mir_sntprintf(destfile, SIZEOF(destfile), _T("%s\\%s.dll"), g_szSkinLib, def_kn_fp_overlays_mask[i].szIconFileName);
+ if ( !WildCompare(szMirVer, p.szMaskUpper))
+ continue;
- struct _stat64i32 stFileInfo;
- if ( _tstat(destfile, &stFileInfo) != -1)
- break;
- }
- j++;
+ if (p.szIconFileName != _T("ClientIcons_Packs"))
+ break;
+
+ TCHAR destfile[MAX_PATH];
+ mir_sntprintf(destfile, SIZEOF(destfile), _T("%s\\%s.dll"), g_szSkinLib, p.szIconFileName);
+
+ struct _stat64i32 stFileInfo;
+ if ( _tstat(destfile, &stFileInfo) != -1)
+ break;
}
- k = 0;
- while(k < DEFAULT_KN_FP_OVERLAYS2_COUNT) {
- if (WildCompare(tszMirVerUp, def_kn_fp_overlays2_mask[k].szMaskUpper))
+ for (k = 0; k < DEFAULT_KN_FP_OVERLAYS2_COUNT; k++) {
+ KN_FP_MASK& p = def_kn_fp_overlays2_mask[k];
+ if (p.hIcolibItem == NULL)
+ continue;
+
+ if ( WildCompareW(szMirVer, p.szMaskUpper))
break;
- k++;
}
- n = 0;
- while(n < DEFAULT_KN_FP_OVERLAYS3_COUNT) {
- if (WildCompare(tszMirVerUp, def_kn_fp_overlays3_mask[n].szMaskUpper))
+ for (n = 0; n < DEFAULT_KN_FP_OVERLAYS3_COUNT; n++) {
+ KN_FP_MASK& p = def_kn_fp_overlays3_mask[n];
+ if (p.hIcolibItem == NULL)
+ continue;
+
+ if ( WildCompareW(szMirVer, p.szMaskUpper))
break;
- n++;
}
}
@@ -542,6 +532,28 @@ void FASTCALL GetIconsIndexesA(LPSTR szMirVer, short *base, short *overlay,short
*overlay = (j < DEFAULT_KN_FP_OVERLAYS_COUNT) ? j : -1;
*overlay2 = (k < DEFAULT_KN_FP_OVERLAYS2_COUNT) ? k : -1;
*overlay3 = (n < DEFAULT_KN_FP_OVERLAYS3_COUNT) ? n : -1;
+}
+
+/* GetIconsIndexesA
+* Retrieves Icons indexes by Mirver
+*/
+
+void FASTCALL GetIconsIndexesA(LPSTR szMirVer, short *base, short *overlay,short *overlay2,short *overlay3)
+{
+ if (strcmp(szMirVer, "?") == 0) {
+ *base = UNKNOWN_MASK_NUMBER;
+ *overlay = -1;
+ *overlay2 = -1;
+ *overlay3 = -1;
+ return;
+ }
+
+ LPTSTR tszMirVerUp = mir_a2t_cp(szMirVer, g_LPCodePage);
+ size_t iMirVerUpLen = lstrlen(tszMirVerUp);
+ _tcsupr_s(tszMirVerUp, iMirVerUpLen);
+
+ MatchMasks(tszMirVerUp, base, overlay, overlay2, overlay3);
+
mir_free(tszMirVerUp);
}
@@ -551,10 +563,6 @@ void FASTCALL GetIconsIndexesA(LPSTR szMirVer, short *base, short *overlay,short
void FASTCALL GetIconsIndexesW(LPWSTR wszMirVer, short *base, short *overlay,short *overlay2,short *overlay3)
{
- LPWSTR wszMirVerUp;
- size_t iMirVerUpLen;
- short i = 0, j = -1, k = -1, n = -1;
-
if (wcscmp(wszMirVer, L"?") == 0)
{
*base = UNKNOWN_MASK_NUMBER;
@@ -564,66 +572,12 @@ void FASTCALL GetIconsIndexesW(LPWSTR wszMirVer, short *base, short *overlay,sho
return;
}
- iMirVerUpLen = wcslen(wszMirVer) + 1;
- wszMirVerUp = (LPWSTR)mir_alloc(iMirVerUpLen * sizeof(WCHAR));
-
+ size_t iMirVerUpLen = wcslen(wszMirVer) + 1;
+ LPWSTR wszMirVerUp = (LPWSTR)mir_alloc(iMirVerUpLen * sizeof(WCHAR));
wcscpy_s(wszMirVerUp, iMirVerUpLen, wszMirVer);
_wcsupr_s(wszMirVerUp, iMirVerUpLen);
- while(i < DEFAULT_KN_FP_MASK_COUNT) {
- if ( WildCompareW(wszMirVerUp, def_kn_fp_mask[i].szMaskUpper)) {
- if (def_kn_fp_mask[i].szIconFileName != _T("")) {
- TCHAR destfile[MAX_PATH];
- mir_sntprintf(destfile, SIZEOF(destfile), _T("%s\\%s.dll"), g_szSkinLib, def_kn_fp_mask[i].szIconFileName);
- struct _stat64i32 stFileInfo;
-
- if (_tstat(destfile, &stFileInfo) == -1)
- i = NOTFOUND_MASK_NUMBER;
- }
- break;
- }
- i++;
- }
-
- if (!def_kn_fp_mask[i].fNotUseOverlay && i < DEFAULT_KN_FP_MASK_COUNT) {
- j = 0;
- while(j < DEFAULT_KN_FP_OVERLAYS_COUNT) {
- if (WildCompare(wszMirVerUp, def_kn_fp_overlays_mask[j].szMaskUpper)) {
- if (def_kn_fp_overlays_mask[j].szIconFileName == _T("ClientIcons_Packs")) {
- TCHAR destfile[MAX_PATH];
- mir_sntprintf(destfile, SIZEOF(destfile), _T("%s\\%s.dll"), g_szSkinLib, def_kn_fp_overlays_mask[j].szIconFileName);
- struct _stat64i32 stFileInfo;
-
- if (_tstat(destfile, &stFileInfo) == -1)
- j++;
- else
- break;
- }
- else
- break;
- }
- j++;
- }
-
- k = 0;
- while(k < DEFAULT_KN_FP_OVERLAYS2_COUNT) {
- if ( WildCompareW(wszMirVerUp, def_kn_fp_overlays2_mask[k].szMaskUpper))
- break;
- k++;
- }
-
- n = 0;
- while(n < DEFAULT_KN_FP_OVERLAYS3_COUNT) {
- if ( WildCompareW(wszMirVerUp, def_kn_fp_overlays3_mask[n].szMaskUpper))
- break;
- n++;
- }
- }
-
- *base = (i < DEFAULT_KN_FP_MASK_COUNT) ? i : -1;
- *overlay = (j < DEFAULT_KN_FP_OVERLAYS_COUNT) ? j : -1;
- *overlay2 = (k < DEFAULT_KN_FP_OVERLAYS2_COUNT) ? k : -1;
- *overlay3 = (n < DEFAULT_KN_FP_OVERLAYS3_COUNT) ? n : -1;
+ MatchMasks(wszMirVerUp, base, overlay, overlay2, overlay3);
mir_free(wszMirVerUp);
}