aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/DsdiffDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-07-09 20:02:07 +0200
committerMax Kellermann <max@duempel.org>2014-07-09 20:02:07 +0200
commit913064d6cc0dcfddb4eee0dcddacc5c82fa31448 (patch)
tree9ca3e14da0d2c355a65170ad994d47c1ac60c17a /src/decoder/plugins/DsdiffDecoderPlugin.cxx
parentfb45b8a5c94070d30e9a8ef33b04cb44c113515b (diff)
parent09384df32cc6bef40bc3630de1c928d2eb424909 (diff)
downloadmpd-913064d6cc0dcfddb4eee0dcddacc5c82fa31448.tar.gz
mpd-913064d6cc0dcfddb4eee0dcddacc5c82fa31448.tar.xz
mpd-913064d6cc0dcfddb4eee0dcddacc5c82fa31448.zip
Merge branch 'v0.18.x'
Diffstat (limited to 'src/decoder/plugins/DsdiffDecoderPlugin.cxx')
-rw-r--r--src/decoder/plugins/DsdiffDecoderPlugin.cxx25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/decoder/plugins/DsdiffDecoderPlugin.cxx b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
index 92f7ecdaa..d6f402911 100644
--- a/src/decoder/plugins/DsdiffDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
@@ -90,14 +90,14 @@ static bool
dsdiff_read_id(Decoder *decoder, InputStream &is,
DsdId *id)
{
- return dsdlib_read(decoder, is, id, sizeof(*id));
+ return decoder_read_full(decoder, is, id, sizeof(*id));
}
static bool
dsdiff_read_chunk_header(Decoder *decoder, InputStream &is,
DsdiffChunkHeader *header)
{
- return dsdlib_read(decoder, is, header, sizeof(*header));
+ return decoder_read_full(decoder, is, header, sizeof(*header));
}
static bool
@@ -109,8 +109,7 @@ dsdiff_read_payload(Decoder *decoder, InputStream &is,
if (size != (uint64_t)length)
return false;
- size_t nbytes = decoder_read(decoder, is, data, length);
- return nbytes == length;
+ return decoder_read_full(decoder, is, data, length);
}
/**
@@ -142,8 +141,8 @@ dsdiff_read_prop_snd(Decoder *decoder, InputStream &is,
} else if (header.id.Equals("CHNL")) {
uint16_t channels;
if (header.GetSize() < sizeof(channels) ||
- !dsdlib_read(decoder, is,
- &channels, sizeof(channels)) ||
+ !decoder_read_full(decoder, is,
+ &channels, sizeof(channels)) ||
!dsdlib_skip_to(decoder, is, chunk_end_offset))
return false;
@@ -151,8 +150,8 @@ dsdiff_read_prop_snd(Decoder *decoder, InputStream &is,
} else if (header.id.Equals("CMPR")) {
DsdId type;
if (header.GetSize() < sizeof(type) ||
- !dsdlib_read(decoder, is,
- &type, sizeof(type)) ||
+ !decoder_read_full(decoder, is,
+ &type, sizeof(type)) ||
!dsdlib_skip_to(decoder, is, chunk_end_offset))
return false;
@@ -205,7 +204,7 @@ dsdiff_handle_native_tag(InputStream &is,
struct dsdiff_native_tag metatag;
- if (!dsdlib_read(nullptr, is, &metatag, sizeof(metatag)))
+ if (!decoder_read_full(nullptr, is, &metatag, sizeof(metatag)))
return;
uint32_t length = FromBE32(metatag.size);
@@ -218,7 +217,7 @@ dsdiff_handle_native_tag(InputStream &is,
char *label;
label = string;
- if (!dsdlib_read(nullptr, is, label, (size_t)length))
+ if (!decoder_read_full(nullptr, is, label, (size_t)length))
return;
string[length] = '\0';
@@ -325,7 +324,7 @@ dsdiff_read_metadata(Decoder *decoder, InputStream &is,
DsdiffChunkHeader *chunk_header)
{
DsdiffHeader header;
- if (!dsdlib_read(decoder, is, &header, sizeof(header)) ||
+ if (!decoder_read_full(decoder, is, &header, sizeof(header)) ||
!header.id.Equals("FRM8") ||
!header.format.Equals("DSD "))
return false;
@@ -388,10 +387,10 @@ dsdiff_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 (lsbitfirst)