From 250011f0160f213a95ed9f0d551ba00d8715386e Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Thu, 11 Nov 2021 02:18:46 -0800
Subject: [PATCH] return by braced init list

shorter

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 src/Mapper.cxx                                | 6 +++---
 src/db/plugins/simple/Directory.cxx           | 2 +-
 src/db/plugins/upnp/UpnpDatabasePlugin.cxx    | 4 ++--
 src/db/update/Queue.cxx                       | 2 +-
 src/fs/Path.cxx                               | 2 +-
 src/lib/icu/CaseFold.cxx                      | 6 +++---
 src/lib/icu/Converter.cxx                     | 2 +-
 src/player/Thread.cxx                         | 4 ++--
 src/playlist/plugins/ExtM3uPlaylistPlugin.cxx | 4 ++--
 src/song/DetachedSong.cxx                     | 2 +-
 src/song/LightSong.cxx                        | 2 +-
 src/sticker/Database.cxx                      | 2 +-
 src/storage/CompositeStorage.cxx              | 2 +-
 src/util/UriUtil.cxx                          | 4 ++--
 14 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/Mapper.cxx b/src/Mapper.cxx
index 437f75699..6026ebfe4 100644
--- a/src/Mapper.cxx
+++ b/src/Mapper.cxx
@@ -85,15 +85,15 @@ map_fs_to_utf8(Path path_fs) noexcept
 {
 	if (path_fs.IsAbsolute()) {
 		if (global_instance->storage == nullptr)
-			return std::string();
+			return {};
 
 		const auto music_dir_fs = global_instance->storage->MapFS("");
 		if (music_dir_fs.IsNull())
-			return std::string();
+			return {};
 
 		auto relative = music_dir_fs.Relative(path_fs);
 		if (relative == nullptr || StringIsEmpty(relative))
-			return std::string();
+			return {};
 
 		path_fs = Path::FromFS(relative);
 	}
diff --git a/src/db/plugins/simple/Directory.cxx b/src/db/plugins/simple/Directory.cxx
index 308b9f300..313709a31 100644
--- a/src/db/plugins/simple/Directory.cxx
+++ b/src/db/plugins/simple/Directory.cxx
@@ -278,5 +278,5 @@ Directory::Walk(bool recursive, const SongFilter *filter,
 LightDirectory
 Directory::Export() const noexcept
 {
-	return LightDirectory(GetPath(), mtime);
+	return {GetPath(), mtime};
 }
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
index 318ec9a5c..a7a8fc548 100644
--- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
@@ -250,11 +250,11 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server,
 {
 	const SongFilter *filter = selection.filter;
 	if (selection.filter == nullptr)
-		return UPnPDirContent();
+		return {};
 
 	const auto searchcaps = server.getSearchCapabilities(handle);
 	if (searchcaps.empty())
-		return UPnPDirContent();
+		return {};
 
 	std::string cond;
 	for (const auto &item : filter->GetItems()) {
diff --git a/src/db/update/Queue.cxx b/src/db/update/Queue.cxx
index 3527a95b5..ca552218a 100644
--- a/src/db/update/Queue.cxx
+++ b/src/db/update/Queue.cxx
@@ -34,7 +34,7 @@ UpdateQueueItem
 UpdateQueue::Pop() noexcept
 {
 	if (update_queue.empty())
-		return UpdateQueueItem();
+		return {};
 
 	auto i = std::move(update_queue.front());
 	update_queue.pop_front();
diff --git a/src/fs/Path.cxx b/src/fs/Path.cxx
index 60836f342..20edf12cb 100644
--- a/src/fs/Path.cxx
+++ b/src/fs/Path.cxx
@@ -26,7 +26,7 @@ Path::ToUTF8() const noexcept
 	try {
 		return ToUTF8Throw();
 	} catch (...) {
-		return std::string();
+		return {};
 	}
 }
 
diff --git a/src/lib/icu/CaseFold.cxx b/src/lib/icu/CaseFold.cxx
index ec7ca80fb..d085b3cf6 100644
--- a/src/lib/icu/CaseFold.cxx
+++ b/src/lib/icu/CaseFold.cxx
@@ -44,7 +44,7 @@ try {
 #ifdef HAVE_ICU
 	const auto u = UCharFromUTF8(src);
 	if (u.IsNull())
-		return AllocatedString(src);
+		return {src};
 
 	AllocatedArray<UChar> folded(u.size() * 2U);
 
@@ -54,7 +54,7 @@ try {
 					     U_FOLD_CASE_DEFAULT,
 					     &error_code);
 	if (folded_length == 0 || error_code != U_ZERO_ERROR)
-		return AllocatedString(src);
+		return {src};
 
 	folded.SetSize(folded_length);
 	return UCharToUTF8({folded.begin(), folded.size()});
@@ -63,7 +63,7 @@ try {
 #error not implemented
 #endif
 } catch (...) {
-	return AllocatedString(src);
+	return {src};
 }
 
 #endif /* HAVE_ICU_CASE_FOLD */
diff --git a/src/lib/icu/Converter.cxx b/src/lib/icu/Converter.cxx
index 335a8f056..9fc15c728 100644
--- a/src/lib/icu/Converter.cxx
+++ b/src/lib/icu/Converter.cxx
@@ -152,7 +152,7 @@ IcuConverter::FromUTF8(std::string_view s) const
 		throw std::runtime_error(fmt::format(FMT_STRING("Failed to convert from Unicode: {}"),
 						     u_errorName(code)));
 
-	return AllocatedString({buffer, size_t(target - buffer)});
+	return {{buffer, size_t(target - buffer)}};
 
 #elif defined(HAVE_ICONV)
 	return DoConvert(from_utf8, s);
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx
index fb53fc6f3..7d1416837 100644
--- a/src/player/Thread.cxx
+++ b/src/player/Thread.cxx
@@ -466,9 +466,9 @@ real_song_duration(const DetachedSong &song,
 	const SongTime end_time = song.GetEndTime();
 
 	if (end_time.IsPositive() && end_time < SongTime(decoder_duration))
-		return SignedSongTime(end_time - start_time);
+		return {end_time - start_time};
 
-	return SignedSongTime(SongTime(decoder_duration) - start_time);
+	return {SongTime(decoder_duration) - start_time};
 }
 
 bool
diff --git a/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx b/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx
index 7cdc17ac3..fde3487af 100644
--- a/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx
+++ b/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx
@@ -87,7 +87,7 @@ extm3u_parse_tag(const char *line)
 	duration = strtol(line, &endptr, 10);
 	if (endptr[0] != ',')
 		/* malformed line */
-		return Tag();
+		return {};
 
 	if (duration < 0)
 		/* 0 means unknown duration */
@@ -97,7 +97,7 @@ extm3u_parse_tag(const char *line)
 	if (*name == 0 && duration == 0)
 		/* no information available; don't allocate a tag
 		   object */
-		return Tag();
+		return {};
 
 	TagBuilder tag;
 	tag.SetDuration(SignedSongTime::FromS(unsigned(duration)));
diff --git a/src/song/DetachedSong.cxx b/src/song/DetachedSong.cxx
index 0dc151129..5e8aed5bd 100644
--- a/src/song/DetachedSong.cxx
+++ b/src/song/DetachedSong.cxx
@@ -75,5 +75,5 @@ DetachedSong::GetDuration() const noexcept
 		b = SongTime(tag.duration);
 	}
 
-	return SignedSongTime(b - a);
+	return {b - a};
 }
diff --git a/src/song/LightSong.cxx b/src/song/LightSong.cxx
index 2103cbb0c..98d397c4d 100644
--- a/src/song/LightSong.cxx
+++ b/src/song/LightSong.cxx
@@ -31,5 +31,5 @@ LightSong::GetDuration() const noexcept
 		b = SongTime(tag.duration);
 	}
 
-	return SignedSongTime(b - a);
+	return {b - a};
 }
diff --git a/src/sticker/Database.cxx b/src/sticker/Database.cxx
index fd633807b..205be1e92 100644
--- a/src/sticker/Database.cxx
+++ b/src/sticker/Database.cxx
@@ -128,7 +128,7 @@ StickerDatabase::LoadValue(const char *type, const char *uri, const char *name)
 	assert(name != nullptr);
 
 	if (StringIsEmpty(name))
-		return std::string();
+		return {};
 
 	BindAll(s, type, uri, name);
 
diff --git a/src/storage/CompositeStorage.cxx b/src/storage/CompositeStorage.cxx
index 3de5f5f49..fc82d457b 100644
--- a/src/storage/CompositeStorage.cxx
+++ b/src/storage/CompositeStorage.cxx
@@ -303,7 +303,7 @@ CompositeStorage::MapUTF8(std::string_view uri) const noexcept
 
 	auto f = FindStorage(uri);
 	if (f.directory->storage == nullptr)
-		return std::string();
+		return {};
 
 	return f.directory->storage->MapUTF8(f.uri);
 }
diff --git a/src/util/UriUtil.cxx b/src/util/UriUtil.cxx
index 631917ba1..f56d7fd55 100644
--- a/src/util/UriUtil.cxx
+++ b/src/util/UriUtil.cxx
@@ -94,7 +94,7 @@ uri_remove_auth(const char *uri) noexcept
 	const char *auth = SkipUriScheme(uri);
 	if (auth == nullptr)
 		/* unrecognized URI */
-		return std::string();
+		return {};
 
 	const char *slash = std::strchr(auth, '/');
 	if (slash == nullptr)
@@ -103,7 +103,7 @@ uri_remove_auth(const char *uri) noexcept
 	const char *at = (const char *)std::memchr(auth, '@', slash - auth);
 	if (at == nullptr)
 		/* no auth info present, do nothing */
-		return std::string();
+		return {};
 
 	/* duplicate the full URI and then delete the auth
 	   information */