Report better error messages on Brother sector decode.

This commit is contained in:
David Given
2019-01-10 00:48:24 +01:00
parent 10a129d66b
commit 9ee230e179
2 changed files with 9 additions and 4 deletions

View File

@@ -9,12 +9,15 @@
class Sector
{
public:
enum
enum Status
{
OK,
BAD_CHECKSUM
BAD_CHECKSUM,
MISSING
};
static const std::string statusToString(Status status);
Sector(int status, int track, int side, int sector, const std::vector<uint8_t>& data):
status(status),
track(track),

View File

@@ -73,10 +73,12 @@ int main(int argc, const char* argv[])
for (int i=0; i<SECTOR_COUNT; i++)
{
auto& sector = readSectors[i];
if (!sector || (sector->status != Sector::OK))
Sector::Status status = sector ? (Sector::Status)sector->status : Sector::MISSING;
if (status != Sector::OK)
{
std::cout << std::endl
<< " Failed to read sector " << i << "; ";
<< " Failed to read sector " << i
<< " (" << Sector::statusToString(status) << "); ";
hasBadSectors = true;
}
}