lib/fmt: remove even more now-broken uses of FMT_STRING
MPD stopped building since fmt 11.1.0; see <https://github.com/fmtlib/fmt/issues/4304>. The first commit fixing this was 9db7144, followed by 5de0909 (both on the unstable branch). This commit removes what the author believes to be the remaining uses in the MPD codebase.
This commit is contained in:
parent
b24b3c1054
commit
194ecd69e0
src
PlaylistDatabase.cxxPlaylistSave.cxxSongSave.cxxTagPrint.cxxTagSave.cxx
client
command
db/plugins/simple
decoder
lib/icu
mixer
output
playlist
queue
song
storage
@ -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");
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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<IcuConverter>(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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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<std::chrono::seconds>(playtime);
|
||||
r.Fmt(FMT_STRING("playtime: {}\n"), seconds.count());
|
||||
r.Fmt("playtime: {}\n", seconds.count());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
std::string
|
||||
PrioritySongFilter::ToExpression() const noexcept
|
||||
{
|
||||
return fmt::format(FMT_STRING("(prio >= {})"), value);
|
||||
return fmt::format("(prio >= {})", value);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -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"
|
||||
os.Fmt(MOUNT_STATE_BEGIN "\n"
|
||||
MOUNT_STATE_STORAGE_URI "{}\n"
|
||||
MOUNT_STATE_MOUNTED_URL "{}\n"
|
||||
MOUNT_STATE_END "\n"),
|
||||
MOUNT_STATE_END "\n",
|
||||
mount_uri, uri);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user