Mercurial > libdvdread4.hg
changeset 26:0d82d0f30c98 src
cosmetics: Convert all tabs to spaces.
author | diego |
---|---|
date | Tue, 23 Sep 2008 09:14:45 +0000 |
parents | 17258a7b3239 |
children | 98951f8ec89c |
files | dvd_input.c dvd_reader.c dvd_reader.h dvd_udf.c dvd_udf.h ifo_print.c ifo_read.c md5.c md5.h nav_print.c nav_read.c |
diffstat | 11 files changed, 472 insertions(+), 472 deletions(-) [+] |
line wrap: on
line diff
--- a/dvd_input.c Sun Sep 14 20:53:47 2008 +0000 +++ b/dvd_input.c Tue Sep 23 09:14:45 2008 +0000 @@ -316,15 +316,15 @@ if(dlsym(dvdcss_library, U_S "dvdcss_crack")) { 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" ); + "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n" + "libdvdread: You should get the latest version from " + "http://www.videolan.org/\n" ); dlclose(dvdcss_library); dvdcss_library = NULL; } else if(!DVDcss_open || !DVDcss_close || !DVDcss_title || !DVDcss_seek - || !DVDcss_read || !DVDcss_error || !dvdcss_version) { + || !DVDcss_read || !DVDcss_error || !dvdcss_version) { fprintf(stderr, "libdvdread: Missing symbols in %s, " - "this shouldn't happen !\n", CSS_LIB); + "this shouldn't happen !\n", CSS_LIB); dlclose(dvdcss_library); } } @@ -338,7 +338,7 @@ fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose); */ fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n", - dvdcss_version ? *dvdcss_version : ""); + dvdcss_version ? *dvdcss_version : ""); /* libdvdcss wrapper functions */ dvdinput_open = css_open;
--- a/dvd_reader.c Sun Sep 14 20:53:47 2008 +0000 +++ b/dvd_reader.c Tue Sep 23 09:14:45 2008 +0000 @@ -169,53 +169,53 @@ 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" ); + "please be patient\n\n" ); gettimeofday(&all_s, NULL); for( title = 0; title < 100; title++ ) { - gettimeofday( &t_s, NULL ); - if( title == 0 ) { - sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" ); - } else { - sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 0 ); - } - 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", - 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", - (long int) t_e.tv_sec - t_s.tv_sec ); - } + gettimeofday( &t_s, NULL ); + if( title == 0 ) { + sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" ); + } else { + sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 0 ); + } + 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", + 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", + (long int) t_e.tv_sec - t_s.tv_sec ); + } - if( title == 0 ) continue; + 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; + 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", - 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", - (long int) t_e.tv_sec - t_s.tv_sec ); + /* Perform CSS key cracking for this title. */ + 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", + (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", - (long int) all_e.tv_sec - all_s.tv_sec ); + (long int) all_e.tv_sec - all_s.tv_sec ); return 0; } @@ -232,8 +232,8 @@ dev = dvdinput_open( location ); if( !dev ) { - fprintf( stderr, "libdvdread: Can't open %s for reading\n", location ); - return NULL; + fprintf( stderr, "libdvdread: Can't open %s for reading\n", location ); + return NULL; } dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) ); @@ -333,18 +333,18 @@ struct stat fileinfo; int ret; int have_css; - dvd_reader_t *ret_val = NULL; + dvd_reader_t *ret_val = NULL; char *dev_name = NULL; - char *path; + char *path; #ifdef _MSC_VER - int len; + int len; #endif if( ppath == NULL ) return 0; - path = strdup(ppath); + path = strdup(ppath); if( path == NULL ) return 0; @@ -352,14 +352,14 @@ 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] == '\\') && - (path[len - 2] != ':')) - { - path[len-1] = '\0'; - } + /* Strip off the trailing \ if it is not a drive */ + len = strlen(path); + if ((len > 1) && + (path[len - 1] == '\\') && + (path[len - 2] != ':')) + { + path[len-1] = '\0'; + } #endif ret = stat( path, &fileinfo ); @@ -368,127 +368,127 @@ /* maybe "host:port" url? try opening it with acCeSS library */ if( strchr(path,':') ) { - ret_val = DVDOpenImageFile( path, have_css ); - free(path); - return ret_val; + ret_val = DVDOpenImageFile( path, have_css ); + free(path); + return ret_val; } - /* If we can't stat the file, give up */ - fprintf( stderr, "libdvdread: Can't stat %s\n", path ); - perror(""); - free(path); - return NULL; + /* If we can't stat the file, give up */ + fprintf( stderr, "libdvdread: Can't stat %s\n", path ); + perror(""); + free(path); + return NULL; } /* First check if this is a block/char device or a file*/ if( S_ISBLK( fileinfo.st_mode ) || - S_ISCHR( fileinfo.st_mode ) || - S_ISREG( fileinfo.st_mode ) ) { + S_ISCHR( fileinfo.st_mode ) || + S_ISREG( fileinfo.st_mode ) ) { - /** - * Block devices and regular files are assumed to be DVD-Video images. - */ + /** + * Block devices and regular files are assumed to be DVD-Video images. + */ #if defined(__sun) - ret_val = DVDOpenImageFile( sun_block2char( path ), have_css ); + ret_val = DVDOpenImageFile( sun_block2char( path ), have_css ); #elif defined(SYS_BSD) - ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css ); + ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css ); #else - ret_val = DVDOpenImageFile( path, have_css ); + ret_val = DVDOpenImageFile( path, have_css ); #endif - free(path); - return ret_val; + free(path); + return ret_val; } else if( S_ISDIR( fileinfo.st_mode ) ) { - dvd_reader_t *auth_drive = 0; - char *path_copy; + dvd_reader_t *auth_drive = 0; + char *path_copy; #if defined(SYS_BSD) - struct fstab* fe; + struct fstab* fe; #elif defined(__sun) || defined(__linux__) - FILE *mntfile; + FILE *mntfile; #endif - /* XXX: We should scream real loud here. */ - if( !(path_copy = strdup( path ) ) ) { - free(path); - return NULL; - } + /* XXX: We should scream real loud here. */ + if( !(path_copy = strdup( path ) ) ) { + free(path); + return NULL; + } #ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */ /* Also WIN32 does not have symlinks, so we don't need this bit of code. */ - /* Resolve any symlinks and get the absolut dir name. */ - { - char *new_path; - int cdir = open( ".", O_RDONLY ); + /* Resolve any symlinks and get the absolut dir name. */ + { + char *new_path; + int cdir = open( ".", O_RDONLY ); - if( cdir >= 0 ) { - chdir( path_copy ); - new_path = malloc(PATH_MAX+1); - if(!new_path) { - free(path); - return NULL; - } - getcwd(new_path, PATH_MAX ); - fchdir( cdir ); - close( cdir ); - free( path_copy ); - path_copy = new_path; - } - } + if( cdir >= 0 ) { + chdir( path_copy ); + new_path = malloc(PATH_MAX+1); + if(!new_path) { + free(path); + return NULL; + } + getcwd(new_path, PATH_MAX ); + fchdir( cdir ); + close( cdir ); + free( path_copy ); + path_copy = new_path; + } + } #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 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 ] == '/' ) - path_copy[ strlen( path_copy ) - 1 ] = '\0'; - } + if( 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 ]), - "/video_ts" ) ) { - path_copy[ strlen( path_copy ) - TITLES_MAX ] = '\0'; - } - } + if( 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'; - } + if(path_copy[0] == '\0') { + path_copy[0] = '/'; + path_copy[1] = '\0'; + } #if defined(SYS_BSD) - if( ( fe = getfsfile( path_copy ) ) ) { - dev_name = bsd_block2char( fe->fs_spec ); - fprintf( stderr, - "libdvdread: Attempting to use device %s" - " mounted on %s for CSS authentication\n", - dev_name, - fe->fs_file ); - auth_drive = DVDOpenImageFile( dev_name, have_css ); - } + if( ( fe = getfsfile( path_copy ) ) ) { + dev_name = bsd_block2char( fe->fs_spec ); + fprintf( stderr, + "libdvdread: Attempting to use device %s" + " mounted on %s for CSS authentication\n", + dev_name, + fe->fs_file ); + auth_drive = DVDOpenImageFile( dev_name, have_css ); + } #elif defined(__sun) - mntfile = fopen( MNTTAB, "r" ); - if( mntfile ) { - struct mnttab mp; - int res; + mntfile = fopen( MNTTAB, "r" ); + if( mntfile ) { + struct mnttab mp; + int res; - while( ( res = getmntent( mntfile, &mp ) ) != -1 ) { - if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) { - dev_name = sun_block2char( mp.mnt_special ); - fprintf( stderr, - "libdvdread: Attempting to use device %s" - " mounted on %s for CSS authentication\n", - dev_name, - mp.mnt_mountp ); - auth_drive = DVDOpenImageFile( dev_name, have_css ); - break; - } - } - fclose( mntfile ); - } + while( ( res = getmntent( mntfile, &mp ) ) != -1 ) { + if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) { + dev_name = sun_block2char( mp.mnt_special ); + fprintf( stderr, + "libdvdread: Attempting to use device %s" + " mounted on %s for CSS authentication\n", + dev_name, + mp.mnt_mountp ); + auth_drive = DVDOpenImageFile( dev_name, have_css ); + break; + } + } + fclose( mntfile ); + } #elif defined(__linux__) mntfile = fopen( MOUNTED, "r" ); if( mntfile ) { @@ -496,58 +496,58 @@ while( ( me = getmntent( mntfile ) ) ) { if( !strcmp( me->mnt_dir, path_copy ) ) { - fprintf( stderr, - "libdvdread: Attempting to use device %s" - " mounted on %s for CSS authentication\n", - me->mnt_fsname, - me->mnt_dir ); + fprintf( stderr, + "libdvdread: Attempting to use device %s" + " mounted on %s for CSS authentication\n", + me->mnt_fsname, + me->mnt_dir ); auth_drive = DVDOpenImageFile( me->mnt_fsname, have_css ); - dev_name = strdup(me->mnt_fsname); + dev_name = strdup(me->mnt_fsname); break; } } fclose( mntfile ); - } + } #elif defined(_MSC_VER) auth_drive = DVDOpenImageFile( path, have_css ); #endif #ifndef _MSC_VER - if( !dev_name ) { - fprintf( stderr, "libdvdread: Couldn't find device name.\n" ); - } else if( !auth_drive ) { - fprintf( stderr, "libdvdread: Device %s inaccessible, " - "CSS authentication not available.\n", dev_name ); - } + if( !dev_name ) { + fprintf( stderr, "libdvdread: Couldn't find device name.\n" ); + } else if( !auth_drive ) { + fprintf( stderr, "libdvdread: Device %s inaccessible, " + "CSS authentication not available.\n", dev_name ); + } #else - if( !auth_drive ) { - fprintf( stderr, "libdvdread: Device %s inaccessible, " - "CSS authentication not available.\n", dev_name ); - } + if( !auth_drive ) { + fprintf( stderr, "libdvdread: Device %s inaccessible, " + "CSS authentication not available.\n", dev_name ); + } #endif - free( dev_name ); - free( path_copy ); + free( dev_name ); + free( path_copy ); /** * If we've opened a drive, just use that. */ - if( auth_drive ) { - free(path); - return auth_drive; - } + if( auth_drive ) { + free(path); + return auth_drive; + } /** * Otherwise, we now try to open the directory tree instead. */ ret_val = DVDOpenPath( path ); - free( path ); - return ret_val; + free( path ); + return ret_val; } /* If it's none of the above, screw it. */ fprintf( stderr, "libdvdread: Could not open %s\n", path ); - free( path ); + free( path ); return NULL; } @@ -556,7 +556,7 @@ if( dvd ) { if( dvd->dev ) dvdinput_close( dvd->dev ); if( dvd->path_root ) free( dvd->path_root ); - if( dvd->udfcache ) FreeUDFCache( dvd->udfcache ); + if( dvd->udfcache ) FreeUDFCache( dvd->udfcache ); free( dvd ); } } @@ -733,12 +733,12 @@ if( dvd->css_state == 1 /* Need key init */ ) { initAllCSSKeys( dvd ); - dvd->css_state = 2; + 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 ); + filename ); } */ @@ -790,7 +790,7 @@ } dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN; dvd_file->title_devs[ 0 ] = dev; - dvdinput_title( dvd_file->title_devs[0], 0); + dvdinput_title( dvd_file->title_devs[0], 0); dvd_file->filesize = dvd_file->title_sizes[ 0 ]; } else { @@ -808,7 +808,7 @@ dvd_file->title_sizes[ i ] = fileinfo.st_size / DVD_VIDEO_LB_LEN; dvd_file->title_devs[ i ] = dvdinput_open( full_path ); - dvdinput_title( dvd_file->title_devs[ i ], 0 ); + dvdinput_title( dvd_file->title_devs[ i ], 0 ); dvd_file->filesize += dvd_file->title_sizes[ i ]; } if( !dvd_file->title_devs[ 0 ] ) { @@ -821,7 +821,7 @@ } dvd_file_t *DVDOpenFile( dvd_reader_t *dvd, int titlenum, - dvd_read_domain_t domain ) + dvd_read_domain_t domain ) { char filename[ MAX_UDF_FILE_NAME_LEN ]; @@ -877,8 +877,8 @@ if( dvd_file ) { if( dvd_file->dvd->isImageFile ) { - ; - } else { + ; + } else { for( i = 0; i < TITLES_MAX; ++i ) { if( dvd_file->title_devs[ i ] ) { dvdinput_close( dvd_file->title_devs[i] ); @@ -893,23 +893,23 @@ /* Internal, but used from dvd_udf.c */ int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number, - size_t block_count, unsigned char *data, - int encrypted ) + size_t block_count, unsigned char *data, + int encrypted ) { int ret; if( !device->dev ) { - fprintf( stderr, "libdvdread: Fatal error in block read.\n" ); - return 0; + fprintf( stderr, "libdvdread: Fatal error in block read.\n" ); + return 0; } ret = dvdinput_seek( device->dev, (int) lb_number ); if( ret != (int) lb_number ) { - fprintf( stderr, "libdvdread: Can't seek to block %u\n", lb_number ); - return 0; + fprintf( stderr, "libdvdread: Can't seek to block %u\n", lb_number ); + return 0; } ret = dvdinput_read( device->dev, (char *) data, - (int) block_count, encrypted ); + (int) block_count, encrypted ); return ret; } @@ -920,11 +920,11 @@ * descramble the data if it's encrypted. Returning either an * negative error or the number of blocks read. */ static int DVDReadBlocksUDF( dvd_file_t *dvd_file, uint32_t offset, - size_t block_count, unsigned char *data, - int encrypted ) + size_t block_count, unsigned char *data, + int encrypted ) { return UDFReadBlocksRaw( dvd_file->dvd, dvd_file->lb_start + offset, - block_count, data, encrypted ); + block_count, data, encrypted ); } /* This is using possibly several inputs and starting from an offset of '0'. @@ -934,8 +934,8 @@ * descramble the data if it's encrypted. Returning either an * negative error or the number of blocks read. */ static int DVDReadBlocksPath( dvd_file_t *dvd_file, unsigned int offset, - size_t block_count, unsigned char *data, - int encrypted ) + size_t block_count, unsigned char *data, + int encrypted ) { int i; int ret, ret2, off; @@ -947,51 +947,51 @@ if( offset < dvd_file->title_sizes[ i ] ) { if( ( offset + block_count ) <= dvd_file->title_sizes[ i ] ) { - off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset ); + 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", - offset ); - return off < 0 ? off : 0; - } + 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)block_count, encrypted ); + (int)block_count, encrypted ); break; } else { size_t part1_size = dvd_file->title_sizes[ i ] - offset; - /* FIXME: Really needs to be a while loop. + /* 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", - offset ); - return off < 0 ? off : 0; - } + 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. + (int)part1_size, encrypted ); + if( ret < 0 ) return ret; + /* 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 ] ) + /* Does the next part exist? If not then return now. */ + if( i + 1 >= TITLES_MAX || !dvd_file->title_devs[ i + 1 ] ) return ret; /* 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", - 0 ); - return off < 0 ? off : 0; - } + 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 ], - data + ( part1_size - * (int64_t)DVD_VIDEO_LB_LEN ), - (int)(block_count - part1_size), - encrypted ); + data + ( part1_size + * (int64_t)DVD_VIDEO_LB_LEN ), + (int)(block_count - part1_size), + encrypted ); if( ret2 < 0 ) return ret2; - break; + break; } } else { offset -= dvd_file->title_sizes[ i ]; @@ -1003,7 +1003,7 @@ /* 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, - size_t block_count, unsigned char *data ) + size_t block_count, unsigned char *data ) { int ret; /* Check arguments. */ @@ -1014,20 +1014,20 @@ 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 ); + 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 else { - dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start ); + dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start ); }*/ } if( dvd_file->dvd->isImageFile ) { - ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset, - block_count, data, DVDINPUT_READ_DECRYPT ); + ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset, + block_count, data, DVDINPUT_READ_DECRYPT ); } else { - ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset, - block_count, data, DVDINPUT_READ_DECRYPT ); + ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset, + block_count, data, DVDINPUT_READ_DECRYPT ); } return (ssize_t)ret; @@ -1087,17 +1087,17 @@ 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 " - "for file read!\n" ); + 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, - (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); + ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector, + (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); } else { - ret = DVDReadBlocksPath( dvd_file, seek_sector, - (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); + ret = DVDReadBlocksPath( dvd_file, seek_sector, + (size_t) numsec, secbuf, DVDINPUT_NOFLAGS ); } if( ret != (int) numsec ) { @@ -1135,34 +1135,34 @@ * and md5sum them, i.e VIDEO_TS.IFO and VTS_0?_0.IFO */ md5_init_ctx( &ctx ); for( title = 0; title < 10; title++ ) { - dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE ); - if( dvd_file != NULL ) { - ssize_t bytes_read; - 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); + dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE ); + if( dvd_file != NULL ) { + ssize_t bytes_read; + 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 " - "allocate memory for file read!\n" ); - return -1; - } - bytes_read = DVDReadBytes( dvd_file, buffer, file_size ); - if( bytes_read != file_size ) { - fprintf( stderr, "libdvdread: DVDDiscId read returned %zd bytes" - ", wanted %zd\n", bytes_read, file_size ); - DVDCloseFile( dvd_file ); - free( buffer_base ); - return -1; - } + if( buffer_base == NULL ) { + DVDCloseFile( dvd_file ); + fprintf( stderr, "libdvdread: DVDDiscId, failed to " + "allocate memory for file read!\n" ); + return -1; + } + bytes_read = DVDReadBytes( dvd_file, buffer, file_size ); + if( bytes_read != file_size ) { + fprintf( stderr, "libdvdread: DVDDiscId read returned %zd bytes" + ", wanted %zd\n", bytes_read, file_size ); + DVDCloseFile( dvd_file ); + free( buffer_base ); + return -1; + } - md5_process_bytes( buffer, file_size, &ctx ); + md5_process_bytes( buffer, file_size, &ctx ); - DVDCloseFile( dvd_file ); - free( buffer_base ); - nr_of_files++; - } + DVDCloseFile( dvd_file ); + free( buffer_base ); + nr_of_files++; + } } md5_finish_ctx( &ctx, discid ); if(!nr_of_files) @@ -1173,8 +1173,8 @@ int DVDISOVolumeInfo( dvd_reader_t *dvd, - char *volid, unsigned int volid_size, - unsigned char *volsetid, unsigned int volsetid_size ) + char *volid, unsigned int volid_size, + unsigned char *volsetid, unsigned int volsetid_size ) { unsigned char *buffer, *buffer_base; int ret; @@ -1193,14 +1193,14 @@ if( buffer_base == NULL ) { fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to " - "allocate memory for file read!\n" ); + "allocate memory for file read!\n" ); return -1; } ret = UDFReadBlocksRaw( dvd, 16, 1, buffer, 0 ); if( ret != 1 ) { fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to " - "read ISO9660 Primary Volume Descriptor!\n" ); + "read ISO9660 Primary Volume Descriptor!\n" ); free( buffer_base ); return -1; } @@ -1209,7 +1209,7 @@ unsigned int n; for(n = 0; n < 32; n++) { if(buffer[40+n] == 0x20) { - break; + break; } } @@ -1233,8 +1233,8 @@ int DVDUDFVolumeInfo( dvd_reader_t *dvd, - char *volid, unsigned int volid_size, - unsigned char *volsetid, unsigned int volsetid_size ) + char *volid, unsigned int volid_size, + unsigned char *volsetid, unsigned int volsetid_size ) { int ret; /* Check arguments. */
--- a/dvd_reader.h Sun Sep 14 20:53:47 2008 +0000 +++ b/dvd_reader.h Tue Sep 23 09:14:45 2008 +0000 @@ -112,8 +112,8 @@ 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 - the title set are opened and read as a - single file. */ + the title set are opened and read as a + single file. */ } dvd_read_domain_t; /** @@ -229,7 +229,7 @@ * @return 0 on success, -1 on error. */ int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int, - unsigned char *, unsigned int ); + unsigned char *, unsigned int ); int DVDFileSeekForce( dvd_file_t *, int offset, int force_size); @@ -255,7 +255,7 @@ * @return 0 on success, -1 on error. */ int DVDISOVolumeInfo( dvd_reader_t *, char *, unsigned int, - unsigned char *, unsigned int ); + unsigned char *, unsigned int ); /** * Sets the level of caching that is done when reading from a device
--- a/dvd_udf.c Sun Sep 14 20:53:47 2008 +0000 +++ b/dvd_udf.c Tue Sep 23 09:14:45 2008 +0000 @@ -44,13 +44,13 @@ /* 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, - int encrypted ); + 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, - int encrypted ) + size_t block_count, unsigned char *data, + int encrypted ) { int ret; size_t count = block_count; @@ -160,7 +160,7 @@ static int GetUDFCache(dvd_reader_t *device, UDFCacheType type, - uint32_t nr, void *data) + uint32_t nr, void *data) { int n; struct udf_cache *c; @@ -222,7 +222,7 @@ } static int SetUDFCache(dvd_reader_t *device, UDFCacheType type, - uint32_t nr, void *data) + uint32_t nr, void *data) { int n; struct udf_cache *c; @@ -323,11 +323,11 @@ #define GETN1(p) ((uint8_t)data[p]) #define GETN2(p) ((uint16_t)data[p] | ((uint16_t)data[(p) + 1] << 8)) #define GETN3(p) ((uint32_t)data[p] | ((uint32_t)data[(p) + 1] << 8) \ - | ((uint32_t)data[(p) + 2] << 16)) + | ((uint32_t)data[(p) + 2] << 16)) #define GETN4(p) ((uint32_t)data[p] \ - | ((uint32_t)data[(p) + 1] << 8) \ - | ((uint32_t)data[(p) + 2] << 16) \ - | ((uint32_t)data[(p) + 3] << 24)) + | ((uint32_t)data[(p) + 1] << 8) \ + | ((uint32_t)data[(p) + 2] << 16) \ + | ((uint32_t)data[(p) + 3] << 24)) /* This is wrong with regard to endianess */ #define GETN(p, n, target) memcpy(target, &data[p], n) @@ -361,7 +361,7 @@ } static int UDFShortAD( uint8_t *data, struct AD *ad, - struct Partition *partition ) + struct Partition *partition ) { ad->Length = GETN4(0); ad->Flags = ad->Length >> 30; @@ -402,7 +402,7 @@ static int UDFPartition( uint8_t *data, uint16_t *Flags, uint16_t *Number, - char *Contents, uint32_t *Start, uint32_t *Length ) + char *Contents, uint32_t *Start, uint32_t *Length ) { *Flags = GETN2(20); *Number = GETN2(22); @@ -428,7 +428,7 @@ } static int UDFFileEntry( uint8_t *data, uint8_t *FileType, - struct Partition *partition, struct AD *ad ) + struct Partition *partition, struct AD *ad ) { uint16_t flags; uint32_t L_EA, L_AD; @@ -466,7 +466,7 @@ } static int UDFFileIdentifier( uint8_t *data, uint8_t *FileCharacteristics, - char *FileName, struct AD *FileICB ) + char *FileName, struct AD *FileICB ) { uint8_t L_FI; uint16_t L_IU; @@ -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]; @@ -641,7 +641,7 @@ static int UDFGetAVDP( dvd_reader_t *device, - struct avdp_t *avdp) + struct avdp_t *avdp) { uint8_t Anchor_base[ DVD_VIDEO_LB_LEN + 2048 ]; uint8_t *Anchor = (uint8_t *)(((uintptr_t)Anchor_base & ~((uintptr_t)2047)) + 2048); @@ -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); @@ -769,7 +769,7 @@ } uint32_t UDFFindFile( dvd_reader_t *device, char *filename, - uint32_t *filesize ) + uint32_t *filesize ) { 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; @@ -885,8 +885,8 @@ /* Descriptor */ desc_found = 1; } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 ) - / DVD_VIDEO_LB_LEN ) && ( TagID != 8 ) - && ( !desc_found) ); + / DVD_VIDEO_LB_LEN ) && ( TagID != 8 ) + && ( !desc_found) ); if( !desc_found ) { /* Backup volume descriptor */ @@ -922,7 +922,7 @@ * returns the size of buffer needed for all data */ int UDFGetVolumeIdentifier(dvd_reader_t *device, char *volid, - unsigned int volid_size) + unsigned int volid_size) { struct pvd_t pvd; unsigned int volid_len; @@ -951,7 +951,7 @@ * or 0 on error */ int UDFGetVolumeSetIdentifier(dvd_reader_t *device, uint8_t *volsetid, - unsigned int volsetid_size) + unsigned int volsetid_size) { struct pvd_t pvd;
--- a/dvd_udf.h Sun Sep 14 20:53:47 2008 +0000 +++ b/dvd_udf.h Tue Sep 23 09:14:45 2008 +0000 @@ -50,9 +50,9 @@ void FreeUDFCache(void *cache); int UDFGetVolumeIdentifier(dvd_reader_t *device, - char *volid, unsigned int volid_size); + char *volid, unsigned int volid_size); int UDFGetVolumeSetIdentifier(dvd_reader_t *device, - uint8_t *volsetid, unsigned int volsetid_size); + uint8_t *volsetid, unsigned int volsetid_size); void *GetUDFCacheHandle(dvd_reader_t *device); void SetUDFCacheHandle(dvd_reader_t *device, void *cache);
--- a/ifo_print.c Sun Sep 14 20:53:47 2008 +0000 +++ b/ifo_print.c Tue Sep 23 09:14:45 2008 +0000 @@ -37,10 +37,10 @@ assert((dtime->frame_u&0xf) < 0xa); printf("%02x:%02x:%02x.%02x", - dtime->hour, - dtime->minute, - dtime->second, - dtime->frame_u & 0x3f); + dtime->hour, + dtime->minute, + dtime->second, + dtime->frame_u & 0x3f); switch((dtime->frame_u & 0xc0) >> 6) { case 1: rate = "25.00"; @@ -316,7 +316,7 @@ break; default: printf("sample_frequency %i (please send a bug report) ", - attr->sample_frequency); + attr->sample_frequency); } printf("%dCh ", attr->channels + 1); @@ -364,7 +364,7 @@ printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff); } else { printf("%02x%02x ", 0xff & (unsigned)(attr->lang_code >> 8), - 0xff & (unsigned)(attr->lang_code & 0xff)); + 0xff & (unsigned)(attr->lang_code & 0xff)); } printf("%d ", attr->zero1); @@ -501,8 +501,8 @@ 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, - vmgi_mat->specification_version & 0xf); + 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); printf("VMG Number of Volumes: %i\n", vmgi_mat->vmg_nr_of_volumes); @@ -514,7 +514,7 @@ 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", - vmgi_mat->first_play_pgc); + 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); printf("Start sector of VMGM_PGCI_UT: %08x\n", vmgi_mat->vmgm_pgci_ut); @@ -523,19 +523,19 @@ 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", - vmgi_mat->vmgm_vobu_admap); + 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", - vmgi_mat->nr_of_vmgm_audio_streams); + 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", - vmgi_mat->nr_of_vmgm_subp_streams); + vmgi_mat->nr_of_vmgm_subp_streams); if(vmgi_mat->nr_of_vmgm_subp_streams > 0) { printf("\tstream %2i status: ", 1); ifo_print_subp_attributes(5, &vmgi_mat->vmgm_subp_attr); @@ -551,8 +551,8 @@ 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, - vtsi_mat->specification_version&0xf); + 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); printf("Start sector of VTSM_VOBS: %08x\n", vtsi_mat->vtsm_vobs); @@ -571,7 +571,7 @@ printf("\n"); printf("VTSM Number of Audio attributes: %i\n", - vtsi_mat->nr_of_vtsm_audio_streams); + 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); @@ -579,7 +579,7 @@ } printf("VTSM Number of Sub-picture attributes: %i\n", - vtsi_mat->nr_of_vtsm_subp_streams); + 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); @@ -591,7 +591,7 @@ printf("\n"); printf("VTS Number of Audio attributes: %i\n", - vtsi_mat->nr_of_vts_audio_streams); + 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]); @@ -599,7 +599,7 @@ } printf("VTS Number of Subpicture attributes: %i\n", - vtsi_mat->nr_of_vts_subp_streams); + vtsi_mat->nr_of_vts_subp_streams); for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) { printf("\tstream %2i status: ", i); ifo_print_subp_attributes(5, &vtsi_mat->vts_subp_attr[i]); @@ -665,28 +665,28 @@ const char *s; switch(cell_playback[i].block_mode) { case 0: - s = "not a"; break; + s = "not a"; break; case 1: - s = "the first"; break; + s = "the first"; break; case 2: default: - s = ""; break; + s = ""; break; case 3: - s = "last"; break; + s = "last"; break; } printf("%s cell in the block ", s); switch(cell_playback[i].block_type) { case 0: - printf("not part of the block "); - break; + printf("not part of the block "); + break; case 1: - printf("angle block "); - break; + printf("angle block "); + break; case 2: case 3: - printf("(send bug repport) "); - break; + printf("(send bug repport) "); + break; } } if(cell_playback[i].seamless_play) @@ -709,11 +709,11 @@ 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, - cell_playback[i].first_ilvu_end_sector); + 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, - cell_playback[i].last_vobu_start_sector); + cell_playback[i].last_sector, + cell_playback[i].last_vobu_start_sector); } } @@ -727,7 +727,7 @@ for(i=0;i<nr;i++) { printf("Cell: %3i has VOB ID: %3i, Cell ID: %3i\n", i + 1, - cell_position[i].vob_id_nr, cell_position[i].cell_nr); + cell_position[i].vob_id_nr, cell_position[i].cell_nr); } } @@ -751,19 +751,19 @@ for(i = 0; i < 8; i++) { if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */ - printf("Audio stream %i control: %04x\n", - i, pgc->audio_control[i]); + 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", - i, pgc->subp_control[i], - (pgc->subp_control[i] >>24) & 0x1f, - (pgc->subp_control[i] >>16) & 0x1f, - (pgc->subp_control[i] >>8) & 0x1f, - (pgc->subp_control[i] ) & 0x1f); + i, pgc->subp_control[i], + (pgc->subp_control[i] >>24) & 0x1f, + (pgc->subp_control[i] >>16) & 0x1f, + (pgc->subp_control[i] >>8) & 0x1f, + (pgc->subp_control[i] ) & 0x1f); } } @@ -793,18 +793,18 @@ int i; printf("Number of TitleTrack search pointers: %i\n", - tt_srpt->nr_of_srpts); + 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", - tt_srpt->title[i].title_set_nr); + 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", - tt_srpt->title[i].nr_of_angles); + tt_srpt->title[i].nr_of_angles); printf("\tTitle playback type: (%02x)\n", - *(uint8_t *)&(tt_srpt->title[i].pb_ty)); + *(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"); @@ -815,9 +815,9 @@ printf("\t\tChapter search or play:%d\n", tt_srpt->title[i].pb_ty.chapter_search_or_play); printf("\tParental ID field: %04x\n", - tt_srpt->title[i].parental_id); + tt_srpt->title[i].parental_id); printf("\tTitle set starting sector %08x\n", - tt_srpt->title[i].title_set_sector); + tt_srpt->title[i].title_set_sector); } } @@ -825,14 +825,14 @@ 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, - vts_ptt_srpt->last_byte); + 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, - vts_ptt_srpt->title[i].ptt[j].pgcn, - vts_ptt_srpt->title[i].ptt[j].pgn ); + i + 1, j + 1, + vts_ptt_srpt->title[i].ptt[j].pgcn, + vts_ptt_srpt->title[i].ptt[j].pgn ); } } } @@ -852,8 +852,8 @@ for(i = 0; i < ptl_mait->nr_of_countries; i++) { printf("Country code: %c%c\n", - ptl_mait->countries[i].country_code >> 8, - ptl_mait->countries[i].country_code & 0xff); + 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, @@ -865,8 +865,8 @@ 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 - + ptl_mait->countries[i].pf_ptl_mai_start_byte - + j*(ptl_mait->nr_of_vtss+1)*2, (ptl_mait->nr_of_vtss+1)*2); + + 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"); } } @@ -904,10 +904,10 @@ for(i = 0; i < entries; i++) { printf("VOB ID: %3i, Cell ID: %3i ", - c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id); + 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].last_sector); + c_adt->cell_adr_table[i].start_sector, + c_adt->cell_adr_table[i].last_sector); } } @@ -918,7 +918,7 @@ 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, - vobu_admap->vobu_start_sectors[i]); + vobu_admap->vobu_start_sectors[i]); } } @@ -983,8 +983,8 @@ 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); + 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); @@ -1030,14 +1030,14 @@ ifo_print_video_attributes(5, &vts_attributes->vtsm_vobs_attr); printf("\n"); printf("Number of Audio streams: %i\n", - vts_attributes->nr_of_vtsm_audio_streams); + 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", - vts_attributes->nr_of_vtsm_subp_streams); + 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); @@ -1048,7 +1048,7 @@ ifo_print_video_attributes(5, &vts_attributes->vtstt_vobs_video_attr); printf("\n"); printf("Number of Audio streams: %i\n", - vts_attributes->nr_of_vtstt_audio_streams); + 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]); @@ -1056,7 +1056,7 @@ } printf("Number of Subpicture streams: %i\n", - vts_attributes->nr_of_vtstt_subp_streams); + vts_attributes->nr_of_vtstt_subp_streams); for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) { printf("\tstream %2i attributes: ", i); ifo_print_subp_attributes(5, &vts_attributes->vtstt_subp_attr[i]);
--- a/ifo_read.c Sun Sep 14 20:53:47 2008 +0000 +++ b/ifo_read.c Tue Sep 23 09:14:45 2008 +0000 @@ -66,7 +66,7 @@ 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, - unsigned int offset); + unsigned int offset); static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile, pgc_program_map_t *program_map, unsigned int nr, unsigned int offset); @@ -83,7 +83,7 @@ unsigned int sector); static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile, vobu_admap_t *vobu_admap, - unsigned int sector); + unsigned int sector); static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit, unsigned int offset); @@ -363,7 +363,7 @@ if(title) { fprintf(stderr, "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n", - title, title); + title, title); } else { fprintf(stderr, "libdvdread: Invalid IFO for VMGM (VIDEO_TS.IFO).\n"); } @@ -673,7 +673,7 @@ static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile, pgc_command_tbl_t *cmd_tbl, - unsigned int offset) { + unsigned int offset) { memset(cmd_tbl, 0, sizeof(pgc_command_tbl_t)); @@ -706,12 +706,12 @@ cmd_tbl->post_cmds = (vm_cmd_t *)malloc(post_cmds_size); if(!cmd_tbl->post_cmds) { if(cmd_tbl->pre_cmds) - free(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) - free(cmd_tbl->pre_cmds); + free(cmd_tbl->pre_cmds); free(cmd_tbl->post_cmds); return 0; } @@ -722,16 +722,16 @@ cmd_tbl->cell_cmds = (vm_cmd_t *)malloc(cell_cmds_size); if(!cmd_tbl->cell_cmds) { if(cmd_tbl->pre_cmds) - free(cmd_tbl->pre_cmds); + free(cmd_tbl->pre_cmds); if(cmd_tbl->post_cmds) - free(cmd_tbl->post_cmds); + free(cmd_tbl->post_cmds); return 0; } if(!(DVDReadBytes(ifofile->file, cmd_tbl->cell_cmds, cell_cmds_size))) { if(cmd_tbl->pre_cmds) - free(cmd_tbl->pre_cmds); + free(cmd_tbl->pre_cmds); if(cmd_tbl->post_cmds) - free(cmd_tbl->post_cmds); + free(cmd_tbl->post_cmds); free(cmd_tbl->cell_cmds); return 0; } @@ -758,7 +758,7 @@ static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile, pgc_program_map_t *program_map, - unsigned int nr, unsigned int offset) { + unsigned int nr, unsigned int offset) { unsigned int size = nr * sizeof(pgc_program_map_t); if(!DVDFileSeek_(ifofile->file, offset)) @@ -899,15 +899,15 @@ if(!pgc->cell_playback) { ifoFree_PGC_COMMAND_TBL(pgc->command_tbl); if(pgc->program_map) - free(pgc->program_map); + free(pgc->program_map); return 0; } if(!ifoRead_CELL_PLAYBACK_TBL(ifofile, pgc->cell_playback, - pgc->nr_of_cells, + pgc->nr_of_cells, offset + pgc->cell_playback_offset)) { ifoFree_PGC_COMMAND_TBL(pgc->command_tbl); if(pgc->program_map) - free(pgc->program_map); + free(pgc->program_map); free(pgc->cell_playback); return 0; } @@ -922,7 +922,7 @@ return 0; } if(!ifoRead_CELL_POSITION_TBL(ifofile, pgc->cell_position, - pgc->nr_of_cells, + pgc->nr_of_cells, offset + pgc->cell_position_offset)) { ifoFree_PGC(pgc); return 0; @@ -1101,7 +1101,7 @@ return 0; if(!DVDFileSeek_(ifofile->file, - ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN)) + ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN)) return 0; vts_ptt_srpt = (vts_ptt_srpt_t *)malloc(sizeof(vts_ptt_srpt_t)); @@ -1264,7 +1264,7 @@ 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 - <= ptl_mait->last_byte + 1 - PTL_MAIT_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); @@ -1293,14 +1293,14 @@ CHECK_ZERO(ptl_mait->countries[i].zero_1); 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); + + 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, - ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN + 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"); free(ptl_mait->countries); @@ -1331,10 +1331,10 @@ { /* Transpose the array so we can use C indexing. */ int level, vts; for(level = 0; level < 8; level++) { - for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) { - ptl_mait->countries[i].pf_ptl_mai[vts][level] = - pf_temp[(7-level)*(ptl_mait->nr_of_vtss+1) + vts]; - } + for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) { + ptl_mait->countries[i].pf_ptl_mai[vts][level] = + pf_temp[(7-level)*(ptl_mait->nr_of_vtss+1) + vts]; + } } free(pf_temp); } @@ -1486,7 +1486,7 @@ 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); + free(ifofile->vts_tmapt->tmap[i].map_ent); free(ifofile->vts_tmapt->tmap); free(ifofile->vts_tmapt->tmap_offset); free(ifofile->vts_tmapt); @@ -1600,7 +1600,7 @@ 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 < - c_adt->cell_adr_table[i].last_sector); + c_adt->cell_adr_table[i].last_sector); } return 1; @@ -1687,7 +1687,7 @@ static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile, vobu_admap_t *vobu_admap, - unsigned int sector) { + unsigned int sector) { unsigned int i; int info_length; @@ -1711,7 +1711,7 @@ } if(info_length && !(DVDReadBytes(ifofile->file, - vobu_admap->vobu_start_sectors, info_length))) { + vobu_admap->vobu_start_sectors, info_length))) { free(vobu_admap->vobu_start_sectors); return 0; } @@ -1986,9 +1986,9 @@ return 0; } /* - * FIXME: Iterate and verify that all menus that should exists accordingly - * to pgci_ut->lu[i].exists really do? - */ + * FIXME: Iterate and verify that all menus that should exists accordingly + * to pgci_ut->lu[i].exists really do? + */ } return 1; @@ -2180,7 +2180,7 @@ return 1; if(!DVDFileSeek_(ifofile->file, - ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN)) + ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN)) return 0; txtdt_mgi = (txtdt_mgi_t *)malloc(sizeof(txtdt_mgi_t));
--- a/md5.c Sun Sep 14 20:53:47 2008 +0000 +++ b/md5.c Tue Sep 23 09:14:45 2008 +0000 @@ -40,7 +40,7 @@ #endif #ifdef WORDS_BIGENDIAN -# define SWAP(n) \ +# define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #else # define SWAP(n) (n) @@ -110,7 +110,7 @@ /* Put the 64-bit file length in *bits* at the end of the buffer. */ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | - (ctx->total[0] >> 29)); + (ctx->total[0] >> 29)); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); @@ -139,28 +139,28 @@ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the - computation function processes the whole buffer so that with the - next round of the loop another block can be read. */ + computation function processes the whole buffer so that with the + next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ do - { - n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); + { + n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); - sum += n; - } + sum += n; + } while (sum < BLOCKSIZE && n != 0); if (n == 0 && ferror (stream)) return 1; /* If end of file is reached, end the loop. */ if (n == 0) - break; + break; /* Process buffer with BLOCKSIZE bytes. Note that - BLOCKSIZE % 64 == 0 + BLOCKSIZE % 64 == 0 */ md5_process_block (buffer, BLOCKSIZE, &ctx); } @@ -214,13 +214,13 @@ ctx->buflen += add; if (left_over + add > 64) - { - md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx); - /* The regions in the following copy operation cannot overlap. */ - memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], - (left_over + add) & 63); - ctx->buflen = (left_over + add) & 63; - } + { + md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx); + /* The regions in the following copy operation cannot overlap. */ + memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], + (left_over + add) & 63); + ctx->buflen = (left_over + add) & 63; + } buffer = (const char *) buffer + add; len -= add; @@ -288,27 +288,27 @@ md5_uint32 D_save = D; /* First round: using the given function, the context and a constant - the next context is computed. Because the algorithms processing - unit is a 32-bit word and it is determined to work on words in - little endian byte order we perhaps have to change the byte order - before the computation. To reduce the work for the next steps - we store the swapped words in the array CORRECT_WORDS. */ + the next context is computed. Because the algorithms processing + unit is a 32-bit word and it is determined to work on words in + little endian byte order we perhaps have to change the byte order + before the computation. To reduce the work for the next steps + we store the swapped words in the array CORRECT_WORDS. */ -#define OP(a, b, c, d, s, T) \ - do \ - { \ - a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ - ++words; \ - a = rol (a, s); \ - a += b; \ - } \ +#define OP(a, b, c, d, s, T) \ + do \ + { \ + a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ + ++words; \ + a = rol (a, s); \ + a += b; \ + } \ while (0) /* Before we start, one word to the strange constants. - They are defined in RFC 1321 as + They are defined in RFC 1321 as - T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or - perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' + T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or + perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' */ /* Round 1. */ @@ -330,16 +330,16 @@ OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words - in CORRECT_WORDS. Redefine the macro to take an additional first - argument specifying the function to use. */ + in CORRECT_WORDS. Redefine the macro to take an additional first + argument specifying the function to use. */ #undef OP -#define OP(f, a, b, c, d, k, s, T) \ - do \ - { \ - a += f (b, c, d) + correct_words[k] + T; \ - a = rol (a, s); \ - a += b; \ - } \ +#define OP(f, a, b, c, d, k, s, T) \ + do \ + { \ + a += f (b, c, d) + correct_words[k] + T; \ + a = rol (a, s); \ + a += b; \ + } \ while (0) /* Round 2. */
--- a/md5.h Sun Sep 14 20:53:47 2008 +0000 +++ b/md5.h Tue Sep 23 09:14:45 2008 +0000 @@ -72,9 +72,9 @@ #undef __P #if defined (__STDC__) && __STDC__ -#define __P(x) x +#define __P(x) x #else -#define __P(x) () +#define __P(x) () #endif /* Structure to save state of computation between the single steps. */ @@ -104,14 +104,14 @@ starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void md5_process_block __P ((const void *buffer, size_t len, - struct md5_ctx *ctx)); + struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void md5_process_bytes __P ((const void *buffer, size_t len, - struct md5_ctx *ctx)); + struct md5_ctx *ctx)); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little @@ -150,8 +150,8 @@ rol(md5_uint32 x, int n) { __asm__("roll %%cl,%0" - :"=r" (x) - :"0" (x),"c" (n)); + :"=r" (x) + :"0" (x),"c" (n)); return x; } #else
--- a/nav_print.c Sun Sep 14 20:53:47 2008 +0000 +++ b/nav_print.c Tue Sep 23 09:14:45 2008 +0000 @@ -69,7 +69,7 @@ for(i = 0; i < 9; i++) if(nsml_agli->nsml_agl_dsta[i]) printf("nsml_agl_c%d_dsta 0x%08x\n", i + 1, - nsml_agli->nsml_agl_dsta[i]); + nsml_agli->nsml_agl_dsta[i]); } static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) { @@ -110,8 +110,8 @@ for(i = 0; i < 3; i++) for(j = 0; j < 2; j++) printf("btn_cqoli %d %s_coli: %08x\n", - i, (j == 0) ? "sl" : "ac", - btn_colit->btn_coli[i][j]); + i, (j == 0) ? "sl" : "ac", + btn_colit->btn_coli[i][j]); } static void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) { @@ -127,21 +127,21 @@ 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]; + 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("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); + 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"); + /* ifoPrint_COMMAND(&btni->cmd); */ + printf("\n"); } } } @@ -205,14 +205,14 @@ printf("sml_agli:\n"); for(i = 0; i < 9; i++) { printf("agl_c%d address: 0x%08x size 0x%04x\n", i, - sml_agli->data[i].address, sml_agli->data[i].size); + sml_agli->data[i].address, sml_agli->data[i].size); } } static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) { int i; int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11, - 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; + 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); for(i = 0; i < 19; i++) {
--- a/nav_read.c Sun Sep 14 20:53:47 2008 +0000 +++ b/nav_read.c Tue Sep 23 09:14:45 2008 +0000 @@ -160,7 +160,7 @@ 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) - || (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)); } /* pci hli btnit */ @@ -175,27 +175,27 @@ CHECK_VALUE(pci->hli.btnit[n].zero6 == 0); 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); - CHECK_VALUE(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns); - CHECK_VALUE(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns); - CHECK_VALUE(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns); - /* vmcmd_verify(pci->hli.btnit[n].cmd); */ + 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); + CHECK_VALUE(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns); + CHECK_VALUE(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns); + CHECK_VALUE(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns); + /* vmcmd_verify(pci->hli.btnit[n].cmd); */ } else { - int k; - CHECK_VALUE(pci->hli.btnit[n].btn_coln == 0); - CHECK_VALUE(pci->hli.btnit[n].auto_action_mode == 0); - CHECK_VALUE(pci->hli.btnit[n].x_start == 0); - CHECK_VALUE(pci->hli.btnit[n].y_start == 0); - CHECK_VALUE(pci->hli.btnit[n].x_end == 0); - CHECK_VALUE(pci->hli.btnit[n].y_end == 0); - CHECK_VALUE(pci->hli.btnit[n].up == 0); - CHECK_VALUE(pci->hli.btnit[n].down == 0); - CHECK_VALUE(pci->hli.btnit[n].left == 0); - CHECK_VALUE(pci->hli.btnit[n].right == 0); - for (k = 0; k < 8; k++) - CHECK_VALUE(pci->hli.btnit[n].cmd.bytes[k] == 0); /* CHECK_ZERO? */ + int k; + CHECK_VALUE(pci->hli.btnit[n].btn_coln == 0); + CHECK_VALUE(pci->hli.btnit[n].auto_action_mode == 0); + CHECK_VALUE(pci->hli.btnit[n].x_start == 0); + CHECK_VALUE(pci->hli.btnit[n].y_start == 0); + CHECK_VALUE(pci->hli.btnit[n].x_end == 0); + CHECK_VALUE(pci->hli.btnit[n].y_end == 0); + CHECK_VALUE(pci->hli.btnit[n].up == 0); + CHECK_VALUE(pci->hli.btnit[n].down == 0); + CHECK_VALUE(pci->hli.btnit[n].left == 0); + CHECK_VALUE(pci->hli.btnit[n].right == 0); + for (k = 0; k < 8; k++) + CHECK_VALUE(pci->hli.btnit[n].cmd.bytes[k] == 0); /* CHECK_ZERO? */ } } }