From 3d8229dc67106135c815dfa4204b9d74050b4992 Mon Sep 17 00:00:00 2001 From: Tyler Dauwalder Date: Tue, 11 Nov 2003 09:08:40 +0000 Subject: [PATCH] - Got rid of some warnings - Changed a variable name to eliminate shadowing. - Fixed (I think) N and N-256 avdp locations. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5315 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/udf/Recognition.cpp | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/add-ons/kernel/file_systems/udf/Recognition.cpp b/src/add-ons/kernel/file_systems/udf/Recognition.cpp index 2d81530f96..119f521d20 100644 --- a/src/add-ons/kernel/file_systems/udf/Recognition.cpp +++ b/src/add-ons/kernel/file_systems/udf/Recognition.cpp @@ -61,13 +61,13 @@ Udf::udf_recognize(int device, off_t offset, off_t length, uint32 blockSize, // Now hunt down a volume descriptor sequence from one of // the anchor volume pointers (if there are any). - if (!err) + if (!err) { err = walk_anchor_volume_descriptor_sequences(device, offset, length, blockSize, blockShift, logicalVolumeDescriptor, partitionDescriptors, partitionDescriptorCount); - + } RETURN(err); } @@ -174,8 +174,8 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length, const uint8 avds_location_count = 4; const off_t avds_locations[avds_location_count] = { 256, - length-256, - length, + length-1-256, + length-1, 512, }; bool found_vds = false; @@ -224,10 +224,10 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length, PRINT(("block %Ld: found valid vds\n", avds_locations[i])); found_vds = true; break; - } //else { + } else { // Both failed, so loop around and try another avds -// PRINT(("block %Ld: vds search failed\n", avds_locations[i])); -// } + PRINT(("block %Ld: vds search failed\n", avds_locations[i])); + } } status_t err = found_vds ? B_OK : B_ERROR; RETURN(err); @@ -244,7 +244,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, DEBUG_INIT_ETC(CF_PRIVATE, NULL, ("descriptorSequence.loc:%ld, descriptorSequence.len:%ld", descriptorSequence.location(), descriptorSequence.length())); uint32 count = descriptorSequence.length() >> blockShift; - + bool foundLogicalVolumeDescriptor = false; uint8 uniquePartitions = 0; status_t err = B_OK; @@ -252,7 +252,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, for (uint32 i = 0; i < count; i++) { off_t block = descriptorSequence.location()+i; - off_t address = block << blockShift; //AddressForRelativeBlock(block); + off_t address = block << blockShift; MemoryChunk chunk(blockSize); udf_tag *tag = NULL; @@ -281,6 +281,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, { udf_primary_descriptor *primary = reinterpret_cast(tag); PDUMP(primary); + (void)primary; // kill the warning break; } @@ -294,6 +295,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, { udf_implementation_use_descriptor *imp_use = reinterpret_cast(tag); PDUMP(imp_use); + (void)imp_use; // kill the warning break; } @@ -306,20 +308,20 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, // the same number as this partition. If found, keep the one with // the higher vds number. bool foundDuplicate = false; - int i; - for (i = 0; i < uniquePartitions; i++) { - if (partitionDescriptors[i].partition_number() + int num; + for (num = 0; num < uniquePartitions; num++) { + if (partitionDescriptors[num].partition_number() == partition->partition_number()) { foundDuplicate = true; - if (partitionDescriptors[i].vds_number() + if (partitionDescriptors[num].vds_number() < partition->vds_number()) { - partitionDescriptors[i] = *partition; + partitionDescriptors[num] = *partition; PRINT(("Replacing previous partition #%d (vds_number: %ld) with " "new partition #%d (vds_number: %ld)\n", - partitionDescriptors[i].partition_number(), - partitionDescriptors[i].vds_number(), + partitionDescriptors[num].partition_number(), + partitionDescriptors[num].vds_number(), partition->partition_number(), partition->vds_number())); } @@ -329,9 +331,9 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, // If we didn't find a duplicate, see if we have any open descriptor // spaces left. if (!foundDuplicate) { - if (i < Udf::kMaxPartitionDescriptors) { + if (num < Udf::kMaxPartitionDescriptors) { // At least one more partition descriptor allowed - partitionDescriptors[i] = *partition; + partitionDescriptors[num] = *partition; uniquePartitions++; PRINT(("Adding partition #%d (vds_number: %ld)\n", partition->partition_number(), @@ -383,6 +385,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, } else { logicalVolumeDescriptor = *logical; foundLogicalVolumeDescriptor = true; + DUMP(logicalVolumeDescriptor); } break; } @@ -391,13 +394,15 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence, { udf_unallocated_space_descriptor *unallocated = reinterpret_cast(tag); PDUMP(unallocated); + (void)unallocated; // kill the warning break; } case TAGID_TERMINATING_DESCRIPTOR: { udf_terminating_descriptor *terminating = reinterpret_cast(tag); - PDUMP(terminating); + PDUMP(terminating); + (void)terminating; // kill the warning break; }