@@ -68,8 +68,10 @@ class CFindRangeDlg : public DialogBase
6868 AppendNotesToControl (m_cbnMax, static_cast <ModCommand::NOTE>(m_minVal), static_cast <ModCommand::NOTE>(m_maxVal));
6969 } else
7070 {
71- m_cbnMin.InitStorage (m_minVal - m_maxVal + 1 , 4 );
72- m_cbnMax.InitStorage (m_minVal - m_maxVal + 1 , 4 );
71+ const int numItems = m_minVal - m_maxVal + 1 ;
72+ const UINT strSize = static_cast <UINT>(numItems * 4 * sizeof (TCHAR));
73+ m_cbnMin.InitStorage (numItems, strSize);
74+ m_cbnMax.InitStorage (numItems, strSize);
7375 const TCHAR *formatString;
7476 if (m_displayMode == kHex && m_maxVal <= 0x0F )
7577 formatString = _T (" %01X" );
@@ -223,7 +225,7 @@ BOOL CFindReplaceTab::OnInitDialog()
223225 {
224226 int sel = -1 ;
225227 m_cbnNote.SetRedraw (FALSE );
226- m_cbnNote.InitStorage (150 , 6 );
228+ m_cbnNote.InitStorage (150 , 150 * 6 * sizeof (TCHAR) );
227229 m_cbnNote.SetItemData (m_cbnNote.AddString (_T (" ..." )), NOTE_NONE);
228230 if (m_isReplaceTab)
229231 {
@@ -270,10 +272,10 @@ BOOL CFindReplaceTab::OnInitDialog()
270272
271273 // Volume Command
272274 m_cbnVolCmd.SetRedraw (FALSE );
273- m_cbnVolCmd.InitStorage (m_effectInfo.GetNumVolCmds (), 15 );
274- m_cbnVolCmd.SetItemData (m_cbnVolCmd.AddString (_T (" None" )), (DWORD_PTR)-1 );
275275 UINT count = m_effectInfo.GetNumVolCmds ();
276- for (UINT n=0 ; n<count; n++)
276+ m_cbnVolCmd.InitStorage (count, static_cast <UINT>(count * 15 * sizeof (TCHAR)));
277+ m_cbnVolCmd.SetItemData (m_cbnVolCmd.AddString (_T (" None" )), (DWORD_PTR)-1 );
278+ for (UINT n = 0 ; n < count; n++)
277279 {
278280 if (m_effectInfo.GetVolCmdInfo (n, &s) && !s.IsEmpty ())
279281 {
@@ -294,10 +296,10 @@ BOOL CFindReplaceTab::OnInitDialog()
294296 // Command
295297 {
296298 m_cbnCommand.SetRedraw (FALSE );
297- m_cbnCommand.InitStorage (m_effectInfo.GetNumEffects (), 20 );
298- m_cbnCommand.SetItemData (m_cbnCommand.AddString (_T (" None" )), (DWORD_PTR)-1 );
299299 count = m_effectInfo.GetNumEffects ();
300- for (UINT n=0 ; n<count; n++)
300+ m_cbnCommand.InitStorage (count, static_cast <UINT>(count * 20 * sizeof (TCHAR)));
301+ m_cbnCommand.SetItemData (m_cbnCommand.AddString (_T (" None" )), (DWORD_PTR)-1 );
302+ for (UINT n = 0 ; n < count; n++)
301303 {
302304 if (m_effectInfo.GetEffectInfo (n, &s, true ) && !s.IsEmpty ())
303305 {
@@ -343,7 +345,8 @@ void CFindReplaceTab::UpdateInstrumentList()
343345 int sel = (oldSelection == 0 ) ? 0 : -1 ;
344346 m_cbnInstr.SetRedraw (FALSE );
345347 m_cbnInstr.ResetContent ();
346- m_cbnInstr.InitStorage ((isPCEvent ? MAX_MIXPLUGINS : MAX_INSTRUMENTS) + 3 , 32 );
348+ const int numItems = (isPCEvent ? MAX_MIXPLUGINS : MAX_INSTRUMENTS) + 3 ;
349+ m_cbnInstr.InitStorage (numItems, static_cast <UINT>(numItems * 32 * sizeof (TCHAR)));
347350 m_cbnInstr.SetItemData (m_cbnInstr.AddString (_T (" .." )), 0 );
348351 if (m_isReplaceTab)
349352 {
@@ -444,7 +447,7 @@ void CFindReplaceTab::UpdateParamList()
444447 Limit (newpos, 0 , newcount - 1 );
445448 m_cbnParam.SetRedraw (FALSE );
446449 m_cbnParam.ResetContent ();
447- m_cbnParam.InitStorage (newcount + 2 , 4 );
450+ m_cbnParam.InitStorage (newcount + 2 , static_cast <UINT>((newcount + 2 ) * 4 * sizeof (TCHAR)) );
448451
449452 if (m_isReplaceTab)
450453 {
@@ -518,8 +521,9 @@ void CFindReplaceTab::UpdateVolumeList()
518521 AddPluginParameternamesToCombobox (m_cbnPCParam, *m_sndFile.m_MixPlugins [plug].pMixPlugin );
519522 } else
520523 {
521- m_cbnPCParam.InitStorage (ModCommand::maxColumnValue + 1 , 20 );
522- for (int i = 0 ; i <= ModCommand::maxColumnValue; i++)
524+ const int numItems = ModCommand::maxColumnValue + 1 ;
525+ m_cbnPCParam.InitStorage (numItems, static_cast <UINT>(numItems * 20 * sizeof (TCHAR)));
526+ for (int i = 0 ; i < numItems; i++)
523527 {
524528 wsprintf (s, _T (" %02u: Parameter %02u" ), static_cast <unsigned int >(i), static_cast <unsigned int >(i));
525529 m_cbnPCParam.SetItemData (m_cbnPCParam.AddString (s), i);
@@ -574,7 +578,7 @@ void CFindReplaceTab::UpdateVolumeList()
574578 Limit (newpos, 0 , newcount - 1 );
575579 m_cbnVolume.SetRedraw (FALSE );
576580 m_cbnVolume.ResetContent ();
577- m_cbnVolume.InitStorage (newcount + 2 , 4 );
581+ m_cbnVolume.InitStorage (newcount + 2 , static_cast <UINT>((newcount + 2 ) * 4 * sizeof (TCHAR)) );
578582 if (m_isReplaceTab)
579583 {
580584 wsprintf (s, _T (" + %d" ), m_settings.replaceVolume );
0 commit comments