Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
0440c41c
Commit
0440c41c
authored
May 21, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client/Response: add method Fmt() based on libfmt
parent
a9c704b7
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
242 additions
and
196 deletions
+242
-196
SongPrint.cxx
src/SongPrint.cxx
+23
-20
Stats.cxx
src/Stats.cxx
+16
-14
TagPrint.cxx
src/TagPrint.cxx
+9
-8
TimePrint.cxx
src/TimePrint.cxx
+3
-1
Idle.cxx
src/client/Idle.cxx
+3
-1
Response.cxx
src/client/Response.cxx
+11
-5
Response.hxx
src/client/Response.hxx
+20
-0
AllCommands.cxx
src/command/AllCommands.cxx
+4
-2
FileCommands.cxx
src/command/FileCommands.cxx
+11
-29
FingerprintCommands.cxx
src/command/FingerprintCommands.cxx
+4
-2
MessageCommands.cxx
src/command/MessageCommands.cxx
+5
-3
NeighborCommands.cxx
src/command/NeighborCommands.cxx
+6
-4
OtherCommands.cxx
src/command/OtherCommands.cxx
+8
-6
PartitionCommands.cxx
src/command/PartitionCommands.cxx
+3
-1
PlayerCommands.cxx
src/command/PlayerCommands.cxx
+50
-48
PlaylistCommands.cxx
src/command/PlaylistCommands.cxx
+3
-1
QueueCommands.cxx
src/command/QueueCommands.cxx
+3
-1
StorageCommands.cxx
src/command/StorageCommands.cxx
+9
-17
Count.cxx
src/db/Count.cxx
+5
-3
DatabasePrint.cxx
src/db/DatabasePrint.cxx
+12
-10
meson.build
src/db/meson.build
+1
-0
DecoderPrint.cxx
src/decoder/DecoderPrint.cxx
+5
-3
ls.cxx
src/ls.cxx
+3
-2
Print.cxx
src/output/Print.cxx
+11
-8
meson.build
src/output/meson.build
+3
-0
QueuePrint.cxx
src/queue/QueuePrint.cxx
+8
-6
Print.cxx
src/sticker/Print.cxx
+3
-1
No files found.
src/SongPrint.cxx
View file @
0440c41c
...
...
@@ -27,6 +27,8 @@
#include "time/ChronoUtil.hxx"
#include "util/UriUtil.hxx"
#include <fmt/format.h>
#define SONG_FILE "file: "
static
void
...
...
@@ -42,14 +44,15 @@ song_print_uri(Response &r, const char *uri, bool base) noexcept
uri
=
allocated
.
c_str
();
}
r
.
F
ormat
(
SONG_FILE
"%s
\n
"
,
uri
);
r
.
F
mt
(
FMT_STRING
(
SONG_FILE
"{}
\n
"
)
,
uri
);
}
void
song_print_uri
(
Response
&
r
,
const
LightSong
&
song
,
bool
base
)
noexcept
{
if
(
!
base
&&
song
.
directory
!=
nullptr
)
r
.
Format
(
SONG_FILE
"%s/%s
\n
"
,
song
.
directory
,
song
.
uri
);
r
.
Fmt
(
FMT_STRING
(
SONG_FILE
"{}/{}
\n
"
),
song
.
directory
,
song
.
uri
);
else
song_print_uri
(
r
,
song
.
uri
,
base
);
}
...
...
@@ -67,15 +70,15 @@ PrintRange(Response &r, SongTime start_time, SongTime end_time) noexcept
const
unsigned
end_ms
=
end_time
.
ToMS
();
if
(
end_ms
>
0
)
r
.
F
ormat
(
"Range: %u.%03u-%u.%03u
\n
"
,
start_ms
/
1000
,
start_ms
%
1000
,
end_ms
/
1000
,
end_ms
%
1000
);
r
.
F
mt
(
FMT_STRING
(
"Range: {}.{:03}-{}.{:03}
\n
"
)
,
start_ms
/
1000
,
start_ms
%
1000
,
end_ms
/
1000
,
end_ms
%
1000
);
else
if
(
start_ms
>
0
)
r
.
F
ormat
(
"Range: %u.%03u-
\n
"
,
start_ms
/
1000
,
start_ms
%
1000
);
r
.
F
mt
(
FMT_STRING
(
"Range: {}.{:03}-
\n
"
)
,
start_ms
/
1000
,
start_ms
%
1000
);
}
void
...
...
@@ -89,16 +92,16 @@ song_print_info(Response &r, const LightSong &song, bool base) noexcept
time_print
(
r
,
"Last-Modified"
,
song
.
mtime
);
if
(
song
.
audio_format
.
IsDefined
())
r
.
F
ormat
(
"Format: %s
\n
"
,
ToString
(
song
.
audio_format
).
c_str
(
));
r
.
F
mt
(
FMT_STRING
(
"Format: {}
\n
"
),
ToString
(
song
.
audio_format
));
tag_print_values
(
r
,
song
.
tag
);
const
auto
duration
=
song
.
GetDuration
();
if
(
!
duration
.
IsNegative
())
r
.
F
ormat
(
"Time: %i
\n
"
"duration: %1.3f
\n
"
,
duration
.
RoundS
(),
duration
.
ToDoubleS
());
r
.
F
mt
(
FMT_STRING
(
"Time: {}
\n
"
"duration: {:1.3}
\n
"
)
,
duration
.
RoundS
(),
duration
.
ToDoubleS
());
}
void
...
...
@@ -112,14 +115,14 @@ song_print_info(Response &r, const DetachedSong &song, bool base) noexcept
time_print
(
r
,
"Last-Modified"
,
song
.
GetLastModified
());
if
(
const
auto
&
f
=
song
.
GetAudioFormat
();
f
.
IsDefined
())
r
.
F
ormat
(
"Format: %s
\n
"
,
ToString
(
f
).
c_str
(
));
r
.
F
mt
(
FMT_STRING
(
"Format: {}
\n
"
),
ToString
(
f
));
tag_print_values
(
r
,
song
.
GetTag
());
const
auto
duration
=
song
.
GetDuration
();
if
(
!
duration
.
IsNegative
())
r
.
F
ormat
(
"Time: %i
\n
"
"duration: %1.3f
\n
"
,
duration
.
RoundS
(),
duration
.
ToDoubleS
());
r
.
F
mt
(
FMT_STRING
(
"Time: {}
\n
"
"duration: {:1.3}
\n
"
)
,
duration
.
RoundS
(),
duration
.
ToDoubleS
());
}
src/Stats.cxx
View file @
0440c41c
...
...
@@ -34,6 +34,8 @@
#include "system/Clock.hxx"
#endif
#include <fmt/format.h>
#include <chrono>
#ifndef _WIN32
...
...
@@ -97,19 +99,19 @@ db_stats_print(Response &r, const Database &db)
unsigned
total_duration_s
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
seconds
>
(
stats
.
total_duration
).
count
();
r
.
F
ormat
(
"artists: %u
\n
"
"albums: %u
\n
"
"songs: %u
\n
"
"db_playtime: %u
\n
"
,
stats
.
artist_count
,
stats
.
album_count
,
stats
.
song_count
,
total_duration_s
);
r
.
F
mt
(
FMT_STRING
(
"artists: {}
\n
"
"albums: {}
\n
"
"songs: {}
\n
"
"db_playtime: {}
\n
"
)
,
stats
.
artist_count
,
stats
.
album_count
,
stats
.
song_count
,
total_duration_s
);
const
auto
update_stamp
=
db
.
GetUpdateStamp
();
if
(
!
IsNegative
(
update_stamp
))
r
.
F
ormat
(
"db_update: %lu
\n
"
,
(
unsigned
long
)
std
::
chrono
::
system_clock
::
to_time_t
(
update_stamp
));
r
.
F
mt
(
FMT_STRING
(
"db_update: {}
\n
"
)
,
std
::
chrono
::
system_clock
::
to_time_t
(
update_stamp
));
}
#endif
...
...
@@ -123,10 +125,10 @@ stats_print(Response &r, const Partition &partition)
const
auto
uptime
=
std
::
chrono
::
steady_clock
::
now
()
-
start_time
;
#endif
r
.
F
ormat
(
"uptime: %u
\n
"
"playtime: %lu
\n
"
,
(
unsigned
)
std
::
chrono
::
duration_cast
<
std
::
chrono
::
seconds
>
(
uptime
).
count
(),
lround
(
partition
.
pc
.
GetTotalPlayTime
().
count
()));
r
.
F
mt
(
FMT_STRING
(
"uptime: {}
\n
"
"playtime: {}
\n
"
)
,
std
::
chrono
::
duration_cast
<
std
::
chrono
::
seconds
>
(
uptime
).
count
(),
lround
(
partition
.
pc
.
GetTotalPlayTime
().
count
()));
#ifdef ENABLE_DATABASE
const
Database
*
db
=
partition
.
instance
.
GetDatabase
();
...
...
src/TagPrint.cxx
View file @
0440c41c
...
...
@@ -23,26 +23,27 @@
#include "client/Response.hxx"
#include "util/StringView.hxx"
#include <fmt/format.h>
void
tag_print_types
(
Response
&
r
)
noexcept
{
const
auto
tag_mask
=
global_tag_mask
&
r
.
GetTagMask
();
for
(
unsigned
i
=
0
;
i
<
TAG_NUM_OF_ITEM_TYPES
;
i
++
)
if
(
tag_mask
.
Test
(
TagType
(
i
)))
r
.
F
ormat
(
"tagtype: %s
\n
"
,
tag_item_names
[
i
]);
r
.
F
mt
(
FMT_STRING
(
"tagtype: {}
\n
"
)
,
tag_item_names
[
i
]);
}
void
tag_print
(
Response
&
r
,
TagType
type
,
StringView
value
)
noexcept
{
r
.
Format
(
"%s: %.*s
\n
"
,
tag_item_names
[
type
],
int
(
value
.
size
),
value
.
data
);
r
.
Fmt
(
FMT_STRING
(
"{}: {}
\n
"
),
tag_item_names
[
type
],
value
);
}
void
tag_print
(
Response
&
r
,
TagType
type
,
const
char
*
value
)
noexcept
{
r
.
F
ormat
(
"%s: %s
\n
"
,
tag_item_names
[
type
],
value
);
r
.
F
mt
(
FMT_STRING
(
"{}: {}
\n
"
)
,
tag_item_names
[
type
],
value
);
}
void
...
...
@@ -58,10 +59,10 @@ void
tag_print
(
Response
&
r
,
const
Tag
&
tag
)
noexcept
{
if
(
!
tag
.
duration
.
IsNegative
())
r
.
F
ormat
(
"Time: %i
\n
"
"duration: %1.3f
\n
"
,
tag
.
duration
.
RoundS
(),
tag
.
duration
.
ToDoubleS
());
r
.
F
mt
(
FMT_STRING
(
"Time: {}
\n
"
"duration: {:1.3}
\n
"
)
,
tag
.
duration
.
RoundS
(),
tag
.
duration
.
ToDoubleS
());
tag_print_values
(
r
,
tag
);
}
src/TimePrint.cxx
View file @
0440c41c
...
...
@@ -21,6 +21,8 @@
#include "client/Response.hxx"
#include "time/ISO8601.hxx"
#include <fmt/format.h>
void
time_print
(
Response
&
r
,
const
char
*
name
,
std
::
chrono
::
system_clock
::
time_point
t
)
...
...
@@ -33,5 +35,5 @@ time_print(Response &r, const char *name,
return
;
}
r
.
F
ormat
(
"%s: %s
\n
"
,
name
,
s
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"{}: {}
\n
"
),
name
,
s
);
}
src/client/Idle.cxx
View file @
0440c41c
...
...
@@ -22,6 +22,8 @@
#include "Response.hxx"
#include "Idle.hxx"
#include <fmt/format.h>
#include <cassert>
static
void
...
...
@@ -30,7 +32,7 @@ WriteIdleResponse(Response &r, unsigned flags) noexcept
const
char
*
const
*
idle_names
=
idle_get_names
();
for
(
unsigned
i
=
0
;
idle_names
[
i
];
++
i
)
{
if
(
flags
&
(
1
<<
i
))
r
.
F
ormat
(
"changed: %s
\n
"
,
idle_names
[
i
]);
r
.
F
mt
(
FMT_STRING
(
"changed: {}
\n
"
)
,
idle_names
[
i
]);
}
r
.
Write
(
"OK
\n
"
);
...
...
src/client/Response.cxx
View file @
0440c41c
...
...
@@ -22,6 +22,8 @@
#include "util/FormatString.hxx"
#include "util/AllocatedString.hxx"
#include <fmt/format.h>
TagMask
Response
::
GetTagMask
()
const
noexcept
{
...
...
@@ -57,16 +59,20 @@ Response::Format(const char *fmt, ...) noexcept
}
bool
Response
::
VFmt
(
fmt
::
string_view
format_str
,
fmt
::
format_args
args
)
noexcept
{
fmt
::
memory_buffer
buffer
;
fmt
::
vformat_to
(
buffer
,
format_str
,
args
);
return
Write
(
buffer
.
data
(),
buffer
.
size
());
}
bool
Response
::
WriteBinary
(
ConstBuffer
<
void
>
payload
)
noexcept
{
assert
(
payload
.
size
<=
client
.
binary_limit
);
return
#ifdef _WIN32
Format
(
"binary: %lu
\n
"
,
(
unsigned
long
)
payload
.
size
)
&&
#else
Format
(
"binary: %zu
\n
"
,
payload
.
size
)
&&
#endif
Fmt
(
"binary: {}
\n
"
,
payload
.
size
)
&&
Write
(
payload
.
data
,
payload
.
size
)
&&
Write
(
"
\n
"
);
}
...
...
src/client/Response.hxx
View file @
0440c41c
...
...
@@ -23,6 +23,11 @@
#include "protocol/Ack.hxx"
#include "util/Compiler.h"
#include <fmt/core.h>
#if FMT_VERSION < 70000
#include <fmt/format.h>
#endif
#include <cstdarg>
#include <cstddef>
...
...
@@ -79,6 +84,21 @@ public:
gcc_printf
(
2
,
3
)
bool
Format
(
const
char
*
fmt
,
...)
noexcept
;
bool
VFmt
(
fmt
::
string_view
format_str
,
fmt
::
format_args
args
)
noexcept
;
template
<
typename
S
,
typename
...
Args
>
bool
Fmt
(
const
S
&
format_str
,
Args
&&
...
args
)
noexcept
{
#if FMT_VERSION >= 70000
return
VFmt
(
fmt
::
to_string_view
(
format_str
),
fmt
::
make_args_checked
<
Args
...
>
(
format_str
,
args
...));
#else
/* expensive fallback for older libfmt versions */
const
auto
result
=
fmt
::
format
(
format_str
,
args
...);
return
Write
(
result
.
data
(),
result
.
size
());
#endif
}
/**
* Write a binary chunk; this writes the "binary" line, the
* given chunk and the trailing newline.
...
...
src/command/AllCommands.cxx
View file @
0440c41c
...
...
@@ -48,6 +48,8 @@
#include "StickerCommands.hxx"
#endif
#include <fmt/format.h>
#include <cassert>
#include <iterator>
...
...
@@ -253,7 +255,7 @@ PrintAvailableCommands(Response &r, const Partition &partition,
if
(
cmd
->
permission
==
(
permission
&
cmd
->
permission
)
&&
command_available
(
partition
,
cmd
))
r
.
F
ormat
(
"command: %s
\n
"
,
cmd
->
cmd
);
r
.
F
mt
(
FMT_STRING
(
"command: {}
\n
"
)
,
cmd
->
cmd
);
}
return
CommandResult
::
OK
;
...
...
@@ -266,7 +268,7 @@ PrintUnavailableCommands(Response &r, unsigned permission) noexcept
const
struct
command
*
cmd
=
&
i
;
if
(
cmd
->
permission
!=
(
permission
&
cmd
->
permission
))
r
.
F
ormat
(
"command: %s
\n
"
,
cmd
->
cmd
);
r
.
F
mt
(
FMT_STRING
(
"command: {}
\n
"
)
,
cmd
->
cmd
);
}
return
CommandResult
::
OK
;
...
...
src/command/FileCommands.cxx
View file @
0440c41c
...
...
@@ -17,8 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define __STDC_FORMAT_MACROS
/* for PRIu64 */
#include "config.h"
#include "FileCommands.hxx"
#include "Request.hxx"
...
...
@@ -43,9 +41,10 @@
#include "thread/Mutex.hxx"
#include "Log.hxx"
#include <fmt/format.h>
#include <algorithm>
#include <cassert>
#include <cinttypes>
/* for PRIu64 */
gcc_pure
static
bool
...
...
@@ -61,13 +60,6 @@ skip_path(Path name_fs) noexcept
return
name_fs
.
HasNewline
();
}
#if defined(_WIN32) && GCC_CHECK_VERSION(4,6)
/* PRIu64 causes bogus compiler warning */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat"
#pragma GCC diagnostic ignored "-Wformat-extra-args"
#endif
CommandResult
handle_listfiles_local
(
Response
&
r
,
Path
path_fs
)
{
...
...
@@ -88,12 +80,12 @@ handle_listfiles_local(Response &r, Path path_fs)
continue
;
if
(
fi
.
IsRegular
())
r
.
F
ormat
(
"file: %s
\n
"
"size: %"
PRIu64
"
\n
"
,
name_utf8
.
c_str
()
,
fi
.
GetSize
());
r
.
F
mt
(
FMT_STRING
(
"file: {}
\n
"
"size: {}
\n
"
)
,
name_utf8
,
fi
.
GetSize
());
else
if
(
fi
.
IsDirectory
())
r
.
F
ormat
(
"directory: %s
\n
"
,
name_utf8
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"directory: {}
\n
"
),
name_utf8
);
else
continue
;
...
...
@@ -135,9 +127,7 @@ public:
void
OnPair
(
StringView
key
,
StringView
value
)
noexcept
override
{
if
(
IsValidName
(
key
)
&&
IsValidValue
(
value
))
response
.
Format
(
"%.*s: %.*s
\n
"
,
int
(
key
.
size
),
key
.
data
,
int
(
value
.
size
),
value
.
data
);
response
.
Fmt
(
FMT_STRING
(
"{}: {}
\n
"
),
key
,
value
);
}
};
...
...
@@ -228,11 +218,7 @@ read_stream_art(Response &r, const char *uri, size_t offset)
read_size
=
is
->
Read
(
lock
,
buffer
.
get
(),
buffer_size
);
}
#ifdef _WIN32
r
.
Format
(
"size: %lu
\n
"
,
(
unsigned
long
)
art_file_size
);
#else
r
.
Format
(
"size: %"
PRIoffset
"
\n
"
,
art_file_size
);
#endif
r
.
Fmt
(
FMT_STRING
(
"size: {}
\n
"
),
art_file_size
);
r
.
WriteBinary
({
buffer
.
get
(),
read_size
});
...
...
@@ -315,14 +301,10 @@ public:
return
;
}
#ifdef _WIN32
response
.
Format
(
"size: %lu
\n
"
,
(
unsigned
long
)
buffer
.
size
);
#else
response
.
Format
(
"size: %zu
\n
"
,
buffer
.
size
);
#endif
response
.
Fmt
(
FMT_STRING
(
"size: {}
\n
"
),
buffer
.
size
);
if
(
mime_type
!=
nullptr
)
response
.
F
ormat
(
"type: %s
\n
"
,
mime_type
);
response
.
F
mt
(
FMT_STRING
(
"type: {}
\n
"
)
,
mime_type
);
buffer
.
size
-=
offset
;
...
...
src/command/FingerprintCommands.cxx
View file @
0440c41c
...
...
@@ -37,6 +37,8 @@
#include "util/MimeType.hxx"
#include "util/UriExtract.hxx"
#include <fmt/format.h>
class
GetChromaprintCommand
final
:
public
ThreadBackgroundCommand
,
ChromaprintDecoderClient
,
InputStreamHandler
{
...
...
@@ -60,8 +62,8 @@ protected:
void
Run
()
override
;
void
SendResponse
(
Response
&
r
)
noexcept
override
{
r
.
F
ormat
(
"chromaprint: %s
\n
"
,
GetFingerprint
().
c_str
());
r
.
F
mt
(
FMT_STRING
(
"chromaprint: {}
\n
"
)
,
GetFingerprint
());
}
void
CancelThread
()
noexcept
override
{
...
...
src/command/MessageCommands.cxx
View file @
0440c41c
...
...
@@ -25,6 +25,8 @@
#include "util/ConstBuffer.hxx"
#include "Partition.hxx"
#include <fmt/format.h>
#include <cassert>
#include <set>
#include <string>
...
...
@@ -85,7 +87,7 @@ handle_channels(Client &client, [[maybe_unused]] Request args, Response &r)
}
for
(
const
auto
&
channel
:
channels
)
r
.
F
ormat
(
"channel: %s
\n
"
,
channel
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"channel: {}
\n
"
),
channel
);
return
CommandResult
::
OK
;
}
...
...
@@ -97,8 +99,8 @@ handle_read_messages(Client &client,
assert
(
args
.
empty
());
client
.
ConsumeMessages
([
&
r
](
const
auto
&
msg
){
r
.
F
ormat
(
"channel: %s
\n
message: %s
\n
"
,
msg
.
GetChannel
(),
msg
.
GetMessage
());
r
.
F
mt
(
FMT_STRING
(
"channel: {}
\n
message: {}
\n
"
)
,
msg
.
GetChannel
(),
msg
.
GetMessage
());
});
return
CommandResult
::
OK
;
...
...
src/command/NeighborCommands.cxx
View file @
0440c41c
...
...
@@ -25,6 +25,8 @@
#include "neighbor/Glue.hxx"
#include "neighbor/Info.hxx"
#include <fmt/format.h>
#include <string>
bool
...
...
@@ -44,9 +46,9 @@ handle_listneighbors(Client &client, [[maybe_unused]] Request args, Response &r)
}
for
(
const
auto
&
i
:
neighbors
->
GetList
())
r
.
F
ormat
(
"neighbor: %s
\n
"
"name: %s
\n
"
,
i
.
uri
.
c_str
()
,
i
.
display_name
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"neighbor: {}
\n
"
"name: {}
\n
"
)
,
i
.
uri
,
i
.
display_name
);
return
CommandResult
::
OK
;
}
src/command/OtherCommands.cxx
View file @
0440c41c
...
...
@@ -55,13 +55,15 @@
#include "db/update/Service.hxx"
#endif
#include <fmt/format.h>
#include <cassert>
static
void
print_spl_list
(
Response
&
r
,
const
PlaylistVector
&
list
)
{
for
(
const
auto
&
i
:
list
)
{
r
.
F
ormat
(
"playlist: %s
\n
"
,
i
.
name
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"playlist: {}
\n
"
),
i
.
name
);
if
(
!
IsNegative
(
i
.
mtime
))
time_print
(
r
,
"Last-Modified"
,
i
.
mtime
);
...
...
@@ -72,7 +74,7 @@ CommandResult
handle_urlhandlers
(
Client
&
client
,
[[
maybe_unused
]]
Request
args
,
Response
&
r
)
{
if
(
client
.
IsLocal
())
r
.
Format
(
"handler: file://
\n
"
);
r
.
Write
(
"handler: file://
\n
"
);
print_supported_uri_schemes
(
r
);
return
CommandResult
::
OK
;
}
...
...
@@ -248,7 +250,7 @@ handle_update(Response &r, UpdateService &update,
const
char
*
uri_utf8
,
bool
discard
)
{
unsigned
ret
=
update
.
Enqueue
(
uri_utf8
,
discard
);
r
.
F
ormat
(
"updating_db: %i
\n
"
,
ret
);
r
.
F
mt
(
FMT_STRING
(
"updating_db: {}
\n
"
)
,
ret
);
return
CommandResult
::
OK
;
}
...
...
@@ -258,7 +260,7 @@ handle_update(Response &r, Database &db,
{
unsigned
id
=
db
.
Update
(
uri_utf8
,
discard
);
if
(
id
>
0
)
{
r
.
F
ormat
(
"updating_db: %i
\n
"
,
id
);
r
.
F
mt
(
FMT_STRING
(
"updating_db: {}
\n
"
)
,
id
);
return
CommandResult
::
OK
;
}
else
{
/* Database::Update() has returned 0 without setting
...
...
@@ -325,7 +327,7 @@ handle_getvol(Client &client, Request, Response &r)
const
auto
volume
=
volume_level_get
(
partition
.
outputs
);
if
(
volume
>=
0
)
r
.
F
ormat
(
"volume: %i
\n
"
,
volume
);
r
.
F
mt
(
FMT_STRING
(
"volume: {}
\n
"
)
,
volume
);
return
CommandResult
::
OK
;
}
...
...
@@ -391,7 +393,7 @@ handle_config(Client &client, [[maybe_unused]] Request args, Response &r)
const
Storage
*
storage
=
client
.
GetStorage
();
if
(
storage
!=
nullptr
)
{
const
auto
path
=
storage
->
MapUTF8
(
""
);
r
.
F
ormat
(
"music_directory: %s
\n
"
,
path
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"music_directory: {}
\n
"
),
path
);
}
#endif
...
...
src/command/PartitionCommands.cxx
View file @
0440c41c
...
...
@@ -27,6 +27,8 @@
#include "client/Response.hxx"
#include "util/CharUtil.hxx"
#include <fmt/format.h>
CommandResult
handle_partition
(
Client
&
client
,
Request
request
,
Response
&
response
)
{
...
...
@@ -46,7 +48,7 @@ CommandResult
handle_listpartitions
(
Client
&
client
,
Request
,
Response
&
r
)
{
for
(
const
auto
&
partition
:
client
.
GetInstance
().
partitions
)
{
r
.
F
ormat
(
"partition: %s
\n
"
,
partition
.
name
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"partition: {}
\n
"
),
partition
.
name
);
}
return
CommandResult
::
OK
;
...
...
src/command/PlayerCommands.cxx
View file @
0440c41c
...
...
@@ -38,6 +38,8 @@
#include "db/update/Service.hxx"
#endif
#include <fmt/format.h>
#define COMMAND_STATUS_STATE "state"
#define COMMAND_STATUS_REPEAT "repeat"
#define COMMAND_STATUS_SINGLE "single"
...
...
@@ -131,60 +133,60 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
const
auto
volume
=
volume_level_get
(
partition
.
outputs
);
if
(
volume
>=
0
)
r
.
F
ormat
(
"volume: %i
\n
"
,
volume
);
r
.
F
ormat
(
COMMAND_STATUS_REPEAT
": %i
\n
"
COMMAND_STATUS_RANDOM
": %i
\n
"
COMMAND_STATUS_SINGLE
": %s
\n
"
COMMAND_STATUS_CONSUME
": %i
\n
"
"partition: %s
\n
"
COMMAND_STATUS_PLAYLIST
": %li
\n
"
COMMAND_STATUS_PLAYLIST_LENGTH
": %i
\n
"
COMMAND_STATUS_MIXRAMPDB
": %f
\n
"
COMMAND_STATUS_STATE
": %s
\n
"
,
playlist
.
GetRepeat
(),
playlist
.
GetRandom
(),
SingleToString
(
playlist
.
GetSingle
()),
playlist
.
GetConsume
(),
partition
.
name
.
c_str
(),
(
unsigned
long
)
playlist
.
GetVersion
(),
playlist
.
GetLength
(),
(
double
)
pc
.
GetMixRampDb
(),
state
);
r
.
F
mt
(
FMT_STRING
(
"volume: {}
\n
"
)
,
volume
);
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_REPEAT
": {}
\n
"
COMMAND_STATUS_RANDOM
": {}
\n
"
COMMAND_STATUS_SINGLE
": {}
\n
"
COMMAND_STATUS_CONSUME
": {}
\n
"
"partition: {}
\n
"
COMMAND_STATUS_PLAYLIST
": {}
\n
"
COMMAND_STATUS_PLAYLIST_LENGTH
": {}
\n
"
COMMAND_STATUS_MIXRAMPDB
": {}
\n
"
COMMAND_STATUS_STATE
": {}
\n
"
)
,
playlist
.
GetRepeat
(),
playlist
.
GetRandom
(),
SingleToString
(
playlist
.
GetSingle
()),
playlist
.
GetConsume
(),
partition
.
name
.
c_str
(),
playlist
.
GetVersion
(),
playlist
.
GetLength
(),
pc
.
GetMixRampDb
(),
state
);
if
(
pc
.
GetCrossFade
()
>
FloatDuration
::
zero
())
r
.
F
ormat
(
COMMAND_STATUS_CROSSFADE
": %lu
\n
"
,
lround
(
pc
.
GetCrossFade
().
count
()));
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_CROSSFADE
": {}
\n
"
)
,
lround
(
pc
.
GetCrossFade
().
count
()));
if
(
pc
.
GetMixRampDelay
()
>
FloatDuration
::
zero
())
r
.
F
ormat
(
COMMAND_STATUS_MIXRAMPDELAY
": %f
\n
"
,
pc
.
GetMixRampDelay
().
count
());
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_MIXRAMPDELAY
": {}
\n
"
)
,
pc
.
GetMixRampDelay
().
count
());
song
=
playlist
.
GetCurrentPosition
();
if
(
song
>=
0
)
{
r
.
F
ormat
(
COMMAND_STATUS_SONG
": %i
\n
"
COMMAND_STATUS_SONGID
": %u
\n
"
,
song
,
playlist
.
PositionToId
(
song
));
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_SONG
": {}
\n
"
COMMAND_STATUS_SONGID
": {}
\n
"
)
,
song
,
playlist
.
PositionToId
(
song
));
}
if
(
player_status
.
state
!=
PlayerState
::
STOP
)
{
r
.
F
ormat
(
COMMAND_STATUS_TIME
": %i:%i
\n
"
"elapsed: %1.3f
\n
"
COMMAND_STATUS_BITRATE
": %u
\n
"
,
player_status
.
elapsed_time
.
RoundS
(),
player_status
.
total_time
.
IsNegative
()
?
0U
:
unsigned
(
player_status
.
total_time
.
RoundS
()),
player_status
.
elapsed_time
.
ToDoubleS
(),
player_status
.
bit_rate
);
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_TIME
": {}:{}
\n
"
"elapsed: {:1.3}
\n
"
COMMAND_STATUS_BITRATE
": {}
\n
"
)
,
player_status
.
elapsed_time
.
RoundS
(),
player_status
.
total_time
.
IsNegative
()
?
0U
:
unsigned
(
player_status
.
total_time
.
RoundS
()),
player_status
.
elapsed_time
.
ToDoubleS
(),
player_status
.
bit_rate
);
if
(
!
player_status
.
total_time
.
IsNegative
())
r
.
F
ormat
(
"duration: %1.3f
\n
"
,
r
.
F
mt
(
FMT_STRING
(
"duration: {:1.3}
\n
"
)
,
player_status
.
total_time
.
ToDoubleS
());
if
(
player_status
.
audio_format
.
IsDefined
())
r
.
F
ormat
(
COMMAND_STATUS_AUDIO
": %s
\n
"
,
ToString
(
player_status
.
audio_format
).
c_str
(
));
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_AUDIO
": {}
\n
"
)
,
ToString
(
player_status
.
audio_format
));
}
#ifdef ENABLE_DATABASE
...
...
@@ -193,23 +195,23 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
?
update_service
->
GetId
()
:
0
;
if
(
updateJobId
!=
0
)
{
r
.
F
ormat
(
COMMAND_STATUS_UPDATING_DB
": %i
\n
"
,
updateJobId
);
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_UPDATING_DB
": {}
\n
"
)
,
updateJobId
);
}
#endif
try
{
pc
.
LockCheckRethrowError
();
}
catch
(...)
{
r
.
F
ormat
(
COMMAND_STATUS_ERROR
": %s
\n
"
,
GetFullMessage
(
std
::
current_exception
()).
c_str
(
));
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_ERROR
": {}
\n
"
)
,
GetFullMessage
(
std
::
current_exception
()
));
}
song
=
playlist
.
GetNextPosition
();
if
(
song
>=
0
)
r
.
F
ormat
(
COMMAND_STATUS_NEXTSONG
": %i
\n
"
COMMAND_STATUS_NEXTSONGID
": %u
\n
"
,
song
,
playlist
.
PositionToId
(
song
));
r
.
F
mt
(
FMT_STRING
(
COMMAND_STATUS_NEXTSONG
": {}
\n
"
COMMAND_STATUS_NEXTSONGID
": {}
\n
"
)
,
song
,
playlist
.
PositionToId
(
song
));
return
CommandResult
::
OK
;
}
...
...
@@ -351,7 +353,7 @@ CommandResult
handle_replay_gain_status
(
Client
&
client
,
[[
maybe_unused
]]
Request
args
,
Response
&
r
)
{
r
.
F
ormat
(
"replay_gain_mode: %s
\n
"
,
ToString
(
client
.
GetPartition
().
replay_gain_mode
));
r
.
F
mt
(
FMT_STRING
(
"replay_gain_mode: {}
\n
"
)
,
ToString
(
client
.
GetPartition
().
replay_gain_mode
));
return
CommandResult
::
OK
;
}
src/command/PlaylistCommands.cxx
View file @
0440c41c
...
...
@@ -42,6 +42,8 @@
#include "util/UriExtract.hxx"
#include "LocateUri.hxx"
#include <fmt/format.h>
bool
playlist_commands_available
()
noexcept
{
...
...
@@ -52,7 +54,7 @@ static void
print_spl_list
(
Response
&
r
,
const
PlaylistVector
&
list
)
{
for
(
const
auto
&
i
:
list
)
{
r
.
F
ormat
(
"playlist: %s
\n
"
,
i
.
name
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"playlist: {}
\n
"
),
i
.
name
);
if
(
!
IsNegative
(
i
.
mtime
))
time_print
(
r
,
"Last-Modified"
,
i
.
mtime
);
...
...
src/command/QueueCommands.cxx
View file @
0440c41c
...
...
@@ -39,6 +39,8 @@
#include "util/StringAPI.hxx"
#include "util/NumberParser.hxx"
#include <fmt/format.h>
#include <limits>
static
void
...
...
@@ -127,7 +129,7 @@ handle_addid(Client &client, Request args, Response &r)
}
}
r
.
F
ormat
(
"Id: %u
\n
"
,
added_id
);
r
.
F
mt
(
FMT_STRING
(
"Id: {}
\n
"
)
,
added_id
);
return
CommandResult
::
OK
;
}
...
...
src/command/StorageCommands.cxx
View file @
0440c41c
...
...
@@ -17,8 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define __STDC_FORMAT_MACROS
/* for PRIu64 */
#include "config.h"
#include "StorageCommands.hxx"
#include "Request.hxx"
...
...
@@ -37,7 +35,8 @@
#include "TimePrint.hxx"
#include "IdleFlags.hxx"
#include <cinttypes>
/* for PRIu64 */
#include <fmt/format.h>
#include <memory>
gcc_pure
...
...
@@ -47,13 +46,6 @@ skip_path(const char *name_utf8) noexcept
return
std
::
strchr
(
name_utf8
,
'\n'
)
!=
nullptr
;
}
#if defined(_WIN32) && GCC_CHECK_VERSION(4,6)
/* PRIu64 causes bogus compiler warning */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat"
#pragma GCC diagnostic ignored "-Wformat-extra-args"
#endif
static
void
handle_listfiles_storage
(
Response
&
r
,
StorageDirectoryReader
&
reader
)
{
...
...
@@ -75,14 +67,14 @@ handle_listfiles_storage(Response &r, StorageDirectoryReader &reader)
continue
;
case
StorageFileInfo
:
:
Type
::
REGULAR
:
r
.
F
ormat
(
"file: %s
\n
"
"size: %"
PRIu64
"
\n
"
,
name_utf8
,
info
.
size
);
r
.
F
mt
(
FMT_STRING
(
"file: {}
\n
"
"size: {}
\n
"
)
,
name_utf8
,
info
.
size
);
break
;
case
StorageFileInfo
:
:
Type
::
DIRECTORY
:
r
.
F
ormat
(
"directory: %s
\n
"
,
name_utf8
);
r
.
F
mt
(
FMT_STRING
(
"directory: {}
\n
"
)
,
name_utf8
);
break
;
}
...
...
@@ -139,7 +131,7 @@ print_storage_uri(Client &client, Response &r, const Storage &storage)
uri
=
std
::
move
(
allocated
);
}
r
.
F
ormat
(
"storage: %s
\n
"
,
uri
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"storage: {}
\n
"
),
uri
);
}
CommandResult
...
...
@@ -155,7 +147,7 @@ handle_listmounts(Client &client, [[maybe_unused]] Request args, Response &r)
const
auto
visitor
=
[
&
client
,
&
r
](
const
char
*
mount_uri
,
const
Storage
&
storage
){
r
.
F
ormat
(
"mount: %s
\n
"
,
mount_uri
);
r
.
F
mt
(
FMT_STRING
(
"mount: {}
\n
"
)
,
mount_uri
);
print_storage_uri
(
client
,
r
,
storage
);
};
...
...
src/db/Count.cxx
View file @
0440c41c
...
...
@@ -27,6 +27,8 @@
#include "tag/VisitFallback.hxx"
#include "TagPrint.hxx"
#include <fmt/format.h>
#include <functional>
#include <map>
...
...
@@ -47,9 +49,9 @@ PrintSearchStats(Response &r, const SearchStats &stats) noexcept
unsigned
total_duration_s
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
seconds
>
(
stats
.
total_duration
).
count
();
r
.
F
ormat
(
"songs: %u
\n
"
"playtime: %u
\n
"
,
stats
.
n_songs
,
total_duration_s
);
r
.
F
mt
(
FMT_STRING
(
"songs: {}
\n
"
"playtime: {}
\n
"
)
,
stats
.
n_songs
,
total_duration_s
);
}
static
void
...
...
src/db/DatabasePrint.cxx
View file @
0440c41c
...
...
@@ -32,6 +32,8 @@
#include "time/ChronoUtil.hxx"
#include "util/RecursiveMap.hxx"
#include <fmt/format.h>
#include <functional>
gcc_pure
...
...
@@ -47,8 +49,8 @@ static void
PrintDirectoryURI
(
Response
&
r
,
bool
base
,
const
LightDirectory
&
directory
)
noexcept
{
r
.
F
ormat
(
"directory: %s
\n
"
,
ApplyBaseFlag
(
directory
.
GetPath
(),
base
));
r
.
F
mt
(
FMT_STRING
(
"directory: {}
\n
"
)
,
ApplyBaseFlag
(
directory
.
GetPath
(),
base
));
}
static
void
...
...
@@ -77,11 +79,11 @@ print_playlist_in_directory(Response &r, bool base,
const
char
*
name_utf8
)
noexcept
{
if
(
base
||
directory
==
nullptr
)
r
.
F
ormat
(
"playlist: %s
\n
"
,
ApplyBaseFlag
(
name_utf8
,
base
));
r
.
F
mt
(
FMT_STRING
(
"playlist: {}
\n
"
)
,
ApplyBaseFlag
(
name_utf8
,
base
));
else
r
.
F
ormat
(
"playlist: %s/%s
\n
"
,
directory
,
name_utf8
);
r
.
F
mt
(
FMT_STRING
(
"playlist: {}/{}
\n
"
)
,
directory
,
name_utf8
);
}
static
void
...
...
@@ -90,10 +92,10 @@ print_playlist_in_directory(Response &r, bool base,
const
char
*
name_utf8
)
noexcept
{
if
(
base
||
directory
==
nullptr
||
directory
->
IsRoot
())
r
.
F
ormat
(
"playlist: %s
\n
"
,
name_utf8
);
r
.
F
mt
(
FMT_STRING
(
"playlist: {}
\n
"
)
,
name_utf8
);
else
r
.
F
ormat
(
"playlist: %s/%s
\n
"
,
directory
->
GetPath
(),
name_utf8
);
r
.
F
mt
(
FMT_STRING
(
"playlist: {}/{}
\n
"
)
,
directory
->
GetPath
(),
name_utf8
);
}
static
void
...
...
@@ -196,7 +198,7 @@ PrintUniqueTags(Response &r, ConstBuffer<TagType> tag_types,
tag_types
.
pop_front
();
for
(
const
auto
&
[
key
,
tag
]
:
map
)
{
r
.
F
ormat
(
"%s: %s
\n
"
,
name
,
key
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"{}: {}
\n
"
),
name
,
key
);
if
(
!
tag_types
.
empty
())
PrintUniqueTags
(
r
,
tag_types
,
tag
);
...
...
src/db/meson.build
View file @
0440c41c
...
...
@@ -55,6 +55,7 @@ db_glue = static_library(
include_directories: inc,
dependencies: [
boost_dep,
fmt_dep,
log_dep,
],
)
...
...
src/decoder/DecoderPrint.cxx
View file @
0440c41c
...
...
@@ -22,6 +22,8 @@
#include "DecoderPlugin.hxx"
#include "client/Response.hxx"
#include <fmt/format.h>
#include <cassert>
#include <functional>
...
...
@@ -33,15 +35,15 @@ decoder_plugin_print(Response &r,
assert
(
plugin
.
name
!=
nullptr
);
r
.
F
ormat
(
"plugin: %s
\n
"
,
plugin
.
name
);
r
.
F
mt
(
FMT_STRING
(
"plugin: {}
\n
"
)
,
plugin
.
name
);
if
(
plugin
.
suffixes
!=
nullptr
)
for
(
p
=
plugin
.
suffixes
;
*
p
!=
nullptr
;
++
p
)
r
.
F
ormat
(
"suffix: %s
\n
"
,
*
p
);
r
.
F
mt
(
FMT_STRING
(
"suffix: {}
\n
"
)
,
*
p
);
if
(
plugin
.
mime_types
!=
nullptr
)
for
(
p
=
plugin
.
mime_types
;
*
p
!=
nullptr
;
++
p
)
r
.
F
ormat
(
"mime_type: %s
\n
"
,
*
p
);
r
.
F
mt
(
FMT_STRING
(
"mime_type: {}
\n
"
)
,
*
p
);
}
void
...
...
src/ls.cxx
View file @
0440c41c
...
...
@@ -26,8 +26,9 @@
#include "client/Response.hxx"
#include "util/UriExtract.hxx"
#include <
cassert
>
#include <
fmt/format.h
>
#include <cassert>
#include <string>
void
print_supported_uri_schemes_to_fp
(
FILE
*
fp
)
...
...
@@ -67,7 +68,7 @@ print_supported_uri_schemes(Response &r)
});
for
(
const
auto
&
protocol
:
protocols
)
{
r
.
F
ormat
(
"handler: %s
\n
"
,
protocol
.
c_str
()
);
r
.
F
mt
(
FMT_STRING
(
"handler: {}
\n
"
),
protocol
);
}
}
...
...
src/output/Print.cxx
View file @
0440c41c
...
...
@@ -26,21 +26,24 @@
#include "MultipleOutputs.hxx"
#include "client/Response.hxx"
#include <fmt/format.h>
void
printAudioDevices
(
Response
&
r
,
const
MultipleOutputs
&
outputs
)
{
for
(
unsigned
i
=
0
,
n
=
outputs
.
Size
();
i
!=
n
;
++
i
)
{
const
auto
&
ao
=
outputs
.
Get
(
i
);
r
.
F
ormat
(
"outputid: %u
\n
"
"outputname: %s
\n
"
"plugin: %s
\n
"
"outputenabled: %i
\n
"
,
i
,
ao
.
GetName
(),
ao
.
GetPluginName
(),
ao
.
IsEnabled
());
r
.
F
mt
(
FMT_STRING
(
"outputid: {}
\n
"
"outputname: {}
\n
"
"plugin: {}
\n
"
"outputenabled: {}
\n
"
)
,
i
,
ao
.
GetName
(),
ao
.
GetPluginName
(),
ao
.
IsEnabled
());
for
(
const
auto
&
[
attribute
,
value
]
:
ao
.
GetAttributes
())
r
.
Format
(
"attribute: %s=%s
\n
"
,
attribute
.
c_str
(),
value
.
c_str
());
r
.
Fmt
(
FMT_STRING
(
"attribute: {}={}
\n
"
),
attribute
,
value
);
}
}
src/output/meson.build
View file @
0440c41c
...
...
@@ -35,6 +35,9 @@ output_glue = static_library(
'Finish.cxx',
'Init.cxx',
include_directories: inc,
dependencies: [
fmt_dep,
],
)
output_glue_dep = declare_dependency(
...
...
src/queue/QueuePrint.cxx
View file @
0440c41c
...
...
@@ -25,6 +25,8 @@
#include "song/LightSong.hxx"
#include "client/Response.hxx"
#include <fmt/format.h>
/**
* Send detailed information about a range of songs in the queue to a
* client.
...
...
@@ -38,12 +40,12 @@ queue_print_song_info(Response &r, const Queue &queue,
unsigned
position
)
{
song_print_info
(
r
,
queue
.
Get
(
position
));
r
.
F
ormat
(
"Pos: %u
\n
Id: %u
\n
"
,
position
,
queue
.
PositionToId
(
position
));
r
.
F
mt
(
FMT_STRING
(
"Pos: {}
\n
Id: {}
\n
"
)
,
position
,
queue
.
PositionToId
(
position
));
uint8_t
priority
=
queue
.
GetPriorityAtPosition
(
position
);
if
(
priority
!=
0
)
r
.
F
ormat
(
"Prio: %u
\n
"
,
priority
);
r
.
F
mt
(
FMT_STRING
(
"Prio: {}
\n
"
)
,
priority
);
}
void
...
...
@@ -65,7 +67,7 @@ queue_print_uris(Response &r, const Queue &queue,
assert
(
end
<=
queue
.
GetLength
());
for
(
unsigned
i
=
start
;
i
<
end
;
++
i
)
{
r
.
F
ormat
(
"%i:"
,
i
);
r
.
F
mt
(
FMT_STRING
(
"{}:"
)
,
i
);
song_print_uri
(
r
,
queue
.
Get
(
i
));
}
}
...
...
@@ -93,8 +95,8 @@ queue_print_changes_position(Response &r, const Queue &queue,
for
(
unsigned
i
=
start
;
i
<
end
;
i
++
)
if
(
queue
.
IsNewerAtPosition
(
i
,
version
))
r
.
F
ormat
(
"cpos: %i
\n
Id: %i
\n
"
,
i
,
queue
.
PositionToId
(
i
));
r
.
F
mt
(
FMT_STRING
(
"cpos: {}
\n
Id: {}
\n
"
)
,
i
,
queue
.
PositionToId
(
i
));
}
void
...
...
src/sticker/Print.cxx
View file @
0440c41c
...
...
@@ -21,11 +21,13 @@
#include "Sticker.hxx"
#include "client/Response.hxx"
#include <fmt/format.h>
void
sticker_print_value
(
Response
&
r
,
const
char
*
name
,
const
char
*
value
)
{
r
.
F
ormat
(
"sticker: %s=%s
\n
"
,
name
,
value
);
r
.
F
mt
(
FMT_STRING
(
"sticker: {}={}
\n
"
)
,
name
,
value
);
}
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment