From: <sv...@op...> - 2025-01-15 17:24:21
|
Author: sagamusix Date: Wed Jan 15 18:24:06 2025 New Revision: 22856 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22856 Log: [Ref] ITP: Avoid setting m_nInstruments to invalid value and then resetting it to 0. No functional change, just feels cleaner. Modified: trunk/OpenMPT/soundlib/Load_itp.cpp Modified: trunk/OpenMPT/soundlib/Load_itp.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp Wed Jan 15 18:23:23 2025 (r22855) +++ trunk/OpenMPT/soundlib/Load_itp.cpp Wed Jan 15 18:24:06 2025 (r22856) @@ -222,12 +222,10 @@ m_MidiCfg.Sanitize(); // Song Instruments - m_nInstruments = static_cast<INSTRUMENTINDEX>(file.ReadUint32LE()); - if(m_nInstruments >= MAX_INSTRUMENTS) - { - m_nInstruments = 0; + if(uint32 numIns = file.ReadUint32LE(); numIns < MAX_INSTRUMENTS) + m_nInstruments = static_cast<INSTRUMENTINDEX>(numIns); + else return false; - } // Instruments' paths if(version <= 0x102) |