changeset 20:fce16251755c src

Remove all trailing whitespace, patch by Erik Hovland *erik$hovland dot org%
author rathann
date Sat, 06 Sep 2008 21:55:51 +0000
parents 7f7e87bd7536
children 4aa618ae094f
files bswap.h dvd_input.c dvd_input.h dvd_reader.c dvd_reader.h dvd_udf.c dvd_udf.h ifo_print.c ifo_print.h ifo_read.c ifo_read.h ifo_types.h nav_print.c nav_print.h nav_read.c nav_read.h nav_types.h
diffstat 17 files changed, 580 insertions(+), 580 deletions(-) [+]
line wrap: on
line diff
--- a/bswap.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/bswap.h	Sat Sep 06 21:55:51 2008 +0000
@@ -23,12 +23,12 @@
 #include <config.h>
 
 #if defined(WORDS_BIGENDIAN)
-/* All bigendian systems are fine, just ignore the swaps. */  
+/* All bigendian systems are fine, just ignore the swaps. */
 #define B2N_16(x) (void)(x)
 #define B2N_32(x) (void)(x)
 #define B2N_64(x) (void)(x)
 
-#else 
+#else
 
 /* For __FreeBSD_version */
 #if defined(HAVE_SYS_PARAM_H)
@@ -65,10 +65,10 @@
 #define B2N_32(x) x = be32toh(x)
 #define B2N_64(x) x = be64toh(x)
 
-/* This is a slow but portable implementation, it has multiple evaluation 
+/* This is a slow but portable implementation, it has multiple evaluation
  * problems so beware.
- * Old FreeBSD's and Solaris don't have <byteswap.h> or any other such 
- * functionality! 
+ * Old FreeBSD's and Solaris don't have <byteswap.h> or any other such
+ * functionality!
  */
 
 #elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined(__CYGWIN__) || defined(__BEOS__)
--- a/dvd_input.c	Mon Sep 01 21:05:17 2008 +0000
+++ b/dvd_input.c	Sat Sep 06 21:55:51 2008 +0000
@@ -6,7 +6,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -32,7 +32,7 @@
 dvd_input_t (*dvdinput_open)  (const char *);
 int         (*dvdinput_close) (dvd_input_t);
 int         (*dvdinput_seek)  (dvd_input_t, int);
-int         (*dvdinput_title) (dvd_input_t, int); 
+int         (*dvdinput_title) (dvd_input_t, int);
 int         (*dvdinput_read)  (dvd_input_t, void *, int, int);
 char *      (*dvdinput_error) (dvd_input_t);
 
@@ -59,7 +59,7 @@
 static dvdcss_handle (*DVDcss_open)  (const char *);
 static int           (*DVDcss_close) (dvdcss_handle);
 static int           (*DVDcss_seek)  (dvdcss_handle, int, int);
-static int           (*DVDcss_title) (dvdcss_handle, int); 
+static int           (*DVDcss_title) (dvdcss_handle, int);
 static int           (*DVDcss_read)  (dvdcss_handle, void *, int, int);
 static char *        (*DVDcss_error) (dvdcss_handle);
 #endif
@@ -68,7 +68,7 @@
 struct dvd_input_s {
   /* libdvdcss handle */
   dvdcss_handle dvdcss;
-  
+
   /* dummy file input */
   int fd;
 };
@@ -80,14 +80,14 @@
 static dvd_input_t css_open(const char *target)
 {
   dvd_input_t dev;
-    
+
   /* Allocate the handle structure */
   dev = (dvd_input_t) malloc(sizeof(*dev));
   if(dev == NULL) {
     fprintf(stderr, "libdvdread: Could not allocate memory.\n");
     return NULL;
   }
-  
+
   /* Really open it with libdvdcss */
   dev->dvdcss = DVDcss_open(target);
   if(dev->dvdcss == 0) {
@@ -95,7 +95,7 @@
     free(dev);
     return NULL;
   }
-  
+
   return dev;
 }
 
@@ -155,14 +155,14 @@
 static dvd_input_t file_open(const char *target)
 {
   dvd_input_t dev;
-  
+
   /* Allocate the library structure */
   dev = (dvd_input_t) malloc(sizeof(*dev));
   if(dev == NULL) {
     fprintf(stderr, "libdvdread: Could not allocate memory.\n");
     return NULL;
   }
-  
+
   /* Open the device */
 #ifndef WIN32
   dev->fd = open(target, O_RDONLY);
@@ -174,7 +174,7 @@
     free(dev);
     return NULL;
   }
-  
+
   return dev;
 }
 
@@ -217,20 +217,20 @@
 {
   size_t len;
   ssize_t ret;
-  
+
   len = (size_t)blocks * DVD_VIDEO_LB_LEN;
-  
+
   while(len > 0) {
-    
+
     ret = read(dev->fd, buffer, len);
-    
+
     if(ret < 0) {
       /* One of the reads failed, too bad.  We won't even bother
        * returning the reads that went OK, and as in the POSIX spec
        * the file position is left unspecified after a failure. */
       return ret;
     }
-    
+
     if(ret == 0) {
       /* Nothing more to read.  Return all of the whole blocks, if any.
        * Adjust the file position back to the previous block boundary. */
@@ -240,7 +240,7 @@
       /* should have pos % 2048 == 0 */
       return (int) (bytes / DVD_VIDEO_LB_LEN);
     }
-    
+
     len -= ret;
   }
 
@@ -309,11 +309,11 @@
       dlsym(dvdcss_library, U_S "dvdcss_read");
     DVDcss_error = (char* (*)(dvdcss_handle))
       dlsym(dvdcss_library, U_S "dvdcss_error");
-    
+
     dvdcss_version = (char **)dlsym(dvdcss_library, U_S "dvdcss_interface_2");
 
     if(dlsym(dvdcss_library, U_S "dvdcss_crack")) {
-      fprintf(stderr, 
+      fprintf(stderr,
 	      "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n"
 	      "libdvdread: You should get the latest version from "
 	      "http://www.videolan.org/\n" );
@@ -327,7 +327,7 @@
     }
   }
 #endif /* HAVE_DVDCSS_DVDCSS_H */
-  
+
   if(dvdcss_library != NULL) {
     /*
     char *psz_method = getenv( "DVDCSS_METHOD" );
@@ -337,7 +337,7 @@
     */
     fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
 	    dvdcss_version ? *dvdcss_version : "");
-    
+
     /* libdvdcss wrapper functions */
     dvdinput_open  = css_open;
     dvdinput_close = css_close;
@@ -346,7 +346,7 @@
     dvdinput_read  = css_read;
     dvdinput_error = css_error;
     return 1;
-    
+
   } else {
     fprintf(stderr, "libdvdread: Encrypted DVD support unavailable.\n");
 
--- a/dvd_input.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/dvd_input.h	Sat Sep 06 21:55:51 2008 +0000
@@ -9,7 +9,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -36,7 +36,7 @@
 extern dvd_input_t (*dvdinput_open)  (const char *);
 extern int         (*dvdinput_close) (dvd_input_t);
 extern int         (*dvdinput_seek)  (dvd_input_t, int);
-extern int         (*dvdinput_title) (dvd_input_t, int); 
+extern int         (*dvdinput_title) (dvd_input_t, int);
 extern int         (*dvdinput_read)  (dvd_input_t, void *, int, int);
 extern char *      (*dvdinput_error) (dvd_input_t);
 
--- a/dvd_reader.c	Mon Sep 01 21:05:17 2008 +0000
+++ b/dvd_reader.c	Sat Sep 06 21:55:51 2008 +0000
@@ -50,7 +50,7 @@
 #include <io.h> /* read() */
 #define lseek64 _lseeki64
 #endif
- 
+
 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
 #define SYS_BSD 1
 #endif
@@ -73,8 +73,8 @@
 struct dvd_reader_s {
     /* Basic information. */
     int isImageFile;
-  
-    /* Hack for keeping track of the css status. 
+
+    /* Hack for keeping track of the css status.
      * 0: no css, 1: perhaps (need init of keys), 2: have done init */
     int css_state;
     int css_title; /* Last title that we have called dvdinpute_title for. */
@@ -84,7 +84,7 @@
 
     /* Information required for a directory path drive. */
     char *path_root;
-  
+
     /* Filesystem cache */
     int udfcache_level; /* 0 - turned off, 1 - on */
     void *udfcache;
@@ -95,7 +95,7 @@
 struct dvd_file_s {
     /* Basic information. */
     dvd_reader_t *dvd;
-  
+
     /* Hack for selecting the right css title. */
     int css_title;
 
@@ -112,7 +112,7 @@
 };
 
 int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
-                     size_t block_count, unsigned char *data, 
+                     size_t block_count, unsigned char *data,
                      int encrypted );
 
 /**
@@ -123,7 +123,7 @@
 int DVDUDFCacheLevel(dvd_reader_t *device, int level)
 {
   struct dvd_reader_s *dev = (struct dvd_reader_s *)device;
-  
+
   if(level > 0) {
     level = 1;
   } else if(level < 0) {
@@ -131,14 +131,14 @@
   }
 
   dev->udfcache_level = level;
-  
+
   return level;
 }
 
 void *GetUDFCacheHandle(dvd_reader_t *device)
 {
   struct dvd_reader_s *dev = (struct dvd_reader_s *)device;
-  
+
   return dev->udfcache;
 }
 
@@ -159,18 +159,18 @@
     char filename[ MAX_UDF_FILE_NAME_LEN ];
     uint32_t start, len;
     int title;
-	
+
     char *nokeys_str = getenv("DVDREAD_NOKEYS");
     if(nokeys_str != NULL)
       return 0;
-    
+
     fprintf( stderr, "\n" );
     fprintf( stderr, "libdvdread: Attempting to retrieve all CSS keys\n" );
     fprintf( stderr, "libdvdread: This can take a _long_ time, "
 	     "please be patient\n\n" );
-	
+
     gettimeofday(&all_s, NULL);
-	
+
     for( title = 0; title < 100; title++ ) {
 	gettimeofday( &t_s, NULL );
 	if( title == 0 ) {
@@ -181,40 +181,40 @@
 	start = UDFFindFile( dvd, filename, &len );
 	if( start != 0 && len != 0 ) {
 	    /* Perform CSS key cracking for this title. */
-	    fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n", 
+	    fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
 		     filename, start );
 	    if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
 		fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)\n", filename, start);
 	    }
 	    gettimeofday( &t_e, NULL );
-	    fprintf( stderr, "libdvdread: Elapsed time %ld\n",  
+	    fprintf( stderr, "libdvdread: Elapsed time %ld\n",
 		     (long int) t_e.tv_sec - t_s.tv_sec );
 	}
-	    
+
 	if( title == 0 ) continue;
-	    
+
 	gettimeofday( &t_s, NULL );
 	sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 1 );
 	start = UDFFindFile( dvd, filename, &len );
 	if( start == 0 || len == 0 ) break;
-	    
+
 	/* Perform CSS key cracking for this title. */
-	fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n", 
+	fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n",
 		 filename, start );
 	if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
 	    fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)!!\n", filename, start);
 	}
 	gettimeofday( &t_e, NULL );
-	fprintf( stderr, "libdvdread: Elapsed time %ld\n",  
+	fprintf( stderr, "libdvdread: Elapsed time %ld\n",
 		 (long int) t_e.tv_sec - t_s.tv_sec );
     }
     title--;
-    
+
     fprintf( stderr, "libdvdread: Found %d VTS's\n", title );
     gettimeofday(&all_e, NULL);
-    fprintf( stderr, "libdvdread: Elapsed time %ld\n",  
+    fprintf( stderr, "libdvdread: Elapsed time %ld\n",
 	     (long int) all_e.tv_sec - all_s.tv_sec );
-    
+
     return 0;
 }
 
@@ -227,7 +227,7 @@
 {
     dvd_reader_t *dvd;
     dvd_input_t dev;
-    
+
     dev = dvdinput_open( location );
     if( !dev ) {
 	fprintf( stderr, "libdvdread: Can't open %s for reading\n", location );
@@ -242,7 +242,7 @@
     dvd->isImageFile = 1;
     dvd->dev = dev;
     dvd->path_root = NULL;
-    
+
     dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
     dvd->udfcache = NULL;
 
@@ -250,11 +250,11 @@
       /* Only if DVDCSS_METHOD = title, a bit if it's disc or if
        * DVDCSS_METHOD = key but region missmatch. Unfortunaly we
        * don't have that information. */
-    
+
       dvd->css_state = 1; /* Need key init. */
     }
     dvd->css_title = 0;
-    
+
     return dvd;
 }
 
@@ -274,7 +274,7 @@
 
     dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
     dvd->udfcache = NULL;
-    
+
     dvd->css_state = 0; /* Only used in the UDF path */
     dvd->css_title = 0; /* Only matters in the UDF path */
 
@@ -289,7 +289,7 @@
 {
     char *new_path;
 
-    /* Must contain "/dsk/" */ 
+    /* Must contain "/dsk/" */
     if( !strstr( path, "/dsk/" ) ) return (char *) strdup( path );
 
     /* Replace "/dsk/" with "/rdsk/" */
@@ -313,8 +313,8 @@
 {
     char *new_path;
 
-    /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */ 
-    if( !strncmp( path, "/dev/",  5 ) || strncmp( path, "/dev/r", 6 ) ) 
+    /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */
+    if( !strncmp( path, "/dev/",  5 ) || strncmp( path, "/dev/r", 6 ) )
       return (char *) strdup( path );
 
     /* Replace "/dev/" with "/dev/r" */
@@ -345,21 +345,21 @@
 	path = strdup(ppath);
     if( path == NULL )
       return 0;
-	
+
     /* Try to open libdvdcss or fall back to standard functions */
     have_css = dvdinput_setup();
 
 #ifdef _MSC_VER
 	/* Strip off the trailing \ if it is not a drive */
 	len = strlen(path);
-	if ((len > 1) && 
-		(path[len - 1] == '\\')  && 
+	if ((len > 1) &&
+		(path[len - 1] == '\\')  &&
 		(path[len - 2] != ':'))
 	{
 		path[len-1] = '\0';
 	}
 #endif
-    
+
     ret = stat( path, &fileinfo );
 
     if( ret < 0 ) {
@@ -370,7 +370,7 @@
 			free(path);
 	        return ret_val;
         }
-      
+
 	/* If we can't stat the file, give up */
 	fprintf( stderr, "libdvdread: Can't stat %s\n", path );
 	perror("");
@@ -379,8 +379,8 @@
     }
 
     /* First check if this is a block/char device or a file*/
-    if( S_ISBLK( fileinfo.st_mode ) || 
-	S_ISCHR( fileinfo.st_mode ) || 
+    if( S_ISBLK( fileinfo.st_mode ) ||
+	S_ISCHR( fileinfo.st_mode ) ||
 	S_ISREG( fileinfo.st_mode ) ) {
 
 	/**
@@ -408,7 +408,7 @@
 
 	/* XXX: We should scream real loud here. */
 	if( !(path_copy = strdup( path ) ) ) {
-		free(path);	
+		free(path);
 		return NULL;
 	}
 
@@ -419,7 +419,7 @@
 	{
 	    char *new_path;
 	    int cdir = open( ".", O_RDONLY );
-	    
+
 	    if( cdir >= 0 ) {
 		chdir( path_copy );
 		new_path = malloc(PATH_MAX+1);
@@ -434,24 +434,24 @@
 		    path_copy = new_path;
 	    }
 	}
-#endif	
+#endif
 	/**
 	 * If we're being asked to open a directory, check if that directory
 	 * is the mountpoint for a DVD-ROM which we can use instead.
 	 */
 
 	if( strlen( path_copy ) > 1 ) {
-	    if( path_copy[ strlen( path_copy ) - 1 ] == '/' ) 
+	    if( path_copy[ strlen( path_copy ) - 1 ] == '/' )
 		path_copy[ strlen( path_copy ) - 1 ] = '\0';
 	}
 
 	if( strlen( path_copy ) > TITLES_MAX ) {
-	    if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]), 
+	    if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
 			     "/video_ts" ) ) {
 	      path_copy[ strlen( path_copy ) - TITLES_MAX ] = '\0';
 	    }
 	}
-	
+
 	if(path_copy[0] == '\0') {
 	    path_copy[0] = '/';
 	    path_copy[1] = '\0';
@@ -476,7 +476,7 @@
 	    while( ( res = getmntent( mntfile, &mp ) ) != -1 ) {
 		if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) {
 		    dev_name = sun_block2char( mp.mnt_special );
-		    fprintf( stderr, 
+		    fprintf( stderr,
 			     "libdvdread: Attempting to use device %s"
 			     " mounted on %s for CSS authentication\n",
 			     dev_name,
@@ -491,10 +491,10 @@
         mntfile = fopen( MOUNTED, "r" );
         if( mntfile ) {
             struct mntent *me;
- 
+
             while( ( me = getmntent( mntfile ) ) ) {
                 if( !strcmp( me->mnt_dir, path_copy ) ) {
-		    fprintf( stderr, 
+		    fprintf( stderr,
 			     "libdvdread: Attempting to use device %s"
 			     " mounted on %s for CSS authentication\n",
 			     me->mnt_fsname,
@@ -594,7 +594,7 @@
  *     or -1 on file not found.
  *     or -2 on path not found.
  */
-static int findDirFile( const char *path, const char *file, char *filename ) 
+static int findDirFile( const char *path, const char *file, char *filename )
 {
     DIR *dir;
     struct dirent *ent;
@@ -728,18 +728,18 @@
             dvd_file->filesize += len / DVD_VIDEO_LB_LEN;
         }
     }
-    
+
     if( dvd->css_state == 1 /* Need key init */ ) {
         initAllCSSKeys( dvd );
 	dvd->css_state = 2;
     }
-    /*    
+    /*
     if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
         fprintf( stderr, "libdvdread: Error cracking CSS key for %s\n",
 		 filename );
     }
     */
-    
+
     return dvd_file;
 }
 
@@ -760,7 +760,7 @@
     memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
     memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
     dvd_file->filesize = 0;
-    
+
     if( menu ) {
         dvd_input_t dev;
 
@@ -818,11 +818,11 @@
     return dvd_file;
 }
 
-dvd_file_t *DVDOpenFile( dvd_reader_t *dvd, int titlenum, 
+dvd_file_t *DVDOpenFile( dvd_reader_t *dvd, int titlenum,
 			 dvd_read_domain_t domain )
 {
     char filename[ MAX_UDF_FILE_NAME_LEN ];
-    
+
     /* Check arguments. */
     if( dvd == NULL || titlenum < 0 )
       return NULL;
@@ -861,7 +861,7 @@
         fprintf( stderr, "libdvdread: Invalid domain for file open.\n" );
         return NULL;
     }
-    
+
     if( dvd->isImageFile ) {
         return DVDOpenFileUDF( dvd, filename );
     } else {
@@ -891,7 +891,7 @@
 
 /* Internal, but used from dvd_udf.c */
 int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
-			 size_t block_count, unsigned char *data, 
+			 size_t block_count, unsigned char *data,
 			 int encrypted )
 {
    int ret;
@@ -906,7 +906,7 @@
 	return 0;
    }
 
-   ret = dvdinput_read( device->dev, (char *) data, 
+   ret = dvdinput_read( device->dev, (char *) data,
 			 (int) block_count, encrypted );
    return ret;
 }
@@ -947,7 +947,7 @@
             if( ( offset + block_count ) <= dvd_file->title_sizes[ i ] ) {
 		off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
                 if( off < 0 || off != (int)offset ) {
-		    fprintf( stderr, "libdvdread: Can't seek to block %d\n", 
+		    fprintf( stderr, "libdvdread: Can't seek to block %d\n",
 			     offset );
 		    return off < 0 ? off : 0;
 		}
@@ -958,20 +958,20 @@
                 size_t part1_size = dvd_file->title_sizes[ i ] - offset;
 		/* FIXME: Really needs to be a while loop.
                  * (This is only true if you try and read >1GB at a time) */
-		
+
                 /* Read part 1 */
                 off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
                 if( off < 0 || off != (int)offset ) {
-		    fprintf( stderr, "libdvdread: Can't seek to block %d\n", 
+		    fprintf( stderr, "libdvdread: Can't seek to block %d\n",
 			     offset );
 		    return off < 0 ? off : 0;
 		}
                 ret = dvdinput_read( dvd_file->title_devs[ i ], data,
 				     (int)part1_size, encrypted );
 		if( ret < 0 ) return ret;
-		/* FIXME: This is wrong if i is the last file in the set. 
+		/* FIXME: This is wrong if i is the last file in the set.
                  * also error from this read will not show in ret. */
-		
+
 		/* Does the next part exist? If not then return now. */
 		if( i + 1 >= TITLES_MAX || !dvd_file->title_devs[ i + 1 ] )
                     return ret;
@@ -979,11 +979,11 @@
                 /* Read part 2 */
                 off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 );
                 if( off < 0 || off != 0 ) {
-		    fprintf( stderr, "libdvdread: Can't seek to block %d\n", 
+		    fprintf( stderr, "libdvdread: Can't seek to block %d\n",
 			     0 );
 		    return off < 0 ? off : 0;
 		}
-                ret2 = dvdinput_read( dvd_file->title_devs[ i + 1 ], 
+                ret2 = dvdinput_read( dvd_file->title_devs[ i + 1 ],
 				      data + ( part1_size
 					       * (int64_t)DVD_VIDEO_LB_LEN ),
 				      (int)(block_count - part1_size),
@@ -1000,34 +1000,34 @@
 }
 
 /* This is broken reading more than 2Gb at a time is ssize_t is 32-bit. */
-ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset, 
+ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset,
 		       size_t block_count, unsigned char *data )
 {
     int ret;
     /* Check arguments. */
     if( dvd_file == NULL || offset < 0 || data == NULL )
       return -1;
-    
+
     /* Hack, and it will still fail for multiple opens in a threaded app ! */
     if( dvd_file->dvd->css_title != dvd_file->css_title ) {
       dvd_file->dvd->css_title = dvd_file->css_title;
       if( dvd_file->dvd->isImageFile ) {
 	dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start );
-      } 
-      /* Here each vobu has it's own dvdcss handle, so no need to update 
+      }
+      /* Here each vobu has it's own dvdcss handle, so no need to update
       else {
 	dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start );
       }*/
     }
-    
+
     if( dvd_file->dvd->isImageFile ) {
-	ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset, 
+	ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset,
 				block_count, data, DVDINPUT_READ_DECRYPT );
     } else {
-	ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset, 
+	ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset,
 				 block_count, data, DVDINPUT_READ_DECRYPT );
     }
-    
+
     return (ssize_t)ret;
 }
 
@@ -1036,7 +1036,7 @@
     /* Check arguments. */
     if( dvd_file == NULL || offset < 0 )
        return -1;
-    
+
     if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN ) {
        return -1;
     }
@@ -1071,7 +1071,7 @@
     unsigned char *secbuf_base, *secbuf;
     unsigned int numsec, seek_sector, seek_byte;
     int ret;
-    
+
     /* Check arguments. */
     if( dvd_file == NULL || data == NULL )
       return -1;
@@ -1081,20 +1081,20 @@
 
     numsec = ( ( seek_byte + byte_size ) / DVD_VIDEO_LB_LEN ) +
       ( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 );
-    
+
     secbuf_base = (unsigned char *) malloc( numsec * DVD_VIDEO_LB_LEN + 2048 );
     secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~((uintptr_t)2047)) + 2048);
     if( !secbuf_base ) {
-	fprintf( stderr, "libdvdread: Can't allocate memory " 
+	fprintf( stderr, "libdvdread: Can't allocate memory "
 		 "for file read!\n" );
         return 0;
     }
-    
+
     if( dvd_file->dvd->isImageFile ) {
-	ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector, 
+	ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector,
 				(size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
     } else {
-	ret = DVDReadBlocksPath( dvd_file, seek_sector, 
+	ret = DVDReadBlocksPath( dvd_file, seek_sector,
 				 (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
     }
 
@@ -1115,7 +1115,7 @@
     /* Check arguments. */
     if( dvd_file == NULL )
       return -1;
-    
+
     return dvd_file->filesize;
 }
 
@@ -1128,8 +1128,8 @@
     /* Check arguments. */
     if( dvd == NULL || discid == NULL )
       return 0;
-    
-    /* Go through the first 10 IFO:s, in order, 
+
+    /* Go through the first 10 IFO:s, in order,
      * and md5sum them, i.e  VIDEO_TS.IFO and VTS_0?_0.IFO */
     md5_init_ctx( &ctx );
     for( title = 0; title < 10; title++ ) {
@@ -1139,7 +1139,7 @@
 	    size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
 	    char *buffer_base = malloc( file_size + 2048 );
 	    char *buffer = (char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048);
-	    
+
 	    if( buffer_base == NULL ) {
 	        DVDCloseFile( dvd_file );
 		fprintf( stderr, "libdvdread: DVDDiscId, failed to "
@@ -1154,9 +1154,9 @@
 		free( buffer_base );
 		return -1;
 	    }
-	    
+
 	    md5_process_bytes( buffer, file_size,  &ctx );
-	    
+
 	    DVDCloseFile( dvd_file );
 	    free( buffer_base );
 	    nr_of_files++;
@@ -1165,7 +1165,7 @@
     md5_finish_ctx( &ctx, discid );
     if(!nr_of_files)
       return -1;
-    
+
     return 0;
 }
 
@@ -1180,12 +1180,12 @@
   /* Check arguments. */
   if( dvd == NULL )
     return 0;
-  
+
   if( dvd->dev == NULL ) {
     /* No block access, so no ISO... */
     return -1;
   }
-  
+
   buffer_base = malloc( DVD_VIDEO_LB_LEN + 2048 );
   buffer = (unsigned char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048);
 
@@ -1202,7 +1202,7 @@
     free( buffer_base );
     return -1;
   }
-  
+
   if( (volid != NULL) && (volid_size > 0) ) {
     unsigned int n;
     for(n = 0; n < 32; n++) {
@@ -1210,7 +1210,7 @@
 	break;
       }
     }
-    
+
     if(volid_size > n+1) {
       volid_size = n+1;
     }
@@ -1218,7 +1218,7 @@
     memcpy(volid, &buffer[40], volid_size-1);
     volid[volid_size-1] = '\0';
   }
-  
+
   if( (volsetid != NULL) && (volsetid_size > 0) ) {
     if(volsetid_size > 128) {
       volsetid_size = 128;
@@ -1238,12 +1238,12 @@
   /* Check arguments. */
   if( dvd == NULL )
     return -1;
-  
+
   if( dvd->dev == NULL ) {
     /* No block access, so no UDF VolumeSet Identifier */
     return -1;
   }
-  
+
   if( (volid != NULL) && (volid_size > 0) ) {
     ret = UDFGetVolumeIdentifier(dvd, volid, volid_size);
     if(!ret) {
@@ -1256,6 +1256,6 @@
       return -1;
     }
   }
-    
-  return 0;  
+
+  return 0;
 }
--- a/dvd_reader.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/dvd_reader.h	Sat Sep 06 21:55:51 2008 +0000
@@ -56,12 +56,12 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-  
+
 /**
  * Opaque type that is used as a handle for one instance of an opened DVD.
  */
 typedef struct dvd_reader_s dvd_reader_t;
-  
+
 /**
  * Opaque type for a file read handle, much like a normal fd or FILE *.
  */
@@ -73,7 +73,7 @@
  *
  * If the given file is a block device, or is the mountpoint for a block
  * device, then that device is used for CSS authentication using libdvdcss.
- * If no device is available, then no CSS authentication is performed, 
+ * If no device is available, then no CSS authentication is performed,
  * and we hope that the image is decrypted.
  *
  * If the path given is a directory, then the files in that directory may be
@@ -84,7 +84,7 @@
  *   path/VTS_01_1.VOB
  *   path/vts_01_1.vob
  *
- * @param path Specifies the the device, file or directory to be used. 
+ * @param path Specifies the the device, file or directory to be used.
  * @return If successful a a read handle is returned. Otherwise 0 is returned.
  *
  * dvd = DVDOpen(path);
@@ -103,13 +103,13 @@
 void DVDClose( dvd_reader_t * );
 
 /**
- * 
+ *
  */
 typedef enum {
   DVD_READ_INFO_FILE,        /**< VIDEO_TS.IFO  or VTS_XX_0.IFO (title) */
   DVD_READ_INFO_BACKUP_FILE, /**< VIDEO_TS.BUP  or VTS_XX_0.BUP (title) */
   DVD_READ_MENU_VOBS,        /**< VIDEO_TS.VOB  or VTS_XX_0.VOB (title) */
-  DVD_READ_TITLE_VOBS        /**< VTS_XX_[1-9].VOB (title).  All files in 
+  DVD_READ_TITLE_VOBS        /**< VTS_XX_[1-9].VOB (title).  All files in
 				  the title set are opened and read as a
 				  single file. */
 } dvd_read_domain_t;
@@ -123,7 +123,7 @@
  *
  * @param dvd  A dvd read handle.
  * @param titlenum Which Video Title Set should be used, VIDEO_TS is 0.
- * @param domain Which domain. 
+ * @param domain Which domain.
  * @return If successful a a file read handle is returned, otherwise 0.
  *
  * dvd_file = DVDOpenFile(dvd, titlenum, domain); */
@@ -141,8 +141,8 @@
 /**
  * Reads block_count number of blocks from the file at the given block offset.
  * Returns number of blocks read on success, -1 on error.  This call is only
- * for reading VOB data, and should not be used when reading the IFO files.  
- * When reading from an encrypted drive, blocks are decrypted using libdvdcss 
+ * for reading VOB data, and should not be used when reading the IFO files.
+ * When reading from an encrypted drive, blocks are decrypted using libdvdcss
  * where required.
  *
  * @param dvd_file  A file read handle.
@@ -198,7 +198,7 @@
  * This is the MD5 sum of VIDEO_TS.IFO and the VTS_0?_0.IFO files
  * in title order (those that exist).
  * If you need a 'text' representation of the id, print it as a
- * hexadecimal number, using lowercase letters, discid[0] first. 
+ * hexadecimal number, using lowercase letters, discid[0] first.
  * I.e. the same format as the command-line 'md5sum' program uses.
  *
  * @param dvd A read handle to get the disc ID from
@@ -263,7 +263,7 @@
  *             -1 - returns the current setting.
  *              0 - UDF Cache turned off.
  *              1 - (default level) Pointers to IFO files and some data from
- *                  PrimaryVolumeDescriptor are cached. 
+ *                  PrimaryVolumeDescriptor are cached.
  *
  * @return The level of caching.
  */
--- a/dvd_udf.c	Mon Sep 01 21:05:17 2008 +0000
+++ b/dvd_udf.c	Sat Sep 06 21:55:51 2008 +0000
@@ -10,24 +10,24 @@
  * Copyright (C) 1999 Christian Wolff for convergence integrated media
  * GmbH The author can be reached at scarabaeus@convergence.de, the
  * project's page is at http://linuxtv.org/dvd/
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or (at
  * your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.  Or, point your browser to
  * http://www.gnu.org/copyleft/gpl.html
  */
- 
+
 #include "config.h"
 
 #include <stdio.h>
@@ -44,12 +44,12 @@
 
 /* Private but located in/shared with dvd_reader.c */
 extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
-				size_t block_count, unsigned char *data, 
+				size_t block_count, unsigned char *data,
 				int encrypted );
 
 /* It's required to either fail or deliver all the blocks asked for. */
 static int DVDReadLBUDF( dvd_reader_t *device, uint32_t lb_number,
-			 size_t block_count, unsigned char *data, 
+			 size_t block_count, unsigned char *data,
 			 int encrypted )
 {
   int ret;
@@ -234,7 +234,7 @@
   c = (struct udf_cache *)GetUDFCacheHandle(device);
 
   if(c == NULL) {
-    c = calloc(1, sizeof(struct udf_cache));    
+    c = calloc(1, sizeof(struct udf_cache));
     /* fprintf(stderr, "calloc: %d\n", sizeof(struct udf_cache)); */
     if(c == NULL)
       return 0;
@@ -244,19 +244,19 @@
 
   switch(type) {
   case AVDPCache:
-    c->avdp = *(struct avdp_t *)data; 
+    c->avdp = *(struct avdp_t *)data;
     c->avdp_valid = 1;
     break;
   case PVDCache:
-    c->pvd = *(struct pvd_t *)data; 
+    c->pvd = *(struct pvd_t *)data;
     c->pvd_valid = 1;
     break;
   case PartitionCache:
-    c->partition = *(struct Partition *)data; 
+    c->partition = *(struct Partition *)data;
     c->partition_valid = 1;
     break;
   case RootICBCache:
-    c->rooticb = *(struct AD *)data; 
+    c->rooticb = *(struct AD *)data;
     c->rooticb_valid = 1;
     break;
   case LBUDFCache:
@@ -331,7 +331,7 @@
 /* This is wrong with regard to endianess */
 #define GETN(p, n, target) memcpy(target, &data[p], n)
 
-static int Unicodedecode( uint8_t *data, int len, char *target ) 
+static int Unicodedecode( uint8_t *data, int len, char *target )
 {
     int p = 1, i = 0;
 
@@ -346,22 +346,22 @@
     return 0;
 }
 
-static int UDFDescriptor( uint8_t *data, uint16_t *TagID ) 
+static int UDFDescriptor( uint8_t *data, uint16_t *TagID )
 {
     *TagID = GETN2(0);
     /* TODO: check CRC 'n stuff */
     return 0;
 }
 
-static int UDFExtentAD( uint8_t *data, uint32_t *Length, uint32_t *Location ) 
+static int UDFExtentAD( uint8_t *data, uint32_t *Length, uint32_t *Location )
 {
     *Length   = GETN4(0);
     *Location = GETN4(4);
     return 0;
 }
 
-static int UDFShortAD( uint8_t *data, struct AD *ad, 
-		       struct Partition *partition ) 
+static int UDFShortAD( uint8_t *data, struct AD *ad,
+		       struct Partition *partition )
 {
     ad->Length = GETN4(0);
     ad->Flags = ad->Length >> 30;
@@ -427,7 +427,7 @@
     return 0;
 }
 
-static int UDFFileEntry( uint8_t *data, uint8_t *FileType, 
+static int UDFFileEntry( uint8_t *data, uint8_t *FileType,
 			 struct Partition *partition, struct AD *ad )
 {
     uint16_t flags;
@@ -488,7 +488,7 @@
  * return 1 on success, 0 on error;
  */
 static int UDFMapICB( dvd_reader_t *device, struct AD ICB, uint8_t *FileType,
-		      struct Partition *partition, struct AD *File ) 
+		      struct Partition *partition, struct AD *File )
 {
     uint8_t LogBlock_base[DVD_VIDEO_LB_LEN + 2048];
     uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
@@ -531,7 +531,7 @@
  */
 static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
                        struct Partition *partition, struct AD *FileICB,
-		       int cache_file_info) 
+		       int cache_file_info)
 {
     char filename[ MAX_UDF_FILE_NAME_LEN ];
     uint8_t directory_base[ 2 * DVD_VIDEO_LB_LEN + 2048];
@@ -649,7 +649,7 @@
   uint16_t TagID;
   uint32_t lastsector;
   int terminate;
-  struct avdp_t; 
+  struct avdp_t;
 
   if(GetUDFCache(device, AVDPCache, 0, avdp))
     return 1;
@@ -710,7 +710,7 @@
  *   part: structure to fill with the partition information
  */
 static int UDFFindPartition( dvd_reader_t *device, int partnum,
-			     struct Partition *part ) 
+			     struct Partition *part )
 {
     uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
     uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
@@ -851,7 +851,7 @@
  * bufsize, size of BlockBuf (must be >= DVD_VIDEO_LB_LEN).
  */
 static int UDFGetDescriptor( dvd_reader_t *device, int id,
-			     uint8_t *descriptor, int bufsize) 
+			     uint8_t *descriptor, int bufsize)
 {
   uint32_t lbnum, MVDS_location, MVDS_length;
   struct avdp_t avdp;
@@ -945,7 +945,7 @@
  * Gets the Volume Set Identifier, as a 128-byte dstring (not decoded)
  * WARNING This is not a null terminated string
  * volsetid, place to put the data
- * volsetid_size, size of the buffer volsetid points to 
+ * volsetid_size, size of the buffer volsetid points to
  * the buffer should be >=128 bytes to store the whole volumesetidentifier
  * returns the size of the available volsetid information (128)
  * or 0 on error
--- a/dvd_udf.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/dvd_udf.h	Sat Sep 06 21:55:51 2008 +0000
@@ -8,22 +8,22 @@
  * Modifications by:
  *   Billy Biggs <vektor@dumbterm.net>.
  *   Björn Englund <d4bjorn@dtek.chalmers.se>.
- * 
+ *
  * dvdudf: parse and read the UDF volume information of a DVD Video
  * Copyright (C) 1999 Christian Wolff for convergence integrated media
  * GmbH The author can be reached at scarabaeus@convergence.de, the
  * project's page is at http://linuxtv.org/dvd/
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or (at
  * your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
--- a/ifo_print.c	Mon Sep 01 21:05:17 2008 +0000
+++ b/ifo_print.c	Sat Sep 06 21:55:51 2008 +0000
@@ -1,4 +1,4 @@
-/* 
+/*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -36,8 +36,8 @@
   assert((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa);
   assert((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa);
   assert((dtime->frame_u&0xf) < 0xa);
-  
-  printf("%02x:%02x:%02x.%02x", 
+
+  printf("%02x:%02x:%02x.%02x",
 	 dtime->hour,
 	 dtime->minute,
 	 dtime->second,
@@ -50,13 +50,13 @@
     rate = "29.97";
     break;
   default:
-    if(dtime->hour == 0 && dtime->minute == 0 
+    if(dtime->hour == 0 && dtime->minute == 0
        && dtime->second == 0 && dtime->frame_u == 0)
       rate = "no";
     else
       rate = "(please send a bug report)";
     break;
-  } 
+  }
   printf(" @ %s fps", rate);
 }
 
@@ -81,23 +81,23 @@
 }
 
 static void ifo_print_video_attributes(int level, video_attr_t *attr) {
-  
+
   /* The following test is shorter but not correct ISO C,
      memcmp(attr,my_friendly_zeros, sizeof(video_attr_t)) */
-  if(attr->mpeg_version == 0 
-     && attr->video_format == 0 
-     && attr->display_aspect_ratio == 0 
-     && attr->permitted_df == 0 
-     && attr->unknown1 == 0 
-     && attr->line21_cc_1 == 0 
-     && attr->line21_cc_2 == 0 
-     && attr->video_format == 0 
-     && attr->letterboxed == 0 
+  if(attr->mpeg_version == 0
+     && attr->video_format == 0
+     && attr->display_aspect_ratio == 0
+     && attr->permitted_df == 0
+     && attr->unknown1 == 0
+     && attr->line21_cc_1 == 0
+     && attr->line21_cc_2 == 0
+     && attr->video_format == 0
+     && attr->letterboxed == 0
      && attr->film_mode == 0) {
     printf("-- Unspecified --");
     return;
   }
-  
+
   switch(attr->mpeg_version) {
   case 0:
     printf("mpeg1, ");
@@ -108,7 +108,7 @@
   default:
     printf("(please send a bug report), ");
   }
-  
+
   switch(attr->video_format) {
   case 0:
     printf("ntsc, ");
@@ -119,7 +119,7 @@
   default:
     printf("(please send a bug report), ");
   }
-  
+
   switch(attr->display_aspect_ratio) {
   case 0:
     printf("4:3, ");
@@ -130,7 +130,7 @@
   default:
     printf("(please send a bug report), ");
   }
-  
+
   // Wide is allways allowed..!!!
   switch(attr->permitted_df) {
   case 0:
@@ -148,10 +148,10 @@
   default:
     printf("(please send a bug report), ");
   }
-  
+
   printf("U%x, ", attr->unknown1);
   assert(!attr->unknown1);
-  
+
   if(attr->line21_cc_1 || attr->line21_cc_2) {
     printf("NTSC CC ");
     if(attr->line21_cc_1)
@@ -159,10 +159,10 @@
     if(attr->line21_cc_2)
       printf("2, ");
   }
-  
+
   {
     int height = 480;
-    if(attr->video_format != 0) 
+    if(attr->video_format != 0)
       height = 576;
     switch(attr->picture_size) {
     case 0:
@@ -176,7 +176,7 @@
       break;
     case 3:
       printf("352x%d, ", height/2);
-      break;      
+      break;
     default:
       printf("(please send a bug report), ");
     }
@@ -185,7 +185,7 @@
   if(attr->letterboxed) {
     printf("source letterboxed, ");
   }
-  
+
   if(attr->film_mode) {
     printf("film. ");
   } else {
@@ -194,7 +194,7 @@
 }
 
 static void ifo_print_audio_attributes(int level, audio_attr_t *attr) {
-  
+
   if(attr->audio_format == 0
      && attr->multichannel_extension == 0
      && attr->lang_type == 0
@@ -208,7 +208,7 @@
     printf("-- Unspecified --");
     return;
   }
-  
+
   switch(attr->audio_format) {
   case 0:
     printf("ac3 ");
@@ -230,7 +230,7 @@
         printf("drc ");
         break;
       default:
-        printf("(please send a bug report) mpeg reserved quant/drc  (%d)", attr->quantization);  
+        printf("(please send a bug report) mpeg reserved quant/drc  (%d)", attr->quantization);
     }
     break;
   case 4:
@@ -261,10 +261,10 @@
   default:
     printf("(please send a bug report) ");
   }
-  
+
   if(attr->multichannel_extension)
     printf("multichannel_extension ");
-  
+
   switch(attr->lang_type) {
   case 0:
     // not specified
@@ -290,7 +290,7 @@
   default:
     printf("(please send a bug report) ");
   }
-  
+
   switch(attr->quantization) {
   case 0:
     printf("16bit ");
@@ -307,7 +307,7 @@
   default:
     printf("(please send a bug report) ");
   }
-  
+
   switch(attr->sample_frequency) {
   case 0:
     printf("48kHz ");
@@ -316,12 +316,12 @@
     printf("??kHz ");
     break;
   default:
-    printf("sample_frequency %i (please send a bug report) ", 
+    printf("sample_frequency %i (please send a bug report) ",
 	   attr->sample_frequency);
   }
-  
+
   printf("%dCh ", attr->channels + 1);
-  
+
   switch(attr->lang_extension) {
   case 0:
     printf("Not specified ");
@@ -338,17 +338,17 @@
   case 4: // Directors 2
     printf("Director's comments 2 ");
     break;
-    //case 4: // Music score ?    
+    //case 4: // Music score ?
   default:
     printf("(please send a bug report) ");
   }
-    
+
   printf("%d ", attr->unknown1);
   printf("%d ", attr->unknown3);
 }
 
 static void ifo_print_subp_attributes(int level, subp_attr_t *attr) {
-  
+
   if(attr->type == 0
      && attr->lang_code == 0
      && attr->zero1 == 0
@@ -357,17 +357,17 @@
     printf("-- Unspecified --");
     return;
   }
-  
+
   printf("type %02x ", attr->type);
-  
+
   if(isalpha((int)(attr->lang_code >> 8))
      && isalpha((int)(attr->lang_code & 0xff))) {
     printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff);
   } else {
-    printf("%02x%02x ", 0xff & (unsigned)(attr->lang_code >> 8), 
+    printf("%02x%02x ", 0xff & (unsigned)(attr->lang_code >> 8),
 	   0xff & (unsigned)(attr->lang_code & 0xff));
   }
-  
+
   printf("%d ", attr->zero1);
   printf("%d ", attr->zero2);
 
@@ -381,7 +381,7 @@
   case 2:
     printf("Caption with bigger size character ");
     break;
-  case 3: 
+  case 3:
     printf("Caption for children ");
     break;
   case 4:
@@ -430,12 +430,12 @@
 static void ifo_print_USER_OPS(user_ops_t *user_ops) {
   uint32_t uops;
   unsigned char *ptr = (unsigned char *)user_ops;
-  
+
   uops  = (*ptr++ << 24);
   uops |= (*ptr++ << 16);
   uops |= (*ptr++ << 8);
   uops |= (*ptr++);
-  
+
   if(uops == 0) {
     printf("None\n");
   } else if(uops == 0x01ffffff) {
@@ -497,12 +497,12 @@
 
 
 void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
-  
+
   printf("VMG Identifier: %.12s\n", vmgi_mat->vmg_identifier);
   printf("Last Sector of VMG: %08x\n", vmgi_mat->vmg_last_sector);
   printf("Last Sector of VMGI: %08x\n", vmgi_mat->vmgi_last_sector);
-  printf("Specification version number: %01x.%01x\n", 
-	 vmgi_mat->specification_version >> 4, 
+  printf("Specification version number: %01x.%01x\n",
+	 vmgi_mat->specification_version >> 4,
 	 vmgi_mat->specification_version & 0xf);
   /* Byte 2 of 'VMG Category' (00xx0000) is the Region Code */
   printf("VMG Category: %08x (Region Code=%02x)\n", vmgi_mat->vmg_category, ((vmgi_mat->vmg_category >> 16) & 0xff) ^0xff);
@@ -514,7 +514,7 @@
   printf("VMG POS Code: %08x", (uint32_t)(vmgi_mat->vmg_pos_code >> 32));
   printf("%08x\n", (uint32_t)vmgi_mat->vmg_pos_code);
   printf("End byte of VMGI_MAT: %08x\n", vmgi_mat->vmgi_last_byte);
-  printf("Start byte of First Play PGC (FP PGC): %08x\n", 
+  printf("Start byte of First Play PGC (FP PGC): %08x\n",
 	 vmgi_mat->first_play_pgc);
   printf("Start sector of VMGM_VOBS: %08x\n", vmgi_mat->vmgm_vobs);
   printf("Start sector of TT_SRPT: %08x\n", vmgi_mat->tt_srpt);
@@ -523,19 +523,19 @@
   printf("Start sector of VTS_ATRT: %08x\n", vmgi_mat->vts_atrt);
   printf("Start sector of TXTDT_MG: %08x\n", vmgi_mat->txtdt_mgi);
   printf("Start sector of VMGM_C_ADT: %08x\n", vmgi_mat->vmgm_c_adt);
-  printf("Start sector of VMGM_VOBU_ADMAP: %08x\n", 
+  printf("Start sector of VMGM_VOBU_ADMAP: %08x\n",
 	 vmgi_mat->vmgm_vobu_admap);
   printf("Video attributes of VMGM_VOBS: ");
   ifo_print_video_attributes(5, &vmgi_mat->vmgm_video_attr);
   printf("\n");
-  printf("VMGM Number of Audio attributes: %i\n", 
+  printf("VMGM Number of Audio attributes: %i\n",
 	 vmgi_mat->nr_of_vmgm_audio_streams);
   if(vmgi_mat->nr_of_vmgm_audio_streams > 0) {
     printf("\tstream %i status: ", 1);
     ifo_print_audio_attributes(5, &vmgi_mat->vmgm_audio_attr);
     printf("\n");
   }
-  printf("VMGM Number of Sub-picture attributes: %i\n", 
+  printf("VMGM Number of Sub-picture attributes: %i\n",
 	 vmgi_mat->nr_of_vmgm_subp_streams);
   if(vmgi_mat->nr_of_vmgm_subp_streams > 0) {
     printf("\tstream %2i status: ", 1);
@@ -551,8 +551,8 @@
   printf("VTS Identifier: %.12s\n", vtsi_mat->vts_identifier);
   printf("Last Sector of VTS: %08x\n", vtsi_mat->vts_last_sector);
   printf("Last Sector of VTSI: %08x\n", vtsi_mat->vtsi_last_sector);
-  printf("Specification version number: %01x.%01x\n", 
-	 vtsi_mat->specification_version>>4, 
+  printf("Specification version number: %01x.%01x\n",
+	 vtsi_mat->specification_version>>4,
 	 vtsi_mat->specification_version&0xf);
   printf("VTS Category: %08x\n", vtsi_mat->vts_category);
   printf("End byte of VTSI_MAT: %08x\n", vtsi_mat->vtsi_last_byte);
@@ -570,36 +570,36 @@
   printf("Video attributes of VTSM_VOBS: ");
   ifo_print_video_attributes(5, &vtsi_mat->vtsm_video_attr);
   printf("\n");
-  
-  printf("VTSM Number of Audio attributes: %i\n", 
+
+  printf("VTSM Number of Audio attributes: %i\n",
 	 vtsi_mat->nr_of_vtsm_audio_streams);
   if(vtsi_mat->nr_of_vtsm_audio_streams > 0) {
     printf("\tstream %i status: ", 1);
     ifo_print_audio_attributes(5, &vtsi_mat->vtsm_audio_attr);
     printf("\n");
   }
-  
-  printf("VTSM Number of Sub-picture attributes: %i\n", 
+
+  printf("VTSM Number of Sub-picture attributes: %i\n",
 	 vtsi_mat->nr_of_vtsm_subp_streams);
   if(vtsi_mat->nr_of_vtsm_subp_streams > 0) {
     printf("\tstream %2i status: ", 1);
     ifo_print_subp_attributes(5, &vtsi_mat->vtsm_subp_attr);
     printf("\n");
   }
-  
+
   printf("Video attributes of VTS_VOBS: ");
   ifo_print_video_attributes(5, &vtsi_mat->vts_video_attr);
   printf("\n");
-  
-  printf("VTS Number of Audio attributes: %i\n", 
+
+  printf("VTS Number of Audio attributes: %i\n",
 	 vtsi_mat->nr_of_vts_audio_streams);
   for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) {
     printf("\tstream %i status: ", i);
     ifo_print_audio_attributes(5, &vtsi_mat->vts_audio_attr[i]);
     printf("\n");
   }
-  
-  printf("VTS Number of Subpicture attributes: %i\n", 
+
+  printf("VTS Number of Subpicture attributes: %i\n",
 	 vtsi_mat->nr_of_vts_subp_streams);
   for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) {
     printf("\tstream %2i status: ", i);
@@ -611,12 +611,12 @@
 
 static void ifo_print_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
   int i;
-  
+
   if(cmd_tbl == NULL) {
     printf("No Command table present\n");
     return;
   }
-  
+
   printf("Number of Pre commands: %i\n", cmd_tbl->nr_of_pre);
   for(i = 0; i < cmd_tbl->nr_of_pre; i++) {
     ifo_print_cmd(i, &cmd_tbl->pre_cmds[i]);
@@ -636,12 +636,12 @@
 
 static void ifo_print_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
   int i;
-  
+
   if(program_map == NULL) {
     printf("No Program map present\n");
     return;
   }
-  
+
   for(i = 0; i < nr; i++) {
     printf("Program %3i Entry Cell: %3i\n", i + 1, program_map[i]);
   }
@@ -650,12 +650,12 @@
 
 static void ifo_print_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
   int i;
-  
+
   if(cell_playback == NULL) {
     printf("No Cell Playback info present\n");
     return;
   }
-  
+
   for(i=0;i<nr;i++) {
     printf("Cell: %3i ", i + 1);
 
@@ -676,7 +676,7 @@
 	s = "last"; break;
       }
       printf("%s cell in the block ", s);
-      
+
       switch(cell_playback[i].block_type) {
       case 0:
 	printf("not part of the block ");
@@ -708,26 +708,26 @@
       printf("still time %d ", cell_playback[i].still_time);
     if(cell_playback[i].cell_cmd_nr)
       printf("cell command %d", cell_playback[i].cell_cmd_nr);
-    
-    printf("\n\tStart sector: %08x\tFirst ILVU end  sector: %08x\n", 
-	   cell_playback[i].first_sector, 
+
+    printf("\n\tStart sector: %08x\tFirst ILVU end  sector: %08x\n",
+	   cell_playback[i].first_sector,
 	   cell_playback[i].first_ilvu_end_sector);
-    printf("\tEnd   sector: %08x\tLast VOBU start sector: %08x\n", 
-	   cell_playback[i].last_sector, 
+    printf("\tEnd   sector: %08x\tLast VOBU start sector: %08x\n",
+	   cell_playback[i].last_sector,
 	   cell_playback[i].last_vobu_start_sector);
   }
 }
 
 static void ifo_print_CELL_POSITION(cell_position_t *cell_position, int nr) {
   int i;
-  
+
   if(cell_position == NULL) {
     printf("No Cell Position info present\n");
     return;
   }
-  
+
   for(i=0;i<nr;i++) {
-    printf("Cell: %3i has VOB ID: %3i, Cell ID: %3i\n", i + 1, 
+    printf("Cell: %3i has VOB ID: %3i, Cell ID: %3i\n", i + 1,
 	   cell_position[i].vob_id_nr, cell_position[i].cell_nr);
   }
 }
@@ -735,7 +735,7 @@
 
 void ifo_print_PGC(pgc_t *pgc) {
   int i;
-  
+
   if (!pgc) {
     printf("None\n");
     return;
@@ -749,17 +749,17 @@
   /* If no programs/no time then does this mean anything? */
   printf("Prohibited user operations: ");
   ifo_print_USER_OPS(&pgc->prohibited_ops);
-  
+
     for(i = 0; i < 8; i++) {
       if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
-	printf("Audio stream %i control: %04x\n", 
+	printf("Audio stream %i control: %04x\n",
 	       i, pgc->audio_control[i]);
       }
     }
-  
+
   for(i = 0; i < 32; i++) {
     if(pgc->subp_control[i] & 0x80000000) { /* The 'is present' bit */
-      printf("Subpicture stream %2i control: %08x: 4:3=%d, Wide=%d, Letterbox=%d, Pan-Scan=%d\n", 
+      printf("Subpicture stream %2i control: %08x: 4:3=%d, Wide=%d, Letterbox=%d, Pan-Scan=%d\n",
 	     i, pgc->subp_control[i],
 	     (pgc->subp_control[i] >>24) & 0x1f,
 	     (pgc->subp_control[i] >>16) & 0x1f,
@@ -767,7 +767,7 @@
 	     (pgc->subp_control[i] ) & 0x1f);
     }
   }
-  
+
   printf("Next PGC number: %i\n", pgc->next_pgc_nr);
   printf("Prev PGC number: %i\n", pgc->prev_pgc_nr);
   printf("GoUp PGC number: %i\n", pgc->goup_pgc_nr);
@@ -775,13 +775,13 @@
     printf("Still time: %i seconds (255=inf)\n", pgc->still_time);
     printf("PG Playback mode %02x\n", pgc->pg_playback_mode);
   }
-  
+
   if(pgc->nr_of_programs != 0) {
     for(i = 0; i < 16; i++) {
       printf("Color %2i: %08x\n", i, pgc->palette[i]);
     }
   }
-  
+
   /* Memmory offsets to div. tables. */
   ifo_print_PGC_COMMAND_TBL(pgc->command_tbl);
   ifo_print_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
@@ -792,23 +792,23 @@
 
 void ifo_print_TT_SRPT(tt_srpt_t *tt_srpt) {
   int i;
-  
+
   printf("Number of TitleTrack search pointers: %i\n",
 	 tt_srpt->nr_of_srpts);
   for(i=0;i<tt_srpt->nr_of_srpts;i++) {
     printf("Title Track index %i\n", i + 1);
-    printf("\tTitle set number (VTS): %i", 
+    printf("\tTitle set number (VTS): %i",
 	   tt_srpt->title[i].title_set_nr);
     printf("\tVTS_TTN: %i\n", tt_srpt->title[i].vts_ttn);
     printf("\tNumber of PTTs: %i\n", tt_srpt->title[i].nr_of_ptts);
-    printf("\tNumber of angles: %i\n", 
+    printf("\tNumber of angles: %i\n",
 	   tt_srpt->title[i].nr_of_angles);
 
-    printf("\tTitle playback type: (%02x)\n", 
+    printf("\tTitle playback type: (%02x)\n",
 	   *(uint8_t *)&(tt_srpt->title[i].pb_ty));
     printf("\t\t%s\n",
        tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequencial");
-    if (tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd) printf("\t\tJump/Link/Call exists in cell cmd\n"); 
+    if (tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd) printf("\t\tJump/Link/Call exists in cell cmd\n");
     if (tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd) printf("\t\tJump/Link/Call exists in pre/post cmd\n");
     if (tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd) printf("\t\tJump/Link/Call exists in button cmd\n");
     if (tt_srpt->title[i].pb_ty.jlc_exists_in_tt_dom) printf("\t\tJump/Link/Call exists in tt_dom cmd\n");
@@ -817,7 +817,7 @@
 
     printf("\tParental ID field: %04x\n",
 	   tt_srpt->title[i].parental_id);
-    printf("\tTitle set starting sector %08x\n", 
+    printf("\tTitle set starting sector %08x\n",
 	   tt_srpt->title[i].title_set_sector);
   }
 }
@@ -825,13 +825,13 @@
 
 void ifo_print_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
   int i, j;
-  printf(" nr_of_srpts %i last byte %i\n", 
-	 vts_ptt_srpt->nr_of_srpts, 
+  printf(" nr_of_srpts %i last byte %i\n",
+	 vts_ptt_srpt->nr_of_srpts,
 	 vts_ptt_srpt->last_byte);
   for(i=0;i<vts_ptt_srpt->nr_of_srpts;i++) {
     for(j=0;j<vts_ptt_srpt->title[i].nr_of_ptts;j++) {
       printf("VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n",
-	     i + 1, j + 1, 
+	     i + 1, j + 1,
 	     vts_ptt_srpt->title[i].ptt[j].pgcn,
 	     vts_ptt_srpt->title[i].ptt[j].pgn );
     }
@@ -846,18 +846,18 @@
 
 void ifo_print_PTL_MAIT(ptl_mait_t *ptl_mait) {
   int i, j;
-  
+
   printf("Number of Countries: %i\n", ptl_mait->nr_of_countries);
   printf("Number of VTSs: %i\n", ptl_mait->nr_of_vtss);
   //printf("Last byte: %i\n", ptl_mait->last_byte);
-  
+
   for(i = 0; i < ptl_mait->nr_of_countries; i++) {
-    printf("Country code: %c%c\n", 
+    printf("Country code: %c%c\n",
 	   ptl_mait->countries[i].country_code >> 8,
 	   ptl_mait->countries[i].country_code & 0xff);
     /*
-      printf("Start byte: %04x %i\n", 
-      ptl_mait->countries[i].pf_ptl_mai_start_byte, 
+      printf("Start byte: %04x %i\n",
+      ptl_mait->countries[i].pf_ptl_mai_start_byte,
       ptl_mait->countries[i].pf_ptl_mai_start_byte);
     */
     /* This seems to be pointing at a array with 8 2byte fields per VTS
@@ -865,7 +865,7 @@
        all the dics I tested so it might be padding to even also.
        If it is for the menu it probably the first entry.  */
     for(j=0;j<8;j++) {
-      hexdump( (uint8_t *)ptl_mait->countries - PTL_MAIT_COUNTRY_SIZE 
+      hexdump( (uint8_t *)ptl_mait->countries - PTL_MAIT_COUNTRY_SIZE
 	       + ptl_mait->countries[i].pf_ptl_mai_start_byte
 	       + j*(ptl_mait->nr_of_vtss+1)*2, (ptl_mait->nr_of_vtss+1)*2);
       printf("\n");
@@ -898,16 +898,16 @@
 
 void ifo_print_C_ADT(c_adt_t *c_adt) {
   int i, entries;
-  
+
   printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs);
   //entries = c_adt->nr_of_vobs;
   entries = (c_adt->last_byte + 1 - C_ADT_SIZE)/sizeof(c_adt_t);
-  
+
   for(i = 0; i < entries; i++) {
-    printf("VOB ID: %3i, Cell ID: %3i   ", 
+    printf("VOB ID: %3i, Cell ID: %3i   ",
 	   c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id);
     printf("Sector (first): 0x%08x   (last): 0x%08x\n",
-	   c_adt->cell_adr_table[i].start_sector, 
+	   c_adt->cell_adr_table[i].start_sector,
 	   c_adt->cell_adr_table[i].last_sector);
   }
 }
@@ -915,7 +915,7 @@
 
 void ifo_print_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
   int i, entries;
-  
+
   entries = (vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE)/4;
   for(i = 0; i < entries; i++) {
     printf("VOBU %5i  First sector: 0x%08x\n", i + 1,
@@ -955,7 +955,7 @@
 /* pgc_type=1 for menu, 0 for title. */
 void ifo_print_PGCIT(pgcit_t *pgcit, int pgc_type) {
   int i;
-  
+
   printf("\nNumber of Program Chains: %3i\n", pgcit->nr_of_pgci_srp);
   for(i = 0; i < pgcit->nr_of_pgci_srp; i++) {
     printf("\nProgram (PGC): %3i\n", i + 1);
@@ -979,14 +979,14 @@
 
 void ifo_print_PGCI_UT(pgci_ut_t *pgci_ut) {
   int i, menu;
-  
+
   printf("Number of Menu Language Units (PGCI_LU): %3i\n", pgci_ut->nr_of_lus);
   for(i = 0; i < pgci_ut->nr_of_lus; i++) {
     printf("\nMenu Language Unit %d\n", i+1);
     printf("\nMenu Language Code: %c%c\n",
 	   pgci_ut->lu[i].lang_code >> 8,
 	   pgci_ut->lu[i].lang_code & 0xff);
-  
+
     menu = pgci_ut->lu[i].exists;
     printf("Menu Existence: %02x: ", menu);
     if (menu == 0) {
@@ -1024,42 +1024,42 @@
 
 static void ifo_print_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
   int i;
-  
+
   printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat);
- 
+
   printf("Video attributes of VTSM_VOBS: ");
   ifo_print_video_attributes(5, &vts_attributes->vtsm_vobs_attr);
   printf("\n");
-  printf("Number of Audio streams: %i\n", 
+  printf("Number of Audio streams: %i\n",
 	 vts_attributes->nr_of_vtsm_audio_streams);
   if(vts_attributes->nr_of_vtsm_audio_streams > 0) {
     printf("\tstream %i attributes: ", 1);
     ifo_print_audio_attributes(5, &vts_attributes->vtsm_audio_attr);
     printf("\n");
   }
-  printf("Number of Subpicture streams: %i\n", 
+  printf("Number of Subpicture streams: %i\n",
 	 vts_attributes->nr_of_vtsm_subp_streams);
   if(vts_attributes->nr_of_vtsm_subp_streams > 0) {
     printf("\tstream %2i attributes: ", 1);
     ifo_print_subp_attributes(5, &vts_attributes->vtsm_subp_attr);
     printf("\n");
   }
-   
+
   printf("Video attributes of VTSTT_VOBS: ");
   ifo_print_video_attributes(5, &vts_attributes->vtstt_vobs_video_attr);
   printf("\n");
-  printf("Number of Audio streams: %i\n", 
+  printf("Number of Audio streams: %i\n",
 	 vts_attributes->nr_of_vtstt_audio_streams);
   for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) {
     printf("\tstream %i attributes: ", i);
     ifo_print_audio_attributes(5, &vts_attributes->vtstt_audio_attr[i]);
     printf("\n");
   }
-  
-  printf("Number of Subpicture streams: %i\n", 
+
+  printf("Number of Subpicture streams: %i\n",
 	 vts_attributes->nr_of_vtstt_subp_streams);
   for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) {
-    printf("\tstream %2i attributes: ", i);    
+    printf("\tstream %2i attributes: ", i);
     ifo_print_subp_attributes(5, &vts_attributes->vtstt_subp_attr[i]);
     printf("\n");
   }
@@ -1068,7 +1068,7 @@
 
 void ifo_print_VTS_ATRT(vts_atrt_t *vts_atrt) {
   int i;
-  
+
   printf("Number of Video Title Sets: %3i\n", vts_atrt->nr_of_vtss);
   for(i = 0; i < vts_atrt->nr_of_vtss; i++) {
     printf("\nVideo Title Set %i\n", i + 1);
@@ -1085,8 +1085,8 @@
     fprintf(stderr, "Can't open info file for title %d\n", title);
     return;
   }
-  
-  
+
+
   if(ifohandle->vmgi_mat) {
 
     printf("VMG top level\n-------------\n");
@@ -1121,7 +1121,7 @@
     printf("\nVideo Title Set Attribute Table\n");
     printf(  "-------------------------------\n");
     ifo_print_VTS_ATRT(ifohandle->vts_atrt);
-    
+
     printf("\nText Data Manager Information\n");
     printf(  "-----------------------------\n");
     if(ifohandle->txtdt_mgi) {
@@ -1143,7 +1143,7 @@
     if(ifohandle->menu_vobu_admap) {
       ifo_print_VOBU_ADMAP(ifohandle->menu_vobu_admap);
     } else {
-      printf("No Menu VOBU address map present\n");   
+      printf("No Menu VOBU address map present\n");
     }
   }
 
@@ -1200,7 +1200,7 @@
     printf("\nVideo Title Set VOBU address map\n");
     printf(  "-----------------\n");
     ifo_print_VOBU_ADMAP(ifohandle->vts_vobu_admap);
-  } 
+  }
 
   ifoClose(ifohandle);
 }
--- a/ifo_print.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/ifo_print.h	Sat Sep 06 21:55:51 2008 +0000
@@ -3,12 +3,12 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
--- a/ifo_read.c	Mon Sep 01 21:05:17 2008 +0000
+++ b/ifo_read.c	Sat Sep 06 21:55:51 2008 +0000
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000, 2001, 2002, 2003
- *               Björn Englund <d4bjorn@dtek.chalmers.se>, 
+ *               Björn Englund <d4bjorn@dtek.chalmers.se>,
  *               Håkan Hjort <d95hjort@dtek.chalmers.se>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -62,27 +62,27 @@
 static int ifoRead_VMG(ifo_handle_t *ifofile);
 static int ifoRead_VTS(ifo_handle_t *ifofile);
 static int ifoRead_PGC(ifo_handle_t *ifofile, pgc_t *pgc, unsigned int offset);
-static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile, 
-                                   pgc_command_tbl_t *cmd_tbl, 
+static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile,
+                                   pgc_command_tbl_t *cmd_tbl,
 				   unsigned int offset);
-static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile, 
-                                   pgc_program_map_t *program_map, 
+static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile,
+                                   pgc_program_map_t *program_map,
                                    unsigned int nr, unsigned int offset);
-static int ifoRead_CELL_PLAYBACK_TBL(ifo_handle_t *ifofile, 
-                                     cell_playback_t *cell_playback, 
+static int ifoRead_CELL_PLAYBACK_TBL(ifo_handle_t *ifofile,
+                                     cell_playback_t *cell_playback,
                                      unsigned int nr, unsigned int offset);
-static int ifoRead_CELL_POSITION_TBL(ifo_handle_t *ifofile, 
-                                     cell_position_t *cell_position, 
+static int ifoRead_CELL_POSITION_TBL(ifo_handle_t *ifofile,
+                                     cell_position_t *cell_position,
                                      unsigned int nr, unsigned int offset);
-static int ifoRead_VTS_ATTRIBUTES(ifo_handle_t *ifofile, 
-                                  vts_attributes_t *vts_attributes, 
+static int ifoRead_VTS_ATTRIBUTES(ifo_handle_t *ifofile,
+                                  vts_attributes_t *vts_attributes,
                                   unsigned int offset);
-static int ifoRead_C_ADT_internal(ifo_handle_t *ifofile, c_adt_t *c_adt, 
+static int ifoRead_C_ADT_internal(ifo_handle_t *ifofile, c_adt_t *c_adt,
                                   unsigned int sector);
-static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile, 
-                                       vobu_admap_t *vobu_admap, 
+static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile,
+                                       vobu_admap_t *vobu_admap,
 				       unsigned int sector);
-static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit, 
+static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
                                   unsigned int offset);
 
 static void ifoFree_PGC(pgc_t *pgc);
@@ -119,7 +119,7 @@
 static void read_audio_attr(audio_attr_t *aa) {
   getbits_state_t state;
   uint8_t buf[sizeof(audio_attr_t)];
-  
+
   memcpy(buf, aa, sizeof(audio_attr_t));
   if (!dvdread_getbits_init(&state, buf)) abort();
   aa->audio_format = dvdread_getbits(&state, 3);
@@ -144,7 +144,7 @@
 static void read_multichannel_ext(multichannel_ext_t *me) {
   getbits_state_t state;
   uint8_t buf[sizeof(multichannel_ext_t)];
-  
+
   memcpy(buf, me, sizeof(multichannel_ext_t));
   if (!dvdread_getbits_init(&state, buf)) abort();
   me->zero1 = dvdread_getbits(&state, 7);
@@ -171,7 +171,7 @@
 static void read_subp_attr(subp_attr_t *sa) {
   getbits_state_t state;
   uint8_t buf[sizeof(subp_attr_t)];
-  
+
   memcpy(buf, sa, sizeof(subp_attr_t));
   if (!dvdread_getbits_init(&state, buf)) abort();
   sa->code_mode = dvdread_getbits(&state, 3);
@@ -186,7 +186,7 @@
 static void read_user_ops(user_ops_t *uo) {
   getbits_state_t state;
   uint8_t buf[sizeof(user_ops_t)];
-  
+
   memcpy(buf, uo, sizeof(user_ops_t));
   if (!dvdread_getbits_init(&state, buf)) abort();
   uo->zero                           = dvdread_getbits(&state, 7);
@@ -220,7 +220,7 @@
 static void read_pgci_srp(pgci_srp_t *ps) {
   getbits_state_t state;
   uint8_t buf[sizeof(pgci_srp_t)];
-  
+
   memcpy(buf, ps, sizeof(pgci_srp_t));
   if (!dvdread_getbits_init(&state, buf)) abort();
   ps->entry_id                       = dvdread_getbits(&state, 8);
@@ -234,7 +234,7 @@
 static void read_cell_playback(cell_playback_t *cp) {
   getbits_state_t state;
   uint8_t buf[sizeof(cell_playback_t)];
-  
+
   memcpy(buf, cp, sizeof(cell_playback_t));
   if (!dvdread_getbits_init(&state, buf)) abort();
   cp->block_mode                      = dvdread_getbits(&state, 2);
@@ -248,12 +248,12 @@
   cp->unknown2                        = dvdread_getbits(&state, 6);
   cp->still_time                      = dvdread_getbits(&state, 8);
   cp->cell_cmd_nr                     = dvdread_getbits(&state, 8);
-  
+
   cp->playback_time.hour              = dvdread_getbits(&state, 8);
   cp->playback_time.minute            = dvdread_getbits(&state, 8);
   cp->playback_time.second            = dvdread_getbits(&state, 8);
   cp->playback_time.frame_u           = dvdread_getbits(&state, 8);
-  
+
   cp->first_sector                    = dvdread_getbits(&state, 32);
   cp->first_ilvu_end_sector           = dvdread_getbits(&state, 32);
   cp->last_vobu_start_sector          = dvdread_getbits(&state, 32);
@@ -263,7 +263,7 @@
 static void read_playback_type(playback_type_t *pt) {
   getbits_state_t state;
   uint8_t buf[sizeof(playback_type_t)];
-  
+
   memcpy(buf, pt, sizeof(playback_type_t));
   if (!dvdread_getbits_init(&state, buf)) abort();
   pt->zero_1                          = dvdread_getbits(&state, 1);
@@ -399,19 +399,19 @@
 
 ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) {
   ifo_handle_t *ifofile;
-  
+
   ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t));
   if(!ifofile)
     return NULL;
 
   memset(ifofile, 0, sizeof(ifo_handle_t));
-  
+
   if(title <= 0 || title > 99) {
     fprintf(stderr, "libdvdread: ifoOpenVTSI invalid title (%d).\n", title);
     free(ifofile);
     return NULL;
   }
-    
+
   ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_FILE);
   if(!ifofile->file) /* Should really catch any error and try to fallback */
     ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
@@ -435,7 +435,7 @@
 void ifoClose(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   ifoFree_VOBU_ADMAP(ifofile);
   ifoFree_TITLE_VOBU_ADMAP(ifofile);
   ifoFree_C_ADT(ifofile);
@@ -489,7 +489,7 @@
     ifofile->vmgi_mat = 0;
     return 0;
   }
-  
+
   B2N_32(vmgi_mat->vmg_last_sector);
   B2N_32(vmgi_mat->vmgi_last_sector);
   B2N_32(vmgi_mat->vmg_category);
@@ -521,7 +521,7 @@
   CHECK_ZERO(vmgi_mat->zero_7);
   CHECK_ZERO(vmgi_mat->zero_8);
   CHECK_ZERO(vmgi_mat->zero_9);
-  CHECK_ZERO(vmgi_mat->zero_10);  
+  CHECK_ZERO(vmgi_mat->zero_10);
   CHECK_VALUE(vmgi_mat->vmg_last_sector != 0);
   CHECK_VALUE(vmgi_mat->vmgi_last_sector != 0);
   CHECK_VALUE(vmgi_mat->vmgi_last_sector * 2 <= vmgi_mat->vmg_last_sector);
@@ -532,11 +532,11 @@
   CHECK_VALUE(vmgi_mat->disc_side == 1 || vmgi_mat->disc_side == 2);
   CHECK_VALUE(vmgi_mat->vmg_nr_of_title_sets != 0);
   CHECK_VALUE(vmgi_mat->vmgi_last_byte >= 341);
-  CHECK_VALUE(vmgi_mat->vmgi_last_byte / DVD_BLOCK_LEN <= 
+  CHECK_VALUE(vmgi_mat->vmgi_last_byte / DVD_BLOCK_LEN <=
          vmgi_mat->vmgi_last_sector);
   /* It seems that first_play_pgc is optional. */
   CHECK_VALUE(vmgi_mat->first_play_pgc < vmgi_mat->vmgi_last_byte);
-  CHECK_VALUE(vmgi_mat->vmgm_vobs == 0 || 
+  CHECK_VALUE(vmgi_mat->vmgm_vobs == 0 ||
         (vmgi_mat->vmgm_vobs > vmgi_mat->vmgi_last_sector &&
          vmgi_mat->vmgm_vobs < vmgi_mat->vmg_last_sector));
   CHECK_VALUE(vmgi_mat->tt_srpt <= vmgi_mat->vmgi_last_sector);
@@ -561,7 +561,7 @@
   vtsi_mat = (vtsi_mat_t *)malloc(sizeof(vtsi_mat_t));
   if(!vtsi_mat)
     return 0;
-  
+
   ifofile->vtsi_mat = vtsi_mat;
 
   if(!DVDFileSeek_(ifofile->file, 0)) {
@@ -629,10 +629,10 @@
   CHECK_ZERO(vtsi_mat->zero_21);
   CHECK_VALUE(vtsi_mat->vtsi_last_sector*2 <= vtsi_mat->vts_last_sector);
   CHECK_VALUE(vtsi_mat->vtsi_last_byte/DVD_BLOCK_LEN <= vtsi_mat->vtsi_last_sector);
-  CHECK_VALUE(vtsi_mat->vtsm_vobs == 0 || 
+  CHECK_VALUE(vtsi_mat->vtsm_vobs == 0 ||
        (vtsi_mat->vtsm_vobs > vtsi_mat->vtsi_last_sector &&
          vtsi_mat->vtsm_vobs < vtsi_mat->vts_last_sector));
-  CHECK_VALUE(vtsi_mat->vtstt_vobs == 0 || 
+  CHECK_VALUE(vtsi_mat->vtstt_vobs == 0 ||
         (vtsi_mat->vtstt_vobs > vtsi_mat->vtsi_last_sector &&
          vtsi_mat->vtstt_vobs < vtsi_mat->vts_last_sector));
   CHECK_VALUE(vtsi_mat->vts_ptt_srpt <= vtsi_mat->vtsi_last_sector);
@@ -643,7 +643,7 @@
   CHECK_VALUE(vtsi_mat->vtsm_vobu_admap <= vtsi_mat->vtsi_last_sector);
   CHECK_VALUE(vtsi_mat->vts_c_adt <= vtsi_mat->vtsi_last_sector);
   CHECK_VALUE(vtsi_mat->vts_vobu_admap <= vtsi_mat->vtsi_last_sector);
-  
+
   CHECK_VALUE(vtsi_mat->nr_of_vtsm_audio_streams <= 1);
   CHECK_VALUE(vtsi_mat->nr_of_vtsm_subp_streams <= 1);
 
@@ -653,8 +653,8 @@
 
   CHECK_VALUE(vtsi_mat->nr_of_vts_subp_streams <= 32);
   for(i = vtsi_mat->nr_of_vts_subp_streams; i < 32; i++)
-    CHECK_ZERO(vtsi_mat->vts_subp_attr[i]);      
-  
+    CHECK_ZERO(vtsi_mat->vts_subp_attr[i]);
+
   for(i = 0; i < 8; i++) {
     read_multichannel_ext(&vtsi_mat->vts_mu_audio_attr[i]);
     CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero1);
@@ -664,17 +664,17 @@
     CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero5);
     CHECK_ZERO(vtsi_mat->vts_mu_audio_attr[i].zero6);
   }
-  
+
   return 1;
 }
 
 
-static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile, 
-                                   pgc_command_tbl_t *cmd_tbl, 
+static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile,
+                                   pgc_command_tbl_t *cmd_tbl,
 				   unsigned int offset) {
-  
+
   memset(cmd_tbl, 0, sizeof(pgc_command_tbl_t));
-  
+
   if(!DVDFileSeek_(ifofile->file, offset))
     return 0;
 
@@ -686,7 +686,7 @@
   B2N_16(cmd_tbl->nr_of_cell);
 
   CHECK_VALUE(cmd_tbl->nr_of_pre + cmd_tbl->nr_of_post + cmd_tbl->nr_of_cell<= 255);
-     
+
   if(cmd_tbl->nr_of_pre != 0) {
     unsigned int pre_cmds_size  = cmd_tbl->nr_of_pre * COMMAND_DATA_SIZE;
     cmd_tbl->pre_cmds = (vm_cmd_t *)malloc(pre_cmds_size);
@@ -698,17 +698,17 @@
       return 0;
     }
   }
-  
+
   if(cmd_tbl->nr_of_post != 0) {
     unsigned int post_cmds_size = cmd_tbl->nr_of_post * COMMAND_DATA_SIZE;
     cmd_tbl->post_cmds = (vm_cmd_t *)malloc(post_cmds_size);
     if(!cmd_tbl->post_cmds) {
-      if(cmd_tbl->pre_cmds) 
+      if(cmd_tbl->pre_cmds)
 	free(cmd_tbl->pre_cmds);
       return 0;
     }
     if(!(DVDReadBytes(ifofile->file, cmd_tbl->post_cmds, post_cmds_size))) {
-      if(cmd_tbl->pre_cmds) 
+      if(cmd_tbl->pre_cmds)
 	free(cmd_tbl->pre_cmds);
       free(cmd_tbl->post_cmds);
       return 0;
@@ -726,16 +726,16 @@
       return 0;
     }
     if(!(DVDReadBytes(ifofile->file, cmd_tbl->cell_cmds, cell_cmds_size))) {
-      if(cmd_tbl->pre_cmds) 
+      if(cmd_tbl->pre_cmds)
 	free(cmd_tbl->pre_cmds);
-      if(cmd_tbl->post_cmds) 
+      if(cmd_tbl->post_cmds)
 	free(cmd_tbl->post_cmds);
       free(cmd_tbl->cell_cmds);
       return 0;
     }
   }
-  
-  /* 
+
+  /*
    * Make a run over all the commands and see that we can interpret them all?
    */
   return 1;
@@ -754,21 +754,21 @@
   }
 }
 
-static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile, 
-                                   pgc_program_map_t *program_map, 
+static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile,
+                                   pgc_program_map_t *program_map,
 				   unsigned int nr, unsigned int offset) {
   unsigned int size = nr * sizeof(pgc_program_map_t);
 
   if(!DVDFileSeek_(ifofile->file, offset))
     return 0;
- 
+
   if(!(DVDReadBytes(ifofile->file, program_map, size)))
     return 0;
 
   return 1;
 }
 
-static int ifoRead_CELL_PLAYBACK_TBL(ifo_handle_t *ifofile, 
+static int ifoRead_CELL_PLAYBACK_TBL(ifo_handle_t *ifofile,
                                      cell_playback_t *cell_playback,
                                      unsigned int nr, unsigned int offset) {
   unsigned int i;
@@ -783,9 +783,9 @@
   for(i = 0; i < nr; i++) {
     read_cell_playback(&cell_playback[i]);
     /* Changed < to <= because this was false in the movie 'Pi'. */
-    CHECK_VALUE(cell_playback[i].last_vobu_start_sector <= 
+    CHECK_VALUE(cell_playback[i].last_vobu_start_sector <=
            cell_playback[i].last_sector);
-    CHECK_VALUE(cell_playback[i].first_sector <= 
+    CHECK_VALUE(cell_playback[i].first_sector <=
            cell_playback[i].last_vobu_start_sector);
   }
 
@@ -793,8 +793,8 @@
 }
 
 
-static int ifoRead_CELL_POSITION_TBL(ifo_handle_t *ifofile, 
-                                     cell_position_t *cell_position, 
+static int ifoRead_CELL_POSITION_TBL(ifo_handle_t *ifofile,
+                                     cell_position_t *cell_position,
                                      unsigned int nr, unsigned int offset) {
   unsigned int i;
   unsigned int size = nr * sizeof(cell_position_t);
@@ -818,7 +818,7 @@
 
   if(!DVDFileSeek_(ifofile->file, offset))
     return 0;
- 
+
   if(!(DVDReadBytes(ifofile->file, pgc, PGC_SIZE)))
     return 0;
 
@@ -837,7 +837,7 @@
     B2N_32(pgc->subp_control[i]);
   for(i = 0; i < 16; i++)
     B2N_32(pgc->palette[i]);
-  
+
   CHECK_ZERO(pgc->zero_1);
   CHECK_VALUE(pgc->nr_of_programs <= pgc->nr_of_cells);
 
@@ -848,7 +848,7 @@
   for(i = 0; i < 32; i++)
     if(!pgc->subp_control[i] & 0x80000000) /* The 'is present' bit */
       CHECK_ZERO(pgc->subp_control[i]);
-  
+
   /* Check that time is 0:0:0:0 also if nr_of_programs == 0 */
   if(pgc->nr_of_programs == 0) {
     CHECK_ZERO(pgc->still_time);
@@ -861,13 +861,13 @@
     CHECK_VALUE(pgc->cell_playback_offset != 0);
     CHECK_VALUE(pgc->cell_position_offset != 0);
   }
-  
+
   if(pgc->command_tbl_offset != 0) {
     pgc->command_tbl = malloc(sizeof(pgc_command_tbl_t));
     if(!pgc->command_tbl)
       return 0;
 
-    if(!ifoRead_PGC_COMMAND_TBL(ifofile, pgc->command_tbl, 
+    if(!ifoRead_PGC_COMMAND_TBL(ifofile, pgc->command_tbl,
                                 offset + pgc->command_tbl_offset)) {
       free(pgc->command_tbl);
       return 0;
@@ -875,7 +875,7 @@
   } else {
     pgc->command_tbl = NULL;
   }
-  
+
   if(pgc->program_map_offset != 0 && pgc->nr_of_programs>0) {
     pgc->program_map = malloc(pgc->nr_of_programs * sizeof(pgc_program_map_t));
     if(!pgc->program_map) {
@@ -891,7 +891,7 @@
   } else {
     pgc->program_map = NULL;
   }
-  
+
   if(pgc->cell_playback_offset != 0 && pgc->nr_of_cells>0) {
     pgc->cell_playback = malloc(pgc->nr_of_cells * sizeof(cell_playback_t));
     if(!pgc->cell_playback) {
@@ -900,7 +900,7 @@
 	free(pgc->program_map);
       return 0;
     }
-    if(!ifoRead_CELL_PLAYBACK_TBL(ifofile, pgc->cell_playback, 
+    if(!ifoRead_CELL_PLAYBACK_TBL(ifofile, pgc->cell_playback,
 				  pgc->nr_of_cells,
                                   offset + pgc->cell_playback_offset)) {
       ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
@@ -912,14 +912,14 @@
   } else {
     pgc->cell_playback = NULL;
   }
-  
+
   if(pgc->cell_position_offset != 0 && pgc->nr_of_cells>0) {
     pgc->cell_position = malloc(pgc->nr_of_cells * sizeof(cell_position_t));
     if(!pgc->cell_position) {
       ifoFree_PGC(pgc);
       return 0;
     }
-    if(!ifoRead_CELL_POSITION_TBL(ifofile, pgc->cell_position, 
+    if(!ifoRead_CELL_POSITION_TBL(ifofile, pgc->cell_position,
 				  pgc->nr_of_cells,
                                   offset + pgc->cell_position_offset)) {
       ifoFree_PGC(pgc);
@@ -939,17 +939,17 @@
 
   if(!ifofile->vmgi_mat)
     return 0;
-  
+
   /* It seems that first_play_pgc is optional after all. */
   ifofile->first_play_pgc = 0;
   if(ifofile->vmgi_mat->first_play_pgc == 0)
     return 1;
-  
+
   ifofile->first_play_pgc = (pgc_t *)malloc(sizeof(pgc_t));
   if(!ifofile->first_play_pgc)
     return 0;
-  
-  if(!ifoRead_PGC(ifofile, ifofile->first_play_pgc, 
+
+  if(!ifoRead_PGC(ifofile, ifofile->first_play_pgc,
                   ifofile->vmgi_mat->first_play_pgc)) {
     free(ifofile->first_play_pgc);
     ifofile->first_play_pgc = 0;
@@ -974,7 +974,7 @@
 void ifoFree_FP_PGC(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   if(ifofile->first_play_pgc) {
     ifoFree_PGC(ifofile->first_play_pgc);
     free(ifofile->first_play_pgc);
@@ -1004,7 +1004,7 @@
     return 0;
 
   ifofile->tt_srpt = tt_srpt;
-  
+
   if(!(DVDReadBytes(ifofile->file, tt_srpt, TT_SRPT_SIZE))) {
     fprintf(stderr, "libdvdread: Unable to read read TT_SRPT.\n");
     free(tt_srpt);
@@ -1013,10 +1013,10 @@
 
   B2N_16(tt_srpt->nr_of_srpts);
   B2N_32(tt_srpt->last_byte);
-  
+
   info_length = tt_srpt->last_byte + 1 - TT_SRPT_SIZE;
 
-  tt_srpt->title = (title_info_t *)malloc(info_length); 
+  tt_srpt->title = (title_info_t *)malloc(info_length);
   if(!tt_srpt->title) {
     free(tt_srpt);
     ifofile->tt_srpt = 0;
@@ -1033,13 +1033,13 @@
     B2N_16(tt_srpt->title[i].parental_id);
     B2N_32(tt_srpt->title[i].title_set_sector);
   }
-  
+
 
   CHECK_ZERO(tt_srpt->zero_1);
   CHECK_VALUE(tt_srpt->nr_of_srpts != 0);
   CHECK_VALUE(tt_srpt->nr_of_srpts < 100); /* ?? */
   CHECK_VALUE((int)tt_srpt->nr_of_srpts * sizeof(title_info_t) <= info_length);
-  
+
   for(i = 0; i < tt_srpt->nr_of_srpts; i++) {
     read_playback_type(&tt_srpt->title[i].pb_ty);
     CHECK_VALUE(tt_srpt->title[i].pb_ty.zero_1 == 0);
@@ -1054,16 +1054,16 @@
     CHECK_VALUE(tt_srpt->title[i].vts_ttn < 100); /* ?? */
     /* CHECK_VALUE(tt_srpt->title[i].title_set_sector != 0); */
   }
-  
+
   /* Make this a function */
 #if 0
-  if(memcmp((uint8_t *)tt_srpt->title + 
-            tt_srpt->nr_of_srpts * sizeof(title_info_t), 
-            my_friendly_zeros, 
+  if(memcmp((uint8_t *)tt_srpt->title +
+            tt_srpt->nr_of_srpts * sizeof(title_info_t),
+            my_friendly_zeros,
             info_length - tt_srpt->nr_of_srpts * sizeof(title_info_t))) {
     fprintf(stderr, "VMG_PTT_SRPT slack is != 0, ");
-    hexdump((uint8_t *)tt_srpt->title + 
-            tt_srpt->nr_of_srpts * sizeof(title_info_t), 
+    hexdump((uint8_t *)tt_srpt->title +
+            tt_srpt->nr_of_srpts * sizeof(title_info_t),
             info_length - tt_srpt->nr_of_srpts * sizeof(title_info_t));
   }
 #endif
@@ -1075,7 +1075,7 @@
 void ifoFree_TT_SRPT(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   if(ifofile->tt_srpt) {
     free(ifofile->tt_srpt->title);
     free(ifofile->tt_srpt);
@@ -1091,13 +1091,13 @@
 
   if(!ifofile)
     return 0;
-  
+
   if(!ifofile->vtsi_mat)
     return 0;
 
   if(ifofile->vtsi_mat->vts_ptt_srpt == 0) /* mandatory */
     return 0;
-    
+
   if(!DVDFileSeek_(ifofile->file,
 		   ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN))
     return 0;
@@ -1120,10 +1120,10 @@
   CHECK_ZERO(vts_ptt_srpt->zero_1);
   CHECK_VALUE(vts_ptt_srpt->nr_of_srpts != 0);
   CHECK_VALUE(vts_ptt_srpt->nr_of_srpts < 100); /* ?? */
-  
+
   info_length = vts_ptt_srpt->last_byte + 1 - VTS_PTT_SRPT_SIZE;
-  
-  data = (uint32_t *)malloc(info_length); 
+
+  data = (uint32_t *)malloc(info_length);
   if(!data) {
     free(vts_ptt_srpt);
     ifofile->vts_ptt_srpt = 0;
@@ -1140,14 +1140,14 @@
   for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
     B2N_32(data[i]);
     /* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);
-       Magic Knight Rayearth Daybreak is mastered very strange and has 
+       Magic Knight Rayearth Daybreak is mastered very strange and has
        Titles with 0 PTTs. They all have a data[i] offsets beyond the end of
        of the vts_ptt_srpt structure. */
     CHECK_VALUE(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1 + 4);
   }
- 
+
   vts_ptt_srpt->ttu_offset = data;
-  
+
   vts_ptt_srpt->title = malloc(vts_ptt_srpt->nr_of_srpts * sizeof(ttu_t));
   if(!vts_ptt_srpt->title) {
     free(vts_ptt_srpt);
@@ -1162,11 +1162,11 @@
     else
       n = (vts_ptt_srpt->last_byte + 1 - data[i]);
     /* assert(n > 0 && (n % 4) == 0);
-       Magic Knight Rayearth Daybreak is mastered very strange and has 
+       Magic Knight Rayearth Daybreak is mastered very strange and has
        Titles with 0 PTTs. */
     if(n < 0) n = 0;
     CHECK_VALUE(n % 4 == 0);
-    
+
     vts_ptt_srpt->title[i].nr_of_ptts = n / 4;
     vts_ptt_srpt->title[i].ptt = malloc(n * sizeof(ptt_info_t));
     if(!vts_ptt_srpt->title[i].ptt) {
@@ -1180,20 +1180,20 @@
     for(j = 0; j < vts_ptt_srpt->title[i].nr_of_ptts; j++) {
       /* The assert placed here because of Magic Knight Rayearth Daybreak */
       CHECK_VALUE(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);
-      vts_ptt_srpt->title[i].ptt[j].pgcn 
+      vts_ptt_srpt->title[i].ptt[j].pgcn
         = *(uint16_t*)(((char *)data) + data[i] + 4*j - VTS_PTT_SRPT_SIZE);
-      vts_ptt_srpt->title[i].ptt[j].pgn 
+      vts_ptt_srpt->title[i].ptt[j].pgn
         = *(uint16_t*)(((char *)data) + data[i] + 4*j + 2 - VTS_PTT_SRPT_SIZE);
     }
   }
-  
+
   for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
     for(j = 0; j < vts_ptt_srpt->title[i].nr_of_ptts; j++) {
       B2N_16(vts_ptt_srpt->title[i].ptt[j].pgcn);
       B2N_16(vts_ptt_srpt->title[i].ptt[j].pgn);
     }
   }
-  
+
   for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
     CHECK_VALUE(vts_ptt_srpt->title[i].nr_of_ptts < 1000); /* ?? */
     for(j = 0; j < vts_ptt_srpt->title[i].nr_of_ptts; j++) {
@@ -1211,7 +1211,7 @@
 void ifoFree_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   if(ifofile->vts_ptt_srpt) {
     int i;
     for(i = 0; i < ifofile->vts_ptt_srpt->nr_of_srpts; i++)
@@ -1231,10 +1231,10 @@
 
   if(!ifofile)
     return 0;
-  
+
   if(!ifofile->vmgi_mat)
     return 0;
-  
+
   if(ifofile->vmgi_mat->ptl_mait == 0)
     return 1;
 
@@ -1256,14 +1256,14 @@
   B2N_16(ptl_mait->nr_of_countries);
   B2N_16(ptl_mait->nr_of_vtss);
   B2N_32(ptl_mait->last_byte);
-  
+
   CHECK_VALUE(ptl_mait->nr_of_countries != 0);
   CHECK_VALUE(ptl_mait->nr_of_countries < 100); /* ?? */
   CHECK_VALUE(ptl_mait->nr_of_vtss != 0);
   CHECK_VALUE(ptl_mait->nr_of_vtss < 100); /* ?? */
-  CHECK_VALUE(ptl_mait->nr_of_countries * PTL_MAIT_COUNTRY_SIZE 
+  CHECK_VALUE(ptl_mait->nr_of_countries * PTL_MAIT_COUNTRY_SIZE
 	      <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE);
-  
+
   info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t);
   ptl_mait->countries = (ptl_mait_country_t *)malloc(info_length);
   if(!ptl_mait->countries) {
@@ -1271,7 +1271,7 @@
     ifofile->ptl_mait = 0;
     return 0;
   }
-  
+
   for(i = 0; i < ptl_mait->nr_of_countries; i++) {
     if(!(DVDReadBytes(ifofile->file, &ptl_mait->countries[i], PTL_MAIT_COUNTRY_SIZE))) {
       fprintf(stderr, "libdvdread: Unable to read PTL_MAIT.\n");
@@ -1286,18 +1286,18 @@
     B2N_16(ptl_mait->countries[i].country_code);
     B2N_16(ptl_mait->countries[i].pf_ptl_mai_start_byte);
   }
-  
+
   for(i = 0; i < ptl_mait->nr_of_countries; i++) {
     CHECK_ZERO(ptl_mait->countries[i].zero_1);
-    CHECK_ZERO(ptl_mait->countries[i].zero_2);    
+    CHECK_ZERO(ptl_mait->countries[i].zero_2);
     CHECK_VALUE(ptl_mait->countries[i].pf_ptl_mai_start_byte
 		+ 8*2 * (ptl_mait->nr_of_vtss + 1) <= ptl_mait->last_byte + 1);
   }
 
   for(i = 0; i < ptl_mait->nr_of_countries; i++) {
     uint16_t *pf_temp;
-    
-    if(!DVDFileSeek_(ifofile->file, 
+
+    if(!DVDFileSeek_(ifofile->file,
 		     ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN
                      + ptl_mait->countries[i].pf_ptl_mai_start_byte)) {
       fprintf(stderr, "libdvdread: Unable to seak PTL_MAIT table.\n");
@@ -1342,10 +1342,10 @@
 
 void ifoFree_PTL_MAIT(ifo_handle_t *ifofile) {
   unsigned int i;
-  
+
   if(!ifofile)
     return;
-  
+
   if(ifofile->ptl_mait) {
     for(i = 0; i < ifofile->ptl_mait->nr_of_countries; i++) {
        free(ifofile->ptl_mait->countries[i].pf_ptl_mai);
@@ -1362,7 +1362,7 @@
   unsigned int offset;
   int info_length;
   unsigned int i, j;
-  
+
   if(!ifofile)
     return 0;
 
@@ -1374,18 +1374,18 @@
     fprintf(stderr,"Please send bug report - no VTS_TMAPT ?? \n");
     return 1;
   }
-  
+
   offset = ifofile->vtsi_mat->vts_tmapt * DVD_BLOCK_LEN;
-  
-  if(!DVDFileSeek_(ifofile->file, offset)) 
+
+  if(!DVDFileSeek_(ifofile->file, offset))
     return 0;
-  
+
   vts_tmapt = (vts_tmapt_t *)malloc(sizeof(vts_tmapt_t));
   if(!vts_tmapt)
     return 0;
-  
+
   ifofile->vts_tmapt = vts_tmapt;
-  
+
   if(!(DVDReadBytes(ifofile->file, vts_tmapt, VTS_TMAPT_SIZE))) {
     fprintf(stderr, "libdvdread: Unable to read VTS_TMAPT.\n");
     free(vts_tmapt);
@@ -1395,11 +1395,11 @@
 
   B2N_16(vts_tmapt->nr_of_tmaps);
   B2N_32(vts_tmapt->last_byte);
-  
+
   CHECK_ZERO(vts_tmapt->zero_1);
-  
+
   info_length = vts_tmapt->nr_of_tmaps * 4;
-  
+
   vts_tmap_srp = (uint32_t *)malloc(info_length);
   if(!vts_tmap_srp) {
     free(vts_tmapt);
@@ -1408,7 +1408,7 @@
   }
 
   vts_tmapt->tmap_offset = vts_tmap_srp;
-  
+
   if(!(DVDReadBytes(ifofile->file, vts_tmap_srp, info_length))) {
     fprintf(stderr, "libdvdread: Unable to read VTS_TMAPT.\n");
     free(vts_tmap_srp);
@@ -1418,12 +1418,12 @@
   }
 
   for (i = 0; i < vts_tmapt->nr_of_tmaps; i++) {
-     B2N_32(vts_tmap_srp[i]); 
+     B2N_32(vts_tmap_srp[i]);
   }
 
-  
+
   info_length = vts_tmapt->nr_of_tmaps * sizeof(vts_tmap_t);
-  
+
   vts_tmapt->tmap = (vts_tmap_t *)malloc(info_length);
   if(!vts_tmapt->tmap) {
     free(vts_tmap_srp);
@@ -1433,7 +1433,7 @@
   }
 
   memset(vts_tmapt->tmap, 0, info_length); /* So ifoFree_VTS_TMAPT works. */
-  
+
   for(i = 0; i < vts_tmapt->nr_of_tmaps; i++) {
     if(!DVDFileSeek_(ifofile->file, offset + vts_tmap_srp[i])) {
       ifoFree_VTS_TMAPT(ifofile);
@@ -1445,17 +1445,17 @@
       ifoFree_VTS_TMAPT(ifofile);
       return 0;
     }
-    
+
     B2N_16(vts_tmapt->tmap[i].nr_of_entries);
     CHECK_ZERO(vts_tmapt->tmap[i].zero_1);
-    
+
     if(vts_tmapt->tmap[i].nr_of_entries == 0) { /* Early out if zero entries */
       vts_tmapt->tmap[i].map_ent = NULL;
       continue;
     }
-    
+
     info_length = vts_tmapt->tmap[i].nr_of_entries * sizeof(map_ent_t);
-    
+
     vts_tmapt->tmap[i].map_ent = (map_ent_t *)malloc(info_length);
     if(!vts_tmapt->tmap[i].map_ent) {
       ifoFree_VTS_TMAPT(ifofile);
@@ -1467,21 +1467,21 @@
       ifoFree_VTS_TMAPT(ifofile);
       return 0;
     }
-    
+
     for(j = 0; j < vts_tmapt->tmap[i].nr_of_entries; j++)
       B2N_32(vts_tmapt->tmap[i].map_ent[j]);
-  }    
-  
+  }
+
   return 1;
 }
 
 void ifoFree_VTS_TMAPT(ifo_handle_t *ifofile) {
   unsigned int i;
-  
+
   if(!ifofile)
     return;
-  
-  if(ifofile->vts_tmapt) {  
+
+  if(ifofile->vts_tmapt) {
     for(i = 0; i < ifofile->vts_tmapt->nr_of_tmaps; i++)
       if(ifofile->vts_tmapt->tmap[i].map_ent)
 	free(ifofile->vts_tmapt->tmap[i].map_ent);
@@ -1508,7 +1508,7 @@
   if(!ifofile->vts_c_adt)
     return 0;
 
-  if(!ifoRead_C_ADT_internal(ifofile, ifofile->vts_c_adt, 
+  if(!ifoRead_C_ADT_internal(ifofile, ifofile->vts_c_adt,
                              ifofile->vtsi_mat->vts_c_adt)) {
     free(ifofile->vts_c_adt);
     ifofile->vts_c_adt = 0;
@@ -1523,7 +1523,7 @@
 
   if(!ifofile)
     return 0;
-  
+
   if(ifofile->vmgi_mat) {
     if(ifofile->vmgi_mat->vmgm_c_adt == 0)
       return 1;
@@ -1535,7 +1535,7 @@
   } else {
     return 0;
   }
-  
+
   ifofile->menu_c_adt = (c_adt_t *)malloc(sizeof(c_adt_t));
   if(!ifofile->menu_c_adt)
     return 0;
@@ -1549,7 +1549,7 @@
   return 1;
 }
 
-static int ifoRead_C_ADT_internal(ifo_handle_t *ifofile, 
+static int ifoRead_C_ADT_internal(ifo_handle_t *ifofile,
                                   c_adt_t *c_adt, unsigned int sector) {
   int i, info_length;
 
@@ -1561,15 +1561,15 @@
 
   B2N_16(c_adt->nr_of_vobs);
   B2N_32(c_adt->last_byte);
-  
+
   info_length = c_adt->last_byte + 1 - C_ADT_SIZE;
-  
+
   CHECK_ZERO(c_adt->zero_1);
-  /* assert(c_adt->nr_of_vobs > 0);  
-     Magic Knight Rayearth Daybreak is mastered very strange and has 
+  /* assert(c_adt->nr_of_vobs > 0);
+     Magic Knight Rayearth Daybreak is mastered very strange and has
      Titles with a VOBS that has no cells. */
   CHECK_VALUE(info_length % sizeof(cell_adr_t) == 0);
-  
+
   /* assert(info_length / sizeof(cell_adr_t) >= c_adt->nr_of_vobs);
      Enemy of the State region 2 (de) has Titles where nr_of_vobs field
      is to high, they high ones are never referenced though. */
@@ -1577,12 +1577,12 @@
     fprintf(stderr, "libdvdread: *C_ADT nr_of_vobs > avaiable info entries\n");
     c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t);
   }
-  
+
   c_adt->cell_adr_table = (cell_adr_t *)malloc(info_length);
   if(!c_adt->cell_adr_table)
     return 0;
 
-  if(info_length && 
+  if(info_length &&
      !(DVDReadBytes(ifofile->file, c_adt->cell_adr_table, info_length))) {
     free(c_adt->cell_adr_table);
     return 0;
@@ -1597,7 +1597,7 @@
     CHECK_VALUE(c_adt->cell_adr_table[i].vob_id > 0);
     CHECK_VALUE(c_adt->cell_adr_table[i].vob_id <= c_adt->nr_of_vobs);
     CHECK_VALUE(c_adt->cell_adr_table[i].cell_id > 0);
-    CHECK_VALUE(c_adt->cell_adr_table[i].start_sector < 
+    CHECK_VALUE(c_adt->cell_adr_table[i].start_sector <
 	   c_adt->cell_adr_table[i].last_sector);
   }
 
@@ -1615,7 +1615,7 @@
 void ifoFree_C_ADT(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   ifoFree_C_ADT_internal(ifofile->menu_c_adt);
   ifofile->menu_c_adt = 0;
 }
@@ -1623,7 +1623,7 @@
 void ifoFree_TITLE_C_ADT(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   ifoFree_C_ADT_internal(ifofile->vts_c_adt);
   ifofile->vts_c_adt = 0;
 }
@@ -1634,10 +1634,10 @@
 
   if(!ifofile->vtsi_mat)
     return 0;
-  
+
   if(ifofile->vtsi_mat->vts_vobu_admap == 0) /* mandatory */
     return 0;
-  
+
   ifofile->vts_vobu_admap = (vobu_admap_t *)malloc(sizeof(vobu_admap_t));
   if(!ifofile->vts_vobu_admap)
     return 0;
@@ -1657,7 +1657,7 @@
 
   if(!ifofile)
     return 0;
-     
+
   if(ifofile->vmgi_mat) {
     if(ifofile->vmgi_mat->vmgm_vobu_admap == 0)
       return 1;
@@ -1669,11 +1669,11 @@
   } else {
     return 0;
   }
-  
+
   ifofile->menu_vobu_admap = (vobu_admap_t *)malloc(sizeof(vobu_admap_t));
   if(!ifofile->menu_vobu_admap)
     return 0;
-  
+
   if(!ifoRead_VOBU_ADMAP_internal(ifofile, ifofile->menu_vobu_admap, sector)) {
     free(ifofile->menu_vobu_admap);
     ifofile->menu_vobu_admap = 0;
@@ -1683,8 +1683,8 @@
   return 1;
 }
 
-static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile, 
-                                       vobu_admap_t *vobu_admap, 
+static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile,
+                                       vobu_admap_t *vobu_admap,
 				       unsigned int sector) {
   unsigned int i;
   int info_length;
@@ -1696,19 +1696,19 @@
     return 0;
 
   B2N_32(vobu_admap->last_byte);
-  
+
   info_length = vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE;
   /* assert(info_length > 0);
-     Magic Knight Rayearth Daybreak is mastered very strange and has 
+     Magic Knight Rayearth Daybreak is mastered very strange and has
      Titles with a VOBS that has no VOBUs. */
   CHECK_VALUE(info_length % sizeof(uint32_t) == 0);
-  
-  vobu_admap->vobu_start_sectors = (uint32_t *)malloc(info_length); 
+
+  vobu_admap->vobu_start_sectors = (uint32_t *)malloc(info_length);
   if(!vobu_admap->vobu_start_sectors) {
     return 0;
   }
-  if(info_length && 
-     !(DVDReadBytes(ifofile->file, 
+  if(info_length &&
+     !(DVDReadBytes(ifofile->file,
 		    vobu_admap->vobu_start_sectors, info_length))) {
     free(vobu_admap->vobu_start_sectors);
     return 0;
@@ -1731,7 +1731,7 @@
 void ifoFree_VOBU_ADMAP(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   ifoFree_VOBU_ADMAP_internal(ifofile->menu_vobu_admap);
   ifofile->menu_vobu_admap = 0;
 }
@@ -1739,7 +1739,7 @@
 void ifoFree_TITLE_VOBU_ADMAP(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   ifoFree_VOBU_ADMAP_internal(ifofile->vts_vobu_admap);
   ifofile->vts_vobu_admap = 0;
 }
@@ -1748,18 +1748,18 @@
 
   if(!ifofile)
     return 0;
-  
+
   if(!ifofile->vtsi_mat)
     return 0;
-  
+
   if(ifofile->vtsi_mat->vts_pgcit == 0) /* mandatory */
     return 0;
-  
+
   ifofile->vts_pgcit = (pgcit_t *)malloc(sizeof(pgcit_t));
   if(!ifofile->vts_pgcit)
     return 0;
 
-  if(!ifoRead_PGCIT_internal(ifofile, ifofile->vts_pgcit, 
+  if(!ifoRead_PGCIT_internal(ifofile, ifofile->vts_pgcit,
                              ifofile->vtsi_mat->vts_pgcit * DVD_BLOCK_LEN)) {
     free(ifofile->vts_pgcit);
     ifofile->vts_pgcit = 0;
@@ -1769,11 +1769,11 @@
   return 1;
 }
 
-static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit, 
+static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
                                   unsigned int offset) {
   int i, info_length;
   uint8_t *data, *ptr;
-  
+
   if(!DVDFileSeek_(ifofile->file, offset))
     return 0;
 
@@ -1782,13 +1782,13 @@
 
   B2N_16(pgcit->nr_of_pgci_srp);
   B2N_32(pgcit->last_byte);
-  
+
   CHECK_ZERO(pgcit->zero_1);
   /* assert(pgcit->nr_of_pgci_srp != 0);
-     Magic Knight Rayearth Daybreak is mastered very strange and has 
+     Magic Knight Rayearth Daybreak is mastered very strange and has
      Titles with 0 PTTs. */
   CHECK_VALUE(pgcit->nr_of_pgci_srp < 10000); /* ?? seen max of 1338 */
-  
+
   info_length = pgcit->nr_of_pgci_srp * PGCI_SRP_SIZE;
   data = malloc(info_length);
   if(!data)
@@ -1812,10 +1812,10 @@
     CHECK_VALUE(pgcit->pgci_srp[i].unknown1 == 0);
   }
   free(data);
-  
+
   for(i = 0; i < pgcit->nr_of_pgci_srp; i++)
     CHECK_VALUE(pgcit->pgci_srp[i].pgc_start_byte + PGC_SIZE <= pgcit->last_byte+1);
-  
+
   for(i = 0; i < pgcit->nr_of_pgci_srp; i++) {
     pgcit->pgci_srp[i].pgc = malloc(sizeof(pgc_t));
     if(!pgcit->pgci_srp[i].pgc) {
@@ -1826,7 +1826,7 @@
       }
       goto fail;
     }
-    if(!ifoRead_PGC(ifofile, pgcit->pgci_srp[i].pgc, 
+    if(!ifoRead_PGC(ifofile, pgcit->pgci_srp[i].pgc,
                     offset + pgcit->pgci_srp[i].pgc_start_byte)) {
       int j;
       for(j = 0; j < i; j++) {
@@ -1856,7 +1856,7 @@
 void ifoFree_PGCIT(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   if(ifofile->vts_pgcit) {
     ifoFree_PGCIT_internal(ifofile->vts_pgcit);
     free(ifofile->vts_pgcit);
@@ -1868,13 +1868,13 @@
 int ifoRead_PGCI_UT(ifo_handle_t *ifofile) {
   pgci_ut_t *pgci_ut;
   unsigned int sector;
-  unsigned int i;  
+  unsigned int i;
   int info_length;
   uint8_t *data, *ptr;
 
   if(!ifofile)
     return 0;
-  
+
   if(ifofile->vmgi_mat) {
     if(ifofile->vmgi_mat->vmgm_pgci_ut == 0)
       return 1;
@@ -1886,28 +1886,28 @@
   } else {
     return 0;
   }
-  
+
   ifofile->pgci_ut = (pgci_ut_t *)malloc(sizeof(pgci_ut_t));
   if(!ifofile->pgci_ut)
     return 0;
-  
+
   if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) {
     free(ifofile->pgci_ut);
     ifofile->pgci_ut = 0;
     return 0;
   }
-  
+
   if(!(DVDReadBytes(ifofile->file, ifofile->pgci_ut, PGCI_UT_SIZE))) {
     free(ifofile->pgci_ut);
     ifofile->pgci_ut = 0;
     return 0;
   }
-  
+
   pgci_ut = ifofile->pgci_ut;
-  
+
   B2N_16(pgci_ut->nr_of_lus);
   B2N_32(pgci_ut->last_byte);
-  
+
   CHECK_ZERO(pgci_ut->zero_1);
   CHECK_VALUE(pgci_ut->nr_of_lus != 0);
   CHECK_VALUE(pgci_ut->nr_of_lus < 100); /* ?? 3-4 ? */
@@ -1938,11 +1938,11 @@
   for(i = 0; i < pgci_ut->nr_of_lus; i++) {
     memcpy(&pgci_ut->lu[i], ptr, PGCI_LU_SIZE);
     ptr += PGCI_LU_SIZE;
-    B2N_16(pgci_ut->lu[i].lang_code); 
-    B2N_32(pgci_ut->lu[i].lang_start_byte); 
+    B2N_16(pgci_ut->lu[i].lang_code);
+    B2N_32(pgci_ut->lu[i].lang_start_byte);
   }
   free(data);
-  
+
   for(i = 0; i < pgci_ut->nr_of_lus; i++) {
     /* Maybe this is only defined for v1.1 and later titles? */
     /* If the bits in 'lu[i].exists' are enumerated abcd efgh then:
@@ -1969,8 +1969,8 @@
       ifofile->pgci_ut = 0;
       return 0;
     }
-    if(!ifoRead_PGCIT_internal(ifofile, pgci_ut->lu[i].pgcit, 
-                               sector * DVD_BLOCK_LEN 
+    if(!ifoRead_PGCIT_internal(ifofile, pgci_ut->lu[i].pgcit,
+                               sector * DVD_BLOCK_LEN
                                + pgci_ut->lu[i].lang_start_byte)) {
       unsigned int j;
       for(j = 0; j < i; j++) {
@@ -1998,7 +1998,7 @@
 
   if(!ifofile)
     return;
-  
+
   if(ifofile->pgci_ut) {
     for(i = 0; i < ifofile->pgci_ut->nr_of_lus; i++) {
       ifoFree_PGCIT_internal(ifofile->pgci_ut->lu[i].pgcit);
@@ -2010,8 +2010,8 @@
   }
 }
 
-static int ifoRead_VTS_ATTRIBUTES(ifo_handle_t *ifofile, 
-                                  vts_attributes_t *vts_attributes, 
+static int ifoRead_VTS_ATTRIBUTES(ifo_handle_t *ifofile,
+                                  vts_attributes_t *vts_attributes,
                                   unsigned int offset) {
   unsigned int i;
 
@@ -2031,7 +2031,7 @@
     read_subp_attr(&vts_attributes->vtstt_subp_attr[i]);
   B2N_32(vts_attributes->last_byte);
   B2N_32(vts_attributes->vts_cat);
-  
+
   CHECK_ZERO(vts_attributes->zero_1);
   CHECK_ZERO(vts_attributes->zero_2);
   CHECK_ZERO(vts_attributes->zero_3);
@@ -2047,7 +2047,7 @@
   CHECK_VALUE(vts_attributes->nr_of_vtstt_subp_streams <= 32);
   {
     unsigned int nr_coded;
-    CHECK_VALUE(vts_attributes->last_byte + 1 >= VTS_ATTRIBUTES_MIN_SIZE);  
+    CHECK_VALUE(vts_attributes->last_byte + 1 >= VTS_ATTRIBUTES_MIN_SIZE);
     nr_coded = (vts_attributes->last_byte + 1 - VTS_ATTRIBUTES_MIN_SIZE)/6;
     /* This is often nr_coded = 70, how do you know how many there really are? */
     if(nr_coded > 32) { /* We haven't read more from disk/file anyway */
@@ -2070,13 +2070,13 @@
 
   if(!ifofile)
     return 0;
-  
+
   if(!ifofile->vmgi_mat)
     return 0;
-  
+
   if(ifofile->vmgi_mat->vts_atrt == 0) /* mandatory */
     return 0;
-  
+
   sector = ifofile->vmgi_mat->vts_atrt;
   if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN))
     return 0;
@@ -2086,7 +2086,7 @@
     return 0;
 
   ifofile->vts_atrt = vts_atrt;
-  
+
   if(!(DVDReadBytes(ifofile->file, vts_atrt, VTS_ATRT_SIZE))) {
     free(vts_atrt);
     ifofile->vts_atrt = 0;
@@ -2099,7 +2099,7 @@
   CHECK_ZERO(vts_atrt->zero_1);
   CHECK_VALUE(vts_atrt->nr_of_vtss != 0);
   CHECK_VALUE(vts_atrt->nr_of_vtss < 100); /* ?? */
-  CHECK_VALUE((uint32_t)vts_atrt->nr_of_vtss * (4 + VTS_ATTRIBUTES_MIN_SIZE) + 
+  CHECK_VALUE((uint32_t)vts_atrt->nr_of_vtss * (4 + VTS_ATTRIBUTES_MIN_SIZE) +
          VTS_ATRT_SIZE < vts_atrt->last_byte + 1);
 
   info_length = vts_atrt->nr_of_vtss * sizeof(uint32_t);
@@ -2110,7 +2110,7 @@
     return 0;
   }
 
-  vts_atrt->vts_atrt_offsets = data;   
+  vts_atrt->vts_atrt_offsets = data;
 
   if(!(DVDReadBytes(ifofile->file, data, info_length))) {
     free(data);
@@ -2118,12 +2118,12 @@
     ifofile->vts_atrt = 0;
     return 0;
   }
-  
+
   for(i = 0; i < vts_atrt->nr_of_vtss; i++) {
     B2N_32(data[i]);
     CHECK_VALUE(data[i] + VTS_ATTRIBUTES_MIN_SIZE < vts_atrt->last_byte + 1);
   }
-  
+
   info_length = vts_atrt->nr_of_vtss * sizeof(vts_attributes_t);
   vts_atrt->vts = (vts_attributes_t *)malloc(info_length);
   if(!vts_atrt->vts) {
@@ -2154,7 +2154,7 @@
 void ifoFree_VTS_ATRT(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   if(ifofile->vts_atrt) {
     free(ifofile->vts_atrt->vts);
     free(ifofile->vts_atrt->vts_atrt_offsets);
@@ -2169,18 +2169,18 @@
 
   if(!ifofile)
     return 0;
-  
+
   if(!ifofile->vmgi_mat)
     return 0;
- 
-  /* Return successfully if there is nothing to read. */ 
+
+  /* Return successfully if there is nothing to read. */
   if(ifofile->vmgi_mat->txtdt_mgi == 0)
     return 1;
 
-  if(!DVDFileSeek_(ifofile->file, 
+  if(!DVDFileSeek_(ifofile->file,
 		   ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN))
     return 0;
-  
+
   txtdt_mgi = (txtdt_mgi_t *)malloc(sizeof(txtdt_mgi_t));
   if(!txtdt_mgi) {
     return 0;
@@ -2201,7 +2201,7 @@
 void ifoFree_TXTDT_MGI(ifo_handle_t *ifofile) {
   if(!ifofile)
     return;
-  
+
   if(ifofile->txtdt_mgi) {
     free(ifofile->txtdt_mgi);
     ifofile->txtdt_mgi = 0;
--- a/ifo_read.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/ifo_read.h	Sat Sep 06 21:55:51 2008 +0000
@@ -136,7 +136,7 @@
  * VTSI files, this fills the ifofile->vtsm_pgci_ut structure.
  */
 int ifoRead_PGCI_UT(ifo_handle_t *);
-  
+
 /**
  * okay = ifoRead_VTS_TMAPT(ifofile);
  *
@@ -146,7 +146,7 @@
  * seeking for One_Sequential_PGC_Titles.
  */
 int ifoRead_VTS_TMAPT(ifo_handle_t *);
-  
+
 /**
  * okay = ifoRead_C_ADT(ifofile);
  *
--- a/ifo_types.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/ifo_types.h	Sat Sep 06 21:55:51 2008 +0000
@@ -25,7 +25,7 @@
 
 
 #undef ATTRIBUTE_PACKED
-#undef PRAGMA_PACK_BEGIN 
+#undef PRAGMA_PACK_BEGIN
 #undef PRAGMA_PACK_END
 
 #if defined(__GNUC__)
@@ -79,12 +79,12 @@
   unsigned char video_format         : 2;
   unsigned char display_aspect_ratio : 2;
   unsigned char permitted_df         : 2;
-  
+
   unsigned char line21_cc_1          : 1;
   unsigned char line21_cc_2          : 1;
   unsigned char unknown1             : 1;
   unsigned char bit_rate             : 1;
-  
+
   unsigned char picture_size         : 2;
   unsigned char letterboxed          : 1;
   unsigned char film_mode            : 1;
@@ -98,7 +98,7 @@
   unsigned char multichannel_extension : 1;
   unsigned char lang_type              : 2;
   unsigned char application_mode       : 2;
-  
+
   unsigned char quantization           : 2;
   unsigned char sample_frequency       : 2;
   unsigned char unknown1               : 1;
@@ -182,7 +182,7 @@
 
 /**
  * PGC Command Table.
- */ 
+ */
 typedef struct {
   uint16_t nr_of_pre;
   uint16_t nr_of_post;
@@ -197,7 +197,7 @@
 /**
  * PGC Program Map
  */
-typedef uint8_t pgc_program_map_t; 
+typedef uint8_t pgc_program_map_t;
 
 /**
  * Cell Playback Information.
@@ -244,7 +244,7 @@
 typedef struct {
   unsigned int zero                           : 7; /* 25-31 */
   unsigned int video_pres_mode_change         : 1; /* 24 */
-  
+
   unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */
   unsigned int angle_change                   : 1;
   unsigned int subpic_stream_change           : 1;
@@ -253,7 +253,7 @@
   unsigned int still_off                      : 1;
   unsigned int button_select_or_activate      : 1;
   unsigned int resume                         : 1; /* 16 */
-  
+
   unsigned int chapter_menu_call              : 1; /* 15 */
   unsigned int angle_menu_call                : 1;
   unsigned int audio_menu_call                : 1;
@@ -262,7 +262,7 @@
   unsigned int title_menu_call                : 1;
   unsigned int backward_scan                  : 1;
   unsigned int forward_scan                   : 1; /* 8 */
-  
+
   unsigned int next_pg_search                 : 1; /* 7 */
   unsigned int prev_or_top_pg_search          : 1;
   unsigned int time_or_chapter_search         : 1;
@@ -420,7 +420,7 @@
   uint32_t vmgm_c_adt;            /* sector */
   uint32_t vmgm_vobu_admap;       /* sector */
   uint8_t  zero_6[32];
-  
+
   video_attr_t vmgm_video_attr;
   uint8_t  zero_7;
   uint8_t  nr_of_vmgm_audio_streams; /* should be 0 or 1 */
@@ -503,20 +503,20 @@
 typedef struct {
   uint32_t last_byte;
   uint32_t vts_cat;
-  
+
   video_attr_t vtsm_vobs_attr;
   uint8_t  zero_1;
   uint8_t  nr_of_vtsm_audio_streams; /* should be 0 or 1 */
   audio_attr_t vtsm_audio_attr;
-  audio_attr_t zero_2[7];  
+  audio_attr_t zero_2[7];
   uint8_t  zero_3[16];
   uint8_t  zero_4;
   uint8_t  nr_of_vtsm_subp_streams; /* should be 0 or 1 */
   subp_attr_t vtsm_subp_attr;
   subp_attr_t zero_5[27];
-  
+
   uint8_t  zero_6[2];
-  
+
   video_attr_t vtstt_vobs_video_attr;
   uint8_t  zero_7;
   uint8_t  nr_of_vtstt_audio_streams;
@@ -547,10 +547,10 @@
 typedef struct {
   uint32_t last_byte;    /* offsets are relative here */
   uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */
-#if 0  
+#if 0
   uint16_t unknown; /* 0x48 ?? 0x48 words (16bit) info following */
   uint16_t zero_1;
-  
+
   uint8_t type_of_info; /* ?? 01 == disc, 02 == Title, 04 == Title part */
   uint8_t unknown1;
   uint8_t unknown2;
@@ -558,14 +558,14 @@
   uint8_t unknown4; /* ?? allways 0x30 language?, text format? */
   uint8_t unknown5;
   uint16_t offset; /* from first */
-  
+
   char text[12]; /* ended by 0x09 */
 #endif
 } ATTRIBUTE_PACKED txtdt_t;
 
 /**
  * Text Data Language Unit. (Incomplete)
- */ 
+ */
 typedef struct {
   uint16_t lang_code;
   uint16_t unknown;      /* 0x0001, title 1? disc 1? side 1? */
@@ -625,7 +625,7 @@
   uint32_t vts_c_adt;       /* sector */
   uint32_t vts_vobu_admap;  /* sector */
   uint8_t  zero_13[24];
-  
+
   video_attr_t vtsm_video_attr;
   uint8_t  zero_14;
   uint8_t  nr_of_vtsm_audio_streams; /* should be 0 or 1 */
@@ -636,7 +636,7 @@
   subp_attr_t vtsm_subp_attr;
   subp_attr_t zero_17[27];
   uint8_t  zero_18[2];
-  
+
   video_attr_t vts_video_attr;
   uint8_t  zero_19;
   uint8_t  nr_of_vts_audio_streams;
@@ -721,20 +721,20 @@
  */
 typedef struct {
   dvd_file_t *file;
-  
+
   /* VMGI */
   vmgi_mat_t     *vmgi_mat;
   tt_srpt_t      *tt_srpt;
-  pgc_t          *first_play_pgc;    
+  pgc_t          *first_play_pgc;
   ptl_mait_t     *ptl_mait;
   vts_atrt_t     *vts_atrt;
   txtdt_mgi_t    *txtdt_mgi;
-  
+
   /* Common */
   pgci_ut_t      *pgci_ut;
   c_adt_t        *menu_c_adt;
   vobu_admap_t   *menu_vobu_admap;
-  
+
   /* VTSI */
   vtsi_mat_t     *vtsi_mat;
   vts_ptt_srpt_t *vts_ptt_srpt;
--- a/nav_print.c	Mon Sep 01 21:05:17 2008 +0000
+++ b/nav_print.c	Sat Sep 06 21:55:51 2008 +0000
@@ -45,7 +45,7 @@
   printf("e_eltm        ");
   dvdread_print_time(&pci_gi->e_eltm);
   printf("\n");
-  
+
   printf("vobu_isrc     \"");
   for(i = 0; i < 32; i++) {
     char c = pci_gi->vobu_isrc[i];
@@ -59,24 +59,24 @@
 
 static void navPrint_NSML_AGLI(nsml_agli_t *nsml_agli) {
   int i, j = 0;
-  
+
   for(i = 0; i < 9; i++)
     j |= nsml_agli->nsml_agl_dsta[i];
   if(j == 0)
     return;
-  
+
   printf("nsml_agli:\n");
   for(i = 0; i < 9; i++)
     if(nsml_agli->nsml_agl_dsta[i])
-      printf("nsml_agl_c%d_dsta  0x%08x\n", i + 1, 
+      printf("nsml_agl_c%d_dsta  0x%08x\n", i + 1,
 	     nsml_agli->nsml_agl_dsta[i]);
 }
 
 static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) {
-  
+
   if((hl_gi->hli_ss & 0x03) == 0)
     return;
-  
+
   printf("hl_gi:\n");
   printf("hli_ss        0x%01x\n", hl_gi->hli_ss & 0x03);
   printf("hli_s_ptm     0x%08x\n", hl_gi->hli_s_ptm);
@@ -88,7 +88,7 @@
   printf("btngr%d_dsp_ty    0x%02x\n", 1, hl_gi->btngr1_dsp_ty);
   printf("btngr%d_dsp_ty    0x%02x\n", 2, hl_gi->btngr2_dsp_ty);
   printf("btngr%d_dsp_ty    0x%02x\n", 3, hl_gi->btngr3_dsp_ty);
-  
+
   printf("btn_ofn       %d\n", hl_gi->btn_ofn);
   *btn_ns = hl_gi->btn_ns;
   printf("btn_ns        %d\n", hl_gi->btn_ns);
@@ -99,13 +99,13 @@
 
 static void navPrint_BTN_COLIT(btn_colit_t *btn_colit) {
   int i, j;
-  
+
   j = 0;
   for(i = 0; i < 6; i++)
     j |= btn_colit->btn_coli[i/2][i&1];
   if(j == 0)
     return;
-  
+
   printf("btn_colit:\n");
   for(i = 0; i < 3; i++)
     for(j = 0; j < 2; j++)
@@ -116,30 +116,30 @@
 
 static void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) {
   int i, j;
-  
+
   printf("btnit:\n");
   printf("btngr_ns: %i\n", btngr_ns);
   printf("btn_ns: %i\n", btn_ns);
-  
+
   if(btngr_ns == 0)
     return;
-  
+
   for(i = 0; i < btngr_ns; i++) {
     for(j = 0; j < (36 / btngr_ns); j++) {
       if(j < btn_ns) {
 	btni_t *btni = &btni_table[(36 / btngr_ns) * i + j];
-	
+
 	printf("group %d btni %d:  ", i+1, j+1);
 	printf("btn_coln %d, auto_action_mode %d\n",
 	       btni->btn_coln, btni->auto_action_mode);
 	printf("coords   (%d, %d) .. (%d, %d)\n",
 	       btni->x_start, btni->y_start, btni->x_end, btni->y_end);
-	
+
 	printf("up %d, ", btni->up);
 	printf("down %d, ", btni->down);
 	printf("left %d, ", btni->left);
 	printf("right %d\n", btni->right);
-	
+
 	/* ifoPrint_COMMAND(&btni->cmd); */
 	printf("\n");
       }
@@ -149,7 +149,7 @@
 
 static void navPrint_HLI(hli_t *hli) {
   int btngr_ns = 0, btn_ns = 0;
-  
+
   printf("hli:\n");
   navPrint_HL_GI(&hli->hl_gi, & btngr_ns, & btn_ns);
   navPrint_BTN_COLIT(&hli->btn_colit);
@@ -189,14 +189,14 @@
     printf("VOBU at the beginning of ILVU\n");
   if(sml_pbi->category & 0x1000)
     printf("VOBU at end of PREU of ILVU\n");
-  
+
   printf("ilvu_ea       0x%08x\n", sml_pbi->ilvu_ea);
   printf("nxt_ilvu_sa   0x%08x\n", sml_pbi->ilvu_sa);
   printf("nxt_ilvu_size 0x%04x\n", sml_pbi->size);
-  
+
   printf("vob_v_s_s_ptm 0x%08x\n", sml_pbi->vob_v_s_s_ptm);
   printf("vob_v_e_e_ptm 0x%08x\n", sml_pbi->vob_v_e_e_ptm);
-  
+
   /* $$$ more code needed here */
 }
 
@@ -211,7 +211,7 @@
 
 static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) {
   int i;
-  int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11, 
+  int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11,
 		     10,   9,  8,  7,  6,  5,  4,  3,  2, 1};
   printf("vobu_sri:\n");
   printf("Next VOBU with Video %08x\n", vobu_sri->next_video);
@@ -231,7 +231,7 @@
 
 static void navPrint_SYNCI(synci_t *synci) {
   int i;
-  
+
   printf("synci:\n");
   /* $$$ more code needed here */
   for(i = 0; i < 8; i++)
--- a/nav_print.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/nav_print.h	Sat Sep 06 21:55:51 2008 +0000
@@ -36,7 +36,7 @@
  * @param pci Pointer to the PCI data structure to be printed.
  */
 void navPrint_PCI(pci_t *);
-  
+
 /**
  * Prints information contained in the DSI to stdout.
  *
--- a/nav_read.c	Mon Sep 01 21:05:17 2008 +0000
+++ b/nav_read.c	Sat Sep 06 21:55:51 2008 +0000
@@ -44,7 +44,7 @@
   pci->pci_gi.vobu_uop_ctl.zero = getbits(&state, 7 );
   pci->pci_gi.vobu_uop_ctl.video_pres_mode_change         = getbits(&state, 1 );
 
-  pci->pci_gi.vobu_uop_ctl.karaoke_audio_pres_mode_change = getbits(&state, 1 ); 
+  pci->pci_gi.vobu_uop_ctl.karaoke_audio_pres_mode_change = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.angle_change                   = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.subpic_stream_change           = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.audio_stream_change            = getbits(&state, 1 );
@@ -53,7 +53,7 @@
   pci->pci_gi.vobu_uop_ctl.button_select_or_activate      = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.resume                         = getbits(&state, 1 );
 
-  pci->pci_gi.vobu_uop_ctl.chapter_menu_call              = getbits(&state, 1 ); 
+  pci->pci_gi.vobu_uop_ctl.chapter_menu_call              = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.angle_menu_call                = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.audio_menu_call                = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.subpic_menu_call               = getbits(&state, 1 );
@@ -62,7 +62,7 @@
   pci->pci_gi.vobu_uop_ctl.backward_scan                  = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.forward_scan                   = getbits(&state, 1 );
 
-  pci->pci_gi.vobu_uop_ctl.next_pg_search                 = getbits(&state, 1 ); 
+  pci->pci_gi.vobu_uop_ctl.next_pg_search                 = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.prev_or_top_pg_search          = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.time_or_chapter_search         = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.go_up                          = getbits(&state, 1 );
@@ -70,9 +70,9 @@
   pci->pci_gi.vobu_uop_ctl.title_play                     = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.chapter_search_or_play         = getbits(&state, 1 );
   pci->pci_gi.vobu_uop_ctl.title_or_time_play             = getbits(&state, 1 );
-  pci->pci_gi.vobu_s_ptm = getbits(&state, 32 ); 
-  pci->pci_gi.vobu_e_ptm = getbits(&state, 32 ); 
-  pci->pci_gi.vobu_se_e_ptm = getbits(&state, 32 ); 
+  pci->pci_gi.vobu_s_ptm = getbits(&state, 32 );
+  pci->pci_gi.vobu_e_ptm = getbits(&state, 32 );
+  pci->pci_gi.vobu_se_e_ptm = getbits(&state, 32 );
   pci->pci_gi.e_eltm.hour   = getbits(&state, 8 );
   pci->pci_gi.e_eltm.minute = getbits(&state, 8 );
   pci->pci_gi.e_eltm.second = getbits(&state, 8 );
@@ -86,7 +86,7 @@
 
   /* pci hli hli_gi */
   pci->hli.hl_gi.hli_ss = getbits(&state, 16 );
-  pci->hli.hl_gi.hli_s_ptm = getbits(&state, 32 ); 
+  pci->hli.hl_gi.hli_s_ptm = getbits(&state, 32 );
   pci->hli.hl_gi.hli_e_ptm = getbits(&state, 32 );
   pci->hli.hl_gi.btn_se_e_ptm = getbits(&state, 32 );
   pci->hli.hl_gi.zero1 = getbits(&state, 2 );
@@ -99,7 +99,7 @@
   pci->hli.hl_gi.btngr3_dsp_ty = getbits(&state, 3 );
   pci->hli.hl_gi.btn_ofn = getbits(&state, 8 );
   pci->hli.hl_gi.btn_ns = getbits(&state, 8 );
-  pci->hli.hl_gi.nsl_btn_ns = getbits(&state, 8 ); 
+  pci->hli.hl_gi.nsl_btn_ns = getbits(&state, 8 );
   pci->hli.hl_gi.zero5 = getbits(&state, 8 );
   pci->hli.hl_gi.fosl_btnn = getbits(&state, 8 );
   pci->hli.hl_gi.foac_btnn = getbits(&state, 8 );
@@ -107,11 +107,11 @@
   /* pci hli btn_colit */
   for(i = 0; i < 3; i++)
     for(j = 0; j < 2; j++)
-      pci->hli.btn_colit.btn_coli[i][j] = getbits(&state, 32 ); 
+      pci->hli.btn_colit.btn_coli[i][j] = getbits(&state, 32 );
 
   /* NOTE: I've had to change the structure from the disk layout to get
    * the packing to work with Sun's Forte C compiler. */
-  
+
   /* pci hli btni */
   for(i = 0; i < 36; i++) {
     pci->hli.btnit[i].btn_coln = getbits(&state, 2 );
@@ -142,7 +142,7 @@
 #ifndef NDEBUG
   /* Asserts */
 
-  /* pci pci gi */ 
+  /* pci pci gi */
   CHECK_VALUE(pci->pci_gi.zero1 == 0);
 
   /* pci hli hli_gi */
@@ -154,10 +154,10 @@
 
   /* Are there buttons defined here? */
   if((pci->hli.hl_gi.hli_ss & 0x03) != 0) {
-    CHECK_VALUE(pci->hli.hl_gi.btn_ns != 0); 
-    CHECK_VALUE(pci->hli.hl_gi.btngr_ns != 0); 
+    CHECK_VALUE(pci->hli.hl_gi.btn_ns != 0);
+    CHECK_VALUE(pci->hli.hl_gi.btngr_ns != 0);
   } else {
-    CHECK_VALUE((pci->hli.hl_gi.btn_ns != 0 && pci->hli.hl_gi.btngr_ns != 0) 
+    CHECK_VALUE((pci->hli.hl_gi.btn_ns != 0 && pci->hli.hl_gi.btngr_ns != 0)
 	   || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0));
   }
 
@@ -171,8 +171,8 @@
       CHECK_VALUE(pci->hli.btnit[n].zero4 == 0);
       CHECK_VALUE(pci->hli.btnit[n].zero5 == 0);
       CHECK_VALUE(pci->hli.btnit[n].zero6 == 0);
-      
-      if (j < pci->hli.hl_gi.btn_ns) {	
+
+      if (j < pci->hli.hl_gi.btn_ns) {
 	CHECK_VALUE(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end);
 	CHECK_VALUE(pci->hli.btnit[n].y_start <= pci->hli.btnit[n].y_end);
 	CHECK_VALUE(pci->hli.btnit[n].up <= pci->hli.hl_gi.btn_ns);
@@ -256,7 +256,7 @@
   for(i = 0; i < 32; i++)
     dsi->synci.sp_synca[i] = getbits(&state, 32 );
 
-  
+
   /* Asserts */
 
   /* dsi dsi gi */
--- a/nav_read.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/nav_read.h	Sat Sep 06 21:55:51 2008 +0000
@@ -31,15 +31,15 @@
 
 /**
  * Reads the PCI packet data pointed to into th pci struct.
- * 
+ *
  * @param pci Pointer to the PCI data structure to be filled in.
  * @param bufffer Pointer to the buffer of the on disc PCI data.
- */  
+ */
 void navRead_PCI(pci_t *, unsigned char *);
 
 /**
  * Reads the DSI packet data pointed to into dsi struct.
- * 
+ *
  * @param dsi Pointer to the DSI data structure to be filled in.
  * @param bufffer Pointer to the buffer of the on disc DSI data.
  */
--- a/nav_types.h	Mon Sep 01 21:05:17 2008 +0000
+++ b/nav_types.h	Sat Sep 06 21:55:51 2008 +0000
@@ -43,7 +43,7 @@
 #define DSI_START_BYTE 1031
 
 /**
- * PCI General Information 
+ * PCI General Information
  */
 typedef struct {
   uint32_t nv_pck_lbn;      /**< sector address of this nav pack */
@@ -64,8 +64,8 @@
   uint32_t nsml_agl_dsta[9];  /**< address of destination vobu in AGL_C#n */
 } ATTRIBUTE_PACKED nsml_agli_t;
 
-/** 
- * Highlight General Information 
+/**
+ * Highlight General Information
  *
  * For btngrX_dsp_ty the bits have the following meaning:
  * 000b: normal 4/3 only buttons
@@ -87,7 +87,7 @@
   unsigned int zero4 : 1;          /**< reserved */
   unsigned int btngr3_dsp_ty : 3;  /**< display type of subpic stream for button group 3 */
   uint8_t btn_ofn;     /**< button offset number range 0-255 */
-  uint8_t btn_ns;      /**< number of valid buttons  <= 36/18/12 (low 6 bits) */  
+  uint8_t btn_ns;      /**< number of valid buttons  <= 36/18/12 (low 6 bits) */
   uint8_t nsl_btn_ns;  /**< number of buttons selectable by U_BTNNi (low 6 bits)   nsl_btn_ns <= btn_ns */
   uint8_t zero5;       /**< reserved */
   uint8_t fosl_btnn;   /**< forcedly selected button  (low 6 bits) */
@@ -95,8 +95,8 @@
 } ATTRIBUTE_PACKED hl_gi_t;
 
 
-/** 
- * Button Color Information Table 
+/**
+ * Button Color Information Table
  * Each entry beeing a 32bit word that contains the color indexs and alpha
  * values to use.  They are all represented by 4 bit number and stored
  * like this [Ci3, Ci2, Ci1, Ci0, A3, A2, A1, A0].   The actual palette
@@ -107,7 +107,7 @@
   uint32_t btn_coli[3][2];  /**< [button color number-1][select:0/action:1] */
 } ATTRIBUTE_PACKED btn_colit_t;
 
-/** 
+/**
  * Button Information
  *
  * NOTE: I've had to change the structure from the disk layout to get
@@ -137,7 +137,7 @@
 } ATTRIBUTE_PACKED btni_t;
 
 /**
- * Highlight Information 
+ * Highlight Information
  */
 typedef struct {
   hl_gi_t     hl_gi;
@@ -159,7 +159,7 @@
 
 
 /**
- * DSI General Information 
+ * DSI General Information
  */
 typedef struct {
   uint32_t nv_pck_scr;
@@ -188,7 +188,7 @@
     uint32_t stp_ptm1;
     uint32_t stp_ptm2;
     uint32_t gap_len1;
-    uint32_t gap_len2;      
+    uint32_t gap_len2;
   } vob_a[8];
 } ATTRIBUTE_PACKED sml_pbi_t;
 
@@ -208,7 +208,7 @@
 } ATTRIBUTE_PACKED sml_agli_t;
 
 /**
- * VOBU Search Information 
+ * VOBU Search Information
  */
 typedef struct {
   uint32_t next_video; /**< Next vobu that contains video */
@@ -223,7 +223,7 @@
 
 /**
  * Synchronous Information
- */ 
+ */
 typedef struct {
   uint16_t a_synca[8];   /**< offset to first audio packet for this VOBU */
   uint32_t sp_synca[32]; /**< offset to first subpicture packet */