diff --git a/Main/src/CapsBase.cpp b/Main/src/CapsBase.cpp index b59f6514..920cc265 100644 --- a/Main/src/CapsBase.cpp +++ b/Main/src/CapsBase.cpp @@ -179,13 +179,13 @@ : CTrackReaderWriter(trw) // - initialization , modified(false) - , nSectors(nSectors) , sectors( nSectors, sectors ) { + , sectors( nSectors, sectors ) { RewindToIndex(0); } CCapsBase::CInternalTrack::~CInternalTrack(){ // dtor - for( TSector i=0; i{Lock,Unlock} if (rit){ // may be Null if, e.g., device manually reset, disconnected, etc. - if (GetCountOfHealthySectors(cyl,head)>0 || !rit->nSectors // Track at least partly healthy or without known Sectors + if (GetCountOfHealthySectors(cyl,head)>0 || !rit->sectors.length // Track at least partly healthy or without known Sectors || params.calibrationAfterError==TParams::TCalibrationAfterError::NONE // calibration disabled ) break; if (params.calibrationAfterErrorOnlyForKnownSectors && dos->IsKnown()){ bool knownSectorBad=false; // assumption (the Track is unhealthy due to an irrelevant Unknown Sector, e.g. out of geometry) - for( TSector s=0; snSectors; s++ ){ + for( TSector s=0; ssectors.length; s++ ){ const TInternalSector &is=rit->sectors[s]; const TPhysicalAddress chs={ cyl, head, is.id }; if (!dos->IsStdSector(chs)) @@ -609,7 +609,7 @@ } // - scanning the Track if (const PCInternalTrack pit=rit){ - for( TSector s=0; snSectors; s++ ){ + for( TSector s=0; ssectors.length; s++ ){ const TInternalSector &ris=pit->sectors[s]; if (bufferId) *bufferId++=ris.id; @@ -628,7 +628,7 @@ *pCodec=pit->GetCodec(); if (pAvgGap3) *pAvgGap3=FDD_350_SECTOR_GAP3*2/3; // TODO - return pit->nSectors; + return pit->sectors.length; }else return 0; } @@ -665,7 +665,7 @@ // . searching for the Sector on the Track const TSectorId sectorId=*bufferId++; TInternalSector *pis=pit->sectors; - TSector n=pit->nSectors; + TSector n=pit->sectors.length; for( BYTE nSectorsToSkip=*bufferNumbersOfSectorsToSkip++; n>0; n--,pis++ ) if (nSectorsToSkip) nSectorsToSkip--; @@ -736,7 +736,7 @@ ASSERT( revnSectors){ + while (nSectorsToSkipsectors.length){ const auto &ris=pit->sectors[nSectorsToSkip++]; if (ris.id==id) if (rev>=ris.nRevolutions) @@ -754,7 +754,7 @@ Revolution::TType CCapsBase::GetDirtyRevolution(RCPhysicalAddress chs,BYTE nSectorsToSkip) const{ // returns the Revolution that has been marked as "dirty" if (const PCInternalTrack pit=GetInternalTrackSafe(chs.cylinder,chs.head)) - while (nSectorsToSkipnSectors){ + while (nSectorsToSkipsectors.length){ const auto &ris=pit->sectors[nSectorsToSkip++]; if (ris.id==chs.sectorId) return ris.dirtyRevolution; @@ -790,7 +790,7 @@ CInternalTrack::CreateFrom( *this, trw, rOutMediumType=(Medium::TType)type ) ) ){ - const TSector nRecognizedSectors=rit->nSectors; + const TSector nRecognizedSectors=rit->sectors.length; if (WORD score= nRecognizedSectors + 32*GetCountOfHealthySectors(cyl,0)){ if (Medium::GetProperties( (Medium::TType)type )->IsAcceptableRevolutionTime( trw.GetAvgIndexDistance() )) score|=0x8000; @@ -1013,12 +1013,12 @@ const Utils::CVarTempReset pit0( internalTracks[cyl][head], nullptr ); // forcing rescan ScanTrack( cyl, head ); if (const PInternalTrack pitVerif=internalTracks[cyl][head]){ - if (pitVerif->nSectors>0 || !cancelled){ + if (pitVerif->sectors.length>0 || !cancelled){ const PInternalTrack pitWritten=CInternalTrack::CreateFrom( *this, trwWritten, floppyType ); // . comparing common cells between first two Indices - const auto &revWrittenFirstSector=pitWritten->sectors[0].revolutions[0]; + const auto &revWrittenFirstSector=pitWritten->sectors[(TSector)0].revolutions[0]; pitWritten->SetCurrentTimeAndProfile( revWrittenFirstSector.idEndTime, revWrittenFirstSector.idEndProfile ); - const auto &revVerifFirstSector=pitVerif->sectors[0].revolutions[0]; + const auto &revVerifFirstSector=pitVerif->sectors[(TSector)0].revolutions[0]; pitVerif->SetCurrentTimeAndProfile( revVerifFirstSector.idEndTime, revVerifFirstSector.idEndProfile ); while ( *pitWritten && pitWritten->GetCurrentTime()GetIndexTime(1) diff --git a/Main/src/CapsBase.h b/Main/src/CapsBase.h index 03b58b75..e97505fe 100644 --- a/Main/src/CapsBase.h +++ b/Main/src/CapsBase.h @@ -73,8 +73,7 @@ static CInternalTrack *CreateFrom(const CCapsBase &cb,const CapsTrackInfoT2 *ctiRevs,BYTE nRevs,UDWORD lockFlags); static CInternalTrack *CreateFrom(const CCapsBase &cb,CTrackReaderWriter trw,Medium::TType floppyType=Medium::UNKNOWN); - const TSector nSectors; - const Utils::CCallocPtr sectors; + const Utils::CCallocPtr sectors; bool modified; ~CInternalTrack(); diff --git a/Main/src/CapsBase_Mining.cpp b/Main/src/CapsBase_Mining.cpp index 55839bff..4ae06fac 100644 --- a/Main/src/CapsBase_Mining.cpp +++ b/Main/src/CapsBase_Mining.cpp @@ -79,7 +79,7 @@ TARGET_ALL_STD_SECTORS_PRESENT ); } - if (pit && pit->nSectors){ + if (pit && pit->sectors.length){ cbx.SetItemData( cbx.AddString(_T("All current sectors healthy")), TARGET_ALL_CURRENT_SECTORS_HEALTHY diff --git a/Main/src/KryoFluxBase.cpp b/Main/src/KryoFluxBase.cpp index 5c732ee9..a37bf5e9 100644 --- a/Main/src/KryoFluxBase.cpp +++ b/Main/src/KryoFluxBase.cpp @@ -59,7 +59,7 @@ if (chs.cylinder>capsImageInfo.maxcylinder || chs.head>capsImageInfo.maxhead) return ERROR_INVALID_PARAMETER; if (const PInternalTrack pit=internalTracks[chs.cylinder][chs.head]){ - while (nSectorsToSkipnSectors){ + while (nSectorsToSkipsectors.length){ auto &ris=pit->sectors[nSectorsToSkip++]; if (ris.id==chs.sectorId){ ASSERT( ris.dirtyRevolution>=Revolution::MAX||ris.dirtyRevolution==ris.currentRevolution ); // no Revolution yet marked as "dirty" or marking "dirty" the same Revolution diff --git a/Main/src/KryoFluxDevice.cpp b/Main/src/KryoFluxDevice.cpp index 04cf9e4c..f5ae4f60 100644 --- a/Main/src/KryoFluxDevice.cpp +++ b/Main/src/KryoFluxDevice.cpp @@ -695,7 +695,7 @@ for( BYTE i=1; iGetIndexCount(); i++ ){ const BYTE r=i-1; TSector nHealthySectors=0; bool hasDataOverIndex=false; // assumptions - for( TSector s=0; snSectors; s++ ){ + for( TSector s=0; ssectors.length; s++ ){ pit->ReadSector( pit->sectors[s], r ); const auto &rev=pit->sectors[s].revolutions[r]; if (pit->GetIndexTime(i)nSectors) // best possible Revolution found? + if (bestRev.nHealthySectors==pit->sectors.length) // best possible Revolution found? break; } // . extracting the minimum number of fluxes into the temporary Track const TLogTime tIndex0=pit->RewindToIndex(bestRev.i), tIndex1=pit->GetIndexTime(bestRev.i+1); TLogTime tWritingEnd=tIndex1; if (bestRev.hasDataOverIndex){ - const auto &firstSector=pit->sectors[0]; + const auto &firstSector=pit->sectors[(TSector)0]; TLogTime tOverhang=INT_MAX; for( BYTE r=0; rnSectors>0){ // can verify the Track only if A&B&C, A = writing successfull, B&C = at least one Sector is recognized in it + if (!err && params.verifyWrittenTracks && pit->sectors.length>0){ // can verify the Track only if A&B&C, A = writing successfull, B&C = at least one Sector is recognized in it const Utils::CVarTempReset cae0( params.calibrationAfterError, TParams::TCalibrationAfterError::NONE ); // already calibrated before writing const Utils::CVarTempReset p0( params.precision, TParams::TPrecision::SINGLE ); std::unique_ptr pVerifiedTrack;