# HG changeset patch # User nicodvb # Date 1210452780 0 # Node ID b6fa98f690eea42adab981a1048756e94e6b7193 # Parent e2973c342e59f35956060849d66df618d9cf5e3f more braces removed diff -r e2973c342e59 -r b6fa98f690ee dvdread/dvd_udf.c --- a/dvdread/dvd_udf.c Sat May 10 20:46:42 2008 +0000 +++ b/dvdread/dvd_udf.c Sat May 10 20:53:00 2008 +0000 @@ -236,9 +236,8 @@ if(c == NULL) { c = calloc(1, sizeof(struct udf_cache)); /* fprintf(stderr, "calloc: %d\n", sizeof(struct udf_cache)); */ - if(c == NULL) { + if(c == NULL) return 0; - } SetUDFCacheHandle(device, c); } @@ -555,9 +554,9 @@ if(!GetUDFCache(device, LBUDFCache, lbnum, &cached_dir)) { dir_lba = (Dir.Length + DVD_VIDEO_LB_LEN) / DVD_VIDEO_LB_LEN; - if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL) { + if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL) return 0; - } + cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~((uintptr_t)2047)) + 2048); if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) { free(cached_dir_base); @@ -679,13 +678,12 @@ terminate = 1; } else { /* TODO: Find last sector of the disc (this is optional). */ - if( lastsector ) { + if( lastsector ) /* Try #2, backup anchor */ lbnum = lastsector - 256; - } else { + else /* Unable to find last sector */ return 0; - } } } else /* It's an anchor! We can leave */ @@ -749,7 +747,7 @@ part->valid = ( partnum == part->Number ); } else if( ( TagID == 6 ) && ( !volvalid ) ) { /* Logical Volume Descriptor */ - if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) { + if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) { /* TODO: sector size wrong! */ } else volvalid = 1;