diff options
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r-- | c/episodelistview.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index 4b93587..0cb95d6 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -1,3 +1,4 @@ +#include <vector> #include <windows.h> #include <commctrl.h> #include <TCHAR.H> @@ -305,7 +306,7 @@ void EpisodeListView::Update() LVFINDINFO lvfi; extern HWND g_hWndStatus; static TCHAR tszDisp[16], tszEpisode[16]; - static int aEpSel[2048]; + static std::vector<int> vEpSel; lviEpisode.mask = LVIF_TEXT|LVIF_PARAM; @@ -315,15 +316,12 @@ void EpisodeListView::Update() ListView_GetItem(hWnd, &lviTop); /* Save selected episodes. */ - i = 0; + vEpSel.clear(); lvi.mask = LVIF_PARAM; lvi.iItem = -1; - while ((lvi.iItem = ListView_GetNextItem( - hWnd, lvi.iItem, LVNI_SELECTED)) != -1 - && i < 2048) + while ((lvi.iItem = ListView_GetNextItem(hWnd, lvi.iItem, LVNI_SELECTED)) != -1) if (ListView_GetItem(hWnd, &lvi)) - aEpSel[i++] = lvi.lParam; - aEpSel[i] = 0; + vEpSel.push_back(lvi.lParam); iItemMark = ListView_GetSelectionMark(hWnd); /* Save focus. */ @@ -370,9 +368,9 @@ void EpisodeListView::Update() lvfi.flags = LVFI_PARAM; /* Reset selection. */ - for (i = 0; aEpSel[i]; i++) { + for (const int iEpSel : vEpSel) { int iItemSel; - lvfi.lParam = aEpSel[i]; + lvfi.lParam = iEpSel; if ((iItemSel = ListView_FindItem(hWnd, -1, &lvfi)) != -1) ListView_SetItemState(hWnd, iItemSel, LVIS_SELECTED, LVIS_SELECTED); |