mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Don't spin in an infinite loop if the decoder tries to find a data record and
the matcher fails to find anything, leaving the seek point unchanged.
This commit is contained in:
@@ -114,6 +114,8 @@ public:
|
||||
auto idbits = readRawBits(16);
|
||||
const Bytes idbytes = decodeFmMfm(idbits);
|
||||
uint8_t id = idbytes.slice(0, 1)[0];
|
||||
if (eof())
|
||||
return RecordType::UNKNOWN_RECORD;
|
||||
seek(here);
|
||||
|
||||
switch (id)
|
||||
|
||||
@@ -107,6 +107,7 @@ std::unique_ptr<TrackDataFlux> AbstractDecoder::decodeToSectors(
|
||||
break;
|
||||
if (fmr.eof())
|
||||
break;
|
||||
fmr.skipToEvent(F_BIT_PULSE);
|
||||
}
|
||||
recordStart = fmr.tell();
|
||||
if (r == DATA_RECORD)
|
||||
|
||||
@@ -57,6 +57,9 @@ public:
|
||||
void seek(const Fluxmap::Position& pos)
|
||||
{ return _fmr->seek(pos); }
|
||||
|
||||
bool eof() const
|
||||
{ return _fmr->eof(); }
|
||||
|
||||
virtual std::set<unsigned> requiredSectors(unsigned cylinder, unsigned head) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "bytes.h"
|
||||
#include "protocol.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
class RawBits;
|
||||
|
||||
@@ -17,6 +18,10 @@ public:
|
||||
|
||||
nanoseconds_t ns() const
|
||||
{ return ticks * NS_PER_TICK; }
|
||||
|
||||
operator std::string () {
|
||||
return fmt::format("[b:{}, t:{}, z:{}]", bytes, ticks, zeroes);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user