X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fkino%2Friff.cc;h=44a082ca1e655af9bc21000554834f5106b2109e;hb=f4963a6aa07644399b273b5d2b1f9299c9047414;hp=bc616dda02cd972d2f0185b8188581b6eb516696;hpb=815c458e95c73c39433fa7913afb4a830d7fd376;p=melted diff --git a/src/modules/kino/riff.cc b/src/modules/kino/riff.cc index bc616dd..44a082c 100644 --- a/src/modules/kino/riff.cc +++ b/src/modules/kino/riff.cc @@ -21,6 +21,12 @@ * Change log: * * $Log$ +* Revision 1.3 2005/07/25 14:41:29 lilo_booter +* + Minor correction for entry length being less than the data length +* +* Revision 1.2 2005/07/25 07:21:39 lilo_booter +* + fixes for opendml dv avi +* * Revision 1.1 2005/04/15 14:28:26 lilo_booter * Initial version * @@ -76,7 +82,9 @@ //#include #include #include +#ifndef __FreeBSD__ #include +#endif /* __FreeBSD__ */ using std::cout; using std::hex; @@ -107,7 +115,7 @@ using std::endl; could not get it working on the gcc compiler so I had to use this workaround. We can now use id = make_fourcc("ABCD") instead. */ -FOURCC make_fourcc( char *s ) +FOURCC make_fourcc( const char *s ) { if ( s[ 0 ] == 0 ) return 0; @@ -507,10 +515,10 @@ void RIFFFile::ParseChunk( int parent ) /* Check whether it is a LIST. If so, let ParseList deal with it */ - read( fd, &type, sizeof( type ) ); + fail_if( read( fd, &type, sizeof( type ) ) != sizeof( type )); if ( type == make_fourcc( "LIST" ) ) { - typesize = -sizeof( type ); + typesize = (int) -sizeof( type ); fail_if( lseek( fd, typesize, SEEK_CUR ) == ( off_t ) - 1 ); ParseList( parent ); } @@ -612,14 +620,14 @@ void RIFFFile::ParseRIFF( void ) */ -void RIFFFile::ReadChunk( int chunk_index, void *data ) +void RIFFFile::ReadChunk( int chunk_index, void *data, off_t data_len ) { RIFFDirEntry entry; entry = GetDirectoryEntry( chunk_index ); pthread_mutex_lock( &file_mutex ); fail_if( lseek( fd, entry.offset, SEEK_SET ) == ( off_t ) - 1 ); - fail_neg( read( fd, data, entry.length ) ); + fail_neg( read( fd, data, entry.length > data_len ? data_len : entry.length ) ); pthread_mutex_unlock( &file_mutex ); }