changeset 335:0bfe718f75e8 src

#define TITLES_MAX as 9 instead of using an hardcodec value ; patch by Erik Hovland - erik hovland org
author nicodvb
date Sat, 19 Apr 2008 09:34:55 +0000
parents c73a93208d14
children 63aad8298f28
files dvdread/dvd_reader.c
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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 ] ) {