Skip to content

Commit 194ecd6

Browse files
committed
lib/fmt: remove even more now-broken uses of FMT_STRING
MPD stopped building since fmt 11.1.0; see <fmtlib/fmt#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.
1 parent b24b3c1 commit 194ecd6

21 files changed

+62
-62
lines changed

src/PlaylistDatabase.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ void
1919
playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv)
2020
{
2121
for (const PlaylistInfo &pi : pv) {
22-
os.Fmt(FMT_STRING(PLAYLIST_META_BEGIN "{}\n"), pi.name);
22+
os.Fmt(PLAYLIST_META_BEGIN "{}\n", pi.name);
2323
if (!IsNegative(pi.mtime))
24-
os.Fmt(FMT_STRING("mtime: {}\n"),
24+
os.Fmt("mtime: {}\n",
2525
std::chrono::system_clock::to_time_t(pi.mtime));
2626
os.Write("playlist_end\n");
2727
}

src/PlaylistSave.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ playlist_print_path(BufferedOutputStream &os, const Path path)
2626
"narrow" charset (i.e. CP_ACP) is incapable of storing all
2727
Unicode paths */
2828
try {
29-
os.Fmt(FMT_STRING("{}\n"), path.ToUTF8Throw());
29+
os.Fmt("{}\n", path.ToUTF8Throw());
3030
} catch (...) {
3131
}
3232
#else
33-
os.Fmt(FMT_STRING("{}\n"), path.c_str());
33+
os.Fmt("{}\n", path.c_str());
3434
#endif
3535
}
3636

src/SongSave.cxx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,54 +29,54 @@ static void
2929
range_save(BufferedOutputStream &os, unsigned start_ms, unsigned end_ms)
3030
{
3131
if (end_ms > 0)
32-
os.Fmt(FMT_STRING("Range: {}-{}\n"), start_ms, end_ms);
32+
os.Fmt("Range: {}-{}\n", start_ms, end_ms);
3333
else if (start_ms > 0)
34-
os.Fmt(FMT_STRING("Range: {}-\n"), start_ms);
34+
os.Fmt("Range: {}-\n", start_ms);
3535
}
3636

3737
void
3838
song_save(BufferedOutputStream &os, const Song &song)
3939
{
40-
os.Fmt(FMT_STRING(SONG_BEGIN "{}\n"), song.filename);
40+
os.Fmt(SONG_BEGIN "{}\n", song.filename);
4141

4242
if (!song.target.empty())
43-
os.Fmt(FMT_STRING("Target: {}\n"), song.target);
43+
os.Fmt("Target: {}\n", song.target);
4444

4545
range_save(os, song.start_time.ToMS(), song.end_time.ToMS());
4646

4747
tag_save(os, song.tag);
4848

4949
if (song.audio_format.IsDefined())
50-
os.Fmt(FMT_STRING("Format: {}\n"), song.audio_format);
50+
os.Fmt("Format: {}\n", song.audio_format);
5151

5252
if (song.in_playlist)
5353
os.Write("InPlaylist: yes\n");
5454

5555
if (!IsNegative(song.mtime))
56-
os.Fmt(FMT_STRING(SONG_MTIME ": {}\n"),
56+
os.Fmt(SONG_MTIME ": {}\n",
5757
std::chrono::system_clock::to_time_t(song.mtime));
5858

5959
if (!IsNegative(song.added))
60-
os.Fmt(FMT_STRING(SONG_ADDED ": {}\n"),
60+
os.Fmt(SONG_ADDED ": {}\n",
6161
std::chrono::system_clock::to_time_t(song.added));
6262
os.Write(SONG_END "\n");
6363
}
6464

6565
void
6666
song_save(BufferedOutputStream &os, const DetachedSong &song)
6767
{
68-
os.Fmt(FMT_STRING(SONG_BEGIN "{}\n"), song.GetURI());
68+
os.Fmt(SONG_BEGIN "{}\n", song.GetURI());
6969

7070
range_save(os, song.GetStartTime().ToMS(), song.GetEndTime().ToMS());
7171

7272
tag_save(os, song.GetTag());
7373

7474
if (!IsNegative(song.GetLastModified()))
75-
os.Fmt(FMT_STRING(SONG_MTIME ": {}\n"),
75+
os.Fmt(SONG_MTIME ": {}\n",
7676
std::chrono::system_clock::to_time_t(song.GetLastModified()));
7777

7878
if (!IsNegative(song.GetAdded()))
79-
os.Fmt(FMT_STRING(SONG_ADDED ": {}\n"),
79+
os.Fmt(SONG_ADDED ": {}\n",
8080
std::chrono::system_clock::to_time_t(song.GetAdded()));
8181
os.Write(SONG_END "\n");
8282
}

src/TagPrint.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ tag_print_types_available(Response &r) noexcept
2323
{
2424
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++)
2525
if (global_tag_mask.Test(TagType(i)))
26-
r.Fmt(FMT_STRING("tagtype: {}\n"), tag_item_names[i]);
26+
r.Fmt("tagtype: {}\n", tag_item_names[i]);
2727
}
2828

2929
void
30-
tag_print(Response &r, TagType type, std::string_view value) noexcept
30+
tag_print(Response &r, TagType type, std::string_view _value) noexcept
3131
{
3232
const std::string_view value{_value};
3333
r.Fmt("{}: {}\n", tag_item_names[type], value);

src/TagSave.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ void
1414
tag_save(BufferedOutputStream &os, const Tag &tag)
1515
{
1616
if (!tag.duration.IsNegative())
17-
os.Fmt(FMT_STRING(SONG_TIME "{}\n"), tag.duration.ToDoubleS());
17+
os.Fmt(SONG_TIME "{}\n", tag.duration.ToDoubleS());
1818

1919
if (tag.has_playlist)
2020
os.Write("Playlist: yes\n");
2121

2222
for (const auto &i : tag)
23-
os.Fmt(FMT_STRING("{}: {}\n"),
23+
os.Fmt("{}: {}\n",
2424
tag_item_names[i.type], i.value);
2525
}

src/client/ProtocolFeature.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ protocol_features_print(Client &client, Response &r) noexcept
5050
const auto protocol_feature = client.GetProtocolFeatures();
5151
for (unsigned i = 0; i < PF_NUM_OF_ITEM_TYPES; i++)
5252
if (protocol_feature.Test(ProtocolFeatureType(i)))
53-
r.Fmt(FMT_STRING("feature: {}\n"), protocol_feature_names[i]);
53+
r.Fmt("feature: {}\n", protocol_feature_names[i]);
5454
}
5555

5656
void
5757
protocol_features_print_all(Response &r) noexcept
5858
{
5959
for (unsigned i = 0; i < PF_NUM_OF_ITEM_TYPES; i++)
60-
r.Fmt(FMT_STRING("feature: {}\n"), protocol_feature_names[i]);
60+
r.Fmt("feature: {}\n", protocol_feature_names[i]);
6161
}
6262

6363
ProtocolFeatureType

src/command/OtherCommands.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ handle_config(Client &client, [[maybe_unused]] Request args, Response &r)
377377
#endif
378378

379379
if (const auto spl_path = map_spl_path(); !spl_path.IsNull())
380-
r.Fmt(FMT_STRING("playlist_directory: {}\n"), spl_path.ToUTF8());
380+
r.Fmt("playlist_directory: {}\n", spl_path.ToUTF8());
381381

382382
#ifdef HAVE_PCRE
383383
r.Write("pcre: 1\n");

src/command/StickerCommands.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ handle_sticker(Client &client, Request args, Response &r)
458458
/* set */
459459
if (args.size() == 5 && StringIsEqual(cmd, "set"))
460460
return handler->Set(uri, sticker_name, args[4]);
461-
461+
462462
/* inc */
463463
if (args.size() == 5 && StringIsEqual(cmd, "inc"))
464464
return handler->Inc(uri, sticker_name, args[4]);
@@ -550,6 +550,6 @@ handle_sticker_types(Client &client, Request args, Response &r)
550550
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++)
551551
if (sticker_allowed_tags.Test(TagType(i)) &&
552552
tag_mask.Test(TagType(i)))
553-
r.Fmt(FMT_STRING("stickertype: {}\n"), tag_item_names[i]);
553+
r.Fmt("stickertype: {}\n", tag_item_names[i]);
554554
return CommandResult::OK;
555555
}

src/db/plugins/simple/DatabaseSave.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ void
3737
db_save_internal(BufferedOutputStream &os, const Directory &music_root)
3838
{
3939
os.Write(DIRECTORY_INFO_BEGIN "\n");
40-
os.Fmt(FMT_STRING(DB_FORMAT_PREFIX "{}\n"), DB_FORMAT);
40+
os.Fmt(DB_FORMAT_PREFIX "{}\n", DB_FORMAT);
4141
os.Write(DIRECTORY_MPD_VERSION VERSION "\n");
42-
os.Fmt(FMT_STRING(DIRECTORY_FS_CHARSET "{}\n"), GetFSCharset());
42+
os.Fmt(DIRECTORY_FS_CHARSET "{}\n", GetFSCharset());
4343

4444
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i)
4545
if (IsTagEnabled(i))
46-
os.Fmt(FMT_STRING(DB_TAG_PREFIX "{}\n"),
46+
os.Fmt(DB_TAG_PREFIX "{}\n",
4747
tag_item_names[i]);
4848

4949
os.Write(DIRECTORY_INFO_END "\n");

src/db/plugins/simple/DirectorySave.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ directory_save(BufferedOutputStream &os, const Directory &directory)
6767
if (!directory.IsRoot()) {
6868
const char *type = DeviceToTypeString(directory.device);
6969
if (type != nullptr)
70-
os.Fmt(FMT_STRING(DIRECTORY_TYPE "{}\n"), type);
70+
os.Fmt(DIRECTORY_TYPE "{}\n", type);
7171

7272
if (!IsNegative(directory.mtime))
73-
os.Fmt(FMT_STRING(DIRECTORY_MTIME "{}\n"),
73+
os.Fmt(DIRECTORY_MTIME "{}\n",
7474
std::chrono::system_clock::to_time_t(directory.mtime));
7575

76-
os.Fmt(FMT_STRING(DIRECTORY_BEGIN "{}\n"), directory.GetPath());
76+
os.Fmt(DIRECTORY_BEGIN "{}\n", directory.GetPath());
7777
}
7878

7979
for (const auto &child : directory.children) {
8080
if (child.IsMount())
8181
continue;
8282

83-
os.Fmt(FMT_STRING(DIRECTORY_DIR "{}\n"), child.GetName());
83+
os.Fmt(DIRECTORY_DIR "{}\n", child.GetName());
8484
directory_save(os, child);
8585
}
8686

@@ -90,7 +90,7 @@ directory_save(BufferedOutputStream &os, const Directory &directory)
9090
playlist_vector_save(os, directory.playlists);
9191

9292
if (!directory.IsRoot())
93-
os.Fmt(FMT_STRING(DIRECTORY_END "{}\n"), directory.GetPath());
93+
os.Fmt(DIRECTORY_END "{}\n", directory.GetPath());
9494
}
9595

9696
static bool

0 commit comments

Comments
 (0)