lib/fmt/RuntimeError: new library
Replacing FormatRuntimeError().
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "FlacPcm.hxx"
|
||||
#include "pcm/CheckAudioFormat.hxx"
|
||||
#include "lib/xiph/FlacAudioFormat.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -30,8 +30,8 @@ FlacPcmImport::Open(unsigned sample_rate, unsigned bits_per_sample,
|
||||
{
|
||||
auto sample_format = FlacSampleFormat(bits_per_sample);
|
||||
if (sample_format == SampleFormat::UNDEFINED)
|
||||
throw FormatRuntimeError("Unsupported FLAC bit depth: %u",
|
||||
bits_per_sample);
|
||||
throw FmtRuntimeError("Unsupported FLAC bit depth: {}",
|
||||
bits_per_sample);
|
||||
|
||||
audio_format = CheckAudioFormat(sample_rate, sample_format, channels);
|
||||
}
|
||||
|
@@ -21,10 +21,10 @@
|
||||
#include "MikmodDecoderPlugin.hxx"
|
||||
#include "../DecoderAPI.hxx"
|
||||
#include "lib/fmt/PathFormatter.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "tag/Handler.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "Version.h"
|
||||
|
||||
@@ -111,8 +111,8 @@ mikmod_decoder_init(const ConfigBlock &block)
|
||||
mikmod_loop = block.GetBlockValue("loop", false);
|
||||
mikmod_sample_rate = block.GetPositiveValue("sample_rate", 44100U);
|
||||
if (!audio_valid_sample_rate(mikmod_sample_rate))
|
||||
throw FormatRuntimeError("Invalid sample rate in line %d: %u",
|
||||
block.line, mikmod_sample_rate);
|
||||
throw FmtRuntimeError("Invalid sample rate in line {}: {}",
|
||||
block.line, mikmod_sample_rate);
|
||||
|
||||
md_device = 0;
|
||||
md_reverb = 0;
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#include "../DecoderAPI.hxx"
|
||||
#include "input/InputStream.hxx"
|
||||
#include "tag/Handler.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -56,14 +56,14 @@ modplug_decoder_init(const ConfigBlock &block)
|
||||
} else if (strcmp(modplug_resampling_mode_value, "fir") == 0) {
|
||||
modplug_resampling_mode = MODPLUG_RESAMPLE_FIR;
|
||||
} else {
|
||||
throw FormatRuntimeError("Invalid resampling mode in line %d: %s",
|
||||
block.line, modplug_resampling_mode_value);
|
||||
throw FmtRuntimeError("Invalid resampling mode in line {}: {}",
|
||||
block.line, modplug_resampling_mode_value);
|
||||
}
|
||||
|
||||
modplug_loop_count = block.GetBlockValue("loop_count", 0);
|
||||
if (modplug_loop_count < -1)
|
||||
throw FormatRuntimeError("Invalid loop count in line %d: %i",
|
||||
block.line, modplug_loop_count);
|
||||
throw FmtRuntimeError("Invalid loop count in line {}: {}",
|
||||
block.line, modplug_loop_count);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include "tag/Handler.hxx"
|
||||
#include "tag/Type.h"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <libopenmpt/libopenmpt.hpp>
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "OpusTags.hxx"
|
||||
#include "lib/xiph/OggPacket.hxx"
|
||||
#include "lib/xiph/OggFind.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "../DecoderAPI.hxx"
|
||||
#include "decoder/Reader.hxx"
|
||||
#include "input/Reader.hxx"
|
||||
@@ -31,7 +32,6 @@
|
||||
#include "tag/Handler.hxx"
|
||||
#include "tag/Builder.hxx"
|
||||
#include "input/InputStream.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <opus.h>
|
||||
@@ -206,8 +206,8 @@ MPDOpusDecoder::OnOggBeginning(const ogg_packet &packet)
|
||||
assert(IsInitialized() == (output_buffer != nullptr));
|
||||
|
||||
if (IsInitialized() && channels != previous_channels)
|
||||
throw FormatRuntimeError("Next stream has different channels (%u -> %u)",
|
||||
previous_channels, channels);
|
||||
throw FmtRuntimeError("Next stream has different channels ({} -> {})",
|
||||
previous_channels, channels);
|
||||
|
||||
/* TODO: parse attributes from the OpusHead (sample rate,
|
||||
channels, ...) */
|
||||
@@ -216,8 +216,8 @@ MPDOpusDecoder::OnOggBeginning(const ogg_packet &packet)
|
||||
opus_decoder = opus_decoder_create(opus_sample_rate, channels,
|
||||
&opus_error);
|
||||
if (opus_decoder == nullptr)
|
||||
throw FormatRuntimeError("libopus error: %s",
|
||||
opus_strerror(opus_error));
|
||||
throw FmtRuntimeError("libopus error: {}",
|
||||
opus_strerror(opus_error));
|
||||
|
||||
if (IsInitialized()) {
|
||||
/* decoder was already initialized by the previous
|
||||
@@ -318,8 +318,8 @@ MPDOpusDecoder::HandleAudio(const ogg_packet &packet)
|
||||
0);
|
||||
if (gcc_unlikely(nframes <= 0)) {
|
||||
if (nframes < 0)
|
||||
throw FormatRuntimeError("libopus error: %s",
|
||||
opus_strerror(nframes));
|
||||
throw FmtRuntimeError("libopus error: {}",
|
||||
opus_strerror(nframes));
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
@@ -25,17 +25,17 @@
|
||||
#include "song/DetachedSong.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "lib/fmt/PathFormatter.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "lib/icu/Converter.hxx"
|
||||
#ifdef HAVE_SIDPLAYFP
|
||||
#include "io/FileReader.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#endif
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/AllocatedString.hxx"
|
||||
#include "util/CharUtil.hxx"
|
||||
#include "util/ByteOrder.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#ifdef HAVE_SIDPLAYFP
|
||||
@@ -88,10 +88,7 @@ static void loadRom(const Path rom_path, uint8_t *dump)
|
||||
{
|
||||
FileReader romDump(rom_path);
|
||||
if (romDump.Read(dump, rom_size) != rom_size)
|
||||
{
|
||||
throw FormatRuntimeError
|
||||
("Could not load rom dump '%s'", rom_path.c_str());
|
||||
}
|
||||
throw FmtRuntimeError("Could not load rom dump '{}'", rom_path);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -108,8 +105,8 @@ sidplay_load_songlength_db(const Path path)
|
||||
bool error = db->open(path.c_str()) < 0;
|
||||
#endif
|
||||
if (error)
|
||||
throw FormatRuntimeError("unable to read songlengths file %s: %s",
|
||||
path.c_str(), db->error());
|
||||
throw FmtRuntimeError("unable to read songlengths file {}: {}",
|
||||
path, db->error());
|
||||
|
||||
return db;
|
||||
}
|
||||
|
@@ -24,10 +24,11 @@
|
||||
#include "pcm/CheckAudioFormat.hxx"
|
||||
#include "tag/Handler.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "lib/fmt/PathFormatter.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "util/AllocatedString.hxx"
|
||||
#include "util/Math.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
#include <wavpack/wavpack.h>
|
||||
|
||||
@@ -54,8 +55,8 @@ WavpackOpenInput(Path path, int flags, int norm_offset)
|
||||
auto *wpc = WavpackOpenFileInput(path.c_str(), error,
|
||||
flags, norm_offset);
|
||||
if (wpc == nullptr)
|
||||
throw FormatRuntimeError("failed to open WavPack file \"%s\": %s",
|
||||
path.c_str(), error);
|
||||
throw FmtRuntimeError("failed to open WavPack file \"{}\": {}",
|
||||
path, error);
|
||||
|
||||
return wpc;
|
||||
}
|
||||
@@ -72,8 +73,8 @@ WavpackOpenInput(const WavpackStreamReader64 &reader, void *wv_id, void *wvc_id,
|
||||
wv_id, wvc_id, error,
|
||||
flags, norm_offset);
|
||||
if (wpc == nullptr)
|
||||
throw FormatRuntimeError("failed to open WavPack stream: %s",
|
||||
error);
|
||||
throw FmtRuntimeError("failed to open WavPack stream: {}",
|
||||
error);
|
||||
|
||||
return wpc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user