# HG changeset patch # User nicodvb # Date 1208597695 0 # Node ID 0bfe718f75e8627a3702a1217cd4d6b7a7cbc6b9 # Parent c73a93208d1471713cc4453f956d52a5bde39b73 #define TITLES_MAX as 9 instead of using an hardcodec value ; patch by Erik Hovland - erik hovland org diff -r c73a93208d14 -r 0bfe718f75e8 dvdread/dvd_reader.c --- a/dvdread/dvd_reader.c Sat Apr 19 09:29:18 2008 +0000 +++ b/dvdread/dvd_reader.c Sat Apr 19 09:34:55 2008 +0000 @@ -88,6 +88,8 @@ void *udfcache; }; +#define TITLES_MAX 9 + struct dvd_file_s { /* Basic information. */ dvd_reader_t *dvd; @@ -100,8 +102,8 @@ uint32_t seek_pos; /* Information required for a directory path drive. */ - size_t title_sizes[ 9 ]; - dvd_input_t title_devs[ 9 ]; + size_t title_sizes[ TITLES_MAX ]; + dvd_input_t title_devs[ TITLES_MAX ]; /* Calculated at open-time, size in blocks. */ ssize_t filesize; @@ -441,10 +443,10 @@ path_copy[ strlen( path_copy ) - 1 ] = '\0'; } - if( strlen( path_copy ) > 9 ) { - if( !strcasecmp( &(path_copy[ strlen( path_copy ) - 9 ]), + if( strlen( path_copy ) > TITLES_MAX ) { + if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]), "/video_ts" ) ) { - path_copy[ strlen( path_copy ) - 9 ] = '\0'; + path_copy[ strlen( path_copy ) - TITLES_MAX ] = '\0'; } } @@ -788,7 +790,7 @@ dvd_file->filesize = dvd_file->title_sizes[ 0 ]; } else { - for( i = 0; i < 9; ++i ) { + for( i = 0; i < TITLES_MAX; ++i ) { sprintf( filename, "VTS_%02i_%i.VOB", title, i + 1 ); if( !findDVDFile( dvd, filename, full_path ) ) { @@ -873,7 +875,7 @@ if( dvd_file->dvd->isImageFile ) { ; } else { - for( i = 0; i < 9; ++i ) { + for( i = 0; i < TITLES_MAX; ++i ) { if( dvd_file->title_devs[ i ] ) { dvdinput_close( dvd_file->title_devs[i] ); } @@ -936,7 +938,7 @@ ret = 0; ret2 = 0; - for( i = 0; i < 9; ++i ) { + for( i = 0; i < TITLES_MAX; ++i ) { if( !dvd_file->title_sizes[ i ] ) return 0; /* Past end of file */ if( offset < dvd_file->title_sizes[ i ] ) {