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) 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;

View File

@ -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;
} }

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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;
} }