Use getter functions when accessing string fields in RGBControllers in ProfileManager and cli

This commit is contained in:
Adam Honse 2025-07-31 18:36:38 -05:00
parent abd34f1810
commit 9fb71a30ec
2 changed files with 22 additions and 22 deletions

View file

@ -249,38 +249,38 @@ bool ProfileManager::LoadDeviceFromListWithOptions
\*---------------------------------------------------------*/
bool location_check;
if(load_controller->location.find("HID: ") == 0)
if(load_controller->GetLocation().find("HID: ") == 0)
{
location_check = true;
}
else if(load_controller->location.find("I2C: ") == 0)
else if(load_controller->GetLocation().find("I2C: ") == 0)
{
std::size_t loc = load_controller->location.rfind(", ");
std::size_t loc = load_controller->GetLocation().rfind(", ");
if(loc == std::string::npos)
{
location_check = false;
}
else
{
std::string i2c_address = load_controller->location.substr(loc + 2);
location_check = temp_controller->location.find(i2c_address) != std::string::npos;
std::string i2c_address = load_controller->GetLocation().substr(loc + 2);
location_check = temp_controller->GetLocation().find(i2c_address) != std::string::npos;
}
}
else
{
location_check = temp_controller->location == load_controller->location;
location_check = temp_controller->GetLocation() == load_controller->GetLocation();
}
/*---------------------------------------------------------*\
| Test if saved controller data matches this controller |
\*---------------------------------------------------------*/
if((temp_controller_used[temp_index] == false )
&&(temp_controller->type == load_controller->type )
&&(temp_controller->name == load_controller->name )
&&(temp_controller->description == load_controller->description)
&&(temp_controller->version == load_controller->version )
&&(temp_controller->serial == load_controller->serial )
&&(location_check == true ))
if((temp_controller_used[temp_index] == false )
&&(temp_controller->type == load_controller->type )
&&(temp_controller->GetName() == load_controller->GetName() )
&&(temp_controller->GetDescription() == load_controller->GetDescription())
&&(temp_controller->GetVersion() == load_controller->GetVersion() )
&&(temp_controller->GetSerial() == load_controller->GetSerial() )
&&(location_check == true ))
{
/*---------------------------------------------------------*\
| Set used flag for this temp device |
@ -417,7 +417,7 @@ bool ProfileManager::LoadProfileWithOptions
for(std::size_t controller_index = 0; controller_index < controllers.size(); controller_index++)
{
bool temp_ret_val = LoadDeviceFromListWithOptions(temp_controllers, temp_controller_used, controllers[controller_index], load_size, load_settings);
std::string current_name = controllers[controller_index]->name + " @ " + controllers[controller_index]->location;
std::string current_name = controllers[controller_index]->name + " @ " + controllers[controller_index]->GetLocation();
LOG_INFO("[ProfileManager] Profile loading: %s for %s", ( temp_ret_val ? "Succeeded" : "FAILED!" ), current_name.c_str());
ret_val |= temp_ret_val;
}