Prevent endless read of silent files

This fixes issues with analysis and archiving that rely on a readable
to return 0.

Note however that createSilent() uses max_samplecnt (INT64_MAX) by
default. This relies on a region setting the length of its missing
source.
This commit is contained in:
Robin Gareus
2018-12-05 16:04:29 +01:00
parent 5f3672eef0
commit 863a6ade9e

View File

@@ -51,7 +51,8 @@ protected:
_length = len;
}
samplecnt_t read_unlocked (Sample *dst, samplepos_t /*start*/, samplecnt_t cnt) const {
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const {
cnt = std::min (cnt, _length - start);
memset (dst, 0, sizeof (Sample) * cnt);
return cnt;
}