Commit 34aa67ea authored by Max Kellermann's avatar Max Kellermann

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

...@@ -258,12 +258,8 @@ ContentDirectoryService::getMetadata(UpnpClient_Handle hdl, ...@@ -258,12 +258,8 @@ ContentDirectoryService::getMetadata(UpnpClient_Handle hdl,
if (code != UPNP_E_SUCCESS) if (code != UPNP_E_SUCCESS)
throw FormatRuntimeError("UpnpSendAction() failed: %s", throw FormatRuntimeError("UpnpSendAction() failed: %s",
UpnpGetErrorMessage(code)); UpnpGetErrorMessage(code));
const char *p = ""; auto it = std::find_if(responseData.begin(), responseData.end(), [](auto&& entry){ return entry.first == "Result"; });
for (const auto &entry : responseData) { const char *p = it != responseData.end() ? it->second.c_str() : "";
if (entry.first == "Result") {
p = entry.second.c_str();
}
}
UPnPDirContent dirbuf; UPnPDirContent dirbuf;
dirbuf.Parse(p); dirbuf.Parse(p);
return dirbuf; return dirbuf;
......
...@@ -121,7 +121,7 @@ std::unique_ptr<Filter> ...@@ -121,7 +121,7 @@ std::unique_ptr<Filter>
convert_filter_new(const AudioFormat in_audio_format, convert_filter_new(const AudioFormat in_audio_format,
const AudioFormat out_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); filter->Set(out_audio_format);
return filter; return filter;
} }
......
...@@ -37,7 +37,7 @@ InterleaveFrame(const AVFrame &frame, FfmpegBuffer &buffer) ...@@ -37,7 +37,7 @@ InterleaveFrame(const AVFrame &frame, FfmpegBuffer &buffer)
{ {
assert(frame.nb_samples > 0); assert(frame.nb_samples > 0);
const AVSampleFormat format = AVSampleFormat(frame.format); const auto format = AVSampleFormat(frame.format);
const unsigned channels = frame.channels; const unsigned channels = frame.channels;
const std::size_t n_frames = frame.nb_samples; const std::size_t n_frames = frame.nb_samples;
......
...@@ -367,11 +367,7 @@ SnapcastOutput::IsDrained() const noexcept ...@@ -367,11 +367,7 @@ SnapcastOutput::IsDrained() const noexcept
if (!chunks.empty()) if (!chunks.empty())
return false; return false;
for (const auto &client : clients) return std::all_of(clients.begin(), clients.end(), [](auto&& c){ return c.IsDrained(); });
if (!client.IsDrained())
return false;
return true;
} }
void void
......
...@@ -63,7 +63,7 @@ cue_next_token(StringView &src) noexcept ...@@ -63,7 +63,7 @@ cue_next_token(StringView &src) noexcept
return cue_next_word(src); return cue_next_word(src);
} }
static const StringView static StringView
cue_next_value(StringView &src) noexcept cue_next_value(StringView &src) noexcept
{ {
src.StripLeft(); src.StripLeft();
......
...@@ -158,7 +158,7 @@ TagBuilder::Commit() noexcept ...@@ -158,7 +158,7 @@ TagBuilder::Commit() noexcept
std::unique_ptr<Tag> std::unique_ptr<Tag>
TagBuilder::CommitNew() noexcept TagBuilder::CommitNew() noexcept
{ {
std::unique_ptr<Tag> tag(new Tag()); auto tag = std::make_unique<Tag>();
Commit(*tag); Commit(*tag);
return tag; return tag;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment