Skip to content

Commit 397d85e

Browse files
committedFeb 5, 2024
[#49] Formatting/unformatting cylinders needs revision (Part 19: Minor improvements)
1 parent 45027c9 commit 397d85e

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed
 

‎Main/src/DialogFormatting.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
const LPCTSTR currMediumDesc=Medium::GetDescription((Medium::TType)ComboBox_GetItemData( hMedium, ComboBox_GetCurSel(hMedium) ));
164164
CImage::PopulateComboBoxWithCompatibleMedia( hMedium, dos->properties->supportedMedia, dos->image->properties );
165165
ComboBox_SelectString( hMedium, 0, currMediumDesc );
166-
::SetWindowPos( hMedium, nullptr, 0,0, rc.Width(),rc.Height(), SWP_NOZORDER|SWP_NOMOVE );
166+
SetDlgItemSize( ID_MEDIUM, rc.Width(), rc.Height() );
167167
::EnableWindow( hMedium, TRUE );
168168
}
169169
*pResult=0;

‎Main/src/Dos.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ reportError:Utils::Information(buf);
157157
return ERROR_EMPTY;
158158
}
159159

160+
TStdWinError CDos::IsStdTrackEmpty(TCylinder cyl,THead head) const{
161+
// returns ERROR_EMPTY/ERROR_NOT_EMPTY or another Windows standard i/o error
162+
TSectorId bufferId[(TSector)-1];
163+
return IsTrackEmpty( cyl, head, GetListOfStdSectors(cyl,head,bufferId), bufferId );
164+
}
165+
160166
CDos::TEmptyCylinderParams::TEmptyCylinderParams(const CDos *dos,TCylinder cylA,TCylinder cylZInclusive)
161167
: dos(dos)
162168
, cylA(cylA) , cylZInclusive(cylZInclusive) {
@@ -177,9 +183,8 @@ reportError:Utils::Information(buf);
177183
// - checking if range of Cylinders empty
178184
for( TCylinder cyl=ecp.cylA; cyl<=ecp.cylZInclusive; pAction->UpdateProgress(++cyl-ecp.cylA) ){
179185
if (pAction->Cancelled) return ERROR_CANCELLED;
180-
TSectorId bufferId[(TSector)-1];
181186
for( THead head=0; head<ecp.dos->formatBoot.nHeads; head++ ){
182-
const TStdWinError err=ecp.dos->IsTrackEmpty( cyl, head, ecp.dos->GetListOfStdSectors(cyl,head,bufferId), bufferId );
187+
const TStdWinError err=ecp.dos->IsStdTrackEmpty( cyl, head );
183188
if (err!=ERROR_EMPTY)
184189
return pAction->TerminateWithError(err);
185190
}

‎Main/src/Dos.h

+1
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@
400400
virtual TCylinder GetFirstCylinderWithEmptySector() const;
401401
TCylinder GetLastOccupiedStdCylinder() const;
402402
TStdWinError GetFirstEmptyHealthySector(bool skipBadSectors,TPhysicalAddress &rOutChs) const;
403+
TStdWinError IsStdTrackEmpty(TCylinder cyl,THead head) const;
403404
TStdWinError AreStdCylindersEmpty(TCylinder cylA,TCylinder cylZInclusive) const;
404405
bool AddStdCylindersToFatAsEmpty(TCylinder cylA,TCylinder cylZInclusive,CActionProgress &ap) const;
405406
bool RemoveStdCylindersFromFat(TCylinder cylA,TCylinder cylZInclusive,CActionProgress &ap) const;

‎Main/src/Dsk5.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,7 @@ formatError: ::SetLastError(ERROR_BAD_FORMAT);
536536
if (trackLength>0xff80) // 0xff80 = maximum for "standard" DSK, 0xff00 = maximum for Revision 5
537537
return ERROR_BAD_COMMAND;
538538
// - if Track already formatted, unformatting it
539-
if (__findTrack__(cyl,head))
540-
UnformatTrack(cyl,head);
539+
UnformatTrack(cyl,head);
541540
// - formatting Track
542541
do{
543542
if (cancelled)

0 commit comments

Comments
 (0)
Please sign in to comment.