Fixed streamfile offset at EOF

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@787 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
josh-w 2010-04-30 12:05:08 +00:00
parent 87e7537643
commit 637ff7d24f

View File

@ -49,11 +49,15 @@ 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;
} catch (...) {
streamfile->offset = streamfile->m_file->get_size(*streamfile->p_abort);
return length_read; //fail miserably
}
@ -146,7 +150,7 @@ static off_t get_offset_foo(FOO_STREAMFILE *streamFile) {
static void close_foo(FOO_STREAMFILE * streamfile) {
streamfile->m_file.release();
free(streamfile->buffer);
free(streamfile);
free(streamfile);
}
static void get_name_foo(FOO_STREAMFILE *streamfile,char *buffer,size_t length) {