From 29ae84e199a9900026171551c994feea64240dbd Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 11 Nov 2021 02:40:47 -0800 Subject: [PATCH] manual braced init Signed-off-by: Rosen Penev --- src/MusicBuffer.cxx | 2 +- src/fs/AllocatedPath.cxx | 4 ++-- src/lib/upnp/Discovery.cxx | 3 +-- src/protocol/ArgParser.cxx | 2 +- src/song/Filter.cxx | 9 +++------ 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/MusicBuffer.cxx b/src/MusicBuffer.cxx index 120aca0a2..8795dbe9d 100644 --- a/src/MusicBuffer.cxx +++ b/src/MusicBuffer.cxx @@ -30,7 +30,7 @@ MusicChunkPtr MusicBuffer::Allocate() noexcept { const std::scoped_lock protect(mutex); - return MusicChunkPtr(buffer.Allocate(), MusicChunkDeleter(*this)); + return {buffer.Allocate(), MusicChunkDeleter(*this)}; } void diff --git a/src/fs/AllocatedPath.cxx b/src/fs/AllocatedPath.cxx index cd747e559..f47cf450a 100644 --- a/src/fs/AllocatedPath.cxx +++ b/src/fs/AllocatedPath.cxx @@ -31,7 +31,7 @@ AllocatedPath::FromUTF8(std::string_view path_utf8) noexcept return FromFS(path_utf8); #else try { - return AllocatedPath(::PathFromUTF8(path_utf8)); + return {::PathFromUTF8(path_utf8)}; } catch (...) { return nullptr; } @@ -44,7 +44,7 @@ AllocatedPath::FromUTF8Throw(std::string_view path_utf8) #ifdef FS_CHARSET_ALWAYS_UTF8 return FromFS(path_utf8); #else - return AllocatedPath(::PathFromUTF8(path_utf8)); + return {::PathFromUTF8(path_utf8)}; #endif } diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx index b67328d49..7bd8b8d90 100644 --- a/src/lib/upnp/Discovery.cxx +++ b/src/lib/upnp/Discovery.cxx @@ -339,8 +339,7 @@ UPnPDeviceDirectory::GetServer(std::string_view friendly_name) for (const auto &service : device.services) if (isCDService(service.serviceType.c_str())) - return ContentDirectoryService(device, - service); + return {device, service}; } throw std::runtime_error("Server not found"); diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index 72190d9de..41f45e8b6 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -31,7 +31,7 @@ MakeArgError(const char *msg, const char *value) noexcept { char buffer[256]; snprintf(buffer, sizeof(buffer), "%s: %s", msg, value); - return ProtocolError(ACK_ERROR_ARG, buffer); + return {ACK_ERROR_ARG, buffer}; } uint32_t diff --git a/src/song/Filter.cxx b/src/song/Filter.cxx index 287e1d2e6..f767491cb 100644 --- a/src/song/Filter.cxx +++ b/src/song/Filter.cxx @@ -206,15 +206,13 @@ ParseStringFilter(const char *&s, bool fold_case) if (auto after_contains = StringAfterPrefixIgnoreCase(s, "contains ")) { s = StripLeft(after_contains); auto value = ExpectQuoted(s); - return StringFilter(std::move(value), - fold_case, true, false); + return {std::move(value), fold_case, true, false}; } if (auto after_not_contains = StringAfterPrefixIgnoreCase(s, "!contains ")) { s = StripLeft(after_not_contains); auto value = ExpectQuoted(s); - return StringFilter(std::move(value), - fold_case, true, true); + return {std::move(value), fold_case, true, true}; } bool negated = false; @@ -240,8 +238,7 @@ ParseStringFilter(const char *&s, bool fold_case) s = StripLeft(s + 2); auto value = ExpectQuoted(s); - return StringFilter(std::move(value), - fold_case, false, negated); + return {std::move(value), fold_case, false, negated}; } ISongFilterPtr