use more libfmt instead of sprintf()
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
|
||||
#include "LogCallback.hxx"
|
||||
#include "Domain.hxx"
|
||||
#include "lib/fmt/ToBuffer.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
extern "C" {
|
||||
@@ -40,9 +40,9 @@ FfmpegLogCallback(void *ptr, int level, const char *fmt, std::va_list vl)
|
||||
|
||||
if (cls != nullptr) {
|
||||
const auto domain =
|
||||
StringFormat<64>("%s/%s",
|
||||
ffmpeg_domain.GetName(),
|
||||
cls->item_name(ptr));
|
||||
FmtBuffer<64>("{}/{}",
|
||||
ffmpeg_domain.GetName(),
|
||||
cls->item_name(ptr));
|
||||
const Domain d(domain);
|
||||
|
||||
char msg[1024];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// author: Max Kellermann <mk@cm4all.com>
|
||||
|
||||
#include "Error.hxx"
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "lib/fmt/ToBuffer.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include <nfsc/libnfs.h>
|
||||
@@ -13,20 +13,20 @@ extern "C" {
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static StringBuffer<256>
|
||||
static auto
|
||||
FormatNfsClientError(struct nfs_context *nfs, const char *msg) noexcept
|
||||
{
|
||||
assert(msg != nullptr);
|
||||
|
||||
const char *msg2 = nfs_get_error(nfs);
|
||||
return StringFormat<256>("%s: %s", msg, msg2);
|
||||
return FmtBuffer<256>("{}: {}", msg, msg2);
|
||||
}
|
||||
|
||||
NfsClientError::NfsClientError(struct nfs_context *nfs, const char *msg) noexcept
|
||||
:std::runtime_error(FormatNfsClientError(nfs, msg).c_str()),
|
||||
code(0) {}
|
||||
|
||||
static StringBuffer<256>
|
||||
static auto
|
||||
FormatNfsClientError(int err, struct nfs_context *nfs, void *data,
|
||||
const char *msg) noexcept
|
||||
{
|
||||
@@ -40,7 +40,7 @@ FormatNfsClientError(int err, struct nfs_context *nfs, void *data,
|
||||
msg2 = strerror(-err);
|
||||
}
|
||||
|
||||
return StringFormat<256>("%s: %s", msg, msg2);
|
||||
return FmtBuffer<256>("{}: {}", msg, msg2);
|
||||
}
|
||||
|
||||
NfsClientError::NfsClientError(int err, struct nfs_context *nfs, void *data,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Database.hxx"
|
||||
#include "Error.hxx"
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "lib/fmt/ToBuffer.hxx"
|
||||
|
||||
namespace Sqlite {
|
||||
|
||||
@@ -12,8 +12,8 @@ Database::Database(const char *path)
|
||||
int result = sqlite3_open(path, &db);
|
||||
if (result != SQLITE_OK)
|
||||
throw SqliteError(db, result,
|
||||
StringFormat<1024>("Failed to open sqlite database '%s'",
|
||||
path));
|
||||
FmtBuffer<1024>("Failed to open sqlite database '{}'",
|
||||
path));
|
||||
}
|
||||
|
||||
} // namespace Sqlite
|
||||
|
||||
Reference in New Issue
Block a user