mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-19 01:15:12 -04:00
[ui] prevent flicker on large FAT32 format.c
* Also convert 1.4TB FAT32 autolabel to 1_4TB rather than 14TB and use 2 decimal points rather than 1
This commit is contained in:
parent
2945389edc
commit
5b2e4d1721
3 changed files with 16 additions and 13 deletions
15
src/format.c
15
src/format.c
|
@ -205,8 +205,8 @@ static void ToValidLabel(WCHAR* name, BOOL bFAT)
|
|||
{
|
||||
size_t i, j, k;
|
||||
BOOL found;
|
||||
WCHAR unauthorized[] = L"*?.,;:/\\|+=<>[]";
|
||||
WCHAR to_underscore[] = L"\t";
|
||||
WCHAR unauthorized[] = L"*?,;:/\\|+=<>[]";
|
||||
WCHAR to_underscore[] = L"\t.";
|
||||
|
||||
if (name == NULL)
|
||||
return;
|
||||
|
@ -331,7 +331,7 @@ static DWORD GetFATSizeSectors(DWORD DskSize, DWORD ReservedSecCnt, DWORD SecPer
|
|||
static BOOL FormatFAT32(DWORD DriveIndex)
|
||||
{
|
||||
BOOL r = FALSE;
|
||||
DWORD i;
|
||||
DWORD i, LastRefresh = 0;
|
||||
HANDLE hLogicalVolume;
|
||||
DWORD cbRet;
|
||||
DISK_GEOMETRY dgDrive;
|
||||
|
@ -549,9 +549,12 @@ static BOOL FormatFAT32(DWORD DriveIndex)
|
|||
|
||||
format_percent = 0.0f;
|
||||
for (i=0; i<(SystemAreaSize+BurstSize-1); i+=BurstSize) {
|
||||
format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize));
|
||||
PrintStatus(0, FALSE, "Formatting: %d%% completed.", (int)format_percent);
|
||||
UpdateProgress(OP_FORMAT, format_percent);
|
||||
if (GetTickCount() > LastRefresh + 25) {
|
||||
LastRefresh = GetTickCount();
|
||||
format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize));
|
||||
PrintStatus(0, FALSE, "Formatting: %0.1f%% completed.", format_percent);
|
||||
UpdateProgress(OP_FORMAT, format_percent);
|
||||
}
|
||||
if (IS_ERROR(FormatStatus)) goto out; // For cancellation
|
||||
if (write_sectors(hLogicalVolume, BytesPerSect, i, BurstSize, pZeroSect) != (BytesPerSect*BurstSize)) {
|
||||
die("Error clearing reserved sectors\n", ERROR_WRITE_FAULT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue