From ce2d4f19e3f810b282eb7d47d470d426ff459e1f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Nov 2014 20:25:58 +0000 Subject: mir_strcmp, mir_strcmpi, mir_wstrcmp, mir_wstrcmpi git-svn-id: http://svn.miranda-ng.org/main/trunk@11179 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../Clist_modern/src/hdr/modern_commonheaders.h | 11 +------- plugins/Clist_modern/src/modern_cachefuncs.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 30 +++++++++++----------- plugins/Clist_modern/src/modern_clcitems.cpp | 2 +- plugins/Clist_modern/src/modern_clcopts.cpp | 2 +- plugins/Clist_modern/src/modern_clistsettings.cpp | 20 +++++++-------- plugins/Clist_modern/src/modern_clui.cpp | 4 +-- plugins/Clist_modern/src/modern_skinengine.cpp | 9 ++++--- plugins/Clist_modern/src/modern_utils.cpp | 23 +---------------- plugins/Clist_modern/src/modern_viewmodebar.cpp | 2 +- 10 files changed, 39 insertions(+), 66 deletions(-) (limited to 'plugins/Clist_modern/src') 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 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")); -- cgit v1.2.3