Repository: xbmc/xbmc
File: xbmc/settings/AdvancedSettings.cpp (C++)

Code before:
  {
    std::vector<std::string> exts = StringUtils::Split(extraExtensions, '|');
    for (std::vector<std::string>::const_iterator i = exts.begin(); i != exts.end(); ++i)
    {
      size_t iPos = extensions.find(*i);
      if (iPos != std::string::npos)
        extensions.erase(iPos,i->size()+1);
    }
  }
}

void CAdvancedSettings::AddSettingsFile(const std::string &filename)
{
  m_settingsFiles.push_back(filename);
}

float CAdvancedSettings::GetLatencyTweak(float refreshrate, bool isHDREnabled)
{
  float delay = m_videoDefaultLatency;
  for (int i = 0; i < (int) m_videoRefreshLatency.size(); i++)
  {
    RefreshVideoLatency& videolatency = m_videoRefreshLatency[i];
    if (refreshrate >= videolatency.refreshmin && refreshrate <= videolatency.refreshmax)
    {
      delay = videolatency.delay;
      if (isHDREnabled && videolatency.hdrlatency != NULL)
        delay += videolatency.hdrlatency;
    }
  }

  return delay; // in milliseconds
}

void CAdvancedSettings::SetDebugMode(bool debug)
{
  if (debug)
  {
    int level = std::max(m_logLevelHint, LOG_LEVEL_DEBUG_FREEMEM);
    m_logLevel = level;
    CServiceBroker::GetLogging().SetLogLevel(level);
    CLog::Log(LOGINFO, "Enabled debug logging due to GUI setting. Level {}.", level);
  }
  else
  {
    int level = std::min(m_logLevelHint, LOG_LEVEL_DEBUG/*LOG_LEVEL_NORMAL*/);
    CLog::Log(LOGINFO, "Disabled debug logging due to GUI setting. Level {}.", level);
    m_logLevel = level;
    CServiceBroker::GetLogging().SetLogLevel(level);
  }
}


Review comment (performance):
```suggestion
      if (isHDREnabled && (videolatency.hdrlatency > 0.0f || videolatency.hdrlatency < 0.0f))
```
Compare float with NULL is not correct.

Code after:
  if (XMLUtils::GetString(pRootElement, "remove", extraExtensions) && !extraExtensions.empty())
  {
    std::vector<std::string> exts = StringUtils::Split(extraExtensions, '|');
    for (std::vector<std::string>::const_iterator i = exts.begin(); i != exts.end(); ++i)
    {
      size_t iPos = extensions.find(*i);
      if (iPos != std::string::npos)
        extensions.erase(iPos,i->size()+1);
    }
  }
}

void CAdvancedSettings::AddSettingsFile(const std::string &filename)
{
  m_settingsFiles.push_back(filename);
}

float CAdvancedSettings::GetLatencyTweak(float refreshrate, bool isHDREnabled)
{
  float delay{};
  const auto& latency =
      std::find_if(m_videoRefreshLatency.cbegin(), m_videoRefreshLatency.cend(),
                   [refreshrate](const auto& param)
                   { return refreshrate >= param.refreshmin && refreshrate <= param.refreshmax; });

  if (latency != m_videoRefreshLatency.cend()) //refresh rate specific setting is found
  {
    delay = latency->delay == 0.0f ? m_videoDefaultLatency : latency->delay;
    if (isHDREnabled)
      delay +=
          latency->hdrextradelay == 0.0f ? m_videoDefaultHdrExtraLatency : latency->hdrextradelay;
  }
  else //apply default delay settings
  {
    delay = isHDREnabled ? m_videoDefaultLatency + m_videoDefaultHdrExtraLatency
                         : m_videoDefaultLatency;
  }
  return delay; // in milliseconds
}

void CAdvancedSettings::SetDebugMode(bool debug)
{
  if (debug)
  {
    int level = std::max(m_logLevelHint, LOG_LEVEL_DEBUG_FREEMEM);
    m_logLevel = level;
    CServiceBroker::GetLogging().SetLogLevel(level);
    CLog::Log(LOGINFO, "Enabled debug logging due to GUI setting. Level {}.", level);
  }
  else
  {