diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-09 19:32:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-09 19:32:39 +0300 |
commit | df6b0c988eb26339d4c7e4a1d0fe3b9717703c28 (patch) | |
tree | 5b4960edd6c9186e1fbc14f83f7f08a6a842f0a7 /plugins/PluginUpdater | |
parent | 303dd9297732fc943ed3e20ab37587f0c009dfe5 (diff) |
more loop-related code cleaning
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 3 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 11 |
2 files changed, 6 insertions, 8 deletions
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index fa521bbcfc..81f40481b7 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -27,9 +27,8 @@ static void SelectAll(HWND hDlg, bool bEnable) OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
- for (int i = 0; i < todo.getCount(); i++) {
+ for (int i = 0; i < todo.getCount(); i++)
ListView_SetCheckState(hwndList, i, todo[i].bEnabled = bEnable);
- }
}
static void ApplyDownloads(void *param)
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 91f6358b2d..467e7e44ce 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -315,8 +315,8 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM // Toggle the Download button
bool enableOk = false;
OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- for (int i=0; i < todo.getCount(); ++i) {
- if (todo[i].bEnabled) {
+ for (auto &it : todo) {
+ if (it->bEnabled) {
enableOk = true;
break;
}
@@ -423,11 +423,10 @@ static void DlgUpdateSilent(void *param) HNETLIBCONN nlc = nullptr;
// Count all updates that have been enabled
int count = 0;
- for (int i = 0; i < UpdateFiles.getCount(); i++) {
- if (UpdateFiles[i].bEnabled && !UpdateFiles[i].bDeleteOnly) {
+ for (auto &it : UpdateFiles) {
+ if (it->bEnabled && !it->bDeleteOnly) {
// download update
- FILEURL *pFileUrl = &UpdateFiles[i].File;
- if (!DownloadFile(pFileUrl, nlc)) {
+ if (!DownloadFile(&it->File, nlc)) {
// interrupt update as we require all components to be updated
Netlib_CloseHandle(nlc);
Skin_PlaySound("updatefailed");
|