diff options
author | Joff <jauffrayl@gmail.com> | 2014-07-09 19:18:36 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-07-09 19:18:36 +0200 |
commit | 09384df32cc6bef40bc3630de1c928d2eb424909 (patch) | |
tree | 2fe6c8683a931ac3142d0014c74e1d8102ad5f23 /src/decoder/DsfDecoderPlugin.cxx | |
parent | 20538516b92082067ce3477d612fb404ba8671ad (diff) | |
download | mpd-09384df32cc6bef40bc3630de1c928d2eb424909.tar.gz mpd-09384df32cc6bef40bc3630de1c928d2eb424909.tar.xz mpd-09384df32cc6bef40bc3630de1c928d2eb424909.zip |
decoder/dsd: use decoder_read_full() where appropriate
Addresses Mantis ticket 0004015.
[mk: use decoder_read_full() only when needed, and a few formal
changes]
Diffstat (limited to 'src/decoder/DsfDecoderPlugin.cxx')
-rw-r--r-- | src/decoder/DsfDecoderPlugin.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/decoder/DsfDecoderPlugin.cxx b/src/decoder/DsfDecoderPlugin.cxx index 5ef94e647..ad5483c32 100644 --- a/src/decoder/DsfDecoderPlugin.cxx +++ b/src/decoder/DsfDecoderPlugin.cxx @@ -103,7 +103,7 @@ dsf_read_metadata(Decoder *decoder, InputStream &is, DsfMetaData *metadata) { DsfHeader dsf_header; - if (!dsdlib_read(decoder, is, &dsf_header, sizeof(dsf_header)) || + if (!decoder_read_full(decoder, is, &dsf_header, sizeof(dsf_header)) || !dsf_header.id.Equals("DSD ")) return false; @@ -117,7 +117,8 @@ dsf_read_metadata(Decoder *decoder, InputStream &is, /* read the 'fmt ' chunk of the DSF file */ DsfFmtChunk dsf_fmt_chunk; - if (!dsdlib_read(decoder, is, &dsf_fmt_chunk, sizeof(dsf_fmt_chunk)) || + if (!decoder_read_full(decoder, is, + &dsf_fmt_chunk, sizeof(dsf_fmt_chunk)) || !dsf_fmt_chunk.id.Equals("fmt ")) return false; @@ -143,7 +144,7 @@ dsf_read_metadata(Decoder *decoder, InputStream &is, /* read the 'data' chunk of the DSF file */ DsfDataChunk data_chunk; - if (!dsdlib_read(decoder, is, &data_chunk, sizeof(data_chunk)) || + if (!decoder_read_full(decoder, is, &data_chunk, sizeof(data_chunk)) || !data_chunk.id.Equals("data")) return false; @@ -247,10 +248,10 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is, now_size = now_frames * frame_size; } - size_t nbytes = decoder_read(&decoder, is, buffer, now_size); - if (nbytes != now_size) + if (!decoder_read_full(&decoder, is, buffer, now_size)) return false; + const size_t nbytes = now_size; chunk_size -= nbytes; if (bitreverse) |