| 72 | } |
| 73 | |
| 74 | void Image::calculateSize() |
| 75 | { |
| 76 | _geometry = {}; |
| 77 | unsigned maxSector = 0; |
| 78 | for (const auto& i : _sectors) |
| 79 | { |
| 80 | const auto& sector = i.second; |
| 81 | if (sector) |
| 82 | { |
| 83 | _geometry.numCylinders = std::max( |
| 84 | _geometry.numCylinders, (unsigned)sector->logicalCylinder + 1); |
| 85 | _geometry.numHeads = |
| 86 | std::max(_geometry.numHeads, (unsigned)sector->logicalHead + 1); |
| 87 | _geometry.firstSector = std::min( |
| 88 | _geometry.firstSector, (unsigned)sector->logicalSector); |
| 89 | maxSector = std::max(maxSector, (unsigned)sector->logicalSector); |
| 90 | _geometry.sectorSize = |
| 91 | std::max(_geometry.sectorSize, sector->data.size()); |
| 92 | _geometry.totalBytes += _geometry.sectorSize; |
| 93 | } |
| 94 | } |
| 95 | _geometry.numSectors = maxSector - _geometry.firstSector + 1; |
| 96 | } |
| 97 | |
| 98 | void Image::populateSectorPhysicalLocationsFromLogicalLocations( |
| 99 | const DiskLayout& diskLayout) |
no test coverage detected