manual braced init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2021-11-11 02:40:47 -08:00
parent 250011f016
commit 29ae84e199
5 changed files with 8 additions and 12 deletions

View File

@ -30,7 +30,7 @@ MusicChunkPtr
MusicBuffer::Allocate() noexcept MusicBuffer::Allocate() noexcept
{ {
const std::scoped_lock<Mutex> protect(mutex); const std::scoped_lock<Mutex> protect(mutex);
return MusicChunkPtr(buffer.Allocate(), MusicChunkDeleter(*this)); return {buffer.Allocate(), MusicChunkDeleter(*this)};
} }
void void

View File

@ -31,7 +31,7 @@ AllocatedPath::FromUTF8(std::string_view path_utf8) noexcept
return FromFS(path_utf8); return FromFS(path_utf8);
#else #else
try { try {
return AllocatedPath(::PathFromUTF8(path_utf8)); return {::PathFromUTF8(path_utf8)};
} catch (...) { } catch (...) {
return nullptr; return nullptr;
} }
@ -44,7 +44,7 @@ AllocatedPath::FromUTF8Throw(std::string_view path_utf8)
#ifdef FS_CHARSET_ALWAYS_UTF8 #ifdef FS_CHARSET_ALWAYS_UTF8
return FromFS(path_utf8); return FromFS(path_utf8);
#else #else
return AllocatedPath(::PathFromUTF8(path_utf8)); return {::PathFromUTF8(path_utf8)};
#endif #endif
} }

View File

@ -339,8 +339,7 @@ UPnPDeviceDirectory::GetServer(std::string_view friendly_name)
for (const auto &service : device.services) for (const auto &service : device.services)
if (isCDService(service.serviceType.c_str())) if (isCDService(service.serviceType.c_str()))
return ContentDirectoryService(device, return {device, service};
service);
} }
throw std::runtime_error("Server not found"); throw std::runtime_error("Server not found");

View File

@ -31,7 +31,7 @@ MakeArgError(const char *msg, const char *value) noexcept
{ {
char buffer[256]; char buffer[256];
snprintf(buffer, sizeof(buffer), "%s: %s", msg, value); snprintf(buffer, sizeof(buffer), "%s: %s", msg, value);
return ProtocolError(ACK_ERROR_ARG, buffer); return {ACK_ERROR_ARG, buffer};
} }
uint32_t uint32_t

View File

@ -206,15 +206,13 @@ ParseStringFilter(const char *&s, bool fold_case)
if (auto after_contains = StringAfterPrefixIgnoreCase(s, "contains ")) { if (auto after_contains = StringAfterPrefixIgnoreCase(s, "contains ")) {
s = StripLeft(after_contains); s = StripLeft(after_contains);
auto value = ExpectQuoted(s); auto value = ExpectQuoted(s);
return StringFilter(std::move(value), return {std::move(value), fold_case, true, false};
fold_case, true, false);
} }
if (auto after_not_contains = StringAfterPrefixIgnoreCase(s, "!contains ")) { if (auto after_not_contains = StringAfterPrefixIgnoreCase(s, "!contains ")) {
s = StripLeft(after_not_contains); s = StripLeft(after_not_contains);
auto value = ExpectQuoted(s); auto value = ExpectQuoted(s);
return StringFilter(std::move(value), return {std::move(value), fold_case, true, true};
fold_case, true, true);
} }
bool negated = false; bool negated = false;
@ -240,8 +238,7 @@ ParseStringFilter(const char *&s, bool fold_case)
s = StripLeft(s + 2); s = StripLeft(s + 2);
auto value = ExpectQuoted(s); auto value = ExpectQuoted(s);
return StringFilter(std::move(value), return {std::move(value), fold_case, false, negated};
fold_case, false, negated);
} }
ISongFilterPtr ISongFilterPtr