diff options
author | Max Kellermann <max@musicpd.org> | 2016-12-09 20:53:04 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-12-09 20:53:04 +0100 |
commit | 0be5fbdc35223f20721b846c45a7a7401d292f55 (patch) | |
tree | e5d62515540eec795a33816c40d53728a6287866 /src/decoder | |
parent | ae7e25ea657de864fd5e1ab7b420343c2e9a1db1 (diff) |
decoder/wavpack: use AtScopeExit()
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/plugins/WavpackDecoderPlugin.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx index 16fcf4d60..f08bb131b 100644 --- a/src/decoder/plugins/WavpackDecoderPlugin.cxx +++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx @@ -279,6 +279,10 @@ wavpack_scan_file(Path path_fs, return false; } + AtScopeExit(wpc) { + WavpackCloseFile(wpc); + }; + const auto duration = SongTime::FromScale<uint64_t>(WavpackGetNumSamples(wpc), WavpackGetSampleRate(wpc)); @@ -312,8 +316,6 @@ wavpack_scan_file(Path path_fs, } } - WavpackCloseFile(wpc); - return true; } @@ -561,13 +563,15 @@ wavpack_filedecode(DecoderClient &client, Path path_fs) return; } + AtScopeExit(wpc) { + WavpackCloseFile(wpc); + }; + ReplayGainInfo rgi; if (wavpack_replaygain(rgi, wpc)) client.SubmitReplayGain(&rgi); wavpack_decode(client, wpc, true); - - WavpackCloseFile(wpc); } static char const *const wavpack_suffixes[] = { |