Fail initializing the CD-FLAC codec if the hunk size is not CD-compatible.
Centralize detection of existing output files. Add detection (require --force) for extracted files as well. Move checks outside of try/catch so that the files are not subsequently deleted.
This commit is contained in:
parent
9e8ea7466f
commit
397de27f0c
@ -1248,6 +1248,10 @@ chd_cd_flac_compressor::chd_cd_flac_compressor(chd_file &chd, bool lossy)
|
||||
: chd_compressor(chd, lossy),
|
||||
m_buffer(chd.hunk_bytes())
|
||||
{
|
||||
// make sure the CHD's hunk size is an even multiple of the frame size
|
||||
if (chd.hunk_bytes() % CD_FRAME_SIZE != 0)
|
||||
throw CHDERR_CODEC_ERROR;
|
||||
|
||||
// determine whether we want native or swapped samples
|
||||
UINT16 native_endian = 0;
|
||||
*reinterpret_cast<UINT8 *>(&native_endian) = 1;
|
||||
@ -1342,6 +1346,10 @@ chd_cd_flac_decompressor::chd_cd_flac_decompressor(chd_file &chd, bool lossy)
|
||||
: chd_decompressor(chd, lossy),
|
||||
m_buffer(chd.hunk_bytes())
|
||||
{
|
||||
// make sure the CHD's hunk size is an even multiple of the frame size
|
||||
if (chd.hunk_bytes() % CD_FRAME_SIZE != 0)
|
||||
throw CHDERR_CODEC_ERROR;
|
||||
|
||||
// determine whether we want native or swapped samples
|
||||
UINT16 native_endian = 0;
|
||||
*reinterpret_cast<UINT8 *>(&native_endian) = 1;
|
||||
|
1021
src/tools/chdman.c
1021
src/tools/chdman.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user