diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-25 15:28:04 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-25 15:28:04 +0000 |
commit | a75c230f0b36bc16a2d36e4321ebbdb82a25cc9b (patch) | |
tree | f24b2b324b7c459657e82ee81de60f10253b8eed /plugins/PluginUpdater/src/Compat/compat.h | |
parent | 6cd5066a4a158b7d6ec0ca5c210c51b251c8c14d (diff) |
compilation fix for Miranda IM
git-svn-id: http://svn.miranda-ng.org/main/trunk@8741 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src/Compat/compat.h')
-rw-r--r-- | plugins/PluginUpdater/src/Compat/compat.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/PluginUpdater/src/Compat/compat.h b/plugins/PluginUpdater/src/Compat/compat.h index 8e3d152126..6afc901e17 100644 --- a/plugins/PluginUpdater/src/Compat/compat.h +++ b/plugins/PluginUpdater/src/Compat/compat.h @@ -121,3 +121,26 @@ __forceinline INT_PTR CreateDirectoryTreeT(const TCHAR *ptszPath) int __forceinline PUDeletePopup(HWND hWndPopup)
{ return (int)SendMessage(hWndPopup, UM_DESTROYPOPUP, 0, 0);
}
+
+#define _qtoupper(_c) (((_c) >= 'a' && (_c) <= 'z')?((_c)-('a'+'A')):(_c))
+
+int __forceinline wildcmpit(const WCHAR *name, const WCHAR *mask)
+{
+ if (name == NULL || mask == NULL)
+ return false;
+
+ const WCHAR* last = NULL;
+ for (;; mask++, name++) {
+ if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break;
+ if (*name == '\0') return ((BOOL)!*mask);
+ }
+ if (*mask != '*') return FALSE;
+ for (;; mask++, name++) {
+ while(*mask == '*') {
+ last = mask++;
+ if (*mask == '\0') return ((BOOL)!*mask); /* true */
+ }
+ if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */
+ if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) name -= (size_t)(mask - last) - 1, mask = last;
+ }
+}
|