decoder/wavpack: use AtScopeExit()

This commit is contained in:
Max Kellermann 2016-12-09 20:53:04 +01:00
parent ae7e25ea65
commit 0be5fbdc35
1 changed files with 8 additions and 4 deletions

View File

@ -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[] = {