From bf5ec6dfc533e9a29958047ebf56bfa18b2f89ea Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Nov 2017 16:46:03 +1100 Subject: [PATCH] [Debugger] Use sizeof instead of checking for null --- .../Debugger/Debugger-RegisterTabs.cpp | 115 +++++++----------- .../Debugger/Debugger-RegisterTabs.h | 91 ++++++-------- 2 files changed, 80 insertions(+), 126 deletions(-) diff --git a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp index 59b673b92..e23110a23 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp @@ -34,43 +34,43 @@ void CRegisterTabs::Attach(HWND hWndNew) m_SITab = AddTab("SI", IDD_Debugger_RegSI, TabProcDefault); m_DDTab = AddTab("DD", IDD_Debugger_RegDD, TabProcDefault); - InitRegisterEdits64(m_GPRTab, m_GPREdits, GPREditIds); + InitRegisterEdits64(m_GPRTab, m_GPREdits, GPREditIds, sizeof(GPREditIds) / sizeof(GPREditIds[0])); InitRegisterEdit64(m_GPRTab, m_HIEdit, IDC_HI_EDIT); InitRegisterEdit64(m_GPRTab, m_LOEdit, IDC_LO_EDIT); - InitRegisterEdits(m_FPRTab, m_FPREdits, FPREditIds); + InitRegisterEdits(m_FPRTab, m_FPREdits, FPREditIds, sizeof(FPREditIds) / sizeof(FPREditIds[0])); InitRegisterEdit(m_FPRTab, m_FCSREdit, IDC_FCSR_EDIT); - InitRegisterEdits(m_COP0Tab, m_COP0Edits, COP0EditIds); + InitRegisterEdits(m_COP0Tab, m_COP0Edits, COP0EditIds, sizeof(COP0EditIds) / sizeof(COP0EditIds[0])); m_CauseTip.Attach(m_COP0Tab.GetDlgItem(IDC_CAUSE_TIP)); - InitRegisterEdits(m_RDRAMTab, m_RDRAMEdits, RDRAMEditIds); + InitRegisterEdits(m_RDRAMTab, m_RDRAMEdits, RDRAMEditIds, sizeof(RDRAMEditIds) / sizeof(RDRAMEditIds[0])); - InitRegisterEdits(m_SPTab, m_SPEdits, SPEditIds); + InitRegisterEdits(m_SPTab, m_SPEdits, SPEditIds, sizeof(SPEditIds) / sizeof(SPEditIds[0])); InitRegisterEdit(m_SPTab, m_SPPCEdit, IDC_SP_PC_EDIT); - InitRegisterEdits(m_DPCTab, m_DPCEdits, DPCEditIds); + InitRegisterEdits(m_DPCTab, m_DPCEdits, DPCEditIds, sizeof(DPCEditIds) / sizeof(DPCEditIds[0])); - InitRegisterEdits(m_MITab, m_MIEdits, MIEditIds); + InitRegisterEdits(m_MITab, m_MIEdits, MIEditIds, sizeof(MIEditIds) / sizeof(MIEditIds[0])); - InitRegisterEdits(m_VITab, m_VIEdits, VIEditIds); + InitRegisterEdits(m_VITab, m_VIEdits, VIEditIds, sizeof(VIEditIds) / sizeof(VIEditIds[0])); - InitRegisterEdits(m_AITab, m_AIEdits, AIEditIds); + InitRegisterEdits(m_AITab, m_AIEdits, AIEditIds, sizeof(AIEditIds) / sizeof(AIEditIds[0])); - InitRegisterEdits(m_PITab, m_PIEdits, PIEditIds); + InitRegisterEdits(m_PITab, m_PIEdits, PIEditIds, sizeof(PIEditIds) / sizeof(PIEditIds[0])); - InitRegisterEdits(m_RITab, m_RIEdits, RIEditIds); + InitRegisterEdits(m_RITab, m_RIEdits, RIEditIds, sizeof(RIEditIds) / sizeof(RIEditIds[0])); - InitRegisterEdits(m_SITab, m_SIEdits, SIEditIds); + InitRegisterEdits(m_SITab, m_SIEdits, SIEditIds, sizeof(SIEditIds) / sizeof(SIEditIds[0])); - InitRegisterEdits(m_DDTab, m_DDEdits, DDEditIds); + InitRegisterEdits(m_DDTab, m_DDEdits, DDEditIds, sizeof(DDEditIds) / sizeof(DDEditIds[0])); SetColorsEnabled(false); RefreshEdits(); RedrawCurrentTab(); } -HWND CRegisterTabs::Detach() +HWND CRegisterTabs::Detach(void) { m_GPRTab = NULL; m_FPRTab = NULL; @@ -99,36 +99,23 @@ void CRegisterTabs::RefreshEdits() { if (g_Reg == NULL) { - ZeroRegisterEdits64(m_GPREdits, GPREditIds); + ZeroRegisterEdits64(m_GPREdits, sizeof(m_GPREdits) / sizeof(m_GPREdits[0])); ZeroRegisterEdit64(m_HIEdit); ZeroRegisterEdit64(m_LOEdit); - - ZeroRegisterEdits(m_FPREdits, FPREditIds); + ZeroRegisterEdits(m_FPREdits, sizeof(m_FPREdits) / sizeof(m_FPREdits[0])); ZeroRegisterEdit(m_FCSREdit); - - ZeroRegisterEdits(m_COP0Edits, COP0EditIds); - - ZeroRegisterEdits(m_RDRAMEdits, RDRAMEditIds); - - ZeroRegisterEdits(m_SPEdits, SPEditIds); + ZeroRegisterEdits(m_COP0Edits, sizeof(m_COP0Edits) / sizeof(m_COP0Edits[0])); + ZeroRegisterEdits(m_RDRAMEdits, sizeof(m_RDRAMEdits) / sizeof(m_RDRAMEdits[0])); + ZeroRegisterEdits(m_SPEdits, sizeof(m_SPEdits) / sizeof(m_SPEdits[0])); ZeroRegisterEdit(m_SPPCEdit); - - ZeroRegisterEdits(m_DPCEdits, DPCEditIds); - - ZeroRegisterEdits(m_MIEdits, MIEditIds); - - ZeroRegisterEdits(m_VIEdits, VIEditIds); - - ZeroRegisterEdits(m_AIEdits, AIEditIds); - - ZeroRegisterEdits(m_PIEdits, PIEditIds); - - ZeroRegisterEdits(m_RIEdits, RIEditIds); - - ZeroRegisterEdits(m_SIEdits, SIEditIds); - - ZeroRegisterEdits(m_DDEdits, DDEditIds); - + ZeroRegisterEdits(m_DPCEdits, sizeof(m_DPCEdits) / sizeof(m_DPCEdits[0])); + ZeroRegisterEdits(m_MIEdits, sizeof(m_MIEdits) / sizeof(m_MIEdits[0])); + ZeroRegisterEdits(m_VIEdits, sizeof(m_VIEdits) / sizeof(m_VIEdits[0])); + ZeroRegisterEdits(m_AIEdits, sizeof(m_AIEdits) / sizeof(m_AIEdits[0])); + ZeroRegisterEdits(m_PIEdits, sizeof(m_PIEdits) / sizeof(m_PIEdits[0])); + ZeroRegisterEdits(m_RIEdits, sizeof(m_RIEdits) / sizeof(m_RIEdits[0])); + ZeroRegisterEdits(m_SIEdits, sizeof(m_SIEdits) / sizeof(m_SIEdits[0])); + ZeroRegisterEdits(m_DDEdits, sizeof(m_DDEdits) / sizeof(m_DDEdits[0])); return; } @@ -302,7 +289,7 @@ void CRegisterTabs::RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam) } else { - int nReg = MapEditRegNum(ctrlId, GPREditIds); + int nReg = MapEditRegNum(ctrlId, GPREditIds, sizeof(GPREditIds) / sizeof(GPREditIds[0])); g_Reg->m_GPR[nReg].UDW = value; } return; @@ -320,7 +307,7 @@ void CRegisterTabs::RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam) return; } - int nReg = MapEditRegNum(ctrlId, FPREditIds); + int nReg = MapEditRegNum(ctrlId, FPREditIds, sizeof(FPREditIds) / sizeof(FPREditIds[0])); *(uint32_t*)g_Reg->m_FPR_S[nReg] = value; return; } @@ -517,7 +504,7 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L } else { - int nReg = MapEditRegNum(ctrlId, GPREditIds); + int nReg = MapEditRegNum(ctrlId, GPREditIds, sizeof(GPREditIds) / sizeof(GPREditIds[0])); bOpReads = opInfo.ReadsGPR(nReg); bOpWrites = opInfo.WritesGPR(nReg); } @@ -621,22 +608,14 @@ CWindow CRegisterTabs::AddTab(char* caption, int dialogId, DLGPROC dlgProc) void CRegisterTabs::ShowTab(int nPage) { - for (int i = 0; i < m_TabWindows.size(); i++) + for (size_t i = 0; i < m_TabWindows.size(); i++) { ::ShowWindow(m_TabWindows[i], SW_HIDE); } CRect pageRect = GetPageRect(); - ::SetWindowPos( - m_TabWindows[nPage], - HWND_TOP, - pageRect.left, - pageRect.top, - pageRect.Width(), - pageRect.Height(), - SWP_SHOWWINDOW - ); + ::SetWindowPos(m_TabWindows[nPage], HWND_TOP, pageRect.left, pageRect.top, pageRect.Width(), pageRect.Height(), SWP_SHOWWINDOW); } void CRegisterTabs::RedrawCurrentTab() @@ -644,15 +623,7 @@ void CRegisterTabs::RedrawCurrentTab() int nPage = GetCurSel(); CRect pageRect = GetPageRect(); - ::SetWindowPos( - m_TabWindows[nPage], - HWND_TOP, - pageRect.left, - pageRect.top, - pageRect.Width(), - pageRect.Height(), - SWP_SHOWWINDOW - ); + ::SetWindowPos(m_TabWindows[nPage], HWND_TOP, pageRect.left, pageRect.top, pageRect.Width(), pageRect.Height(), SWP_SHOWWINDOW); } void CRegisterTabs::SetColorsEnabled(bool bColorsEnabled) @@ -666,9 +637,9 @@ void CRegisterTabs::InitRegisterEdit(CWindow& tab, CEditNumber& edit, WORD ctrlI edit.SetDisplayType(CEditNumber::DisplayHex); } -void CRegisterTabs::InitRegisterEdits(CWindow& tab, CEditNumber* edits, const DWORD* ctrlIds) +void CRegisterTabs::InitRegisterEdits(CWindow& tab, CEditNumber* edits, const WORD* ctrlIds, uint32_t ctrlIdsCount) { - for (int i = 0; i < ctrlIds[i] != 0; i++) + for (int i = 0, n = ctrlIdsCount; i < n; i++) { InitRegisterEdit(tab, edits[i], ctrlIds[i]); } @@ -679,9 +650,9 @@ void CRegisterTabs::InitRegisterEdit64(CWindow& tab, CEditReg64& edit, WORD ctrl edit.Attach(tab.GetDlgItem(ctrlId)); } -void CRegisterTabs::InitRegisterEdits64(CWindow& tab, CEditReg64* edits, const DWORD* ctrlIds) +void CRegisterTabs::InitRegisterEdits64(CWindow& tab, CEditReg64* edits, const WORD* ctrlIds, uint32_t ctrlIdsCount) { - for (int i = 0; i < ctrlIds[i] != 0; i++) + for (int i = 0, n = ctrlIdsCount; i < n; i++) { InitRegisterEdit64(tab, edits[i], ctrlIds[i]); } @@ -692,9 +663,9 @@ void CRegisterTabs::ZeroRegisterEdit(CEditNumber& edit) edit.SetValue(0, false, true); } -void CRegisterTabs::ZeroRegisterEdits(CEditNumber* edits, const DWORD* ctrlIds) +void CRegisterTabs::ZeroRegisterEdits(CEditNumber* edits, uint32_t ctrlIdsCount) { - for (int i = 0; ctrlIds[i] != 0; i++) + for (int i = 0, n = ctrlIdsCount; i < n; i++) { ZeroRegisterEdit(edits[i]); } @@ -705,9 +676,9 @@ void CRegisterTabs::ZeroRegisterEdit64(CEditReg64& edit) edit.SetValue(0); } -void CRegisterTabs::ZeroRegisterEdits64(CEditReg64* edits, const DWORD* ctrlIds) +void CRegisterTabs::ZeroRegisterEdits64(CEditReg64* edits, uint32_t ctrlIdsCount) { - for (int i = 0; ctrlIds[i] != 0; i++) + for (uint32_t i = 0, n = ctrlIdsCount; i < n; i++) { ZeroRegisterEdit64(edits[i]); } @@ -744,7 +715,7 @@ LRESULT CEditReg64::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandl goto canceled; } - char charCode = wParam; + char charCode = (char)wParam; if (!isxdigit(charCode) && charCode != ' ') { @@ -796,7 +767,7 @@ uint64_t CEditReg64::GetValue() return ParseValue(text); } -LRESULT CEditReg64::OnLostFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +LRESULT CEditReg64::OnLostFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { SetValue(GetValue()); // clean up bHandled = FALSE; diff --git a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h index f9cd5a68c..bac45f8ef 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h @@ -8,16 +8,9 @@ * GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html * * * ****************************************************************************/ - #pragma once -#include "stdafx.h" - #include "Breakpoints.h" -#ifndef COUNT_OF -#define COUNT_OF(a) (sizeof(a) / sizeof(a[0])) -#endif - class CEditReg64 : public CWindowImpl { public: @@ -42,7 +35,8 @@ private: { uint32_t intval; - struct { + struct + { unsigned : 2; unsigned exceptionCode : 5; unsigned : 1; @@ -54,13 +48,15 @@ private: }; } CAUSE; - enum TAB_ID { + enum TAB_ID + { TabDefault, TabGPR, TabFPR }; - static constexpr DWORD GPREditIds[] = { + static constexpr WORD GPREditIds[] = + { IDC_R0_EDIT, IDC_R1_EDIT, IDC_R2_EDIT, IDC_R3_EDIT, IDC_R4_EDIT, IDC_R5_EDIT, IDC_R6_EDIT, IDC_R7_EDIT, IDC_R8_EDIT, IDC_R9_EDIT, IDC_R10_EDIT, IDC_R11_EDIT, @@ -69,10 +65,9 @@ private: IDC_R20_EDIT, IDC_R21_EDIT, IDC_R22_EDIT, IDC_R23_EDIT, IDC_R24_EDIT, IDC_R25_EDIT, IDC_R26_EDIT, IDC_R27_EDIT, IDC_R28_EDIT, IDC_R29_EDIT, IDC_R30_EDIT, IDC_R31_EDIT, - 0 }; - static constexpr DWORD FPREditIds[] = { + static constexpr WORD FPREditIds[] = { IDC_F0_EDIT, IDC_F1_EDIT, IDC_F2_EDIT, IDC_F3_EDIT, IDC_F4_EDIT, IDC_F5_EDIT, IDC_F6_EDIT, IDC_F7_EDIT, IDC_F8_EDIT, IDC_F9_EDIT, IDC_F10_EDIT, IDC_F11_EDIT, @@ -81,87 +76,75 @@ private: IDC_F20_EDIT, IDC_F21_EDIT, IDC_F22_EDIT, IDC_F23_EDIT, IDC_F24_EDIT, IDC_F25_EDIT, IDC_F26_EDIT, IDC_F27_EDIT, IDC_F28_EDIT, IDC_F29_EDIT, IDC_F30_EDIT, IDC_F31_EDIT, - 0 }; - static constexpr DWORD COP0EditIds[] = { + static constexpr WORD COP0EditIds[] = { IDC_COP0_0_EDIT, IDC_COP0_1_EDIT, IDC_COP0_2_EDIT, IDC_COP0_3_EDIT, IDC_COP0_4_EDIT, IDC_COP0_5_EDIT, IDC_COP0_6_EDIT, IDC_COP0_7_EDIT, IDC_COP0_8_EDIT, IDC_COP0_9_EDIT, IDC_COP0_10_EDIT, IDC_COP0_11_EDIT, IDC_COP0_12_EDIT, IDC_COP0_13_EDIT, IDC_COP0_14_EDIT, IDC_COP0_15_EDIT, IDC_COP0_16_EDIT, IDC_COP0_17_EDIT, IDC_COP0_18_EDIT, - 0 }; - static constexpr DWORD RDRAMEditIds[] = { + static constexpr WORD RDRAMEditIds[] = { IDC_RDRAM00_EDIT, IDC_RDRAM04_EDIT, IDC_RDRAM08_EDIT, IDC_RDRAM0C_EDIT, IDC_RDRAM10_EDIT, IDC_RDRAM14_EDIT, IDC_RDRAM18_EDIT, IDC_RDRAM1C_EDIT, IDC_RDRAM20_EDIT, IDC_RDRAM24_EDIT, - 0 }; - static constexpr DWORD SPEditIds[] = { + static constexpr WORD SPEditIds[] = { IDC_SP00_EDIT, IDC_SP04_EDIT, IDC_SP08_EDIT, IDC_SP0C_EDIT, IDC_SP10_EDIT, IDC_SP14_EDIT, IDC_SP18_EDIT, IDC_SP1C_EDIT, - 0 }; - static constexpr DWORD DPCEditIds[] = { + static constexpr WORD DPCEditIds[] = { IDC_DPC00_EDIT, IDC_DPC04_EDIT, IDC_DPC08_EDIT, IDC_DPC0C_EDIT, IDC_DPC10_EDIT, IDC_DPC14_EDIT, IDC_DPC18_EDIT, IDC_DPC1C_EDIT, - 0 }; - static constexpr DWORD MIEditIds[] = { + static constexpr WORD MIEditIds[] = { IDC_MI00_EDIT, IDC_MI04_EDIT, IDC_MI08_EDIT, IDC_MI0C_EDIT, - 0 }; - static constexpr DWORD VIEditIds[] = { + static constexpr WORD VIEditIds[] = { IDC_VI00_EDIT, IDC_VI04_EDIT, IDC_VI08_EDIT, IDC_VI0C_EDIT, IDC_VI10_EDIT, IDC_VI14_EDIT, IDC_VI18_EDIT, IDC_VI1C_EDIT, IDC_VI20_EDIT, IDC_VI24_EDIT, IDC_VI28_EDIT, IDC_VI2C_EDIT, IDC_VI30_EDIT, IDC_VI34_EDIT, - 0 }; - static constexpr DWORD AIEditIds[] = { + static constexpr WORD AIEditIds[] = { IDC_AI00_EDIT, IDC_AI04_EDIT, IDC_AI08_EDIT, IDC_AI0C_EDIT, IDC_AI10_EDIT, IDC_AI14_EDIT, - 0 }; - static constexpr DWORD PIEditIds[] = { + static constexpr WORD PIEditIds[] = { IDC_PI00_EDIT, IDC_PI04_EDIT, IDC_PI08_EDIT, IDC_PI0C_EDIT, IDC_PI10_EDIT, IDC_PI14_EDIT, IDC_PI18_EDIT, IDC_PI1C_EDIT, IDC_PI20_EDIT, IDC_PI24_EDIT, IDC_PI28_EDIT, IDC_PI2C_EDIT, IDC_PI30_EDIT, - 0 }; - static constexpr DWORD RIEditIds[] = { + static constexpr WORD RIEditIds[] = { IDC_RI00_EDIT, IDC_RI04_EDIT, IDC_RI08_EDIT, IDC_RI0C_EDIT, IDC_RI10_EDIT, IDC_RI14_EDIT, IDC_RI18_EDIT, IDC_RI1C_EDIT, - 0 }; - static constexpr DWORD SIEditIds[] = { + static constexpr WORD SIEditIds[] = { IDC_SI00_EDIT, IDC_SI04_EDIT, IDC_SI08_EDIT, IDC_SI0C_EDIT, - 0 }; - static constexpr DWORD DDEditIds[] = { + static constexpr WORD DDEditIds[] = { IDC_DD00_EDIT, IDC_DD04_EDIT, IDC_DD08_EDIT, IDC_DD0C_EDIT, IDC_DD10_EDIT, IDC_DD14_EDIT, IDC_DD18_EDIT, IDC_DD1C_EDIT, IDC_DD20_EDIT, IDC_DD24_EDIT, IDC_DD28_EDIT, IDC_DD2C_EDIT, IDC_DD30_EDIT, IDC_DD34_EDIT, IDC_DD38_EDIT, IDC_DD3C_EDIT, IDC_DD40_EDIT, IDC_DD44_EDIT, IDC_DD48_EDIT, - 0 }; - static int MapEditRegNum(DWORD controlId, const DWORD* edits) + static int MapEditRegNum(DWORD controlId, const WORD* edits, uint32_t ctrlIdsCount) { - for (int i = 0; edits[i] != 0; i++) + for (uint32_t i = 0, n = ctrlIdsCount; i < n; i++) { if (edits[i] == controlId) { @@ -212,48 +195,48 @@ private: vector m_TabWindows; CWindow m_GPRTab; - CEditReg64 m_GPREdits[COUNT_OF(GPREditIds) - 1]; + CEditReg64 m_GPREdits[sizeof(GPREditIds) / sizeof(GPREditIds[0])]; CEditReg64 m_HIEdit; CEditReg64 m_LOEdit; CWindow m_FPRTab; - CEditNumber m_FPREdits[COUNT_OF(FPREditIds) - 1]; + CEditNumber m_FPREdits[sizeof(FPREditIds) / sizeof(FPREditIds[0])]; CEditNumber m_FCSREdit; CWindow m_COP0Tab; - CEditNumber m_COP0Edits[COUNT_OF(COP0EditIds) - 1]; + CEditNumber m_COP0Edits[sizeof(COP0EditIds) / sizeof(COP0EditIds[0])]; CStatic m_CauseTip; CWindow m_RDRAMTab; - CEditNumber m_RDRAMEdits[COUNT_OF(RDRAMEditIds) - 1]; + CEditNumber m_RDRAMEdits[sizeof(RDRAMEditIds) / sizeof(RDRAMEditIds[0])]; CWindow m_SPTab; - CEditNumber m_SPEdits[COUNT_OF(SPEditIds) - 1]; + CEditNumber m_SPEdits[sizeof(SPEditIds) / sizeof(SPEditIds[0])]; CEditNumber m_SPPCEdit; CWindow m_DPCTab; - CEditNumber m_DPCEdits[COUNT_OF(DPCEditIds) - 1]; + CEditNumber m_DPCEdits[sizeof(DPCEditIds) / sizeof(DPCEditIds[0])]; CWindow m_MITab; - CEditNumber m_MIEdits[COUNT_OF(MIEditIds) - 1]; + CEditNumber m_MIEdits[sizeof(MIEditIds) / sizeof(MIEditIds[0])]; CWindow m_VITab; - CEditNumber m_VIEdits[COUNT_OF(VIEditIds) - 1]; + CEditNumber m_VIEdits[sizeof(VIEditIds) / sizeof(VIEditIds[0])]; CWindow m_AITab; - CEditNumber m_AIEdits[COUNT_OF(AIEditIds) - 1]; + CEditNumber m_AIEdits[sizeof(AIEditIds) / sizeof(AIEditIds[0])]; CWindow m_PITab; - CEditNumber m_PIEdits[COUNT_OF(PIEditIds) - 1]; + CEditNumber m_PIEdits[sizeof(PIEditIds) / sizeof(PIEditIds[0])]; CWindow m_RITab; - CEditNumber m_RIEdits[COUNT_OF(RIEditIds) - 1]; + CEditNumber m_RIEdits[sizeof(RIEditIds) / sizeof(RIEditIds[0])]; CWindow m_SITab; - CEditNumber m_SIEdits[COUNT_OF(SIEditIds) - 1]; + CEditNumber m_SIEdits[sizeof(SIEditIds) / sizeof(SIEditIds[0])]; CWindow m_DDTab; - CEditNumber m_DDEdits[COUNT_OF(DDEditIds) - 1]; + CEditNumber m_DDEdits[sizeof(DDEditIds) / sizeof(DDEditIds[0])]; static void RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam); @@ -262,13 +245,13 @@ private: static INT_PTR CALLBACK TabProcFPR(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); static void InitRegisterEdit(CWindow& tab, CEditNumber& edit, WORD ctrlId); - static void InitRegisterEdits(CWindow& tab, CEditNumber* edits, const DWORD* ctrlIds); + static void InitRegisterEdits(CWindow& tab, CEditNumber* edits, const WORD* ctrlIds, uint32_t ctrlIdsCount); static void InitRegisterEdit64(CWindow& tab, CEditReg64& edit, WORD ctrlId); - static void InitRegisterEdits64(CWindow& tab, CEditReg64* edits, const DWORD* ctrlIds); + static void InitRegisterEdits64(CWindow& tab, CEditReg64* edits, const WORD* ctrlIds, uint32_t ctrlIdsCount); static void ZeroRegisterEdit(CEditNumber& edit); - static void ZeroRegisterEdits(CEditNumber* edits, const DWORD* ctrlIds); + static void ZeroRegisterEdits(CEditNumber* edits, uint32_t ctrlIdsCount); static void ZeroRegisterEdit64(CEditReg64& edit); - static void ZeroRegisterEdits64(CEditReg64* edits, const DWORD* ctrlIds); + static void ZeroRegisterEdits64(CEditReg64* edits, uint32_t ctrlIdsCount); public: void Attach(HWND hWndNew);