*: let libfmt quote strings

This commit is contained in:
Max Kellermann 2024-04-16 11:06:34 +02:00
parent 39c9e92f42
commit 0c1ecc96a8
71 changed files with 160 additions and 160 deletions

View File

@ -88,7 +88,7 @@ ListenXdgRuntimeDir(ClientListener &listener) noexcept
return true;
} catch (...) {
FmtError(listen_domain,
"Failed to listen on '{}' (not fatal): {}",
"Failed to listen on {:?} (not fatal): {}",
socket_path, std::current_exception());
return false;
}

View File

@ -63,10 +63,10 @@ log_init_file(int line)
out_fd = open_log_file();
if (out_fd < 0) {
#ifdef _WIN32
throw FmtRuntimeError("failed to open log file \"{}\" (config line {})",
throw FmtRuntimeError("failed to open log file {:?} (config line {})",
out_path, line);
#else
throw FmtErrno("failed to open log file \"{}\" (config line {})",
throw FmtErrno("failed to open log file {:?} (config line {})",
out_path, line);
#endif
}
@ -92,7 +92,7 @@ parse_log_level(const char *value)
else if (StringIsEqual(value, "error"))
return LogLevel::ERROR;
else
throw FmtRuntimeError("unknown log level \"{}\"", value);
throw FmtRuntimeError("unknown log level {:?}", value);
}
#endif

View File

@ -49,13 +49,13 @@ PrefetchSong(InputCacheManager &cache, const char *uri) noexcept
if (cache.Contains(uri))
return;
FmtDebug(cache_domain, "Prefetch '{}'", uri);
FmtDebug(cache_domain, "Prefetch {:?}", uri);
try {
cache.Prefetch(uri);
} catch (...) {
FmtError(cache_domain,
"Prefetch '{}' failed: {}",
"Prefetch {:?} failed: {}",
uri, std::current_exception());
}
}

View File

@ -52,7 +52,7 @@ ParsePermission(std::string_view s)
if (s == i->name)
return i->value;
throw FmtRuntimeError("unknown permission \"{}\"", s);
throw FmtRuntimeError("unknown permission {:?}", s);
}
static unsigned
@ -86,7 +86,7 @@ initPermissions(const ConfigData &config)
const auto [password, permissions] =
Split(value, PERMISSION_PASSWORD_CHAR);
if (permissions.data() == nullptr)
throw FmtRuntimeError("\"{}\" not found in password string",
throw FmtRuntimeError("{:?} not found in password string",
PERMISSION_PASSWORD_CHAR);
permission_passwords.emplace(password,

View File

@ -47,7 +47,7 @@ RemoteTagCache::Lookup(const std::string &uri) noexcept
item->scanner->Start();
} catch (...) {
FmtError(remote_tag_cache_domain,
"Failed to scan tags of '{}': {}",
"Failed to scan tags of {:?}: {}",
uri, std::current_exception());
item->scanner.reset();
@ -113,7 +113,7 @@ void
RemoteTagCache::Item::OnRemoteTagError(std::exception_ptr e) noexcept
{
FmtError(remote_tag_cache_domain,
"Failed to scan tags of '{}': {}", uri, e);
"Failed to scan tags of {:?}: {}", uri, e);
scanner.reset();

View File

@ -27,7 +27,7 @@ struct ZzipDir {
explicit ZzipDir(Path path)
:dir(zzip_dir_open(NarrowPath(path), nullptr)) {
if (dir == nullptr)
throw FmtRuntimeError("Failed to open ZIP file {}",
throw FmtRuntimeError("Failed to open ZIP file {:?}",
path);
}
@ -120,11 +120,11 @@ ZzipArchiveFile::OpenStream(const char *pathname,
const auto error = (zzip_error_t)zzip_error(dir->dir);
switch (error) {
case ZZIP_ENOENT:
throw FmtFileNotFound("Failed to open '{}' in ZIP file",
throw FmtFileNotFound("Failed to open {:?} in ZIP file",
pathname);
default:
throw FmtRuntimeError("Failed to open '{}' in ZIP file: {}",
throw FmtRuntimeError("Failed to open {:?} in ZIP file: {}",
pathname,
zzip_strerror(error));
}
@ -145,7 +145,7 @@ ZzipInputStream::Read(std::unique_lock<Mutex> &, void *ptr, size_t read_size)
throw std::runtime_error("zzip_file_read() has failed");
if (nbytes == 0 && !IsEOF())
throw FmtRuntimeError("Unexpected end of file {} at {} of {}",
throw FmtRuntimeError("Unexpected end of file {:?} at {} of {}",
GetURI(), GetOffset(), GetSize());
offset = zzip_tell(file);

View File

@ -22,7 +22,7 @@ Client::ProcessCommandList(bool list_ok,
for (auto &&i : list) {
char *cmd = &*i.begin();
FmtDebug(client_domain, "process command \"{}\"", cmd);
FmtDebug(client_domain, "process command {:?}", cmd);
auto ret = command_process(*this, n++, cmd);
FmtDebug(client_domain, "command returned {}", unsigned(ret));
if (IsExpired())
@ -46,7 +46,7 @@ Client::ProcessLine(char *line) noexcept
letter; this could be a badly routed HTTP
request */
FmtWarning(client_domain,
"[{}] malformed command \"{}\"",
"[{}] malformed command {:?}",
num, line);
return CommandResult::CLOSE;
}
@ -67,7 +67,7 @@ Client::ProcessLine(char *line) noexcept
/* during idle mode, clients must not send anything
except "noidle" */
FmtWarning(client_domain,
"[{}] command \"{}\" during idle",
"[{}] command {:?} during idle",
num, line);
return CommandResult::CLOSE;
}
@ -116,7 +116,7 @@ Client::ProcessLine(char *line) noexcept
const unsigned id = num;
FmtDebug(client_domain,
"[{}] process command \"{}\"",
"[{}] process command {:?}",
id, line);
auto ret = command_process(*this, 0, line);
FmtDebug(client_domain,

View File

@ -320,7 +320,7 @@ command_check_request(const struct command *cmd, Response &r,
{
if (cmd->permission != (permission & cmd->permission)) {
r.FmtError(ACK_ERROR_PERMISSION,
FMT_STRING("you don't have permission for \"{}\""),
FMT_STRING("you don't have permission for {:?}"),
cmd->cmd);
return false;
}
@ -333,17 +333,17 @@ command_check_request(const struct command *cmd, Response &r,
if (min == max && unsigned(max) != args.size()) {
r.FmtError(ACK_ERROR_ARG,
FMT_STRING("wrong number of arguments for \"{}\""),
FMT_STRING("wrong number of arguments for {:?}"),
cmd->cmd);
return false;
} else if (args.size() < unsigned(min)) {
r.FmtError(ACK_ERROR_ARG,
FMT_STRING("too few arguments for \"{}\""),
FMT_STRING("too few arguments for {:?}"),
cmd->cmd);
return false;
} else if (max >= 0 && args.size() > unsigned(max)) {
r.FmtError(ACK_ERROR_ARG,
FMT_STRING("too many arguments for \"{}\""),
FMT_STRING("too many arguments for {:?}"),
cmd->cmd);
return false;
} else
@ -357,7 +357,7 @@ command_checked_lookup(Response &r, unsigned permission,
const struct command *cmd = command_lookup(cmd_name);
if (cmd == nullptr) {
r.FmtError(ACK_ERROR_UNKNOWN,
FMT_STRING("unknown command \"{}\""), cmd_name);
FMT_STRING("unknown command {:?}"), cmd_name);
return nullptr;
}

View File

@ -325,7 +325,7 @@ handle_list(Client &client, Request args, Response &r)
/* for compatibility with < 0.12.0 */
if (tagType != TAG_ALBUM) {
r.FmtError(ACK_ERROR_ARG,
FMT_STRING("should be \"{}\" for 3 arguments"),
FMT_STRING("should be {:?} for 3 arguments"),
tag_item_names[TAG_ALBUM]);
return CommandResult::ERROR;
}

View File

@ -38,7 +38,7 @@ public:
ValidateUri(uri).c_str(),
name);
if (value.empty()) {
response.FmtError(ACK_ERROR_NO_EXIST, "no such sticker: \"{}\"", name);
response.FmtError(ACK_ERROR_NO_EXIST, "no such sticker: {:?}", name);
return CommandResult::ERROR;
}
@ -63,7 +63,7 @@ public:
? sticker_database.Delete(sticker_type, uri)
: sticker_database.DeleteValue(sticker_type, uri, name);
if (!ret) {
response.FmtError(ACK_ERROR_NO_EXIST, "no such sticker: \"{}\"", name);
response.FmtError(ACK_ERROR_NO_EXIST, "no such sticker: {:?}", name);
return CommandResult::ERROR;
}
@ -247,13 +247,13 @@ public:
protected:
std::string ValidateUri(const char *uri) override {
if (tag_type == TAG_NUM_OF_ITEM_TYPES)
throw std::invalid_argument(fmt::format("no such tag: \"{}\"", sticker_type));
throw std::invalid_argument(fmt::format("no such tag: {:?}", sticker_type));
if (!sticker_allowed_tags.Test(tag_type))
throw std::invalid_argument(fmt::format("unsupported tag: \"{}\"", sticker_type));
throw std::invalid_argument(fmt::format("unsupported tag: {:?}", sticker_type));
if (!TagExists(database, tag_type, uri))
throw std::invalid_argument(fmt::format("no such {}: \"{}\"", sticker_type, uri));
throw std::invalid_argument(fmt::format("no such {}: {:?}", sticker_type, uri));
return {uri};
}
@ -283,7 +283,7 @@ protected:
auto normalized = filter.ToExpression();
if (!FilterMatches(database, filter))
throw std::invalid_argument(fmt::format("no matches found: \"{}\"", normalized));
throw std::invalid_argument(fmt::format("no matches found: {:?}", normalized));
return normalized;
}
@ -306,7 +306,7 @@ private:
const ScopeDatabaseLock protect;
if (!playlists.exists(uri))
throw std::invalid_argument(fmt::format("no such playlist: \"{}\"", uri));
throw std::invalid_argument(fmt::format("no such playlist: {:?}", uri));
return {uri};
}
@ -369,7 +369,7 @@ handle_sticker(Client &client, Request args, Response &r)
handler = std::make_unique<TagHandler>(r, db, sticker_database, tag_type);
else {
r.FmtError(ACK_ERROR_ARG, "unknown sticker domain \"{}\"", sticker_type);
r.FmtError(ACK_ERROR_ARG, "unknown sticker domain {:?}", sticker_type);
return CommandResult::ERROR;
}
@ -413,7 +413,7 @@ handle_sticker(Client &client, Request args, Response &r)
sort = s;
}
else {
r.FmtError(ACK_ERROR_ARG, "Unknown sort tag \"{}\"", s);
r.FmtError(ACK_ERROR_ARG, "Unknown sort tag {:?}", s);
return CommandResult::ERROR;
}
@ -444,7 +444,7 @@ handle_sticker(Client &client, Request args, Response &r)
else if (StringIsEqual(op_s, "starts_with"))
op = StickerOperator::STARTS_WITH;
else {
r.FmtError(ACK_ERROR_ARG, "bad operator \"{}\"", op_s);
r.FmtError(ACK_ERROR_ARG, "bad operator {:?}", op_s);
return CommandResult::ERROR;
}
}

View File

@ -12,7 +12,7 @@
void
BlockParam::ThrowWithNested() const
{
std::throw_with_nested(FmtRuntimeError("Error in setting \"{}\" on line {}",
std::throw_with_nested(FmtRuntimeError("Error in setting {:?} on line {}",
name, line));
}

View File

@ -18,7 +18,7 @@ Check(const ConfigBlock &block)
for (const auto &i : block.block_params) {
if (!i.used)
FmtWarning(config_domain,
"option '{}' on line {} was not recognized",
"option {:?} on line {} was not recognized",
i.name, i.line);
}
}

View File

@ -141,7 +141,7 @@ ConfigData::FindBlock(ConfigBlockOption option,
for (const auto &block : GetBlockList(option)) {
const char *value2 = block.GetBlockValue(key);
if (value2 == nullptr)
throw FmtRuntimeError("block without '{}' in line {}",
throw FmtRuntimeError("block without {:?} in line {}",
key, block.line);
if (StringIsEqual(value2, value))

View File

@ -54,7 +54,7 @@ config_read_name_value(ConfigBlock &block, char *input, unsigned line)
const BlockParam *bp = block.GetBlockParam(name);
if (bp != nullptr)
throw FmtRuntimeError("\"{}\" is duplicate, first defined on line {}",
throw FmtRuntimeError("{:?} is duplicate, first defined on line {}",
name, bp->line);
block.AddBlockParam(name, value, line);
@ -102,12 +102,12 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
if (option.deprecated)
FmtWarning(config_file_domain,
"config parameter \"{}\" on line {} is deprecated",
"config parameter {:?} on line {} is deprecated",
name, reader.GetLineNumber());
if (!option.repeatable)
if (const auto *block = config_data.GetBlock(o))
throw FmtRuntimeError("config parameter \"{}\" is first defined "
throw FmtRuntimeError("config parameter {:?} is first defined "
"on line {} and redefined on line {}",
name, block->line,
reader.GetLineNumber());
@ -134,7 +134,7 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
if (option.deprecated)
FmtWarning(config_file_domain,
"config parameter \"{}\" on line {} is deprecated",
"config parameter {:?} on line {} is deprecated",
name, reader.GetLineNumber());
if (!option.repeatable)

View File

@ -20,7 +20,7 @@ ParseBool(const char *value)
if (StringArrayContainsCase(f, value))
return false;
throw FmtRuntimeError(R"(Not a valid boolean ("yes" or "no"): "{}")", value);
throw FmtRuntimeError(R"(Not a valid boolean ("yes" or "no"): {:?})", value);
}
long

View File

@ -22,7 +22,7 @@ GetBufferChunks(const ConfigData &config)
buffer_size = param->With([](const char *s){
size_t result = ParseSize(s, KILOBYTE);
if (result <= 0)
throw FmtRuntimeError("buffer size \"{}\" is not a "
throw FmtRuntimeError("buffer size {:?} is not a "
"positive integer", s);
if (result < MIN_BUFFER_SIZE) {
@ -37,7 +37,7 @@ GetBufferChunks(const ConfigData &config)
unsigned buffer_chunks = buffer_size / CHUNK_SIZE;
if (buffer_chunks >= 1 << 15)
throw FmtRuntimeError("buffer size \"{}\" is too big",
throw FmtRuntimeError("buffer size {:?} is too big",
buffer_size);
return buffer_chunks;

View File

@ -19,14 +19,14 @@ DatabaseGlobalInit(EventLoop &main_event_loop,
const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name);
if (plugin == nullptr)
throw FmtRuntimeError("No such database plugin: {}",
throw FmtRuntimeError("No such database plugin: {:?}",
plugin_name);
try {
return plugin->create(main_event_loop, io_event_loop,
listener, block);
} catch (...) {
std::throw_with_nested(FmtRuntimeError("Failed to initialize database plugin '{}'",
std::throw_with_nested(FmtRuntimeError("Failed to initialize database plugin {:?}",
plugin_name));
}
}

View File

@ -453,7 +453,7 @@ ProxyDatabase::Connect()
std::throw_with_nested(host.empty()
? std::runtime_error("Failed to connect to remote MPD")
: FmtRuntimeError("Failed to connect to remote MPD '{}'",
: FmtRuntimeError("Failed to connect to remote MPD {:?}",
host));
}

View File

@ -90,7 +90,7 @@ db_load_internal(LineReader &file, Directory &music_root,
if (*old_charset != 0
&& strcmp(new_charset, old_charset) != 0)
throw FmtRuntimeError("Existing database has charset "
"\"{}\" instead of \"{}\"; "
"{:?} instead of {:?}; "
"discarding database file",
new_charset, old_charset);
} else if ((p = StringAfterPrefix(line, DB_TAG_PREFIX))) {
@ -100,13 +100,13 @@ db_load_internal(LineReader &file, Directory &music_root,
const char *name = p;
TagType tag = tag_name_parse(name);
if (tag == TAG_NUM_OF_ITEM_TYPES)
throw FmtRuntimeError("Unrecognized tag '{}', "
throw FmtRuntimeError("Unrecognized tag {:?}, "
"discarding database file",
name);
tags[tag] = true;
} else {
throw FmtRuntimeError("Malformed line: {}", line);
throw FmtRuntimeError("Malformed line: {:?}", line);
}
}

View File

@ -124,7 +124,7 @@ directory_load_subdir(LineReader &file, Directory &parent, std::string_view name
break;
if (!ParseLine(*directory, line))
throw FmtRuntimeError("Malformed line: {}", line);
throw FmtRuntimeError("Malformed line: {:?}", line);
}
directory_load(file, *directory);
@ -153,7 +153,7 @@ directory_load(LineReader &file, Directory &directory)
const std::string_view name = child->GetName();
if (!children.emplace(name).second)
throw FmtRuntimeError("Duplicate subdirectory '{}'", name);
throw FmtRuntimeError("Duplicate subdirectory {:?}", name);
} else if ((p = StringAfterPrefix(line, SONG_BEGIN))) {
const char *name = p;
@ -168,7 +168,7 @@ directory_load(LineReader &file, Directory &directory)
song->in_playlist = in_playlist;
if (!songs.emplace(song->filename).second)
throw FmtRuntimeError("Duplicate song '{}'",
throw FmtRuntimeError("Duplicate song {:?}",
name);
directory.AddSong(std::move(song));
@ -176,7 +176,7 @@ directory_load(LineReader &file, Directory &directory)
const char *name = p;
playlist_metadata_load(file, directory.playlists, name);
} else {
throw FmtRuntimeError("Malformed line: {}", line);
throw FmtRuntimeError("Malformed line: {:?}", line);
}
}
}

View File

@ -109,7 +109,7 @@ SimpleDatabase::Check() const
#ifndef _WIN32
/* Check if we can write to the directory */
if (!CheckAccess(dirPath, X_OK | W_OK))
throw FmtErrno("Can't create db file in \"{}\"", dirPath);
throw FmtErrno("Can't create db file in {:?}", dirPath);
#endif
return;
@ -124,7 +124,7 @@ SimpleDatabase::Check() const
#ifndef _WIN32
/* And check that we can write to it */
if (!CheckAccess(path, R_OK | W_OK))
throw FmtErrno("Can't open db file \"{}\" for reading/writing",
throw FmtErrno("Can't open db file {:?} for reading/writing",
path);
#endif
}

View File

@ -40,13 +40,13 @@ InotifyQueue::OnDelay() noexcept
}
} catch (...) {
FmtError(update_domain,
"Failed to enqueue '{}': {}",
"Failed to enqueue {:?}: {}",
uri_utf8, std::current_exception());
queue.pop_front();
continue;
}
FmtDebug(inotify_domain, "updating '{}' job={}",
FmtDebug(inotify_domain, "updating {:?} job={}",
uri_utf8, id);
queue.pop_front();

View File

@ -67,7 +67,7 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
const auto uri_utf8 = storage.MapUTF8(directory->GetPath());
FmtDebug(update_domain, "scanning playlist '{}'", uri_utf8);
FmtDebug(update_domain, "scanning playlist {:?}", uri_utf8);
try {
Mutex mutex;
@ -85,7 +85,7 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
editor.LockDeleteDirectory(directory);
} catch (...) {
FmtError(update_domain,
"Failed to scan playlist '{}': {}",
"Failed to scan playlist {:?}: {}",
uri_utf8, std::current_exception());
editor.LockDeleteDirectory(directory);
}

View File

@ -145,10 +145,10 @@ decoder_plugin_init_all(const ConfigData &config)
decoder_plugins_enabled[i] = true;
} catch (const PluginUnavailable &e) {
FmtError(decoder_domain,
"Decoder plugin '{}' is unavailable: {}",
"Decoder plugin {:?} is unavailable: {}",
plugin.name, std::current_exception());
} catch (...) {
std::throw_with_nested(FmtRuntimeError("Failed to initialize decoder plugin '{}'",
std::throw_with_nested(FmtRuntimeError("Failed to initialize decoder plugin {:?}",
plugin.name));
}
}

View File

@ -481,7 +481,7 @@ FfmpegDecode(DecoderClient &client, InputStream *input,
const AVCodecDescriptor *codec_descriptor =
avcodec_descriptor_get(codec_params.codec_id);
if (codec_descriptor != nullptr)
FmtDebug(ffmpeg_domain, "codec '{}'",
FmtDebug(ffmpeg_domain, "codec {:?}",
codec_descriptor->name);
const AVCodec *codec = avcodec_find_decoder(codec_params.codec_id);
@ -590,10 +590,10 @@ ffmpeg_decode(DecoderClient &client, InputStream &input)
const auto *input_format = format_context->iformat;
if (input_format->long_name == nullptr)
FmtDebug(ffmpeg_domain, "detected input format '{}'",
FmtDebug(ffmpeg_domain, "detected input format {:?}",
input_format->name);
else
FmtDebug(ffmpeg_domain, "detected input format '{}' ({})",
FmtDebug(ffmpeg_domain, "detected input format {:?} ({:?})",
input_format->name, input_format->long_name);
FfmpegDecode(client, &input, *format_context);
@ -665,10 +665,10 @@ ffmpeg_uri_decode(DecoderClient &client, const char *uri)
const auto *input_format = format_context->iformat;
if (input_format->long_name == nullptr)
FmtDebug(ffmpeg_domain, "detected input format '{}'",
FmtDebug(ffmpeg_domain, "detected input format {:?}",
input_format->name);
else
FmtDebug(ffmpeg_domain, "detected input format '{}' ({})",
FmtDebug(ffmpeg_domain, "detected input format {:?} ({:?})",
input_format->name, input_format->long_name);
FfmpegDecode(client, nullptr, *format_context);

View File

@ -142,7 +142,7 @@ gme_file_decode(DecoderClient &client, Path path_fs)
AtScopeExit(emu) { gme_delete(emu); };
FmtDebug(gme_domain, "emulator type '{}'",
FmtDebug(gme_domain, "emulator type {:?}",
gme_type_system(gme_type(emu)));
if (gme_accuracy >= 0)

View File

@ -529,7 +529,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
&lame->version.major, &lame->version.minor) != 2)
return false;
FmtDebug(mad_domain, "detected LAME version {}.{} (\"{}\")",
FmtDebug(mad_domain, "detected LAME version {}.{} ({:?})",
lame->version.major, lame->version.minor, lame->encoder);
/* The reference volume was changed from the 83dB used in the

View File

@ -62,7 +62,7 @@ static void loadRom(const Path rom_path, uint8_t *dump)
{
FileReader romDump(rom_path);
if (romDump.Read(std::as_writable_bytes(std::span{dump, rom_size})) != rom_size)
throw FmtRuntimeError("Could not load rom dump '{}'", rom_path);
throw FmtRuntimeError("Could not load rom dump {:?}", rom_path);
}
/**
@ -74,7 +74,7 @@ sidplay_load_songlength_db(const Path path)
auto db = std::make_unique<SidDatabase>();
bool error = !db->open(path.c_str());
if (error)
throw FmtRuntimeError("unable to read songlengths file {}: {}",
throw FmtRuntimeError("unable to read songlengths file {:?}: {}",
path, db->error());
return db;

View File

@ -41,7 +41,7 @@ WavpackOpenInput(Path path, int flags, int norm_offset)
auto wpc = WavpackOpenFileInput(np, error,
flags, norm_offset);
if (wpc == nullptr)
throw FmtRuntimeError("failed to open WavPack file \"{}\": {}",
throw FmtRuntimeError("failed to open WavPack file {:?}: {}",
path, error);
return wpc;

View File

@ -63,7 +63,7 @@ PreparedLameEncoder::PreparedLameEncoder(const ConfigBlock &block)
quality = float(ParseDouble(value, &endptr));
if (*endptr != '\0' || quality < -1.0f || quality > 10.0f)
throw FmtRuntimeError("quality \"{}\" is not a number in the "
throw FmtRuntimeError("quality {:?} is not a number in the "
"range -1 to 10",
value);

View File

@ -80,7 +80,7 @@ PreparedTwolameEncoder::PreparedTwolameEncoder(const ConfigBlock &block)
quality = float(ParseDouble(value, &endptr));
if (*endptr != '\0' || quality < -1.0f || quality > 10.0f)
throw FmtRuntimeError("quality \"{}\" is not a number in the "
throw FmtRuntimeError("quality {:?} is not a number in the "
"range -1 to 10",
value);

View File

@ -73,7 +73,7 @@ PreparedVorbisEncoder::PreparedVorbisEncoder(const ConfigBlock &block)
quality = ParseDouble(value, &endptr);
if (*endptr != '\0' || quality < -1.0f || quality > 10.0f)
throw FmtRuntimeError("quality \"{}\" is not a number in the "
throw FmtRuntimeError("quality {:?} is not a number in the "
"range -1 to 10",
value);

View File

@ -35,7 +35,7 @@ PreparedTwoFilters::Open(AudioFormat &audio_format)
auto b = second->Open(b_in_format);
if (b_in_format != a_out_format)
throw FmtRuntimeError("Audio format not supported by filter '{}': {}",
throw FmtRuntimeError("Audio format not supported by filter {:?}: {}",
second_name, a_out_format);
return std::make_unique<TwoFilters>(std::move(a),

View File

@ -55,16 +55,16 @@ input_stream_global_init(const ConfigData &config, EventLoop &event_loop)
input_plugins_enabled[i] = true;
} catch (const PluginUnconfigured &e) {
FmtDebug(input_domain,
"Input plugin '{}' is not configured: {}",
"Input plugin {:?} is not configured: {}",
plugin->name, e.what());
continue;
} catch (const PluginUnavailable &e) {
FmtDebug(input_domain,
"Input plugin '{}' is unavailable: {}",
"Input plugin {:?} is unavailable: {}",
plugin->name, e.what());
continue;
} catch (...) {
std::throw_with_nested(FmtRuntimeError("Failed to initialize input plugin '{}'",
std::throw_with_nested(FmtRuntimeError("Failed to initialize input plugin {:?}",
plugin->name));
}
}

View File

@ -256,13 +256,13 @@ AlsaInputStream::Recover(int err)
switch(err) {
case -EPIPE:
FmtDebug(alsa_input_domain,
"Overrun on ALSA capture device \"{}\"",
"Overrun on ALSA capture device {:?}",
device);
break;
case -ESTRPIPE:
FmtDebug(alsa_input_domain,
"ALSA capture device \"{}\" was suspended",
"ALSA capture device {:?} was suspended",
device);
break;
}

View File

@ -28,7 +28,7 @@ OpenArchiveInputStream(Path path, Mutex &mutex)
}
} catch (...) {
FmtDebug(input_domain,
"not an archive, lookup '{}' failed: {}",
"not an archive, lookup {:?} failed: {}",
path, std::current_exception());
return nullptr;
}

View File

@ -17,7 +17,7 @@ RequireFilterByName(const char *name)
{
const auto *filter = avfilter_get_by_name(name);
if (filter == nullptr)
throw FmtRuntimeError("No such FFmpeg filter: '{}'", name);
throw FmtRuntimeError("No such FFmpeg filter: {:?}", name);
return *filter;
}

View File

@ -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>(FMT_STRING("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, FMT_STRING("Failed to initialize charset {:?}"),
charset);
}

View File

@ -12,7 +12,7 @@ Database::Database(const char *path)
int result = sqlite3_open(path, &db);
if (result != SQLITE_OK)
throw SqliteError(db, result,
FmtBuffer<1024>("Failed to open sqlite database '{}'",
FmtBuffer<1024>("Failed to open sqlite database {:?}",
path));
}

View File

@ -33,7 +33,7 @@ output_mixer_get_volume(const AudioOutputControl &ao) noexcept
return mixer->LockGetVolume();
} catch (...) {
FmtError(mixer_domain,
"Failed to read mixer for '{}': {}",
"Failed to read mixer for {:?}: {}",
ao.GetName(), std::current_exception());
return -1;
}
@ -88,9 +88,9 @@ output_mixer_set_volume(AudioOutputControl &ao, unsigned volume)
return SetVolumeResult::OK;
} catch (...) {
FmtError(mixer_domain,
"Failed to set mixer for '{}': {}",
"Failed to set mixer for {:?}: {}",
ao.GetName(), std::current_exception());
std::throw_with_nested(std::runtime_error(FmtBuffer<256>("Failed to set mixer for '{}'",
std::throw_with_nested(std::runtime_error(FmtBuffer<256>("Failed to set mixer for {:?}",
ao.GetName())));
}
}

View File

@ -108,7 +108,7 @@ OssMixer::Open()
throw MakeErrno("READ_DEVMASK failed");
if (((1 << volume_control) & devmask) == 0)
throw FmtErrno("mixer control \"{}\" not usable",
throw FmtErrno("mixer control {:?} not usable",
control);
}
} catch (...) {
@ -134,8 +134,8 @@ OssMixer::GetVolume()
if (left != right) {
FmtWarning(oss_mixer_domain,
"volume for left and right is not the same, \"{}\" and "
"\"{}\"\n", left, right);
"volume for left and right is not the same, {:?} and "
"{:?}\n", left, right);
}
return left;

View File

@ -161,7 +161,7 @@ parse_volume_scale_factor(const char *value) {
float factor = ParseFloat(value, &endptr);
if (endptr == value || *endptr != '\0' || factor < 0.5f || factor > 5.0f)
throw FmtRuntimeError("\"{}\" is not a number in the "
throw FmtRuntimeError("{:?} is not a number in the "
"range 0.5 to 5.0",
value);

View File

@ -22,7 +22,7 @@ CreateNeighborExplorer(EventLoop &loop, NeighborListener &listener,
{
const NeighborPlugin *plugin = GetNeighborPluginByName(plugin_name);
if (plugin == nullptr)
throw FmtRuntimeError("No such neighbor plugin: {}",
throw FmtRuntimeError("No such neighbor plugin: {:?}",
plugin_name);
return plugin->create(loop, listener, block);
@ -56,7 +56,7 @@ NeighborGlue::Open()
for (auto k = explorers.begin(); k != i; ++k)
k->explorer->Close();
std::throw_with_nested(FmtRuntimeError("Failed to open neighblor plugin '{}'",
std::throw_with_nested(FmtRuntimeError("Failed to open neighblor plugin {:?}",
i->name));
}
}

View File

@ -151,7 +151,7 @@ ReadServers(SmbclientContext &ctx, const char *uri,
ReadServers(ctx, handle, list);
ctx.CloseDirectory(handle);
} else
FmtError(smbclient_domain, "smbc_opendir('{}') failed: {}",
FmtError(smbclient_domain, "smbc_opendir({:?}) failed: {}",
uri, strerror(errno));
}

View File

@ -268,7 +268,7 @@ AudioOutputControl::Open(std::unique_lock<Mutex> &lock,
output->mixer->LockOpen();
} catch (...) {
FmtError(output_domain,
"Failed to open mixer for '{}': {}",
"Failed to open mixer for {:?}: {}",
GetName(), std::current_exception());
}
}

View File

@ -56,7 +56,7 @@ audio_output_detect()
continue;
FmtInfo(output_domain,
"Attempting to detect a {} audio device",
"Attempting to detect a {:?} audio device",
plugin->name);
if (ao_plugin_test_default_device(plugin))
return plugin;
@ -154,7 +154,7 @@ FilteredAudioOutput::Configure(const ConfigBlock &block,
config_audio_format.Clear();
}
log_name = fmt::format("\"{}\" ({})", name, plugin_name);
log_name = fmt::format("{:?} ({})", name, plugin_name);
/* create the normalization filter (if configured) */
@ -173,7 +173,7 @@ FilteredAudioOutput::Configure(const ConfigBlock &block,
has been set up already and even an empty one will
work (if only with unexpected behaviour) */
FmtError(output_domain,
"Failed to initialize filter chain for '{}': {}",
"Failed to initialize filter chain for {:?}: {}",
name, std::current_exception());
}
}
@ -223,7 +223,7 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
mixer_listener);
} catch (...) {
FmtError(output_domain,
"Failed to initialize hardware mixer for '{}': {}",
"Failed to initialize hardware mixer for {:?}: {}",
name, std::current_exception());
}
@ -235,7 +235,7 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
mixer, 100);
else
FmtError(output_domain,
"No such mixer for output '{}'", name);
"No such mixer for output {:?}", name);
} else if (!StringIsEqual(replay_gain_handler, "software") &&
prepared_replay_gain_filter != nullptr) {
throw std::runtime_error("Invalid \"replay_gain_handler\" value");

View File

@ -57,7 +57,7 @@ audio_output_state_read(const char *line, MultipleOutputs &outputs)
auto *ao = outputs.FindByName(name);
if (ao == nullptr) {
FmtDebug(output_domain,
"Ignoring device state for '{}'", name);
"Ignoring device state for {:?}", name);
return true;
}

View File

@ -792,14 +792,14 @@ AlsaOutput::Open(AudioFormat &audio_format)
SND_PCM_STREAM_PLAYBACK, mode);
if (err < 0)
throw Alsa::MakeError(err,
FmtBuffer<256>("Failed to open ALSA device \"{}\"",
FmtBuffer<256>("Failed to open ALSA device {:?}",
GetDevice()));
const char *pcm_name = snd_pcm_name(pcm);
if (pcm_name == nullptr)
pcm_name = "?";
FmtDebug(alsa_output_domain, "opened {} type={}",
FmtDebug(alsa_output_domain, "opened {:?} type={}",
pcm_name,
snd_pcm_type_name(snd_pcm_type(pcm)));
@ -830,7 +830,7 @@ AlsaOutput::Open(AudioFormat &audio_format)
);
} catch (...) {
snd_pcm_close(pcm);
std::throw_with_nested(FmtRuntimeError("Error opening ALSA device \"{}\"",
std::throw_with_nested(FmtRuntimeError("Error opening ALSA device {:?}",
GetDevice()));
}
@ -891,11 +891,11 @@ AlsaOutput::Recover(int err) noexcept
{
if (err == -EPIPE) {
FmtDebug(alsa_output_domain,
"Underrun on ALSA device \"{}\"",
"Underrun on ALSA device {:?}",
GetDevice());
} else if (err == -ESTRPIPE) {
FmtDebug(alsa_output_domain,
"ALSA device \"{}\" was suspended",
"ALSA device {:?} was suspended",
GetDevice());
}

View File

@ -105,14 +105,14 @@ AoOutput::AoOutput(const ConfigBlock &block)
driver = ao_driver_id(value);
if (driver < 0)
throw FmtRuntimeError("\"{}\" is not a valid ao driver",
throw FmtRuntimeError("{:?} is not a valid ao driver",
value);
ao_info *ai = ao_driver_info(driver);
if (ai == nullptr)
throw std::runtime_error("problems getting driver info");
FmtDebug(ao_output_domain, "using ao driver \"{}\" for \"{}\"\n",
FmtDebug(ao_output_domain, "using ao driver {:?} for {:?}\n",
ai->short_name, block.GetBlockValue("name", nullptr));
value = block.GetBlockValue("options", nullptr);
@ -120,7 +120,7 @@ AoOutput::AoOutput(const ConfigBlock &block)
for (const std::string_view i : IterableSplitString(value, ';')) {
const auto [n, v] = Split(Strip(i), '=');
if (n.empty() || v.data() == nullptr)
throw FmtRuntimeError("problems parsing option \"{}\"",
throw FmtRuntimeError("problems parsing option {:?}",
i);
ao_append_option(&options, std::string{n}.c_str(),

View File

@ -74,7 +74,7 @@ inline void
FifoOutput::Delete()
{
FmtDebug(fifo_output_domain,
"Removing FIFO \"{}\"", path);
"Removing FIFO {:?}", path);
try {
RemoveFile(path);
@ -108,7 +108,7 @@ inline void
FifoOutput::Create()
{
if (!MakeFifo(path, 0666))
throw FmtErrno("Couldn't create FIFO \"{}\"", path);
throw FmtErrno("Couldn't create FIFO {:?}", path);
created = true;
}
@ -124,11 +124,11 @@ FifoOutput::Check()
return;
}
throw FmtErrno("Failed to stat FIFO \"{}\"", path);
throw FmtErrno("Failed to stat FIFO {:?}", path);
}
if (!S_ISFIFO(st.st_mode))
throw FmtRuntimeError("\"{}\" already exists, but is not a FIFO",
throw FmtRuntimeError("{:?} already exists, but is not a FIFO",
path);
}
@ -139,12 +139,12 @@ try {
input = OpenFile(path, O_RDONLY|O_NONBLOCK|O_BINARY, 0).Steal();
if (input < 0)
throw FmtErrno("Could not open FIFO \"{}\" for reading",
throw FmtErrno("Could not open FIFO {:?} for reading",
path);
output = OpenFile(path, O_WRONLY|O_NONBLOCK|O_BINARY, 0).Steal();
if (output < 0)
throw FmtErrno("Could not open FIFO \"{}\" for writing");
throw FmtErrno("Could not open FIFO {:?} for writing");
} catch (...) {
CloseFifo();
throw;
@ -175,7 +175,7 @@ FifoOutput::Cancel() noexcept
if (bytes < 0 && errno != EAGAIN) {
FmtError(fifo_output_domain,
"Flush of FIFO \"{}\" failed: {}",
"Flush of FIFO {:?} failed: {}",
path, strerror(errno));
}
}

View File

@ -410,7 +410,7 @@ JackOutput::Connect()
portflags, 0);
if (ports[i] == nullptr) {
Disconnect();
throw FmtRuntimeError("Cannot register output port \"{}\"",
throw FmtRuntimeError("Cannot register output port {:?}",
source_ports[i]);
}
}
@ -521,7 +521,7 @@ JackOutput::Start()
jports[num_dports] != nullptr;
++num_dports) {
FmtDebug(jack_output_domain,
"destination_port[{}] = '{}'\n",
"destination_port[{}] = {:?}\n",
num_dports, jports[num_dports]);
dports[num_dports] = jports[num_dports];
}

View File

@ -260,7 +260,7 @@ osx_output_parse_channel_map(const char *device_name,
continue;
}
throw FmtRuntimeError("{}: invalid character '{}' in channel map",
throw FmtRuntimeError("{}: invalid character {:?} in channel map",
device_name, *channel_map_str);
}
@ -567,7 +567,7 @@ FindAudioDeviceByName(const char *name)
return id;
}
throw FmtRuntimeError("Found no audio device names '{}'", name);
throw FmtRuntimeError("Found no audio device names {:?}", name);
}
static void

View File

@ -110,13 +110,13 @@ OpenALOutput::SetupContext()
{
device = alcOpenDevice(device_name);
if (device == nullptr)
throw FmtRuntimeError("Error opening OpenAL device \"{}\"",
throw FmtRuntimeError("Error opening OpenAL device {:?}",
device_name);
context = alcCreateContext(device, nullptr);
if (context == nullptr) {
alcCloseDevice(device);
throw FmtRuntimeError("Error creating context for \"{}\"",
throw FmtRuntimeError("Error creating context for {:?}",
device_name);
}
}

View File

@ -166,7 +166,7 @@ oss_output_test_default_device() noexcept
return true;
FmtError(oss_output_domain,
"Error opening OSS device \"{}\": {}",
"Error opening OSS device {:?}: {}",
default_devices[i], strerror(errno));
}
@ -621,7 +621,7 @@ try {
assert(!fd.IsDefined());
if (!fd.Open(device, O_WRONLY))
throw FmtErrno("Error opening OSS device \"{}\"", device);
throw FmtErrno("Error opening OSS device {:?}", device);
OssIoctlExact(fd, SNDCTL_DSP_CHANNELS, effective_channels,
"Failed to set channel count");
@ -638,7 +638,7 @@ void
OssOutput::Open(AudioFormat &_audio_format)
try {
if (!fd.Open(device, O_WRONLY))
throw FmtErrno("Error opening OSS device \"{}\"", device);
throw FmtErrno("Error opening OSS device {:?}", device);
SetupOrDop(_audio_format);
} catch (...) {
@ -676,7 +676,7 @@ OssOutput::Play(std::span<const std::byte> src)
return pcm_export->CalcInputSize(ret);
if (ret < 0 && errno != EINTR)
throw FmtErrno("Write error on {}", device);
throw FmtErrno("Write error on {:?}", device);
}
}

View File

@ -45,7 +45,7 @@ PipeOutput::Open([[maybe_unused]] AudioFormat &audio_format)
{
fh = popen(cmd.c_str(), "w");
if (fh == nullptr)
throw FmtErrno("Error opening pipe \"{}\"", cmd);
throw FmtErrno("Error opening pipe {:?}", cmd);
}
std::size_t

View File

@ -261,7 +261,7 @@ RecorderOutput::ReopenFormat(AllocatedPath &&new_path)
path = std::move(new_path);
file = new_file;
FmtDebug(recorder_domain, "Recording to \"{}\"", path);
FmtDebug(recorder_domain, "Recording to {:?}", path);
}
void

View File

@ -88,7 +88,7 @@ require_block_string(const ConfigBlock &block, const char *name)
{
const char *value = block.GetBlockValue(name);
if (value == nullptr)
throw FmtRuntimeError("no \"{}\" defined for shout device defined "
throw FmtRuntimeError("no {:?} defined for shout device defined "
"at line {}\n", name, block.line);
return value;
@ -123,7 +123,7 @@ ParseShoutTls(const char *value)
else if (StringIsEqual(value, "rfc2817"))
return SHOUT_TLS_RFC2817;
else
throw FmtRuntimeError("invalid shout TLS option \"{}\"",
throw FmtRuntimeError("invalid shout TLS option {:?}",
value);
}
@ -146,7 +146,7 @@ ParseShoutProtocol(const char *value, const char *mime_type)
if (StringIsEqual(value, "shoutcast")) {
if (!StringIsEqual(mime_type, "audio/mpeg"))
throw FmtRuntimeError("you cannot stream \"{}\" to shoutcast, use mp3",
throw FmtRuntimeError("you cannot stream {:?} to shoutcast, use mp3",
mime_type);
return SHOUT_PROTOCOL_ICY;
} else if (StringIsEqual(value, "icecast1"))
@ -154,7 +154,7 @@ ParseShoutProtocol(const char *value, const char *mime_type)
else if (StringIsEqual(value, "icecast2"))
return SHOUT_PROTOCOL_HTTP;
else
throw FmtRuntimeError("shout protocol \"{}\" is not \"shoutcast\" or "
throw FmtRuntimeError("shout protocol {:?} is not \"shoutcast\" or "
"\"icecast1\"or \"icecast2\"",
value);
}

View File

@ -106,7 +106,7 @@ get_device_id(const char *device_name)
UINT id = strtoul(device_name, &endptr, 0);
if (endptr > device_name && *endptr == 0) {
if (id >= numdevs)
throw FmtRuntimeError("device \"{}\" is not found",
throw FmtRuntimeError("device {:?} is not found",
device_name);
return id;
@ -127,7 +127,7 @@ get_device_id(const char *device_name)
return i;
}
throw FmtRuntimeError("device \"{}\" is not found", device_name);
throw FmtRuntimeError("device {:?} is not found", device_name);
}
WinmmOutput::WinmmOutput(const ConfigBlock &block)

View File

@ -789,7 +789,7 @@ WasapiOutput::ChooseDevice()
if (!SafeSilenceTry([this, &id]() { id = std::stoul(device_config); })) {
device = SearchDevice(*enumerator, device_config);
if (!device)
throw FmtRuntimeError("Device '{}' not found",
throw FmtRuntimeError("Device {:?} not found",
device_config);
} else
device = GetDevice(*enumerator, id);
@ -1007,7 +1007,7 @@ WasapiOutput::EnumerateDevices(IMMDeviceEnumerator &enumerator)
continue;
FmtNotice(wasapi_output_domain,
"Device \"{}\" \"{}\"", i, name.c_str());
"Device {:?} {:?}", i, name.c_str());
}
}

View File

@ -53,11 +53,11 @@ pcm_resample_lsr_global_init(const ConfigBlock &block)
{
const char *converter = block.GetBlockValue("type", "2");
if (!lsr_parse_converter(converter))
throw FmtRuntimeError("unknown samplerate converter '{}'",
throw FmtRuntimeError("unknown samplerate converter {:?}",
converter);
FmtDebug(libsamplerate_domain,
"libsamplerate converter '{}'",
"libsamplerate converter {:?}",
src_get_name(lsr_converter));
}

View File

@ -153,7 +153,7 @@ pcm_resample_soxr_global_init(const ConfigBlock &block)
if (recipe == SOXR_INVALID_RECIPE) {
assert(quality_string != nullptr);
throw FmtRuntimeError("unknown quality setting '{}' in line {}",
throw FmtRuntimeError("unknown quality setting {:?} in line {}",
quality_string, block.line);
} else if (recipe == SOXR_CUSTOM_RECIPE) {
// used to preset possible internal flags, like SOXR_RESET_ON_CLEAR
@ -177,7 +177,7 @@ pcm_resample_soxr_global_init(const ConfigBlock &block)
soxr_quality = soxr_quality_spec(recipe, 0);
}
FmtDebug(soxr_domain, "soxr converter '{}'",
FmtDebug(soxr_domain, "soxr converter {:?}",
soxr_quality_name(recipe));
const unsigned n_threads = block.GetBlockValue("threads", 1);
@ -202,7 +202,7 @@ SoxrPcmResampler::Open(AudioFormat &af, unsigned new_sample_rate)
throw FmtRuntimeError("soxr initialization has failed: {}",
e);
FmtDebug(soxr_domain, "soxr engine '{}'", soxr_engine(soxr));
FmtDebug(soxr_domain, "soxr engine {:?}", soxr_engine(soxr));
if (soxr_use_custom_recipe)
FmtDebug(soxr_domain,
"soxr precision={:0.0f}, phase_response={:0.2f}, "

View File

@ -623,7 +623,7 @@ Player::CheckDecoderStartup(std::unique_lock<Mutex> &lock) noexcept
if (!paused && !OpenOutput()) {
FmtError(player_domain,
"problems opening audio device "
"while playing \"{}\"",
"while playing {:?}",
dc.song->GetURI());
return true;
}
@ -1065,7 +1065,7 @@ Player::SongBorder() noexcept
{
const ScopeUnlock unlock(pc.mutex);
FmtNotice(player_domain, "played \"{}\"", song->GetURI());
FmtNotice(player_domain, "played {:?}", song->GetURI());
ReplacePipe(dc.pipe);
@ -1211,7 +1211,7 @@ Player::Run() noexcept
cross_fade_tag.reset();
if (song != nullptr) {
FmtNotice(player_domain, "played \"{}\"", song->GetURI());
FmtNotice(player_domain, "played {:?}", song->GetURI());
song.reset();
}

View File

@ -45,7 +45,7 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
loader)) {
failures += 1;
if (failures < max_log_msgs) {
FmtError(playlist_domain, "Failed to load \"{}\".", song->GetURI());
FmtError(playlist_domain, "Failed to load {:?}.", song->GetURI());
} else if (failures == max_log_msgs) {
LogError(playlist_domain, "Further errors for this playlist will not be logged.");
}

View File

@ -56,7 +56,7 @@ playlist::QueueSongOrder(PlayerControl &pc, unsigned order) noexcept
const DetachedSong &song = queue.GetOrder(order);
FmtDebug(playlist_domain, "queue song {}:\"{}\"",
FmtDebug(playlist_domain, "queue song {}:{:?}",
queued, song.GetURI());
pc.LockEnqueueSong(std::make_unique<DetachedSong>(song));
@ -168,7 +168,7 @@ playlist::PlayOrder(PlayerControl &pc, unsigned order)
const DetachedSong &song = queue.GetOrder(order);
FmtDebug(playlist_domain, "play {}:\"{}\"", order, song.GetURI());
FmtDebug(playlist_domain, "play {}:{:?}", order, song.GetURI());
current = order;

View File

@ -76,7 +76,7 @@ public:
UnmountWait();
} catch (...) {
FmtError(udisks_domain,
"Failed to unmount '{}': {}",
"Failed to unmount {:?}: {}",
base_uri, std::current_exception());
}
}

View File

@ -44,7 +44,7 @@ TagLoadConfig(const ConfigData &config)
const auto type = tag_name_parse_i(name);
if (type == TAG_NUM_OF_ITEM_TYPES)
throw FmtRuntimeError("error parsing metadata item \"{}\"",
throw FmtRuntimeError("error parsing metadata item {:?}",
name);
if (plus)

View File

@ -56,7 +56,7 @@ daemonize_kill()
const pid_t pid = ReadPidFile(pidfile);
if (pid < 0)
throw FmtErrno("unable to read the pid from file \"{}\"",
throw FmtErrno("unable to read the pid from file {:?}",
pidfile);
if (kill(pid, SIGTERM) < 0)
@ -94,7 +94,7 @@ daemonize_set_user()
user_uid != getuid() &&
initgroups(user_name, user_gid) == -1) {
throw FmtErrno("Failed to set supplementary groups "
"of user \"{}\"",
"of user {:?}",
user_name);
}
#endif
@ -102,7 +102,7 @@ daemonize_set_user()
/* set uid */
if (user_uid != (uid_t)-1 && user_uid != getuid() &&
setuid(user_uid) == -1) {
throw FmtErrno("Failed to set user \"{}\"", user_name);
throw FmtErrno("Failed to set user {:?}", user_name);
}
}
@ -201,7 +201,7 @@ daemonize_init(const char *user, const char *group, AllocatedPath &&_pidfile)
if (user) {
struct passwd *pwd = getpwnam(user);
if (pwd == nullptr)
throw FmtRuntimeError("no such user \"{}\"", user);
throw FmtRuntimeError("no such user {:?}", user);
user_uid = pwd->pw_uid;
user_gid = pwd->pw_gid;
@ -215,7 +215,7 @@ daemonize_init(const char *user, const char *group, AllocatedPath &&_pidfile)
if (group) {
struct group *grp = getgrnam(group);
if (grp == nullptr)
throw FmtRuntimeError("no such group \"{}\"", group);
throw FmtRuntimeError("no such group {:?}", group);
user_gid = grp->gr_gid;
had_group = true;
}

View File

@ -27,7 +27,7 @@ public:
fd = OpenFile(path, O_WRONLY|O_CREAT|O_TRUNC, 0666).Steal();
if (fd < 0)
throw FmtErrno("Failed to create pid file \"{}\"",
throw FmtErrno("Failed to create pid file {:?}",
path);
}

View File

@ -63,7 +63,7 @@ BonjourHelper::Callback([[maybe_unused]] DNSServiceRef sdRef,
helper.Cancel();
} else {
FmtDebug(bonjour_domain,
"Registered zeroconf service with name '{}'",
"Registered zeroconf service with name {:?}",
name);
}
}

View File

@ -47,7 +47,7 @@ AvahiInit(EventLoop &event_loop, const char *service_name,
const char *service_type, unsigned port)
{
if (!avahi_is_valid_service_name(service_name))
throw FmtRuntimeError("Invalid zeroconf_name \"{}\"",
throw FmtRuntimeError("Invalid zeroconf_name {:?}",
service_name);
auto client = shared_avahi_client.lock();

View File

@ -55,7 +55,7 @@ public:
}
void OnDatabaseSongRemoved(const char *uri) noexcept override {
fmt::print("SongRemoved '{}'\n", uri);
fmt::print("SongRemoved {:?}\n", uri);
}
};