mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Warn if two copies of the same sector are seen with different data.
This commit is contained in:
@@ -109,6 +109,21 @@ std::vector<std::unique_ptr<Track>> readTracks()
|
||||
return tracks;
|
||||
}
|
||||
|
||||
static void replace_sector(std::unique_ptr<Sector>& replacing, std::unique_ptr<Sector>& replacement)
|
||||
{
|
||||
if (replacing && (replacing->status == Sector::OK) && (replacement->status == Sector::OK))
|
||||
{
|
||||
if (replacement->data != replacing->data)
|
||||
{
|
||||
std::cout << std::endl
|
||||
<< " Multiple conflicting copies of sector " << replacing->sector
|
||||
<< " seen";
|
||||
}
|
||||
}
|
||||
if (!replacing || (replacing->status != Sector::OK))
|
||||
replacing = std::move(replacement);
|
||||
}
|
||||
|
||||
void readDiskCommand(AbstractDecoder& decoder, const std::string& outputFilename)
|
||||
{
|
||||
bool failures = false;
|
||||
@@ -140,8 +155,7 @@ void readDiskCommand(AbstractDecoder& decoder, const std::string& outputFilename
|
||||
for (auto& sector : sectors)
|
||||
{
|
||||
auto& replacing = readSectors[sector->sector];
|
||||
if (!replacing || (sector->status == Sector::OK))
|
||||
replacing = std::move(sector);
|
||||
replace_sector(replacing, sector);
|
||||
}
|
||||
|
||||
bool hasBadSectors = false;
|
||||
@@ -206,8 +220,7 @@ void readDiskCommand(AbstractDecoder& decoder, const std::string& outputFilename
|
||||
size += sector->data.size();
|
||||
|
||||
auto& replacing = allSectors.get(sector->track, sector->side, sector->sector);
|
||||
if (!replacing || (replacing->status != Sector::OK))
|
||||
replacing = std::move(sector);
|
||||
replace_sector(replacing, sector);
|
||||
}
|
||||
}
|
||||
std::cout << size << " bytes decoded." << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user