Fix a rare case of silence/0-read at the edge of some files

This was only noticeable in some FFmpeg files, since it uses an IO
buffer size that didn't align with foobar's.
This commit is contained in:
bnnm 2017-01-02 15:41:18 +01:00
parent 9d33b42584
commit a79cc5546b

View File

@ -49,13 +49,14 @@ static size_t read_the_rest_foo(uint8_t * dest, off_t offset, size_t length, FOO
streamfile->validsize=0;
try {
if(offset >= streamfile->m_file->get_size(*streamfile->p_abort)) {
if(offset > streamfile->m_file->get_size(*streamfile->p_abort)) {
/* Update offset at end of file */
streamfile->offset = streamfile->m_file->get_size(*streamfile->p_abort);
return length_read;
}
streamfile->m_file->seek(offset,*streamfile->p_abort);
if (streamfile->m_file->is_eof(*streamfile->p_abort)) return length_read;
//if (streamfile->m_file->is_eof(*streamfile->p_abort)) /* allow edge case of offset=filesize */
// return length_read;
} catch (...) {
streamfile->offset = streamfile->m_file->get_size(*streamfile->p_abort);
#ifdef PROFILE_STREAMFILE