Changeset 98084 in vbox
- Timestamp:
- Jan 15, 2023 2:23:39 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r98082 r98084 2832 2832 */ 2833 2833 2834 /* Make a roadmap of which DeviceType_T LED types are wanted */ 2835 DeviceType_T maxWanted = (DeviceType_T)0; 2836 bool aWanted[DeviceType_End] = { 0 }; 2837 Assert(aWanted[1] == false && aWanted[DeviceType_End - 1] == false); 2834 /* 2835 * Make a roadmap of which DeviceType_T LED types are wanted: 2836 */ 2837 uint32_t fWanted = 0; 2838 AssertCompile(DeviceType_End <= 32); 2838 2839 2839 2840 for (size_t iType = 0; iType < aType.size(); ++iType) … … 2842 2843 AssertReturn(enmType > DeviceType_Null && enmType < DeviceType_End, 2843 2844 setError(E_INVALIDARG, tr("Invalid DeviceType for getDeviceActivity in entry #%u: %d"), iType, enmType)); 2844 aWanted[enmType] = true; 2845 if (enmType > maxWanted) 2846 maxWanted = enmType; 2845 fWanted |= RT_BIT_32((unsigned)enmType); 2847 2846 } 2848 2847 … … 2850 2849 aActivity.resize(aType.size()); 2851 2850 2852 /* Collect all the LEDs in a single sweep through all drivers' sets */ 2851 /* 2852 * Collect all the LEDs in a single sweep through all drivers' sets: 2853 */ 2853 2854 PDMLEDCORE aLEDs[DeviceType_End] = { {0} }; 2854 2855 Assert(aLEDs[1].u32 == 0 && aLEDs[DeviceType_End / 2].u32 == 0 && aLEDs[DeviceType_End - 1].u32 == 0); /* paranoia */ … … 2864 2865 { 2865 2866 DeviceType_T const enmType = pLS->paSubTypes[inSet]; 2866 if (enmType < maxWanted && aWanted[enmType]) 2867 Assert((unsigned)enmType < (unsigned)DeviceType_End); 2868 if (fWanted & RT_BIT_32((unsigned)enmType)) 2867 2869 aLEDs[enmType].u32 |= readAndClearLed(pLS->papLeds[inSet]); 2868 2870 } … … 2872 2874 { 2873 2875 DeviceType_T const enmType = pLS->enmType; 2874 if (enmType < maxWanted && aWanted[enmType]) 2876 Assert((unsigned)enmType < (unsigned)DeviceType_End); 2877 if (fWanted & RT_BIT_32((unsigned)enmType)) 2875 2878 for (uint32_t inSet = 0; inSet < pLS->cLeds; ++inSet) 2876 2879 aLEDs[enmType].u32 |= readAndClearLed(pLS->papLeds[inSet]); … … 2878 2881 } 2879 2882 2880 /* Compose the result vector: */ 2883 /* 2884 * Compose the result vector: 2885 */ 2881 2886 for (size_t iType = 0; iType < aActivity.size(); ++iType) 2882 2887 {
Note:
See TracChangeset
for help on using the changeset viewer.