sensor.cpp: minor cleanups

This commit is contained in:
Andrey Gusakov 2024-07-21 00:04:08 +03:00 committed by rusefillc
parent 42213ac172
commit d82f98ae07
1 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ void Sensor::unregister() {
/*static*/ SensorRegistryEntry *Sensor::getEntryForType(SensorType type) {
size_t index = getIndex(type);
// Check that we didn't get garbage
if (index >= getIndex(SensorType::PlaceholderLast)) {
if (index >= efi::size(s_sensorRegistry)) {
return nullptr;
}
@ -257,7 +257,7 @@ void Sensor::setInvalidMockValue(SensorType type) {
* todo: some sort of hashmap in the future?
*/
SensorType findSensorTypeByName(const char *name) {
for (int i = 0;i<(int)SensorType::PlaceholderLast;i++) {
for (size_t i = 0;i < efi::size(s_sensorRegistry); i++) {
SensorType type = (SensorType)i;
const char *sensorName = getSensorType(type);
if (strEqualCaseInsensitive(sensorName, name)) {