*: 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

@@ -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);
}