Merge remote-tracking branches 'neheb/6', 'neheb/5', 'neheb/3', 'neheb/2' and 'neheb/1'

This commit is contained in:
Max Kellermann 2021-08-23 20:36:26 +02:00
6 changed files with 7 additions and 15 deletions

View File

@ -258,12 +258,8 @@ ContentDirectoryService::getMetadata(UpnpClient_Handle hdl,
if (code != UPNP_E_SUCCESS)
throw FormatRuntimeError("UpnpSendAction() failed: %s",
UpnpGetErrorMessage(code));
const char *p = "";
for (const auto &entry : responseData) {
if (entry.first == "Result") {
p = entry.second.c_str();
}
}
auto it = std::find_if(responseData.begin(), responseData.end(), [](auto&& entry){ return entry.first == "Result"; });
const char *p = it != responseData.end() ? it->second.c_str() : "";
UPnPDirContent dirbuf;
dirbuf.Parse(p);
return dirbuf;

View File

@ -121,7 +121,7 @@ std::unique_ptr<Filter>
convert_filter_new(const AudioFormat in_audio_format,
const AudioFormat out_audio_format)
{
std::unique_ptr<ConvertFilter> filter(new ConvertFilter(in_audio_format));
auto filter = std::make_unique<ConvertFilter>(in_audio_format);
filter->Set(out_audio_format);
return filter;
}

View File

@ -37,7 +37,7 @@ InterleaveFrame(const AVFrame &frame, FfmpegBuffer &buffer)
{
assert(frame.nb_samples > 0);
const AVSampleFormat format = AVSampleFormat(frame.format);
const auto format = AVSampleFormat(frame.format);
const unsigned channels = frame.channels;
const std::size_t n_frames = frame.nb_samples;

View File

@ -367,11 +367,7 @@ SnapcastOutput::IsDrained() const noexcept
if (!chunks.empty())
return false;
for (const auto &client : clients)
if (!client.IsDrained())
return false;
return true;
return std::all_of(clients.begin(), clients.end(), [](auto&& c){ return c.IsDrained(); });
}
void

View File

@ -63,7 +63,7 @@ cue_next_token(StringView &src) noexcept
return cue_next_word(src);
}
static const StringView
static StringView
cue_next_value(StringView &src) noexcept
{
src.StripLeft();

View File

@ -158,7 +158,7 @@ TagBuilder::Commit() noexcept
std::unique_ptr<Tag>
TagBuilder::CommitNew() noexcept
{
std::unique_ptr<Tag> tag(new Tag());
auto tag = std::make_unique<Tag>();
Commit(*tag);
return tag;
}