From 5b2e4d1721c8bb716d92495801a4afba5a4a7347 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sun, 22 Sep 2013 03:54:50 +0100 Subject: [PATCH] [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 --- src/format.c | 15 +++++++++------ src/rufus.c | 4 ++-- src/rufus.rc | 10 +++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/format.c b/src/format.c index 567e101c..dd639df7 100644 --- a/src/format.c +++ b/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); diff --git a/src/rufus.c b/src/rufus.c index e15b4a94..f0739dbc 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -545,13 +545,13 @@ static BOOL PopulateProperties(int ComboIndex) HumanReadableSize *= 1024.0; i--; } - // If we're beneath the tolerance, round proposed label to an integer, if not, show one decimal point + // If we're beneath the tolerance, round proposed label to an integer, if not, show two decimal point if (fabs(HumanReadableSize / ceil(HumanReadableSize) - 1.0) < PROPOSEDLABEL_TOLERANCE) { safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label), "%0.0f%s", ceil(HumanReadableSize), suffix[i]); } else { safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label), - "%0.1f%s", HumanReadableSize, suffix[i]); + "%0.2f%s", HumanReadableSize, suffix[i]); } // If no existing label is available and no ISO is selected, propose one according to the size (eg: "256MB", "8GB") diff --git a/src/rufus.rc b/src/rufus.rc index 284c6e79..c51b34d3 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,7 +30,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.3.4.277" +CAPTION "Rufus v1.3.4.278" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -278,8 +278,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,4,277 - PRODUCTVERSION 1,3,4,277 + FILEVERSION 1,3,4,278 + PRODUCTVERSION 1,3,4,278 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -296,13 +296,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.3.4.277" + VALUE "FileVersion", "1.3.4.278" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.3.4.277" + VALUE "ProductVersion", "1.3.4.278" END END BLOCK "VarFileInfo"