decoder/Plugin: add "noexcept"

This commit is contained in:
Max Kellermann 2018-01-21 11:47:17 +01:00
parent d921114832
commit 7d789a984a
19 changed files with 31 additions and 31 deletions

View File

@ -48,7 +48,7 @@ struct DecoderPlugin {
* Deinitialize a decoder plugin which was initialized * Deinitialize a decoder plugin which was initialized
* successfully. Optional method. * successfully. Optional method.
*/ */
void (*finish)(); void (*finish)() noexcept;
/** /**
* Decode a stream (data read from an #InputStream object). * Decode a stream (data read from an #InputStream object).
@ -73,7 +73,7 @@ struct DecoderPlugin {
*/ */
bool (*scan_file)(Path path_fs, bool (*scan_file)(Path path_fs,
const TagHandler &handler, const TagHandler &handler,
void *handler_ctx); void *handler_ctx) noexcept;
/** /**
* Scan metadata of a file. * Scan metadata of a file.
@ -82,7 +82,7 @@ struct DecoderPlugin {
*/ */
bool (*scan_stream)(InputStream &is, bool (*scan_stream)(InputStream &is,
const TagHandler &handler, const TagHandler &handler,
void *handler_ctx); void *handler_ctx) noexcept;
/** /**
* @brief Return a "virtual" filename for subtracks in * @brief Return a "virtual" filename for subtracks in
@ -140,7 +140,7 @@ struct DecoderPlugin {
*/ */
template<typename P> template<typename P>
bool ScanFile(P path_fs, bool ScanFile(P path_fs,
const TagHandler &handler, void *handler_ctx) const { const TagHandler &handler, void *handler_ctx) const noexcept {
return scan_file != nullptr return scan_file != nullptr
? scan_file(path_fs, handler, handler_ctx) ? scan_file(path_fs, handler, handler_ctx)
: false; : false;
@ -150,7 +150,7 @@ struct DecoderPlugin {
* Read the tag of a stream. * Read the tag of a stream.
*/ */
bool ScanStream(InputStream &is, bool ScanStream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const { const TagHandler &handler, void *handler_ctx) const noexcept {
return scan_stream != nullptr return scan_stream != nullptr
? scan_stream(is, handler, handler_ctx) ? scan_stream(is, handler, handler_ctx)
: false; : false;

View File

@ -257,7 +257,7 @@ audiofile_get_duration(InputStream &is) noexcept
static bool static bool
audiofile_scan_stream(InputStream &is, audiofile_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
const auto duration = audiofile_get_duration(is); const auto duration = audiofile_get_duration(is);
if (duration.IsNegative()) if (duration.IsNegative())

View File

@ -451,7 +451,7 @@ dsdiff_stream_decode(DecoderClient &client, InputStream &is)
static bool static bool
dsdiff_scan_stream(InputStream &is, dsdiff_scan_stream(InputStream &is,
gcc_unused const TagHandler &handler, gcc_unused const TagHandler &handler,
gcc_unused void *handler_ctx) gcc_unused void *handler_ctx) noexcept
{ {
DsdiffMetaData metadata; DsdiffMetaData metadata;
DsdiffChunkHeader chunk_header; DsdiffChunkHeader chunk_header;

View File

@ -327,7 +327,7 @@ dsf_stream_decode(DecoderClient &client, InputStream &is)
static bool static bool
dsf_scan_stream(InputStream &is, dsf_scan_stream(InputStream &is,
gcc_unused const TagHandler &handler, gcc_unused const TagHandler &handler,
gcc_unused void *handler_ctx) gcc_unused void *handler_ctx) noexcept
{ {
/* check DSF metadata */ /* check DSF metadata */
DsfMetaData metadata; DsfMetaData metadata;

View File

@ -415,7 +415,7 @@ faad_stream_decode(DecoderClient &client, InputStream &is)
static bool static bool
faad_scan_stream(InputStream &is, faad_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
auto result = faad_get_file_time(is); auto result = faad_get_file_time(is);
if (!result.first) if (!result.first)

View File

@ -103,7 +103,7 @@ ffmpeg_init(const ConfigBlock &block)
} }
static void static void
ffmpeg_finish() ffmpeg_finish() noexcept
{ {
av_dict_free(&avformat_options); av_dict_free(&avformat_options);
} }
@ -856,7 +856,7 @@ FfmpegScanStream(AVFormatContext &format_context,
static bool static bool
ffmpeg_scan_stream(InputStream &is, ffmpeg_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
AVInputFormat *input_format = ffmpeg_probe(nullptr, is); AVInputFormat *input_format = ffmpeg_probe(nullptr, is);
if (input_format == nullptr) if (input_format == nullptr)

View File

@ -70,7 +70,7 @@ flac_write_cb(const FLAC__StreamDecoder *dec, const FLAC__Frame *frame,
static bool static bool
flac_scan_file(Path path_fs, flac_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
FlacMetadataChain chain; FlacMetadataChain chain;
if (!chain.Read(NarrowPath(path_fs))) { if (!chain.Read(NarrowPath(path_fs))) {
@ -86,7 +86,7 @@ flac_scan_file(Path path_fs,
static bool static bool
flac_scan_stream(InputStream &is, flac_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
FlacMetadataChain chain; FlacMetadataChain chain;
if (!chain.Read(is)) { if (!chain.Read(is)) {
@ -290,7 +290,7 @@ oggflac_init(gcc_unused const ConfigBlock &block)
static bool static bool
oggflac_scan_file(Path path_fs, oggflac_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
FlacMetadataChain chain; FlacMetadataChain chain;
if (!chain.ReadOgg(NarrowPath(path_fs))) { if (!chain.ReadOgg(NarrowPath(path_fs))) {
@ -306,7 +306,7 @@ oggflac_scan_file(Path path_fs,
static bool static bool
oggflac_scan_stream(InputStream &is, oggflac_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
FlacMetadataChain chain; FlacMetadataChain chain;
if (!chain.ReadOgg(is)) { if (!chain.ReadOgg(is)) {

View File

@ -194,7 +194,7 @@ fluidsynth_file_decode(DecoderClient &client, Path path_fs)
static bool static bool
fluidsynth_scan_file(Path path_fs, fluidsynth_scan_file(Path path_fs,
gcc_unused const TagHandler &handler, gcc_unused const TagHandler &handler,
gcc_unused void *handler_ctx) gcc_unused void *handler_ctx) noexcept
{ {
return fluid_is_midifile(path_fs.c_str()); return fluid_is_midifile(path_fs.c_str());
} }

View File

@ -282,7 +282,7 @@ ScanMusicEmu(Music_Emu *emu, unsigned song_num,
static bool static bool
gme_scan_file(Path path_fs, gme_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
const auto container = ParseContainerPath(path_fs); const auto container = ParseContainerPath(path_fs);

View File

@ -1063,7 +1063,7 @@ mp3_decode(DecoderClient &client, InputStream &input_stream)
static bool static bool
mad_decoder_scan_stream(InputStream &is, mad_decoder_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
const auto result = mad_decoder_total_file_time(is); const auto result = mad_decoder_total_file_time(is);
if (!result.first) if (!result.first)

View File

@ -141,7 +141,7 @@ mikmod_decoder_init(const ConfigBlock &block)
} }
static void static void
mikmod_decoder_finish(void) mikmod_decoder_finish() noexcept
{ {
MikMod_Exit(); MikMod_Exit();
} }
@ -186,7 +186,7 @@ mikmod_decoder_file_decode(DecoderClient &client, Path path_fs)
static bool static bool
mikmod_decoder_scan_file(Path path_fs, mikmod_decoder_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
/* deconstify the path because libmikmod wants a non-const /* deconstify the path because libmikmod wants a non-const
string pointer */ string pointer */

View File

@ -176,7 +176,7 @@ mod_decode(DecoderClient &client, InputStream &is)
static bool static bool
modplug_scan_stream(InputStream &is, modplug_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
ModPlugFile *f = LoadModPlugFile(nullptr, is); ModPlugFile *f = LoadModPlugFile(nullptr, is);
if (f == nullptr) if (f == nullptr)

View File

@ -258,7 +258,7 @@ mpcdec_get_file_duration(InputStream &is)
static bool static bool
mpcdec_scan_stream(InputStream &is, mpcdec_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
const auto duration = mpcdec_get_file_duration(is); const auto duration = mpcdec_get_file_duration(is);
if (duration.IsNegative()) if (duration.IsNegative())

View File

@ -45,7 +45,7 @@ mpd_mpg123_init(gcc_unused const ConfigBlock &block)
} }
static void static void
mpd_mpg123_finish(void) mpd_mpg123_finish() noexcept
{ {
mpg123_exit(); mpg123_exit();
} }
@ -280,7 +280,7 @@ mpd_mpg123_file_decode(DecoderClient &client, Path path_fs)
static bool static bool
mpd_mpg123_scan_file(Path path_fs, mpd_mpg123_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
int error; int error;
mpg123_handle *const handle = mpg123_new(nullptr, &error); mpg123_handle *const handle = mpg123_new(nullptr, &error);

View File

@ -341,7 +341,7 @@ VisitOpusDuration(InputStream &is, OggSyncState &sync, OggStreamState &stream,
static bool static bool
mpd_opus_scan_stream(InputStream &is, mpd_opus_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
InputStreamReader reader(is); InputStreamReader reader(is);
OggSyncState oy(reader); OggSyncState oy(reader);

View File

@ -262,7 +262,7 @@ static constexpr struct {
static bool static bool
sndfile_scan_stream(InputStream &is, sndfile_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
SF_INFO info; SF_INFO info;

View File

@ -363,7 +363,7 @@ VisitVorbisDuration(InputStream &is,
static bool static bool
vorbis_scan_stream(InputStream &is, vorbis_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
/* initialize libogg */ /* initialize libogg */

View File

@ -579,7 +579,7 @@ wavpack_filedecode(DecoderClient &client, Path path_fs)
*/ */
static bool static bool
wavpack_scan_file(Path path_fs, wavpack_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
auto *wpc = WavpackOpenInput(path_fs, OPEN_DSD_FLAG, 0); auto *wpc = WavpackOpenInput(path_fs, OPEN_DSD_FLAG, 0);
AtScopeExit(wpc) { AtScopeExit(wpc) {
@ -595,7 +595,7 @@ wavpack_scan_file(Path path_fs,
static bool static bool
wavpack_scan_stream(InputStream &is, wavpack_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
WavpackInput isp(nullptr, is); WavpackInput isp(nullptr, is);
auto *wpc = WavpackOpenInput(&mpd_is_reader, &isp, nullptr, auto *wpc = WavpackOpenInput(&mpd_is_reader, &isp, nullptr,

View File

@ -54,7 +54,7 @@ wildmidi_init(const ConfigBlock &block)
} }
static void static void
wildmidi_finish(void) wildmidi_finish() noexcept
{ {
WildMidi_Shutdown(); WildMidi_Shutdown();
} }
@ -127,7 +127,7 @@ wildmidi_file_decode(DecoderClient &client, Path path_fs)
static bool static bool
wildmidi_scan_file(Path path_fs, wildmidi_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx) const TagHandler &handler, void *handler_ctx) noexcept
{ {
midi *wm = WildMidi_Open(path_fs.c_str()); midi *wm = WildMidi_Open(path_fs.c_str());
if (wm == nullptr) if (wm == nullptr)