summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-11-30 20:25:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-11-30 20:25:58 +0000
commitce2d4f19e3f810b282eb7d47d470d426ff459e1f (patch)
treea49f3e9dd42399756b2ce33a3d91caec535b77ab
parent1bb83288c063ce1864e46f6f675751c8c631b530 (diff)
mir_strcmp, mir_strcmpi, mir_wstrcmp, mir_wstrcmpi
git-svn-id: http://svn.miranda-ng.org/main/trunk@11179 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_core.libbin61770 -> 62572 bytes
-rw-r--r--bin10/lib/mir_core64.libbin56488 -> 57214 bytes
-rw-r--r--bin12/lib/mir_core.libbin61770 -> 62572 bytes
-rw-r--r--bin12/lib/mir_core64.libbin56488 -> 57214 bytes
-rw-r--r--include/delphi/m_core.inc8
-rw-r--r--include/m_core.h10
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonheaders.h11
-rw-r--r--plugins/Clist_modern/src/modern_cachefuncs.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp30
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clcopts.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clistsettings.cpp20
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp9
-rw-r--r--plugins/Clist_modern/src/modern_utils.cpp23
-rw-r--r--plugins/Clist_modern/src/modern_viewmodebar.cpp2
-rw-r--r--plugins/UserInfoEx/src/classPsTree.cpp2
-rw-r--r--plugins/UserInfoEx/src/classPsTreeItem.cpp4
-rw-r--r--plugins/UserInfoEx/src/ctrl_edit.cpp2
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp22
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp16
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp6
-rw-r--r--plugins/UserInfoEx/src/mir_string.h6
-rw-r--r--src/mir_core/mir_core.def4
-rw-r--r--src/mir_core/utils.cpp38
29 files changed, 128 insertions, 103 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index 8a92d1aa58..9fc3e0034e 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index b992670550..38bda6e195 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index b7d00a7c7e..7bca5ddaf1 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index 39288c011f..a59d08d0ab 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc
index 622c7caf6c..de9b8dea23 100644
--- a/include/delphi/m_core.inc
+++ b/include/delphi/m_core.inc
@@ -650,6 +650,14 @@ function mir_strncat(dst:PAnsiChar; const src:PAnsiChar; len:size_t):PAnsiChar;
external CoreDLL name 'mir_strncat';
function mir_wstrncat(dst:PWideChar; const src:PWideChar; len:size_t):PWideChar; stdcall;
external CoreDLL name 'mir_wstrncat';
+function mir_strcmp(const p1,p2:PAnsiChar):int; stdcall;
+ external CoreDLL name 'mir_strcmp';
+function mir_wstrcmp(const p1,p2:PWideChar):int; stdcall;
+ external CoreDLL name 'mir_wstrcmp';
+function mir_strcmpi(const p1,p2:PAnsiChar):int; stdcall;
+ external CoreDLL name 'mir_strcmpi';
+function mir_wstrcmpi(const p1,p2:PWideChar):int; stdcall;
+ external CoreDLL name 'mir_wstrcmpi';
///////////////////////////////////////////////////////////////////////////////
// modules
diff --git a/include/m_core.h b/include/m_core.h
index 57bffb68ff..407a00580b 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -588,6 +588,12 @@ MIR_CORE_DLL(wchar_t*) mir_wstrcat(wchar_t *dest, const wchar_t *src);
MIR_CORE_DLL(char*) mir_strncat(char *dest, const char *src, size_t len);
MIR_CORE_DLL(wchar_t*) mir_wstrncat(wchar_t *dest, const wchar_t *src, size_t len);
+MIR_CORE_DLL(int) mir_strcmp(const char *p1, const char *p2);
+MIR_CORE_DLL(int) mir_wstrcmp(const wchar_t *p1, const wchar_t *p2);
+
+MIR_CORE_DLL(int) mir_strcmpi(const char *p1, const char *p2);
+MIR_CORE_DLL(int) mir_wstrcmpi(const wchar_t *p1, const wchar_t *p2);
+
MIR_CORE_DLL(char*) mir_strdup(const char* str);
MIR_CORE_DLL(wchar_t*) mir_wstrdup(const wchar_t* str);
@@ -771,6 +777,8 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); };
#define mir_tstrncpy mir_wstrncpy
#define mir_tstrcat mir_wstrcat
#define mir_tstrncat mir_wstrncat
+ #define mir_tstrcmp mir_wstrcmp
+ #define mir_tstrcmpi mir_wstrcmpi
#define mir_tstrdup mir_wstrdup
#define mir_tstrndup mir_wstrndup
@@ -805,6 +813,8 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); };
#define mir_tstrncpy mir_strncpy
#define mir_tstrcat mir_strcat
#define mir_tstrncat mir_strncat
+ #define mir_tstrcmp mir_strcmp
+ #define mir_tstrcmpi mir_strcmpi
#define mir_tstrdup mir_strdup
#define mir_tstrndup mir_strndup
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h
index 7447002bbd..8a31646f0a 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h
@@ -143,18 +143,9 @@ extern TCHAR SkinsFolder[MAX_PATH];
char* __cdecl strstri( char *a, const char *b);
BOOL __cdecl mir_bool_strcmpi(const char *a, const char *b);
-int __cdecl mir_strcmp (const char *a, const char *b);
-int __cdecl mir_strcmpi(const char *a, const char *b);
-int __cdecl mir_tstrcmpi(const TCHAR *a, const TCHAR *b);
BOOL __cdecl mir_bool_tstrcmpi(const TCHAR *a, const TCHAR *b);
DWORD exceptFunction(LPEXCEPTION_POINTERS EP);
-#ifndef MYCMP
-#define MYCMP 1
-#define strcmp(a,b) mir_strcmp(a,b)
-#define strlen(a) mir_strlen(a)
-#endif
-
// Register of plugin's user
//
// wParam = (WPARAM)szSetting - string that describes a user
@@ -356,7 +347,7 @@ public:
if ( this->_dwKey != second._dwKey )
return ( this->_dwKey < second._dwKey );
else
- return ( strcmp( this->_strKey, second._strKey ) < 0 ); // already maked upper so in any case - will be case insensitive
+ return ( mir_strcmp( this->_strKey, second._strKey ) < 0 ); // already maked upper so in any case - will be case insensitive
}
struct HashKeyLess
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp
index 7eeb92ba6f..a45d9a02dd 100644
--- a/plugins/Clist_modern/src/modern_cachefuncs.cpp
+++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp
@@ -204,7 +204,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce,
if (dat->text_use_protocol_smileys) {
sp.Protocolname = pdnce->m_cache_cszProto;
- if (db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && strcmp(pdnce->m_cache_cszProto, META_PROTO) == 0) {
+ if (db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && mir_strcmp(pdnce->m_cache_cszProto, META_PROTO) == 0) {
MCONTACT hContact = db_mc_getMostOnline(pdnce->hContact);
if (hContact != 0)
sp.Protocolname = GetContactProto(hContact);
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 696dfde5d3..e579ffe7dd 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -205,36 +205,36 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam)
if (hContact == NULL) {
if (!mir_strcmp(cws->szModule, "CListGroups"))
pcli->pfnClcBroadcast(INTM_GROUPSCHANGED, hContact, lParam);
- else if (!strcmp(cws->szSetting, "XStatusId") || !strcmp(cws->szSetting, "XStatusName"))
+ else if (!mir_strcmp(cws->szSetting, "XStatusId") || !mir_strcmp(cws->szSetting, "XStatusName"))
cliCluiProtocolStatusChanged(0, cws->szModule);
}
else // hContact != NULL
{
- if (!strcmp(cws->szSetting, "TickTS"))
+ if (!mir_strcmp(cws->szSetting, "TickTS"))
pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0);
- else if (!strcmp(cws->szModule, "UserInfo")) {
- if (!strcmp(cws->szSetting, "Timezone"))
+ else if (!mir_strcmp(cws->szModule, "UserInfo")) {
+ if (!mir_strcmp(cws->szSetting, "Timezone"))
pcli->pfnClcBroadcast(INTM_TIMEZONECHANGED, hContact, 0);
}
- else if (!strcmp(cws->szModule, "CList")) {
- if (!strcmp(cws->szSetting, "StatusMsg"))
+ else if (!mir_strcmp(cws->szModule, "CList")) {
+ if (!mir_strcmp(cws->szSetting, "StatusMsg"))
pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0);
}
- else if (!strcmp(cws->szModule, "ContactPhoto")) {
- if (!strcmp(cws->szSetting, "File"))
+ else if (!mir_strcmp(cws->szModule, "ContactPhoto")) {
+ if (!mir_strcmp(cws->szSetting, "File"))
pcli->pfnClcBroadcast(INTM_AVATARCHANGED, hContact, 0);
}
else {
- if ((!strcmp(cws->szSetting, "XStatusName") || !strcmp(cws->szSetting, "XStatusMsg")))
+ if ((!mir_strcmp(cws->szSetting, "XStatusName") || !mir_strcmp(cws->szSetting, "XStatusMsg")))
pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0);
- else if (!strcmp(cws->szSetting, "XStatusId"))
+ else if (!mir_strcmp(cws->szSetting, "XStatusId"))
pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0);
- else if (!strcmp(cws->szSetting, "Timezone"))
+ else if (!mir_strcmp(cws->szSetting, "Timezone"))
pcli->pfnClcBroadcast(INTM_TIMEZONECHANGED, hContact, 0);
- else if (!strcmp(cws->szSetting, "ListeningTo"))
+ else if (!mir_strcmp(cws->szSetting, "ListeningTo"))
pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0);
- else if (!strcmp(cws->szSetting, "Transport") || !strcmp(cws->szSetting, "IsTransported")) {
+ else if (!mir_strcmp(cws->szSetting, "Transport") || !mir_strcmp(cws->szSetting, "IsTransported")) {
pcli->pfnInvalidateDisplayNameCacheEntry(hContact);
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, hContact, 0);
}
@@ -1263,7 +1263,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (contSour->isChat() || contDest->isChat())
break;
if (contSour->type == CLCIT_CONTACT) {
- if (!strcmp(contSour->proto, META_PROTO))
+ if (!mir_strcmp(contSour->proto, META_PROTO))
break;
if (!contSour->isSubcontact) {
MCONTACT hcontact = contSour->hContact;
@@ -1306,7 +1306,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (contSour->isChat() || contDest->isChat())
break;
if (contSour->type == CLCIT_CONTACT) {
- if (!strcmp(contSour->proto, META_PROTO))
+ if (!mir_strcmp(contSour->proto, META_PROTO))
break;
if (!contSour->isSubcontact) {
MCONTACT hcontact = contSour->hContact;
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index 7b8d3ad64d..96eb839186 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -387,7 +387,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat)
}
if (cont) {
cont->SubAllocated = 0;
- if (cont->proto && dat->IsMetaContactsEnabled && strcmp(cont->proto, META_PROTO) == 0)
+ if (cont->proto && dat->IsMetaContactsEnabled && mir_strcmp(cont->proto, META_PROTO) == 0)
AddSubcontacts(dat, cont, CLCItems_IsShowOfflineGroup(group));
}
}
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp
index 032e57fb22..c941b7029c 100644
--- a/plugins/Clist_modern/src/modern_clcopts.cpp
+++ b/plugins/Clist_modern/src/modern_clcopts.cpp
@@ -783,7 +783,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName);
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)accs[i]);
- if ((dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && !strcmp(dbv.pszVal, accs[i]->szModuleName))
+ if ((dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && !mir_strcmp(dbv.pszVal, accs[i]->szModuleName))
SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0);
}
db_free(&dbv);
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp
index 3d259999f8..c9491636b9 100644
--- a/plugins/Clist_modern/src/modern_clistsettings.cpp
+++ b/plugins/Clist_modern/src/modern_clistsettings.cpp
@@ -409,10 +409,10 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
- if (!strcmp(cws->szModule, pdnce->m_cache_cszProto)) {
+ if (!mir_strcmp(cws->szModule, pdnce->m_cache_cszProto)) {
InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type);
- if (!strcmp(cws->szSetting, "IsSubcontact"))
+ if (!mir_strcmp(cws->szSetting, "IsSubcontact"))
pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
if (!mir_strcmp(cws->szSetting, "Status") || wildcmp(cws->szSetting, "Status?")) {
@@ -449,18 +449,18 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
}
}
- if (!strcmp(cws->szModule, "CList")) {
+ if (!mir_strcmp(cws->szModule, "CList")) {
//name is null or (setting is myhandle)
- if (!strcmp(cws->szSetting, "Rate"))
+ if (!mir_strcmp(cws->szSetting, "Rate"))
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
- else if (pdnce->tszName == NULL || !strcmp(cws->szSetting, "MyHandle"))
+ else if (pdnce->tszName == NULL || !mir_strcmp(cws->szSetting, "MyHandle"))
InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type);
- else if (!strcmp(cws->szSetting, "Group"))
+ else if (!mir_strcmp(cws->szSetting, "Group"))
InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type);
- else if (!strcmp(cws->szSetting, "Hidden")) {
+ else if (!mir_strcmp(cws->szSetting, "Hidden")) {
InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type);
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) {
char *szProto = GetContactProto(hContact);
@@ -469,13 +469,13 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
}
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
}
- else if (!strcmp(cws->szSetting, "noOffline")) {
+ else if (!mir_strcmp(cws->szSetting, "noOffline")) {
InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type);
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
}
}
- else if (!strcmp(cws->szModule, "Protocol")) {
- if (!strcmp(cws->szSetting, "p")) {
+ else if (!mir_strcmp(cws->szModule, "Protocol")) {
+ if (!mir_strcmp(cws->szSetting, "p")) {
InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type);
char *szProto = (cws->value.type == DBVT_DELETED) ? NULL : cws->value.pszVal;
cli_ChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(szProto,
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index 7ddb44fa42..dc5f07d995 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -51,7 +51,7 @@ struct PROTOTICKS
static int CompareTicks(const PROTOTICKS *p1, const PROTOTICKS *p2)
{
- return strcmp(p1->szProto, p2->szProto);
+ return mir_strcmp(p1->szProto, p2->szProto);
}
static OBJLIST<PROTOTICKS> arTicks(1, CompareTicks);
@@ -1004,7 +1004,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx)
static PROTOTICKS* CLUI_GetProtoTicksByProto(char *szProto)
{
for (int i = 0; i < arTicks.getCount(); i++)
- if (!strcmp(arTicks[i].szProto, szProto))
+ if (!mir_strcmp(arTicks[i].szProto, szProto))
return &arTicks[i];
PROTOTICKS *pt = new PROTOTICKS();
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index 837610d0bc..7f5728783f 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -1412,7 +1412,7 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj)
{
SKINFONT * sf;
sf = (SKINFONT*)gl_plSkinFonts->items[j];
- if (sf->szFontID && !strcmp(sf->szFontID,gt->szFontID))
+ if (sf->szFontID && !mir_strcmp(sf->szFontID,gt->szFontID))
{
gt->hFont = sf->hFont;
break;
@@ -2062,7 +2062,10 @@ static void RegisterMaskByParce(const char * szSetting, char * szValue, SKINOBJE
{
int i;
DWORD ID=atoi(szSetting+1);
- for (i=0; i < mir_strlen(szValue); i++) if (szValue[i] == ':') break;
+ for (i=0; i < mir_strlen(szValue); i++)
+ if (szValue[i] == ':')
+ break;
+
if (i < mir_strlen(szValue))
{
char * Obj, *Mask;
@@ -2104,7 +2107,7 @@ static int ske_enumdb_SkinObjectsProc (const char *szSetting,LPARAM lParam)
static int ske_SortTextGlyphObjectFunc(void * first, void * second)
{
- return strcmp(((GLYPHTEXT*)(((int*)first)[0]))->szGlyphTextID,((GLYPHTEXT*)(((int*)second)[0]))->szGlyphTextID);
+ return mir_strcmp(((GLYPHTEXT*)(((int*)first)[0]))->szGlyphTextID,((GLYPHTEXT*)(((int*)second)[0]))->szGlyphTextID);
}
static void ske_LinkSkinObjects(SKINOBJECTSLIST * pObjectList)
diff --git a/plugins/Clist_modern/src/modern_utils.cpp b/plugins/Clist_modern/src/modern_utils.cpp
index 50856ca11f..f0f3f532a5 100644
--- a/plugins/Clist_modern/src/modern_utils.cpp
+++ b/plugins/Clist_modern/src/modern_utils.cpp
@@ -22,19 +22,7 @@ char * __cdecl strstri( char *a, const char *b)
free(y);
return NULL;
}
-int __cdecl mir_strcmpi(const char *a, const char *b)
-{
- if (a == NULL && b == NULL) return 0;
- if (a == NULL || b == NULL) return _stricmp(a?a:"",b?b:"");
- return _stricmp(a,b);
-}
-int __cdecl mir_tstrcmpi(const TCHAR *a, const TCHAR *b)
-{
- if (a == NULL && b == NULL) return 0;
- if (a == NULL || b == NULL) return _tcsicmp(a?a:_T(""),b?b:_T(""));
- return _tcsicmp(a,b);
-}
BOOL __cdecl mir_bool_strcmpi(const char *a, const char *b)
{
if (a == NULL && b == NULL) return 1;
@@ -50,19 +38,10 @@ BOOL __cdecl mir_bool_tstrcmpi(const TCHAR *a, const TCHAR *b)
}
#ifdef strlen
-#undef strcmp
+#undef mir_strcmp
#undef strlen
#endif
-int __cdecl mir_strcmp (const char *a, const char *b)
-{
- if (!(a && b)) return a != b;
- return (strcmp(a,b));
-};
-
-#define strlen(a) mir_strlen(a)
-#define strcmp(a,b) mir_strcmp(a,b)
-
//copy len symbols from string - do not check is it null terminated or len is more then actual
char * strdupn(const char * src, int len)
{
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp
index 4324fb1a81..4b66621650 100644
--- a/plugins/Clist_modern/src/modern_viewmodebar.cpp
+++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp
@@ -650,7 +650,7 @@ void DeleteViewMode( char * szName )
db_unset(NULL, CLVM_MODULE, szSetting);
db_unset(NULL, CLVM_MODULE, szName);
- if (!strcmp(g_CluiData.current_viewmode, szName) && mir_strlen(szName) == mir_strlen(g_CluiData.current_viewmode)) {
+ if (!mir_strcmp(g_CluiData.current_viewmode, szName) && mir_strlen(szName) == mir_strlen(g_CluiData.current_viewmode)) {
g_CluiData.bFilterEffective = 0;
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
SetWindowText(hwndSelector, TranslateT("All contacts"));
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp
index aecab3b6a7..4d774b0d2d 100644
--- a/plugins/UserInfoEx/src/classPsTree.cpp
+++ b/plugins/UserInfoEx/src/classPsTree.cpp
@@ -118,7 +118,7 @@ BYTE CPsTree::Create(HWND hWndTree, CPsHdr* pPsh)
**/
int CPsTree::AddDummyItem(LPCSTR pszGroup)
{
- if (mir_stricmp(pszGroup, TREE_ROOTITEM))
+ if (mir_strcmpi(pszGroup, TREE_ROOTITEM))
{
CPsHdr psh;
psh._hContact = _pPs->hContact;
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp
index 2969b61fd5..44f4e81a40 100644
--- a/plugins/UserInfoEx/src/classPsTreeItem.cpp
+++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp
@@ -31,7 +31,7 @@ BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hWnd, LPARAM lParam)
{
TCHAR szClass[64];
GetClassName(hWnd, szClass, 64);
- if (!mir_tcscmp(szClass, _T("Button")) && (GetWindowLongPtr(hWnd, GWL_STYLE) & 0x0F) == BS_GROUPBOX)
+ if (!mir_tstrcmp(szClass, _T("Button")) && (GetWindowLongPtr(hWnd, GWL_STYLE) & 0x0F) == BS_GROUPBOX)
SendMessage(hWnd, WM_SETFONT, lParam, NULL);
return TRUE;
}
@@ -202,7 +202,7 @@ int CPsTreeItem::Name(LPTSTR ptszTitle, const BYTE bIsUnicode)
**/
BYTE CPsTreeItem::HasName(const LPCSTR pszName) const
{
- return !mir_stricmp(_pszName, pszName);
+ return !mir_strcmpi(_pszName, pszName);
};
/**
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp
index cf9511b7f1..2a7d65fede 100644
--- a/plugins/UserInfoEx/src/ctrl_edit.cpp
+++ b/plugins/UserInfoEx/src/ctrl_edit.cpp
@@ -269,7 +269,7 @@ void CEditCtrl::OnChangedByUser(WORD wChangedMsg)
if (szText != NULL) {
GetWindowText(_hwnd, szText, cch + 1);
- _Flags.B.hasChanged = mir_tcscmp(_pszValue, szText);
+ _Flags.B.hasChanged = mir_tstrcmp(_pszValue, szText);
if (need_free)
MIR_FREE(szText);
} else {
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index b62aee6d93..e7776df2dc 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -242,7 +242,7 @@ class CAnnivList
case COLUMN_DESC:
ListView_GetItemText(pDlg->_hList, iItem1, pDlg->_sortHeader, szText1, MAX_PATH);
ListView_GetItemText(pDlg->_hList, iItem2, pDlg->_sortHeader, szText2, MAX_PATH);
- result = pDlg->_sortOrder * mir_tcscmp(szText1, szText2);
+ result = pDlg->_sortOrder * mir_tstrcmp(szText1, szText2);
break;
case COLUMN_AGE:
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
index ead8d33c9d..2b4fd52fc3 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp
@@ -503,7 +503,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact)
}
// compare nicknames if no UID
else if (!DB::Setting::GetUString(hContact, _pszProto, SET_CONTACT_NICK, &dbv)) {
- if (dbv.type == DBVT_UTF8 && dbv.pszVal && !mir_stricmp(dbv.pszVal,_pszNick)) {
+ if (dbv.type == DBVT_UTF8 && dbv.pszVal && !mir_strcmpi(dbv.pszVal,_pszNick)) {
LPTSTR ptszNick = mir_utf8decodeT(_pszNick);
LPTSTR ptszProto = mir_a2t(_pszProto);
int ans = MsgBox(NULL, MB_ICONQUESTION|MB_YESNO, LPGENT("Question"), LPGENT("contact identification"),
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
index 0dcd377b73..c33bc8aaf8 100644
--- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp
@@ -421,7 +421,7 @@ BYTE CExImContactXML::ExportEvents()
// find module
TiXmlNode *xmlModule;
for (xmlModule = _xmlNode->FirstChild(); xmlModule != NULL; xmlModule = xmlModule->NextSibling())
- if (!mir_stricmp(((TiXmlElement*)xmlModule)->Attribute("key"), dbei.szModule))
+ if (!mir_strcmpi(((TiXmlElement*)xmlModule)->Attribute("key"), dbei.szModule))
break;
// create new module
@@ -463,7 +463,7 @@ void CExImContactXML::CountKeys(DWORD &numSettings, DWORD &numEvents)
for (TiXmlNode *xkey = xmod->FirstChild();
xkey != NULL;
xkey = xkey->NextSibling()) {
- if (!mir_stricmp(xkey->Value(), XKEY_SET))
+ if (!mir_strcmpi(xkey->Value(), XKEY_SET))
numSettings++;
else
numEvents++;
@@ -526,7 +526,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact)
uidk (xContact->Attribute("uidk"));
if (!_pszProto) {
// check if this is the owner contact
- if (mir_stricmp(xContact->Value(), XKEY_OWNER))
+ if (mir_strcmpi(xContact->Value(), XKEY_OWNER))
return ERROR_INVALID_PARAMS;
_hContact = NULL;
_xmlNode = xContact;
@@ -773,7 +773,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact)
int CExImContactXML::ImportModule(TiXmlNode* xmlModule)
{
// check if parent is really a module
- if (!xmlModule || mir_stricmp(xmlModule->Value(), XKEY_MOD))
+ if (!xmlModule || mir_strcmpi(xmlModule->Value(), XKEY_MOD))
return ERROR_INVALID_SIGNATURE;
// convert to element
@@ -787,14 +787,14 @@ int CExImContactXML::ImportModule(TiXmlNode* xmlModule)
return ERROR_INVALID_PARAMS;
// ignore Modul 'Protocol' as it would cause trouble
- if (!mir_stricmp(pszModule, "Protocol"))
+ if (!mir_strcmpi(pszModule, "Protocol"))
return ERROR_OK;
for (TiXmlElement *xKey = xmlModule->FirstChildElement(); xKey != NULL; xKey = xKey->NextSiblingElement()) {
// import setting
- if (!mir_stricmp(xKey->Value(), XKEY_SET)) {
+ if (!mir_strcmpi(xKey->Value(), XKEY_SET)) {
// check if the module to import is the contact's protocol module
- BYTE isProtoModule = !mir_stricmp(pszModule, _pszProto)/* || DB::Module::IsMeta(pszModule)*/;
+ BYTE isProtoModule = !mir_strcmpi(pszModule, _pszProto)/* || DB::Module::IsMeta(pszModule)*/;
BYTE isMetaModule = DB::Module::IsMeta(pszModule);
// just ignore MetaModule on normal contact to avoid errors (only keys)
@@ -803,9 +803,9 @@ int CExImContactXML::ImportModule(TiXmlNode* xmlModule)
// just ignore MetaModule on Meta to avoid errors (only import spetial keys)
if (isProtoModule && isMetaModule) {
- if (!mir_stricmp(xKey->Attribute("key"),"Nick") ||
- !mir_stricmp(xKey->Attribute("key"),"TzName") ||
- !mir_stricmp(xKey->Attribute("key"),"Timezone"))
+ if (!mir_strcmpi(xKey->Attribute("key"),"Nick") ||
+ !mir_strcmpi(xKey->Attribute("key"),"TzName") ||
+ !mir_strcmpi(xKey->Attribute("key"),"Timezone"))
{
if (ImportSetting(pszModule, xKey->ToElement()) == ERROR_OK)
_pXmlFile->_numSettingsDone++;
@@ -826,7 +826,7 @@ int CExImContactXML::ImportModule(TiXmlNode* xmlModule)
return ERROR_ABORTED;
}
// import event
- else if (!mir_stricmp(xKey->Value(), XKEY_EVT)) {
+ else if (!mir_strcmpi(xKey->Value(), XKEY_EVT)) {
int error = ImportEvent(pszModule, xKey->ToElement());
switch (error) {
case ERROR_OK:
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index 0e294afdfe..a5346841d4 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -95,7 +95,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText)
tvi.hItem != NULL;
tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem))
{
- if (SendMessageA(hTree, TVM_GETITEMA, NULL, (LPARAM)&tvi) && !mir_stricmp(tvi.pszText, pszText))
+ if (SendMessageA(hTree, TVM_GETITEMA, NULL, (LPARAM)&tvi) && !mir_strcmpi(tvi.pszText, pszText))
return tvi.hItem;
}
return NULL;
@@ -318,7 +318,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
}
// contact's base protocol is to be added to the treeview uniquely
- if (!mir_stricmp(p, pszProto))
+ if (!mir_strcmpi(p, pszProto))
{
if (!ExportTree_FindItem(hTree, hItemEssential, p))
{
@@ -329,7 +329,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
// add optional module, which is valid for at least one contact
/*/Filter/*/
- if (mir_stricmp(p, USERINFO) && mir_stricmp(p, MOD_MBIRTHDAY) && mir_stricmp(p, META_PROTO))
+ if (mir_strcmpi(p, USERINFO) && mir_strcmpi(p, MOD_MBIRTHDAY) && mir_strcmpi(p, META_PROTO))
{
ExportTree_AddItem(hTree, hItemOptional, p, bImagesLoaded, 1);
break;
@@ -342,10 +342,10 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
else if (
/*Filter/*/
!DB::Module::IsEmpty(pDat->ExImContact->hContact, p) &&
- (!pDat->ExImContact->hContact || mir_stricmp(p, pszProto)) &&
- //mir_stricmp(p, "Protocol") &&
- mir_stricmp(p, USERINFO) &&
- mir_stricmp(p, MOD_MBIRTHDAY))
+ (!pDat->ExImContact->hContact || mir_strcmpi(p, pszProto)) &&
+ //mir_strcmpi(p, "Protocol") &&
+ mir_strcmpi(p, USERINFO) &&
+ mir_strcmpi(p, MOD_MBIRTHDAY))
{
ExportTree_AddItem(hTree, hItemOptional, (LPSTR)p, bImagesLoaded, 1);
}
@@ -401,7 +401,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
tvi.hItem != NULL && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi);
tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem))
{
- if (!mir_stricmp(tvi.pszText, pszRoot)) {
+ if (!mir_strcmpi(tvi.pszText, pszRoot)) {
tvi.mask = TVIF_STATE;
tvi.state = INDEXTOSTATEIMAGEMASK(LOWORD(wParam) == BTN_UNCHECK ? 1 : 2);
tvi.stateMask = TVIS_STATEIMAGEMASK;
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
index 9c0787ff8b..09bcaa0469 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
@@ -224,7 +224,7 @@ BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...)
mir_vsntprintf(buf, SIZEOF(buf), TranslateTS(pszFormat), vl);
va_end(vl);
GetDlgItemText(_hDlg, TXT_SETTING, tmp, SIZEOF(tmp));
- if (mir_tcsicmp(tmp,buf))
+ if (mir_tstrcmpi(tmp,buf))
SetDlgItemText(_hDlg, TXT_SETTING, buf);
}
SendMessage(hProg, PBM_SETPOS, (int)SendMessage(hProg, PBM_GETPOS, 0, 0) + 1, 0);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
index 7c126562fa..42aa54c2b4 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
@@ -144,7 +144,7 @@ static BYTE ExportContact(MCONTACT hContact, DB::CEnumList* pModules, FILE* file
p = (*pModules)[i];
/*Filter/
- if (mir_stricmp(p, "Protocol"))*/
+ if (mir_strcmpi(p, "Protocol"))*/
{
ExportModule(hContact, p, file);
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
index 12cfcf2a1f..6f5158a941 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
@@ -256,7 +256,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent)
// import contacts
for (xContact = xmlParent->FirstChildElement(); xContact != NULL; xContact = xContact->NextSiblingElement()) {
- if (!mir_stricmp(xContact->Value(), XKEY_CONTACT)) {
+ if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT)) {
// update progressbar and abort if user clicked cancel
pszNick = mir_utf8decodeT(xContact->Attribute("nick"));
// user clicked abort button
@@ -295,7 +295,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent)
if (pszNick) mir_free(pszNick);
}
// import owner contact
- else if (_hContactToWorkOn == INVALID_CONTACT_ID && !mir_stricmp(xContact->Value(), XKEY_OWNER) && (vContact = xContact)) {
+ else if (_hContactToWorkOn == INVALID_CONTACT_ID && !mir_strcmpi(xContact->Value(), XKEY_OWNER) && (vContact = xContact)) {
result = vContact.Import();
switch (result) {
case ERROR_OK:
@@ -327,7 +327,7 @@ DWORD CFileXml::CountContacts(TiXmlElement* xmlParent)
try {
// count contacts in file for progress bar
for (xContact = xmlParent->FirstChild(); xContact != NULL; xContact = xContact->NextSibling()) {
- if (!mir_stricmp(xContact->Value(), XKEY_CONTACT) || !mir_stricmp(xContact->Value(), XKEY_OWNER)) {
+ if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT) || !mir_strcmpi(xContact->Value(), XKEY_OWNER)) {
dwCount += CountContacts(xContact->ToElement()) + 1;
}
}
diff --git a/plugins/UserInfoEx/src/mir_string.h b/plugins/UserInfoEx/src/mir_string.h
index 9e075820be..82f0dcaf69 100644
--- a/plugins/UserInfoEx/src/mir_string.h
+++ b/plugins/UserInfoEx/src/mir_string.h
@@ -22,25 +22,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _MIR_STRING_H_INCLUDED_
#define _MIR_STRING_H_INCLUDED_
-#define mir_tcscmp mir_wcscmp
#define mir_tcsncmp mir_wcsncmp
-#define mir_tcsicmp mir_wcsicmp
#define mir_tcsnicmp mir_wcsnicmp
#define mir_tcschr mir_wcschr
#define mir_tcsrchr mir_wcsrchr
#define mir_tcsncat_c mir_wcsncat_c
#define mir_IsEmpty mir_IsEmptyW
-#define mir_strcmp(s1,s2) ((s1)==0||(s2)==0||strcmp((s1),(s2)))
#define mir_strncmp(s1,s2,n) ((s1)==0||(s2)==0||strncmp((s1),(s2),(n)))
-#define mir_stricmp(s1,s2) ((s1)==0||(s2)==0||_stricmp((s1),(s2)))
#define mir_strnicmp(s1,s2,n) ((s1)==0||(s2)==0||_strnicmp((s1),(s2),(n)))
#define mir_strchr(s,c) (((s)!=0)?strchr((s),(c)):0)
#define mir_strrchr(s,c) (((s)!=0)?strrchr((s),(c)):0)
-#define mir_wcscmp(s1,s2) ((s1)==0||(s2)==0||wcscmp((s1),(s2)))
#define mir_wcsncmp(s1,s2,n) ((s1)==0||(s2)==0||wcsncmp((s1),(s2),(n)))
-#define mir_wcsicmp(s1,s2) ((s1)==0||(s2)==0||_wcsicmp((s1),(s2)))
#define mir_wcsnicmp(s1,s2,n) ((s1)==0||(s2)==0||_wcsnicmp((s1),(s2),(n)))
#define mir_wcschr(s,c) (((s)!=0)?wcschr((s),(c)):0)
#define mir_wcsrchr(s,c) (((s)!=0)?wcsrchr((s),(c)):0)
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index b0b369f320..312540f081 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -276,3 +276,7 @@ mir_strcat @273
mir_wstrcat @274
mir_strncat @275
mir_wstrncat @276
+mir_strcmp @277
+mir_strcmpi @278
+mir_wstrcmp @279
+mir_wstrcmpi @280
diff --git a/src/mir_core/utils.cpp b/src/mir_core/utils.cpp
index 6c584e9c82..5e9c640c4e 100644
--- a/src/mir_core/utils.cpp
+++ b/src/mir_core/utils.cpp
@@ -262,7 +262,7 @@ MIR_CORE_DLL(WCHAR*) bin2hexW(const void *pData, size_t len, WCHAR *dest)
/////////////////////////////////////////////////////////////////////////////////////////
-#pragma intrinsic(strlen, strcpy, strcat, wcslen, wcscpy, wcscat)
+#pragma intrinsic(strlen, strcpy, strcat, strcmp, wcslen, wcscpy, wcscat, wcscmp)
MIR_CORE_DLL(size_t) mir_strlen(const char *p)
{
@@ -373,3 +373,39 @@ MIR_CORE_DLL(wchar_t*) mir_wstrncat(wchar_t *dest, const wchar_t *src, size_t le
wcsncat_s(dest, len, src, _TRUNCATE);
return dest;
}
+
+MIR_CORE_DLL(int) mir_strcmp(const char *p1, const char *p2)
+{
+ if (p1 == NULL)
+ return (p2 == NULL) ? 0 : 1;
+ if (p2 == NULL)
+ return -1;
+ return strcmp(p1, p2);
+}
+
+MIR_CORE_DLL(int) mir_wstrcmp(const wchar_t *p1, const wchar_t *p2)
+{
+ if (p1 == NULL)
+ return (p2 == NULL) ? 0 : 1;
+ if (p2 == NULL)
+ return -1;
+ return wcscmp(p1, p2);
+}
+
+MIR_CORE_DLL(int) mir_strcmpi(const char *p1, const char *p2)
+{
+ if (p1 == NULL)
+ return (p2 == NULL) ? 0 : 1;
+ if (p2 == NULL)
+ return -1;
+ return stricmp(p1, p2);
+}
+
+MIR_CORE_DLL(int) mir_wstrcmpi(const wchar_t *p1, const wchar_t *p2)
+{
+ if (p1 == NULL)
+ return (p2 == NULL) ? 0 : 1;
+ if (p2 == NULL)
+ return -1;
+ return wcsicmp(p1, p2);
+}