Mercurial > libdvdnav.hg
comparison dvdread/dvd_udf.c @ 357:8949e15ebbd4 src
cosmetics: fewer useless braces
author | nicodvb |
---|---|
date | Sat, 10 May 2008 20:21:37 +0000 |
parents | da4ae9160df7 |
children | e998b2df2200 |
comparison
equal
deleted
inserted
replaced
356:da4ae9160df7 | 357:8949e15ebbd4 |
---|---|
151 int n; | 151 int n; |
152 for(n = 0; n < c->lb_num; n++) | 152 for(n = 0; n < c->lb_num; n++) |
153 free(c->lbs[n].data_base); | 153 free(c->lbs[n].data_base); |
154 free(c->lbs); | 154 free(c->lbs); |
155 } | 155 } |
156 if(c->maps) { | 156 if(c->maps) |
157 free(c->maps); | 157 free(c->maps); |
158 } | |
159 free(c); | 158 free(c); |
160 } | 159 } |
161 | 160 |
162 | 161 |
163 static int GetUDFCache(dvd_reader_t *device, UDFCacheType type, | 162 static int GetUDFCache(dvd_reader_t *device, UDFCacheType type, |
226 uint32_t nr, void *data) | 225 uint32_t nr, void *data) |
227 { | 226 { |
228 int n; | 227 int n; |
229 struct udf_cache *c; | 228 struct udf_cache *c; |
230 | 229 |
231 if(DVDUDFCacheLevel(device, -1) <= 0) { | 230 if(DVDUDFCacheLevel(device, -1) <= 0) |
232 return 0; | 231 return 0; |
233 } | |
234 | 232 |
235 c = (struct udf_cache *)GetUDFCacheHandle(device); | 233 c = (struct udf_cache *)GetUDFCacheHandle(device); |
236 | 234 |
237 if(c == NULL) { | 235 if(c == NULL) { |
238 c = calloc(1, sizeof(struct udf_cache)); | 236 c = calloc(1, sizeof(struct udf_cache)); |
501 memcpy(File, &tmpmap.file, sizeof(tmpmap.file)); | 499 memcpy(File, &tmpmap.file, sizeof(tmpmap.file)); |
502 return 1; | 500 return 1; |
503 } | 501 } |
504 | 502 |
505 do { | 503 do { |
506 if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) { | 504 if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) |
507 TagID = 0; | 505 TagID = 0; |
508 } else { | 506 else |
509 UDFDescriptor( LogBlock, &TagID ); | 507 UDFDescriptor( LogBlock, &TagID ); |
510 } | |
511 | 508 |
512 if( TagID == 261 ) { | 509 if( TagID == 261 ) { |
513 UDFFileEntry( LogBlock, FileType, partition, File ); | 510 UDFFileEntry( LogBlock, FileType, partition, File ); |
514 memcpy(&tmpmap.file, File, sizeof(tmpmap.file)); | 511 memcpy(&tmpmap.file, File, sizeof(tmpmap.file)); |
515 tmpmap.filetype = *FileType; | 512 tmpmap.filetype = *FileType; |
572 uint8_t *data[2]; | 569 uint8_t *data[2]; |
573 data[0] = cached_dir_base; | 570 data[0] = cached_dir_base; |
574 data[1] = cached_dir; | 571 data[1] = cached_dir; |
575 SetUDFCache(device, LBUDFCache, lbnum, data); | 572 SetUDFCache(device, LBUDFCache, lbnum, data); |
576 } | 573 } |
577 } else { | 574 } else |
578 in_cache = 1; | 575 in_cache = 1; |
579 } | |
580 | 576 |
581 if(cached_dir == NULL) | 577 if(cached_dir == NULL) |
582 return 0; | 578 return 0; |
583 | 579 |
584 p = 0; | 580 p = 0; |
635 p += UDFFileIdentifier( &directory[ p ], &filechar, | 631 p += UDFFileIdentifier( &directory[ p ], &filechar, |
636 filename, FileICB ); | 632 filename, FileICB ); |
637 if( !strcasecmp( FileName, filename ) ) { | 633 if( !strcasecmp( FileName, filename ) ) { |
638 return 1; | 634 return 1; |
639 } | 635 } |
640 } else { | 636 } else |
641 return 0; | 637 return 0; |
642 } | |
643 } | 638 } |
644 | 639 |
645 return 0; | 640 return 0; |
646 } | 641 } |
647 | 642 |
690 } else { | 685 } else { |
691 /* Unable to find last sector */ | 686 /* Unable to find last sector */ |
692 return 0; | 687 return 0; |
693 } | 688 } |
694 } | 689 } |
695 } else { | 690 } else |
696 /* It's an anchor! We can leave */ | 691 /* It's an anchor! We can leave */ |
697 break; | 692 break; |
698 } | |
699 } | 693 } |
700 /* Main volume descriptor */ | 694 /* Main volume descriptor */ |
701 UDFExtentAD( &Anchor[ 16 ], &MVDS_length, &MVDS_location ); | 695 UDFExtentAD( &Anchor[ 16 ], &MVDS_length, &MVDS_location ); |
702 avdp->mvds.location = MVDS_location; | 696 avdp->mvds.location = MVDS_location; |
703 avdp->mvds.length = MVDS_length; | 697 avdp->mvds.length = MVDS_length; |
741 do { | 735 do { |
742 /* Find Volume Descriptor */ | 736 /* Find Volume Descriptor */ |
743 lbnum = MVDS_location; | 737 lbnum = MVDS_location; |
744 do { | 738 do { |
745 | 739 |
746 if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) { | 740 if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) |
747 TagID = 0; | 741 TagID = 0; |
748 } else { | 742 else |
749 UDFDescriptor( LogBlock, &TagID ); | 743 UDFDescriptor( LogBlock, &TagID ); |
750 } | |
751 | 744 |
752 if( ( TagID == 5 ) && ( !part->valid ) ) { | 745 if( ( TagID == 5 ) && ( !part->valid ) ) { |
753 /* Partition Descriptor */ | 746 /* Partition Descriptor */ |
754 UDFPartition( LogBlock, &part->Flags, &part->Number, | 747 UDFPartition( LogBlock, &part->Flags, &part->Number, |
755 part->Contents, &part->Start, &part->Length ); | 748 part->Contents, &part->Start, &part->Length ); |