Skip to content

Commit

Permalink
[PVR] CPVRGUIActionsPowerManagement: Reduce usage of 'const shared_pt…
Browse files Browse the repository at this point in the history
…r<CFileItem>&' parameters. Use 'const CFileItem&' instead.
  • Loading branch information
ksooo committed Oct 13, 2022
1 parent 41379b4 commit ab667b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions xbmc/pvr/guilib/PVRGUIActionsPowerManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool CPVRGUIActionsPowerManagement::AllLocalBackendsIdle(
CServiceBroker::GetPVRManager().Timers()->GetActiveRecordings();
for (const auto& timer : activeRecordings)
{
if (EventOccursOnLocalBackend(std::make_shared<CFileItem>(timer)))
if (EventOccursOnLocalBackend(timer))
{
causingEvent = timer;
return false;
Expand All @@ -154,7 +154,7 @@ bool CPVRGUIActionsPowerManagement::AllLocalBackendsIdle(
return false;
}

if (EventOccursOnLocalBackend(std::make_shared<CFileItem>(timer)))
if (EventOccursOnLocalBackend(timer))
{
causingEvent = timer;
return false;
Expand All @@ -164,17 +164,15 @@ bool CPVRGUIActionsPowerManagement::AllLocalBackendsIdle(
}

bool CPVRGUIActionsPowerManagement::EventOccursOnLocalBackend(
const std::shared_ptr<CFileItem>& item) const
const std::shared_ptr<CPVRTimerInfoTag>& event) const
{
if (item && item->HasPVRTimerInfoTag())
const std::shared_ptr<CPVRClient> client =
CServiceBroker::GetPVRManager().GetClient(CFileItem(event));
if (client)
{
const std::shared_ptr<CPVRClient> client = CServiceBroker::GetPVRManager().GetClient(*item);
if (client)
{
const std::string hostname = client->GetBackendHostname();
if (!hostname.empty() && CServiceBroker::GetNetwork().IsLocalHost(hostname))
return true;
}
const std::string hostname = client->GetBackendHostname();
if (!hostname.empty() && CServiceBroker::GetNetwork().IsLocalHost(hostname))
return true;
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion xbmc/pvr/guilib/PVRGUIActionsPowerManagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CPVRGUIActionsPowerManagement : public IPVRComponent
CPVRGUIActionsPowerManagement const& operator=(CPVRGUIActionsPowerManagement const&) = delete;

bool AllLocalBackendsIdle(std::shared_ptr<CPVRTimerInfoTag>& causingEvent) const;
bool EventOccursOnLocalBackend(const std::shared_ptr<CFileItem>& item) const;
bool EventOccursOnLocalBackend(const std::shared_ptr<CPVRTimerInfoTag>& event) const;
bool IsNextEventWithinBackendIdleTime() const;

CPVRSettings m_settings;
Expand Down

0 comments on commit ab667b5

Please sign in to comment.