Added a new PartitionMap::CountNonEmptyPartitions() - now, a partition map

is only accepted when there is at least one valid partition in it.
Before, the module would accept even the BFS boot loader which is now less
likely (IOW you can now boot with Bochs again).
Also, if there was one invalid partition, the partitions that come after
it are no longer ignored.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12228 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-04-04 14:01:34 +00:00
parent 597c7235b9
commit 311049d751
3 changed files with 21 additions and 2 deletions
@@ -327,6 +327,19 @@ PartitionMap::CountPartitions() const
return count;
}
// CountNonEmptyPartitions
int32
PartitionMap::CountNonEmptyPartitions() const
{
int32 count = 0;
for (int32 i = CountPartitions() - 1; i >= 0; i--) {
if (!PartitionAt(i)->IsEmpty())
count++;
}
return count;
}
// PartitionAt
Partition *
PartitionMap::PartitionAt(int32 index)