output/Multiple: pass std::string_view to FindByName()
This commit is contained in:
src
@ -155,7 +155,7 @@ handle_delpartition(Client &client, Request request, Response &response)
|
|||||||
CommandResult
|
CommandResult
|
||||||
handle_moveoutput(Client &client, Request request, Response &response)
|
handle_moveoutput(Client &client, Request request, Response &response)
|
||||||
{
|
{
|
||||||
const char *output_name = request[0];
|
const std::string_view output_name = request[0];
|
||||||
|
|
||||||
auto &dest_partition = client.GetPartition();
|
auto &dest_partition = client.GetPartition();
|
||||||
auto *existing_output = dest_partition.outputs.FindByName(output_name);
|
auto *existing_output = dest_partition.outputs.FindByName(output_name);
|
||||||
|
@ -118,10 +118,10 @@ MultipleOutputs::Configure(EventLoop &event_loop, EventLoop &rt_event_loop,
|
|||||||
}
|
}
|
||||||
|
|
||||||
AudioOutputControl *
|
AudioOutputControl *
|
||||||
MultipleOutputs::FindByName(const char *name) noexcept
|
MultipleOutputs::FindByName(const std::string_view name) noexcept
|
||||||
{
|
{
|
||||||
for (const auto &i : outputs)
|
for (const auto &i : outputs)
|
||||||
if (StringIsEqual(i->GetName(), name))
|
if (name == i->GetName())
|
||||||
return i.get();
|
return i.get();
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -115,13 +115,13 @@ public:
|
|||||||
* Returns nullptr if the name does not exist.
|
* Returns nullptr if the name does not exist.
|
||||||
*/
|
*/
|
||||||
gcc_pure
|
gcc_pure
|
||||||
AudioOutputControl *FindByName(const char *name) noexcept;
|
AudioOutputControl *FindByName(std::string_view name) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does an audio output device with this name exist?
|
* Does an audio output device with this name exist?
|
||||||
*/
|
*/
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool HasName(const char *name) noexcept {
|
bool HasName(std::string_view name) noexcept {
|
||||||
return FindByName(name) != nullptr;
|
return FindByName(name) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user