diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-06 18:03:34 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-06 18:03:34 +0300 |
commit | 314767f2cd1490ff5765139e0c4c80b5e24e85eb (patch) | |
tree | a630610b2b4df5a46ab8674c4c5b78b5aeea5e24 /src | |
parent | 24dc075a6d3c8d86f0d343b6c7dd62bbf4c7e9a5 (diff) |
code cleaning
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/searchresults.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index 658efdaa78..d7eb8c090e 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -58,41 +58,41 @@ static const wchar_t *szColumnNames[] = { nullptr, nullptr, L"Nick", L"First Nam static int defaultColumnSizes[] = { 0, 90, 100, 100, 100, 2000 };
void LoadColumnSizes(HWND hwndResults, const char *szProto)
{
- char szSetting[32];
-
defaultColumnSizes[COLUMNID_PROTO] = g_iIconSX + 4;
FindAddDlgData *dat = (FindAddDlgData*)GetWindowLongPtr(GetParent(hwndResults), GWLP_USERDATA);
- int columnCount = NUM_COLUMNID, columnOrder[NUM_COLUMNID];
+ LVCOLUMN lvc;
+ lvc.mask = LVCF_TEXT | LVCF_WIDTH;
+
+ int columnOrder[NUM_COLUMNID];
bool colOrdersValid = true;
for (int i = 0; i < NUM_COLUMNID; i++) {
- LVCOLUMN lvc;
- if (i < columnCount) {
- bool bNeedsFree = false;
- lvc.mask = LVCF_TEXT | LVCF_WIDTH;
- if (szColumnNames[i] != nullptr)
- lvc.pszText = TranslateW(szColumnNames[i]);
- else {
- if (i == COLUMNID_HANDLE) {
- lvc.pszText = L"ID";
- if (szProto) {
- INT_PTR ret = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
- if (ret != CALLSERVICE_NOTFOUND) {
- bNeedsFree = true;
- lvc.pszText = mir_a2u((char*)ret);
- }
+ bool bNeedsFree = false;
+
+ if (szColumnNames[i] != nullptr)
+ lvc.pszText = TranslateW(szColumnNames[i]);
+ else {
+ if (i == COLUMNID_HANDLE) {
+ lvc.pszText = L"ID";
+ if (szProto) {
+ INT_PTR ret = CallProtoServiceInt(0, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ if (ret != CALLSERVICE_NOTFOUND) {
+ bNeedsFree = true;
+ lvc.pszText = mir_a2u((char*)ret);
}
}
- else lvc.mask &= ~LVCF_TEXT;
}
+ else lvc.mask &= ~LVCF_TEXT;
+ }
- mir_snprintf(szSetting, "ColWidth%d", i);
- lvc.cx = db_get_w(0, "FindAdd", szSetting, defaultColumnSizes[i]);
- ListView_InsertColumn(hwndResults, i, (LPARAM)&lvc);
+ char szSetting[32];
+ mir_snprintf(szSetting, "ColWidth%d", i);
+ lvc.cx = db_get_w(0, "FindAdd", szSetting, defaultColumnSizes[i]);
+ ListView_InsertColumn(hwndResults, i, (LPARAM)&lvc);
+
+ if (bNeedsFree)
+ mir_free(lvc.pszText);
- if (bNeedsFree)
- mir_free(lvc.pszText);
- }
mir_snprintf(szSetting, "ColOrder%d", i);
columnOrder[i] = db_get_b(0, "FindAdd", szSetting, -1);
if (columnOrder[i] == -1 || columnOrder[i] >= NUM_COLUMNID)
@@ -100,10 +100,10 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) }
if (colOrdersValid)
- ListView_SetColumnOrderArray(hwndResults, columnCount, columnOrder);
+ ListView_SetColumnOrderArray(hwndResults, NUM_COLUMNID, columnOrder);
dat->iLastColumnSortIndex = db_get_b(0, "FindAdd", "SortColumn", COLUMNID_NICK);
- if (dat->iLastColumnSortIndex >= columnCount)
+ if (dat->iLastColumnSortIndex >= NUM_COLUMNID)
dat->iLastColumnSortIndex = COLUMNID_NICK;
dat->bSortAscending = db_get_b(0, "FindAdd", "SortAscending", TRUE);
|