comparison dvdread/dvd_udf.c @ 360:b6fa98f690ee src

more braces removed
author nicodvb
date Sat, 10 May 2008 20:53:00 +0000
parents e2973c342e59
children
comparison
equal deleted inserted replaced
359:e2973c342e59 360:b6fa98f690ee
234 c = (struct udf_cache *)GetUDFCacheHandle(device); 234 c = (struct udf_cache *)GetUDFCacheHandle(device);
235 235
236 if(c == NULL) { 236 if(c == NULL) {
237 c = calloc(1, sizeof(struct udf_cache)); 237 c = calloc(1, sizeof(struct udf_cache));
238 /* fprintf(stderr, "calloc: %d\n", sizeof(struct udf_cache)); */ 238 /* fprintf(stderr, "calloc: %d\n", sizeof(struct udf_cache)); */
239 if(c == NULL) { 239 if(c == NULL)
240 return 0; 240 return 0;
241 }
242 SetUDFCacheHandle(device, c); 241 SetUDFCacheHandle(device, c);
243 } 242 }
244 243
245 244
246 switch(type) { 245 switch(type) {
553 if(DVDUDFCacheLevel(device, -1) > 0) { 552 if(DVDUDFCacheLevel(device, -1) > 0) {
554 /* caching */ 553 /* caching */
555 554
556 if(!GetUDFCache(device, LBUDFCache, lbnum, &cached_dir)) { 555 if(!GetUDFCache(device, LBUDFCache, lbnum, &cached_dir)) {
557 dir_lba = (Dir.Length + DVD_VIDEO_LB_LEN) / DVD_VIDEO_LB_LEN; 556 dir_lba = (Dir.Length + DVD_VIDEO_LB_LEN) / DVD_VIDEO_LB_LEN;
558 if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL) { 557 if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL)
559 return 0; 558 return 0;
560 } 559
561 cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~((uintptr_t)2047)) + 2048); 560 cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~((uintptr_t)2047)) + 2048);
562 if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) { 561 if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
563 free(cached_dir_base); 562 free(cached_dir_base);
564 cached_dir_base = NULL; 563 cached_dir_base = NULL;
565 cached_dir = NULL; 564 cached_dir = NULL;
677 */ 676 */
678 lbnum = lastsector; 677 lbnum = lastsector;
679 terminate = 1; 678 terminate = 1;
680 } else { 679 } else {
681 /* TODO: Find last sector of the disc (this is optional). */ 680 /* TODO: Find last sector of the disc (this is optional). */
682 if( lastsector ) { 681 if( lastsector )
683 /* Try #2, backup anchor */ 682 /* Try #2, backup anchor */
684 lbnum = lastsector - 256; 683 lbnum = lastsector - 256;
685 } else { 684 else
686 /* Unable to find last sector */ 685 /* Unable to find last sector */
687 return 0; 686 return 0;
688 }
689 } 687 }
690 } else 688 } else
691 /* It's an anchor! We can leave */ 689 /* It's an anchor! We can leave */
692 break; 690 break;
693 } 691 }
747 UDFPartition( LogBlock, &part->Flags, &part->Number, 745 UDFPartition( LogBlock, &part->Flags, &part->Number,
748 part->Contents, &part->Start, &part->Length ); 746 part->Contents, &part->Start, &part->Length );
749 part->valid = ( partnum == part->Number ); 747 part->valid = ( partnum == part->Number );
750 } else if( ( TagID == 6 ) && ( !volvalid ) ) { 748 } else if( ( TagID == 6 ) && ( !volvalid ) ) {
751 /* Logical Volume Descriptor */ 749 /* Logical Volume Descriptor */
752 if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) { 750 if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) {
753 /* TODO: sector size wrong! */ 751 /* TODO: sector size wrong! */
754 } else 752 } else
755 volvalid = 1; 753 volvalid = 1;
756 } 754 }
757 755