diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 3 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 11 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/services.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sidebar.cpp | 53 | ||||
-rw-r--r-- | plugins/TopToolBar/src/toolbar.cpp | 6 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/Flags/svc_flags.cpp | 9 | ||||
-rw-r--r-- | plugins/YAPP/src/services.cpp | 15 |
7 files changed, 42 insertions, 59 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");
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 9cfacbd516..adc15d008e 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -279,8 +279,8 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) Menu_ShowItem(hContactMenuItem, haveMenu);
- for (int i = 0; i < menuHandleArray.getCount(); i++)
- Menu_RemoveItem((HGENMENU)menuHandleArray[i]);
+ for (auto &it : menuHandleArray)
+ Menu_RemoveItem((HGENMENU)it);
menuHandleArray.destroy();
if (haveMenu) {
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index e205025321..9dd8649657 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -592,8 +592,8 @@ HRESULT CSideBar::removeSession(CTabBaseDlg *dat) */
void CSideBar::scrollIntoView(const CSideBarButton *item)
{
- LONG spaceUsed = 0, itemHeight = 0;
- bool fNeedLayout = false;
+ LONG spaceUsed = 0, itemHeight = 0;
+ bool fNeedLayout = false, bFound = false;
if (!m_isActive)
return;
@@ -601,45 +601,36 @@ void CSideBar::scrollIntoView(const CSideBarButton *item) if (item == nullptr)
item = m_activeItem;
- int i;
- for (i = 0; i < m_buttonlist.getCount(); i++) {
- CSideBarButton &p = m_buttonlist[i];
- itemHeight = p.getHeight();
- spaceUsed += (itemHeight + 1);
- if (&p == item)
+ for (auto &it : m_buttonlist) {
+ itemHeight = it->getHeight();
+ spaceUsed += itemHeight;
+ if (it == item) {
+ bFound = true;
break;
+ }
}
RECT rc;
GetClientRect(m_hwndScrollWnd, &rc);
-
- if (m_topHeight <= rc.bottom) {
+ if (m_topHeight <= rc.bottom)
m_firstVisibleOffset = 0;
- Layout();
- return;
- }
- if (i == m_buttonlist.getCount() || (i == 0 && m_firstVisibleOffset == 0)) {
- Layout();
- return; // do nothing for the first item and .end() should not really happen
- }
+ else if (!bFound || (item == &m_buttonlist[0] && m_firstVisibleOffset == 0))
+ ; // do nothing for the first item and .end() should not really happen
- if (spaceUsed <= rc.bottom && spaceUsed - (itemHeight + 1) >= m_firstVisibleOffset) {
- Layout();
- return; // item fully visible, do nothing
- }
+ else if (spaceUsed <= rc.bottom && spaceUsed - (itemHeight +1) >= m_firstVisibleOffset)
+ ; // item fully visible, do nothing
- /*
- * button partially or not at all visible at the top
- */
- if (spaceUsed < m_firstVisibleOffset || spaceUsed - (itemHeight + 1) < m_firstVisibleOffset) {
- m_firstVisibleOffset = spaceUsed - (itemHeight + 1);
- fNeedLayout = true;
- }
- else {
- if (spaceUsed > rc.bottom) { // partially or not at all visible at the bottom
+ else { // button partially or not at all visible at the top
+ if (spaceUsed < m_firstVisibleOffset || spaceUsed - (itemHeight + 1) < m_firstVisibleOffset) {
+ m_firstVisibleOffset = spaceUsed - (itemHeight + 1);
fNeedLayout = true;
- m_firstVisibleOffset = spaceUsed - rc.bottom;
+ }
+ else {
+ if (spaceUsed > rc.bottom) { // partially or not at all visible at the bottom
+ fNeedLayout = true;
+ m_firstVisibleOffset = spaceUsed - rc.bottom;
+ }
}
}
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index 413ac69fb5..de6755c5d8 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -273,12 +273,12 @@ int ArrangeButtons() nextX = 0;
if (g_ctrl->bSingleLine)
break;
- } while (iFirstButtonId < Buttons.getCount() && y >= 0 && (g_ctrl->bAutoSize || (y + g_ctrl->nButtonHeight <= rcClient.bottom - rcClient.top)));
+ }
+ while (iFirstButtonId < Buttons.getCount() && y >= 0 && (g_ctrl->bAutoSize || (y + g_ctrl->nButtonHeight <= rcClient.bottom - rcClient.top)));
- for (i = iLastButtonId; i < Buttons.getCount(); i++) {
+ for (i = iLastButtonId; i < Buttons.getCount(); i++)
if (nullptr != Buttons[i]->hwnd) /* Wine fix. */
hdwp = DeferWindowPos(hdwp, Buttons[i]->hwnd, nullptr, nextX, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW);
- }
if (hdwp)
EndDeferWindowPos(hdwp);
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index a5352033ab..dcbf1af0c5 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -255,12 +255,9 @@ void SvcFlagsOnModulesLoaded() void SvcFlagsUnloadModule()
{
- //Uninit message winsow
- for (int i = 0; i < gMsgWndList.getCount(); i++) {
- //this should not happen
- delete gMsgWndList[i];
- gMsgWndList.remove(i);
- }
+ // Uninit message window
+ for (auto &it : gMsgWndList)
+ delete it;
gMsgWndList.destroy();
// Uninit misc
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index 87ef273df9..d9143ab624 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -323,7 +323,7 @@ INT_PTR Popup_ShowHistory(WPARAM, LPARAM) return 0;
}
-LIST<POPUPCLASS> arClasses(3);
+LIST<POPUPCLASS> arClasses(3, PtrKeySortT);
static INT_PTR RegisterPopupClass(WPARAM, LPARAM lParam)
{
@@ -361,15 +361,12 @@ static INT_PTR UnregisterPopupClass(WPARAM, LPARAM lParam) POPUPCLASS *pc = (POPUPCLASS*)lParam;
if (pc == nullptr)
return 1;
+ if (arClasses.find(pc) == nullptr)
+ return 1;
- for (int i=0; i < arClasses.getCount(); i++)
- if (arClasses[i] == pc) {
- arClasses.remove(i);
- FreePopupClass(pc);
- return 0;
- }
-
- return 1;
+ arClasses.remove(pc);
+ FreePopupClass(pc);
+ return 0;
}
static INT_PTR CreateClassPopup(WPARAM wParam, LPARAM lParam)
|