From 9b4156a282772e560c02e925921e71c23e1880e1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 7 Jul 2018 13:21:27 +0200 Subject: [PATCH] decoder/audiofile: add "noexcept" --- .../plugins/AudiofileDecoderPlugin.cxx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/decoder/plugins/AudiofileDecoderPlugin.cxx b/src/decoder/plugins/AudiofileDecoderPlugin.cxx index 5eca65fb7..6a555abaf 100644 --- a/src/decoder/plugins/AudiofileDecoderPlugin.cxx +++ b/src/decoder/plugins/AudiofileDecoderPlugin.cxx @@ -38,7 +38,7 @@ static constexpr Domain audiofile_domain("audiofile"); static void -audiofile_error_func(long, const char *msg) +audiofile_error_func(long, const char *msg) noexcept { LogWarning(audiofile_domain, msg); } @@ -54,7 +54,7 @@ struct AudioFileInputStream { DecoderClient *const client; InputStream &is; - size_t Read(void *buffer, size_t size) { + size_t Read(void *buffer, size_t size) noexcept { /* libaudiofile does not like partial reads at all, and will abort playback; therefore always force full reads */ @@ -73,7 +73,7 @@ audiofile_get_duration(AFfilehandle fh) noexcept } static ssize_t -audiofile_file_read(AFvirtualfile *vfile, void *data, size_t length) +audiofile_file_read(AFvirtualfile *vfile, void *data, size_t length) noexcept { AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure; @@ -81,7 +81,7 @@ audiofile_file_read(AFvirtualfile *vfile, void *data, size_t length) } static AFfileoffset -audiofile_file_length(AFvirtualfile *vfile) +audiofile_file_length(AFvirtualfile *vfile) noexcept { AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure; InputStream &is = afis.is; @@ -90,7 +90,7 @@ audiofile_file_length(AFvirtualfile *vfile) } static AFfileoffset -audiofile_file_tell(AFvirtualfile *vfile) +audiofile_file_tell(AFvirtualfile *vfile) noexcept { AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure; InputStream &is = afis.is; @@ -99,7 +99,7 @@ audiofile_file_tell(AFvirtualfile *vfile) } static void -audiofile_file_destroy(AFvirtualfile *vfile) +audiofile_file_destroy(AFvirtualfile *vfile) noexcept { assert(vfile->closure != nullptr); @@ -108,7 +108,7 @@ audiofile_file_destroy(AFvirtualfile *vfile) static AFfileoffset audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset _offset, - int is_relative) + int is_relative) noexcept { AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure; InputStream &is = afis.is; @@ -127,7 +127,7 @@ audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset _offset, } static AFvirtualfile * -setup_virtual_fops(AudioFileInputStream &afis) +setup_virtual_fops(AudioFileInputStream &afis) noexcept { AFvirtualfile *vf = new AFvirtualfile(); vf->closure = &afis; @@ -140,8 +140,9 @@ setup_virtual_fops(AudioFileInputStream &afis) return vf; } +gcc_const static SampleFormat -audiofile_bits_to_sample_format(int bits) +audiofile_bits_to_sample_format(int bits) noexcept { switch (bits) { case 8: @@ -161,7 +162,7 @@ audiofile_bits_to_sample_format(int bits) } static SampleFormat -audiofile_setup_sample_format(AFfilehandle af_fp) +audiofile_setup_sample_format(AFfilehandle af_fp) noexcept { int fs, bits;