mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00: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;
|
size_t i, j, k;
|
||||||
BOOL found;
|
BOOL found;
|
||||||
WCHAR unauthorized[] = L"*?.,;:/\\|+=<>[]";
|
WCHAR unauthorized[] = L"*?,;:/\\|+=<>[]";
|
||||||
WCHAR to_underscore[] = L"\t";
|
WCHAR to_underscore[] = L"\t.";
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -331,7 +331,7 @@ static DWORD GetFATSizeSectors(DWORD DskSize, DWORD ReservedSecCnt, DWORD SecPer
|
||||||
static BOOL FormatFAT32(DWORD DriveIndex)
|
static BOOL FormatFAT32(DWORD DriveIndex)
|
||||||
{
|
{
|
||||||
BOOL r = FALSE;
|
BOOL r = FALSE;
|
||||||
DWORD i;
|
DWORD i, LastRefresh = 0;
|
||||||
HANDLE hLogicalVolume;
|
HANDLE hLogicalVolume;
|
||||||
DWORD cbRet;
|
DWORD cbRet;
|
||||||
DISK_GEOMETRY dgDrive;
|
DISK_GEOMETRY dgDrive;
|
||||||
|
@ -549,9 +549,12 @@ static BOOL FormatFAT32(DWORD DriveIndex)
|
||||||
|
|
||||||
format_percent = 0.0f;
|
format_percent = 0.0f;
|
||||||
for (i=0; i<(SystemAreaSize+BurstSize-1); i+=BurstSize) {
|
for (i=0; i<(SystemAreaSize+BurstSize-1); i+=BurstSize) {
|
||||||
format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize));
|
if (GetTickCount() > LastRefresh + 25) {
|
||||||
PrintStatus(0, FALSE, "Formatting: %d%% completed.", (int)format_percent);
|
LastRefresh = GetTickCount();
|
||||||
UpdateProgress(OP_FORMAT, format_percent);
|
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 (IS_ERROR(FormatStatus)) goto out; // For cancellation
|
||||||
if (write_sectors(hLogicalVolume, BytesPerSect, i, BurstSize, pZeroSect) != (BytesPerSect*BurstSize)) {
|
if (write_sectors(hLogicalVolume, BytesPerSect, i, BurstSize, pZeroSect) != (BytesPerSect*BurstSize)) {
|
||||||
die("Error clearing reserved sectors\n", ERROR_WRITE_FAULT);
|
die("Error clearing reserved sectors\n", ERROR_WRITE_FAULT);
|
||||||
|
|
|
@ -545,13 +545,13 @@ static BOOL PopulateProperties(int ComboIndex)
|
||||||
HumanReadableSize *= 1024.0;
|
HumanReadableSize *= 1024.0;
|
||||||
i--;
|
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) {
|
if (fabs(HumanReadableSize / ceil(HumanReadableSize) - 1.0) < PROPOSEDLABEL_TOLERANCE) {
|
||||||
safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label),
|
safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label),
|
||||||
"%0.0f%s", ceil(HumanReadableSize), suffix[i]);
|
"%0.0f%s", ceil(HumanReadableSize), suffix[i]);
|
||||||
} else {
|
} else {
|
||||||
safe_sprintf(SelectedDrive.proposed_label, sizeof(SelectedDrive.proposed_label),
|
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")
|
// If no existing label is available and no ISO is selected, propose one according to the size (eg: "256MB", "8GB")
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -30,7 +30,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 206, 329
|
IDD_DIALOG DIALOGEX 12, 12, 206, 329
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_APPWINDOW
|
EXSTYLE WS_EX_APPWINDOW
|
||||||
CAPTION "Rufus v1.3.4.277"
|
CAPTION "Rufus v1.3.4.278"
|
||||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
|
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
|
||||||
|
@ -278,8 +278,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,3,4,277
|
FILEVERSION 1,3,4,278
|
||||||
PRODUCTVERSION 1,3,4,277
|
PRODUCTVERSION 1,3,4,278
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -296,13 +296,13 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "1.3.4.277"
|
VALUE "FileVersion", "1.3.4.278"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus.exe"
|
VALUE "OriginalFilename", "rufus.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "1.3.4.277"
|
VALUE "ProductVersion", "1.3.4.278"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue