diff --git a/src/PlaylistDatabase.cxx b/src/PlaylistDatabase.cxx index d98633d426..a62335fb50 100644 --- a/src/PlaylistDatabase.cxx +++ b/src/PlaylistDatabase.cxx @@ -19,9 +19,9 @@ void playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv) { for (const PlaylistInfo &pi : pv) { - os.Fmt(FMT_STRING(PLAYLIST_META_BEGIN "{}\n"), pi.name); + os.Fmt(PLAYLIST_META_BEGIN "{}\n", pi.name); if (!IsNegative(pi.mtime)) - os.Fmt(FMT_STRING("mtime: {}\n"), + os.Fmt("mtime: {}\n", std::chrono::system_clock::to_time_t(pi.mtime)); os.Write("playlist_end\n"); } diff --git a/src/PlaylistSave.cxx b/src/PlaylistSave.cxx index 9ea64ccf61..f545a6ac87 100644 --- a/src/PlaylistSave.cxx +++ b/src/PlaylistSave.cxx @@ -26,11 +26,11 @@ playlist_print_path(BufferedOutputStream &os, const Path path) "narrow" charset (i.e. CP_ACP) is incapable of storing all Unicode paths */ try { - os.Fmt(FMT_STRING("{}\n"), path.ToUTF8Throw()); + os.Fmt("{}\n", path.ToUTF8Throw()); } catch (...) { } #else - os.Fmt(FMT_STRING("{}\n"), path.c_str()); + os.Fmt("{}\n", path.c_str()); #endif } diff --git a/src/SongSave.cxx b/src/SongSave.cxx index 7372cdf49e..1ad989f4e2 100644 --- a/src/SongSave.cxx +++ b/src/SongSave.cxx @@ -29,35 +29,35 @@ static void range_save(BufferedOutputStream &os, unsigned start_ms, unsigned end_ms) { if (end_ms > 0) - os.Fmt(FMT_STRING("Range: {}-{}\n"), start_ms, end_ms); + os.Fmt("Range: {}-{}\n", start_ms, end_ms); else if (start_ms > 0) - os.Fmt(FMT_STRING("Range: {}-\n"), start_ms); + os.Fmt("Range: {}-\n", start_ms); } void song_save(BufferedOutputStream &os, const Song &song) { - os.Fmt(FMT_STRING(SONG_BEGIN "{}\n"), song.filename); + os.Fmt(SONG_BEGIN "{}\n", song.filename); if (!song.target.empty()) - os.Fmt(FMT_STRING("Target: {}\n"), song.target); + os.Fmt("Target: {}\n", song.target); range_save(os, song.start_time.ToMS(), song.end_time.ToMS()); tag_save(os, song.tag); if (song.audio_format.IsDefined()) - os.Fmt(FMT_STRING("Format: {}\n"), song.audio_format); + os.Fmt("Format: {}\n", song.audio_format); if (song.in_playlist) os.Write("InPlaylist: yes\n"); if (!IsNegative(song.mtime)) - os.Fmt(FMT_STRING(SONG_MTIME ": {}\n"), + os.Fmt(SONG_MTIME ": {}\n", std::chrono::system_clock::to_time_t(song.mtime)); if (!IsNegative(song.added)) - os.Fmt(FMT_STRING(SONG_ADDED ": {}\n"), + os.Fmt(SONG_ADDED ": {}\n", std::chrono::system_clock::to_time_t(song.added)); os.Write(SONG_END "\n"); } @@ -65,18 +65,18 @@ song_save(BufferedOutputStream &os, const Song &song) void song_save(BufferedOutputStream &os, const DetachedSong &song) { - os.Fmt(FMT_STRING(SONG_BEGIN "{}\n"), song.GetURI()); + os.Fmt(SONG_BEGIN "{}\n", song.GetURI()); range_save(os, song.GetStartTime().ToMS(), song.GetEndTime().ToMS()); tag_save(os, song.GetTag()); if (!IsNegative(song.GetLastModified())) - os.Fmt(FMT_STRING(SONG_MTIME ": {}\n"), + os.Fmt(SONG_MTIME ": {}\n", std::chrono::system_clock::to_time_t(song.GetLastModified())); if (!IsNegative(song.GetAdded())) - os.Fmt(FMT_STRING(SONG_ADDED ": {}\n"), + os.Fmt(SONG_ADDED ": {}\n", std::chrono::system_clock::to_time_t(song.GetAdded())); os.Write(SONG_END "\n"); } diff --git a/src/TagPrint.cxx b/src/TagPrint.cxx index 9b1257bff8..97ab29c84a 100644 --- a/src/TagPrint.cxx +++ b/src/TagPrint.cxx @@ -23,11 +23,11 @@ tag_print_types_available(Response &r) noexcept { for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) if (global_tag_mask.Test(TagType(i))) - r.Fmt(FMT_STRING("tagtype: {}\n"), tag_item_names[i]); + r.Fmt("tagtype: {}\n", tag_item_names[i]); } void -tag_print(Response &r, TagType type, std::string_view value) noexcept +tag_print(Response &r, TagType type, std::string_view _value) noexcept { const std::string_view value{_value}; r.Fmt("{}: {}\n", tag_item_names[type], value); diff --git a/src/TagSave.cxx b/src/TagSave.cxx index 00709712d9..100d92cffa 100644 --- a/src/TagSave.cxx +++ b/src/TagSave.cxx @@ -14,12 +14,12 @@ void tag_save(BufferedOutputStream &os, const Tag &tag) { if (!tag.duration.IsNegative()) - os.Fmt(FMT_STRING(SONG_TIME "{}\n"), tag.duration.ToDoubleS()); + os.Fmt(SONG_TIME "{}\n", tag.duration.ToDoubleS()); if (tag.has_playlist) os.Write("Playlist: yes\n"); for (const auto &i : tag) - os.Fmt(FMT_STRING("{}: {}\n"), + os.Fmt("{}: {}\n", tag_item_names[i.type], i.value); } diff --git a/src/client/ProtocolFeature.cxx b/src/client/ProtocolFeature.cxx index e1fba19eb0..195c6744f1 100644 --- a/src/client/ProtocolFeature.cxx +++ b/src/client/ProtocolFeature.cxx @@ -50,14 +50,14 @@ protocol_features_print(Client &client, Response &r) noexcept const auto protocol_feature = client.GetProtocolFeatures(); for (unsigned i = 0; i < PF_NUM_OF_ITEM_TYPES; i++) if (protocol_feature.Test(ProtocolFeatureType(i))) - r.Fmt(FMT_STRING("feature: {}\n"), protocol_feature_names[i]); + r.Fmt("feature: {}\n", protocol_feature_names[i]); } void protocol_features_print_all(Response &r) noexcept { for (unsigned i = 0; i < PF_NUM_OF_ITEM_TYPES; i++) - r.Fmt(FMT_STRING("feature: {}\n"), protocol_feature_names[i]); + r.Fmt("feature: {}\n", protocol_feature_names[i]); } ProtocolFeatureType diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx index a1664308ce..c20f4854f9 100644 --- a/src/command/OtherCommands.cxx +++ b/src/command/OtherCommands.cxx @@ -377,7 +377,7 @@ handle_config(Client &client, [[maybe_unused]] Request args, Response &r) #endif if (const auto spl_path = map_spl_path(); !spl_path.IsNull()) - r.Fmt(FMT_STRING("playlist_directory: {}\n"), spl_path.ToUTF8()); + r.Fmt("playlist_directory: {}\n", spl_path.ToUTF8()); #ifdef HAVE_PCRE r.Write("pcre: 1\n"); diff --git a/src/command/StickerCommands.cxx b/src/command/StickerCommands.cxx index 1e21bb885b..062768664d 100644 --- a/src/command/StickerCommands.cxx +++ b/src/command/StickerCommands.cxx @@ -458,7 +458,7 @@ handle_sticker(Client &client, Request args, Response &r) /* set */ if (args.size() == 5 && StringIsEqual(cmd, "set")) return handler->Set(uri, sticker_name, args[4]); - + /* inc */ if (args.size() == 5 && StringIsEqual(cmd, "inc")) return handler->Inc(uri, sticker_name, args[4]); @@ -550,6 +550,6 @@ handle_sticker_types(Client &client, Request args, Response &r) for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) if (sticker_allowed_tags.Test(TagType(i)) && tag_mask.Test(TagType(i))) - r.Fmt(FMT_STRING("stickertype: {}\n"), tag_item_names[i]); + r.Fmt("stickertype: {}\n", tag_item_names[i]); return CommandResult::OK; } diff --git a/src/db/plugins/simple/DatabaseSave.cxx b/src/db/plugins/simple/DatabaseSave.cxx index 0d7ee6adad..23b028cb9e 100644 --- a/src/db/plugins/simple/DatabaseSave.cxx +++ b/src/db/plugins/simple/DatabaseSave.cxx @@ -37,13 +37,13 @@ void db_save_internal(BufferedOutputStream &os, const Directory &music_root) { os.Write(DIRECTORY_INFO_BEGIN "\n"); - os.Fmt(FMT_STRING(DB_FORMAT_PREFIX "{}\n"), DB_FORMAT); + os.Fmt(DB_FORMAT_PREFIX "{}\n", DB_FORMAT); os.Write(DIRECTORY_MPD_VERSION VERSION "\n"); - os.Fmt(FMT_STRING(DIRECTORY_FS_CHARSET "{}\n"), GetFSCharset()); + os.Fmt(DIRECTORY_FS_CHARSET "{}\n", GetFSCharset()); for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) if (IsTagEnabled(i)) - os.Fmt(FMT_STRING(DB_TAG_PREFIX "{}\n"), + os.Fmt(DB_TAG_PREFIX "{}\n", tag_item_names[i]); os.Write(DIRECTORY_INFO_END "\n"); diff --git a/src/db/plugins/simple/DirectorySave.cxx b/src/db/plugins/simple/DirectorySave.cxx index 302bda62b2..2a4b8e38ca 100644 --- a/src/db/plugins/simple/DirectorySave.cxx +++ b/src/db/plugins/simple/DirectorySave.cxx @@ -67,20 +67,20 @@ directory_save(BufferedOutputStream &os, const Directory &directory) if (!directory.IsRoot()) { const char *type = DeviceToTypeString(directory.device); if (type != nullptr) - os.Fmt(FMT_STRING(DIRECTORY_TYPE "{}\n"), type); + os.Fmt(DIRECTORY_TYPE "{}\n", type); if (!IsNegative(directory.mtime)) - os.Fmt(FMT_STRING(DIRECTORY_MTIME "{}\n"), + os.Fmt(DIRECTORY_MTIME "{}\n", std::chrono::system_clock::to_time_t(directory.mtime)); - os.Fmt(FMT_STRING(DIRECTORY_BEGIN "{}\n"), directory.GetPath()); + os.Fmt(DIRECTORY_BEGIN "{}\n", directory.GetPath()); } for (const auto &child : directory.children) { if (child.IsMount()) continue; - os.Fmt(FMT_STRING(DIRECTORY_DIR "{}\n"), child.GetName()); + os.Fmt(DIRECTORY_DIR "{}\n", child.GetName()); directory_save(os, child); } @@ -90,7 +90,7 @@ directory_save(BufferedOutputStream &os, const Directory &directory) playlist_vector_save(os, directory.playlists); if (!directory.IsRoot()) - os.Fmt(FMT_STRING(DIRECTORY_END "{}\n"), directory.GetPath()); + os.Fmt(DIRECTORY_END "{}\n", directory.GetPath()); } static bool diff --git a/src/decoder/DecoderPrint.cxx b/src/decoder/DecoderPrint.cxx index ea5d3ffa6a..b4e82e5246 100644 --- a/src/decoder/DecoderPrint.cxx +++ b/src/decoder/DecoderPrint.cxx @@ -27,7 +27,7 @@ decoder_plugin_print(Response &r, if (plugin.suffixes_function != nullptr) for (const auto &i : plugin.suffixes_function()) - r.Fmt(FMT_STRING("suffix: {}\n"), i); + r.Fmt("suffix: {}\n", i); if (plugin.mime_types != nullptr) for (p = plugin.mime_types; *p != nullptr; ++p) diff --git a/src/lib/icu/Converter.cxx b/src/lib/icu/Converter.cxx index 1c058c6269..8ed72339df 100644 --- a/src/lib/icu/Converter.cxx +++ b/src/lib/icu/Converter.cxx @@ -41,7 +41,7 @@ IcuConverter::Create(const char *charset) UConverter *converter = ucnv_open(charset, &code); if (converter == nullptr) throw ICU::MakeError(code, - FmtBuffer<256>(FMT_STRING("Failed to initialize charset {:?}"), + FmtBuffer<256>("Failed to initialize charset {:?}", charset)); return std::unique_ptr(new IcuConverter(converter)); @@ -54,7 +54,7 @@ IcuConverter::Create(const char *charset) iconv_close(to); if (from != (iconv_t)-1) iconv_close(from); - throw FmtErrno(e, FMT_STRING("Failed to initialize charset {:?}"), + throw FmtErrno(e, "Failed to initialize charset {:?}", charset); } diff --git a/src/mixer/Memento.cxx b/src/mixer/Memento.cxx index 5a5fe9d55c..53043edafc 100644 --- a/src/mixer/Memento.cxx +++ b/src/mixer/Memento.cxx @@ -76,5 +76,5 @@ MixerMemento::LoadSoftwareVolumeState(const char *line, MultipleOutputs &outputs void MixerMemento::SaveSoftwareVolumeState(BufferedOutputStream &os) const { - os.Fmt(FMT_STRING(SW_VOLUME_STATE "{}\n"), volume_software_set); + os.Fmt(SW_VOLUME_STATE "{}\n", volume_software_set); } diff --git a/src/output/State.cxx b/src/output/State.cxx index aa6e54e011..5933e57522 100644 --- a/src/output/State.cxx +++ b/src/output/State.cxx @@ -29,7 +29,7 @@ audio_output_state_save(BufferedOutputStream &os, const auto &ao = outputs.Get(i); const std::scoped_lock lock{ao.mutex}; - os.Fmt(FMT_STRING(AUDIO_DEVICE_STATE "{}:{}\n"), + os.Fmt(AUDIO_DEVICE_STATE "{}:{}\n", (unsigned)ao.IsEnabled(), ao.GetName()); } } diff --git a/src/playlist/Length.cxx b/src/playlist/Length.cxx index 96e03fc79e..79c9376eb5 100644 --- a/src/playlist/Length.cxx +++ b/src/playlist/Length.cxx @@ -43,9 +43,9 @@ playlist_provider_length(Response &r, playtime += get_duration(*song); i++; } - r.Fmt(FMT_STRING("songs: {}\n"), i); + r.Fmt("songs: {}\n", i); const auto seconds = std::chrono::round(playtime); - r.Fmt(FMT_STRING("playtime: {}\n"), seconds.count()); + r.Fmt("playtime: {}\n", seconds.count()); } void diff --git a/src/playlist/Print.cxx b/src/playlist/Print.cxx index a86f2cd4ca..2947d007e5 100644 --- a/src/playlist/Print.cxx +++ b/src/playlist/Print.cxx @@ -89,7 +89,7 @@ playlist_provider_search_print(Response &r, if (detail) { song_print_info(r, *song); - r.Fmt(FMT_STRING("Pos: {}\n"), position); + r.Fmt("Pos: {}\n", position); } else /* fallback if no detail was requested or no detail was available */ diff --git a/src/queue/PlaylistState.cxx b/src/queue/PlaylistState.cxx index a34ddd1404..d1785dccaf 100644 --- a/src/queue/PlaylistState.cxx +++ b/src/queue/PlaylistState.cxx @@ -60,33 +60,33 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist, default: os.Write(PLAYLIST_STATE_FILE_STATE_PLAY "\n"); } - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_CURRENT "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_CURRENT "{}\n", playlist.queue.OrderToPosition(playlist.current)); - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_TIME "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_TIME "{}\n", player_status.elapsed_time.ToDoubleS()); } else { os.Write(PLAYLIST_STATE_FILE_STATE_STOP "\n"); if (playlist.current >= 0) - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_CURRENT "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_CURRENT "{}\n", playlist.queue.OrderToPosition(playlist.current)); } - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_RANDOM "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_RANDOM "{}\n", (unsigned)playlist.queue.random); - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_REPEAT "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_REPEAT "{}\n", (unsigned)playlist.queue.repeat); - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_SINGLE "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_SINGLE "{}\n", SingleToString(playlist.queue.single)); - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_CONSUME "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_CONSUME "{}\n", ConsumeToString(playlist.queue.consume)); - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_CROSSFADE "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_CROSSFADE "{}\n", pc.GetCrossFade().count()); - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_MIXRAMPDB "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_MIXRAMPDB "{}\n", pc.GetMixRampDb()); - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_MIXRAMPDELAY "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_MIXRAMPDELAY "{}\n", pc.GetMixRampDelay().count()); - os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_LOADED_PLAYLIST "{}\n"), + os.Fmt(PLAYLIST_STATE_FILE_LOADED_PLAYLIST "{}\n", playlist.GetLastLoadedPlaylist()); os.Write(PLAYLIST_STATE_FILE_PLAYLIST_BEGIN "\n"); queue_save(os, playlist.queue); diff --git a/src/queue/Print.cxx b/src/queue/Print.cxx index 80418b6a7e..9ef70311f9 100644 --- a/src/queue/Print.cxx +++ b/src/queue/Print.cxx @@ -29,12 +29,12 @@ queue_print_song_info(Response &r, const Queue &queue, unsigned position) { song_print_info(r, queue.Get(position)); - r.Fmt(FMT_STRING("Pos: {}\nId: {}\n"), + r.Fmt("Pos: {}\nId: {}\n", position, queue.PositionToId(position)); uint8_t priority = queue.GetPriorityAtPosition(position); if (priority != 0) - r.Fmt(FMT_STRING("Prio: {}\n"), priority); + r.Fmt("Prio: {}\n", priority); } void @@ -56,7 +56,7 @@ queue_print_uris(Response &r, const Queue &queue, assert(end <= queue.GetLength()); for (unsigned i = start; i < end; ++i) { - r.Fmt(FMT_STRING("{}:"), i); + r.Fmt("{}:", i); song_print_uri(r, queue.Get(i)); } } @@ -84,7 +84,7 @@ queue_print_changes_position(Response &r, const Queue &queue, for (unsigned i = start; i < end; i++) if (queue.IsNewerAtPosition(i, version)) - r.Fmt(FMT_STRING("cpos: {}\nId: {}\n"), + r.Fmt("cpos: {}\nId: {}\n", i, queue.PositionToId(i)); } diff --git a/src/queue/Save.cxx b/src/queue/Save.cxx index e049bdfbeb..fd8d9b557c 100644 --- a/src/queue/Save.cxx +++ b/src/queue/Save.cxx @@ -24,7 +24,7 @@ static void queue_save_database_song(BufferedOutputStream &os, int idx, const DetachedSong &song) { - os.Fmt(FMT_STRING("{}:{}\n"), idx, song.GetURI()); + os.Fmt("{}:{}\n", idx, song.GetURI()); } static void @@ -53,7 +53,7 @@ queue_save(BufferedOutputStream &os, const Queue &queue) for (unsigned i = 0; i < queue.GetLength(); i++) { uint8_t prio = queue.GetPriorityAtPosition(i); if (prio != 0) - os.Fmt(FMT_STRING(PRIO_LABEL "{}\n"), prio); + os.Fmt(PRIO_LABEL "{}\n", prio); queue_save_song(os, i, queue.Get(i)); } diff --git a/src/song/PrioritySongFilter.cxx b/src/song/PrioritySongFilter.cxx index 513a86d74c..1805f2a4fa 100644 --- a/src/song/PrioritySongFilter.cxx +++ b/src/song/PrioritySongFilter.cxx @@ -11,7 +11,7 @@ std::string PrioritySongFilter::ToExpression() const noexcept { - return fmt::format(FMT_STRING("(prio >= {})"), value); + return fmt::format("(prio >= {})", value); } bool diff --git a/src/storage/StorageState.cxx b/src/storage/StorageState.cxx index b902d0ecbd..c1b4308f8d 100644 --- a/src/storage/StorageState.cxx +++ b/src/storage/StorageState.cxx @@ -38,10 +38,10 @@ storage_state_save(BufferedOutputStream &os, const Instance &instance) if (uri.empty() || StringIsEmpty(mount_uri)) return; - os.Fmt(FMT_STRING(MOUNT_STATE_BEGIN "\n" - MOUNT_STATE_STORAGE_URI "{}\n" - MOUNT_STATE_MOUNTED_URL "{}\n" - MOUNT_STATE_END "\n"), + os.Fmt(MOUNT_STATE_BEGIN "\n" + MOUNT_STATE_STORAGE_URI "{}\n" + MOUNT_STATE_MOUNTED_URL "{}\n" + MOUNT_STATE_END "\n", mount_uri, uri); }; @@ -80,7 +80,7 @@ storage_state_restore(const char *line, LineReader &file, return true; if (url.empty() || uri.empty()) { - LogError(storage_domain, "Missing value in mountpoint state."); + LogError(storage_domain, "Missing value in mountpoint state."); return true; }