lib/fmt/RuntimeError: new library

Replacing FormatRuntimeError().
This commit is contained in:
Max Kellermann
2022-11-28 21:58:21 +01:00
parent 45b13fc2a6
commit fa58db798b
105 changed files with 551 additions and 502 deletions

View File

@@ -22,7 +22,7 @@
#include "Prepared.hxx"
#include "config/Data.hxx"
#include "config/Block.hxx"
#include "util/RuntimeError.hxx"
#include "lib/fmt/RuntimeError.hxx"
std::unique_ptr<PreparedFilter>
FilterFactory::MakeFilter(const char *name)
@@ -30,8 +30,8 @@ FilterFactory::MakeFilter(const char *name)
const auto *cfg = config.FindBlock(ConfigBlockOption::AUDIO_FILTER,
"name", name);
if (cfg == nullptr)
throw FormatRuntimeError("Filter template not found: %s",
name);
throw FmtRuntimeError("Filter template not found: {}",
name);
cfg->SetUsed();

View File

@@ -22,7 +22,7 @@
#include "Registry.hxx"
#include "Prepared.hxx"
#include "config/Block.hxx"
#include "util/RuntimeError.hxx"
#include "lib/fmt/RuntimeError.hxx"
std::unique_ptr<PreparedFilter>
filter_configured_new(const ConfigBlock &block)
@@ -33,8 +33,8 @@ filter_configured_new(const ConfigBlock &block)
const auto *plugin = filter_plugin_by_name(plugin_name);
if (plugin == nullptr)
throw FormatRuntimeError("No such filter plugin: %s",
plugin_name);
throw FmtRuntimeError("No such filter plugin: {}",
plugin_name);
return plugin->init(block);
}

View File

@@ -17,6 +17,9 @@ filter_glue = static_library(
'LoadOne.cxx',
'LoadChain.cxx',
include_directories: inc,
dependencies: [
fmt_dep,
],
)
filter_glue_dep = declare_dependency(

View File

@@ -47,8 +47,8 @@
#include "pcm/AudioFormat.hxx"
#include "pcm/Buffer.hxx"
#include "pcm/Silence.hxx"
#include "lib/fmt/RuntimeError.hxx"
#include "util/StringStrip.hxx"
#include "util/RuntimeError.hxx"
#include <array>
#include <cstdint>
@@ -159,8 +159,8 @@ PreparedRouteFilter::PreparedRouteFilter(const ConfigBlock &block)
throw std::runtime_error("Malformed 'routes' specification");
if (source >= MAX_CHANNELS)
throw FormatRuntimeError("Invalid source channel number: %u",
source);
throw FmtRuntimeError("Invalid source channel number: {}",
source);
if (source >= min_input_channels)
min_input_channels = source + 1;
@@ -173,8 +173,8 @@ PreparedRouteFilter::PreparedRouteFilter(const ConfigBlock &block)
throw std::runtime_error("Malformed 'routes' specification");
if (dest >= MAX_CHANNELS)
throw FormatRuntimeError("Invalid destination channel number: %u",
dest);
throw FmtRuntimeError("Invalid destination channel number: {}",
dest);
if (dest >= min_output_channels)
min_output_channels = dest + 1;

View File

@@ -19,7 +19,8 @@
#include "TwoFilters.hxx"
#include "pcm/AudioFormat.hxx"
#include "util/RuntimeError.hxx"
#include "lib/fmt/AudioFormatFormatter.hxx"
#include "lib/fmt/RuntimeError.hxx"
#include "util/StringBuffer.hxx"
std::span<const std::byte>
@@ -50,9 +51,8 @@ PreparedTwoFilters::Open(AudioFormat &audio_format)
auto b = second->Open(b_in_format);
if (b_in_format != a_out_format)
throw FormatRuntimeError("Audio format not supported by filter '%s': %s",
second_name.c_str(),
ToString(a_out_format).c_str());
throw FmtRuntimeError("Audio format not supported by filter '{}': {}",
second_name, a_out_format);
return std::make_unique<TwoFilters>(std::move(a),
std::move(b));