diff options
author | George Hazan <george.hazan@gmail.com> | 2016-05-20 15:04:08 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-05-20 15:04:08 +0000 |
commit | 2e091df2cd04344572748a1c8fbc36cd33295964 (patch) | |
tree | 50a07b8b7fcf560b20cad461ff9ebf7e73f8c5ac | |
parent | 5b55ebfcc6a6835c17b90bebcf4395b82b937d04 (diff) |
minus static buffer
git-svn-id: http://svn.miranda-ng.org/main/trunk@16858 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | src/mir_app/src/clc.cpp | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index fd34ede385..b2168711c4 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -380,42 +380,30 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
if (dbcws->value.type == DBVT_ASCIIZ || dbcws->value.type == DBVT_UTF8) {
int groupId = atoi(dbcws->szSetting) + 1;
- TCHAR szFullName[512];
int i, eq;
//check name of group and ignore message if just being expanded/collapsed
if (cli.pfnFindItem(hwnd, dat, groupId | HCONTACT_ISGROUP, &contact, &group, NULL)) {
- mir_tstrcpy(szFullName, contact->szText);
+ CMString szFullName(contact->szText);
while (group->parent) {
- for (i = 0; i < group->parent->cl.count; i++)
- if (group->parent->cl.items[i]->group == group)
+ ClcContact *cc;
+ for (i = 0; i < group->parent->cl.count; i++) {
+ cc = group->parent->cl.items[i];
+ if (cc->group == group)
break;
+ }
if (i == group->parent->cl.count) {
- szFullName[0] = '\0';
+ szFullName.Empty();
break;
}
+ szFullName = CMString(cc->szText) + _T("\\") + szFullName;
group = group->parent;
- size_t nameLen = mir_tstrlen(group->cl.items[i]->szText);
- if (mir_tstrlen(szFullName) + 1 + nameLen > _countof(szFullName)) {
- szFullName[0] = '\0';
- break;
- }
- memmove(szFullName + 1 + nameLen, szFullName, sizeof(TCHAR)*(mir_tstrlen(szFullName) + 1));
- memcpy(szFullName, group->cl.items[i]->szText, sizeof(TCHAR)*nameLen);
- szFullName[nameLen] = '\\';
}
- if (dbcws->value.type == DBVT_ASCIIZ) {
- WCHAR* wszGrpName = mir_a2u(dbcws->value.pszVal + 1);
- eq = !mir_tstrcmp(szFullName, wszGrpName);
- mir_free(wszGrpName);
- }
- else {
- char* szGrpName = NEWSTR_ALLOCA(dbcws->value.pszVal + 1);
- WCHAR* wszGrpName;
- Utf8Decode(szGrpName, &wszGrpName);
- eq = !mir_tstrcmp(szFullName, wszGrpName);
- mir_free(wszGrpName);
- }
+ if (dbcws->value.type == DBVT_ASCIIZ)
+ eq = !mir_tstrcmp(szFullName, _A2T(dbcws->value.pszVal+1));
+ else
+ eq = !mir_tstrcmp(szFullName, ptrT(mir_utf8decodeT(dbcws->value.pszVal + 1)));
+
if (eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
break; //only expanded has changed: no action reqd
}
|