diff --git a/ChangeLog b/ChangeLog index e83bbd810..f1b84f1ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-06-13 Moritz Bunkus + * mkvmerge: bug fix: Reading of broken / unfinished AVI files was + broken on Windows. + * Released v0.9.1. * mkvmerge: Dropped supoprt for 'aviclasses' (one of the two diff --git a/avilib-0.6.10/xio.cpp b/avilib-0.6.10/xio.cpp index fe0a9b2e1..5fca59c42 100644 --- a/avilib-0.6.10/xio.cpp +++ b/avilib-0.6.10/xio.cpp @@ -107,18 +107,25 @@ off_t xio_lseek(int fd, off_t offset, int whence) { + int64_t expected_pos; seek_mode smode; if ((fd < 0) || (fd >= MAX_INSTANCES) || (instances[fd] == NULL)) - return -1; - if (whence == SEEK_SET) + return (off_t)-1; + if (whence == SEEK_SET) { smode = seek_beginning; - else if (whence == SEEK_END) + expected_pos = offset; + } else if (whence == SEEK_END) { smode = seek_end; - else + expected_pos = instances[fd]->get_size() - offset; + } else { smode = seek_current; + expected_pos = instances[fd]->getFilePointer() + offset; + } instances[fd]->setFilePointer(offset, smode); - return instances[fd]->getFilePointer(); + if (instances[fd]->getFilePointer() != expected_pos) + return (off_t)-1; + return expected_pos; } int