From 8a0ba7a725aecd7cd989d09958b2a90a3695ef22 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 13 Jul 2022 11:31:46 +0200 Subject: [PATCH] output/Control: GetName() returns std::string& --- src/output/Control.hxx | 4 ++-- src/output/MultipleOutputs.cxx | 3 ++- src/output/Thread.cxx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/output/Control.hxx b/src/output/Control.hxx index 4d699fb3b..9b9996a87 100644 --- a/src/output/Control.hxx +++ b/src/output/Control.hxx @@ -269,8 +269,8 @@ public: AudioOutputControl &operator=(const AudioOutputControl &) = delete; [[gnu::pure]] - const char *GetName() const noexcept { - return name.c_str(); + const auto &GetName() const noexcept { + return name; } [[gnu::pure]] diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index 5b97bddab..ddb577915 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -100,7 +100,8 @@ MultipleOutputs::Configure(EventLoop &event_loop, EventLoop &rt_event_loop, &filter_factory); if (HasName(output->GetName())) throw FormatRuntimeError("output devices with identical " - "names: %s", output->GetName()); + "names: %s", + output->GetName().c_str()); outputs.emplace_back(std::move(output)); }); diff --git a/src/output/Thread.cxx b/src/output/Thread.cxx index e19b66130..bbc370b7b 100644 --- a/src/output/Thread.cxx +++ b/src/output/Thread.cxx @@ -421,7 +421,7 @@ AudioOutputControl::InternalDrain() noexcept void AudioOutputControl::Task() noexcept { - FormatThreadName("output:%s", GetName()); + FormatThreadName("output:%s", GetName().c_str()); try { SetThreadRealtime();