decoder/{dsdiff,dsf,mpg123,wavpack}: avoid exceptions in scan methods

The scan methods must be "noexcept".
This commit is contained in:
Max Kellermann
2018-01-25 13:01:39 +01:00
parent 47fa8c4cf6
commit fd0a5a1116
4 changed files with 33 additions and 13 deletions

View File

@@ -581,7 +581,14 @@ static bool
wavpack_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx) noexcept
{
auto *wpc = WavpackOpenInput(path_fs, OPEN_DSD_FLAG, 0);
WavpackContext *wpc;
try {
wpc = WavpackOpenInput(path_fs, OPEN_DSD_FLAG, 0);
} catch (...) {
return false;
}
AtScopeExit(wpc) {
WavpackCloseFile(wpc);
};
@@ -598,8 +605,15 @@ wavpack_scan_stream(InputStream &is,
const TagHandler &handler, void *handler_ctx) noexcept
{
WavpackInput isp(nullptr, is);
auto *wpc = WavpackOpenInput(&mpd_is_reader, &isp, nullptr,
OPEN_DSD_FLAG, 0);
WavpackContext *wpc;
try {
wpc = WavpackOpenInput(&mpd_is_reader, &isp, nullptr,
OPEN_DSD_FLAG, 0);
} catch (...) {
return false;
}
AtScopeExit(wpc) {
WavpackCloseFile(wpc);
};