decoder/audiofile: add "noexcept"

This commit is contained in:
Max Kellermann 2018-07-07 13:21:27 +02:00
parent 89b1e27d2e
commit 9b4156a282

View File

@ -38,7 +38,7 @@
static constexpr Domain audiofile_domain("audiofile"); static constexpr Domain audiofile_domain("audiofile");
static void static void
audiofile_error_func(long, const char *msg) audiofile_error_func(long, const char *msg) noexcept
{ {
LogWarning(audiofile_domain, msg); LogWarning(audiofile_domain, msg);
} }
@ -54,7 +54,7 @@ struct AudioFileInputStream {
DecoderClient *const client; DecoderClient *const client;
InputStream &is; 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, /* libaudiofile does not like partial reads at all,
and will abort playback; therefore always force full and will abort playback; therefore always force full
reads */ reads */
@ -73,7 +73,7 @@ audiofile_get_duration(AFfilehandle fh) noexcept
} }
static ssize_t 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; AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure;
@ -81,7 +81,7 @@ audiofile_file_read(AFvirtualfile *vfile, void *data, size_t length)
} }
static AFfileoffset static AFfileoffset
audiofile_file_length(AFvirtualfile *vfile) audiofile_file_length(AFvirtualfile *vfile) noexcept
{ {
AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure; AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure;
InputStream &is = afis.is; InputStream &is = afis.is;
@ -90,7 +90,7 @@ audiofile_file_length(AFvirtualfile *vfile)
} }
static AFfileoffset static AFfileoffset
audiofile_file_tell(AFvirtualfile *vfile) audiofile_file_tell(AFvirtualfile *vfile) noexcept
{ {
AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure; AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure;
InputStream &is = afis.is; InputStream &is = afis.is;
@ -99,7 +99,7 @@ audiofile_file_tell(AFvirtualfile *vfile)
} }
static void static void
audiofile_file_destroy(AFvirtualfile *vfile) audiofile_file_destroy(AFvirtualfile *vfile) noexcept
{ {
assert(vfile->closure != nullptr); assert(vfile->closure != nullptr);
@ -108,7 +108,7 @@ audiofile_file_destroy(AFvirtualfile *vfile)
static AFfileoffset static AFfileoffset
audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset _offset, audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset _offset,
int is_relative) int is_relative) noexcept
{ {
AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure; AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure;
InputStream &is = afis.is; InputStream &is = afis.is;
@ -127,7 +127,7 @@ audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset _offset,
} }
static AFvirtualfile * static AFvirtualfile *
setup_virtual_fops(AudioFileInputStream &afis) setup_virtual_fops(AudioFileInputStream &afis) noexcept
{ {
AFvirtualfile *vf = new AFvirtualfile(); AFvirtualfile *vf = new AFvirtualfile();
vf->closure = &afis; vf->closure = &afis;
@ -140,8 +140,9 @@ setup_virtual_fops(AudioFileInputStream &afis)
return vf; return vf;
} }
gcc_const
static SampleFormat static SampleFormat
audiofile_bits_to_sample_format(int bits) audiofile_bits_to_sample_format(int bits) noexcept
{ {
switch (bits) { switch (bits) {
case 8: case 8:
@ -161,7 +162,7 @@ audiofile_bits_to_sample_format(int bits)
} }
static SampleFormat static SampleFormat
audiofile_setup_sample_format(AFfilehandle af_fp) audiofile_setup_sample_format(AFfilehandle af_fp) noexcept
{ {
int fs, bits; int fs, bits;