VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/VolumeSizeWizardPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main/Forms/VolumeSizeWizardPage.cpp')
-rw-r--r--src/Main/Forms/VolumeSizeWizardPage.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/Main/Forms/VolumeSizeWizardPage.cpp b/src/Main/Forms/VolumeSizeWizardPage.cpp
index 83fdd40f..08aa7052 100644
--- a/src/Main/Forms/VolumeSizeWizardPage.cpp
+++ b/src/Main/Forms/VolumeSizeWizardPage.cpp
@@ -46,63 +46,61 @@ namespace VeraCrypt
diskSpace += static_cast<wxLongLong_t>(containerSizeUnsigned.GetValue());
}
AvailableDiskSpace = (uint64) diskSpace.GetValue ();
}
FreeSpaceStaticText->SetFont (Gui->GetDefaultBoldFont (this));
if (!freeSpaceText.empty())
{
FreeSpaceStaticText->SetLabel (freeSpaceText);
}
else
{
#ifdef TC_WINDOWS
wxString drive = wxFileName (wstring (volumePath)).GetVolume();
if (!drive.empty())
{
FreeSpaceStaticText->SetLabel (StringFormatter (LangString["LINUX_FREE_SPACE_ON_DRIVE"],
drive, Gui->SizeToString (diskSpace.GetValue())));
}
else
#endif
{
FreeSpaceStaticText->SetLabel (StringFormatter (LangString["DISK_FREE"],
Gui->SizeToString (diskSpace.GetValue())));
}
}
VolumeSizeTextCtrl->SetMinSize (wxSize (Gui->GetCharWidth (VolumeSizeTextCtrl) * 20, -1));
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+ wxTextValidator validator (wxFILTER_DIGITS);
VolumeSizeTextCtrl->SetValidator (validator);
}
uint64 VolumeSizeWizardPage::GetVolumeSize () const
{
uint64 prefixMult = 1;
uint64 val;
if (UseAllFreeSpaceCheckBox->IsChecked ())
{
val = MaxVolumeSizeValid ? MaxVolumeSize : AvailableDiskSpace;
}
else
{
int selection = VolumeSizePrefixChoice->GetSelection();
if (selection == wxNOT_FOUND)
return 0;
uint64 counter = reinterpret_cast <uint64> (VolumeSizePrefixChoice->GetClientData (selection));
while (counter)
{
prefixMult *= 1024;
counter--;
}
val = StringConverter::ToUInt64 (wstring(VolumeSizeTextCtrl->GetValue()));
}
if (val <= 0x7fffFFFFffffFFFFull / prefixMult)
{
val *= prefixMult;
uint32 sectorSizeRem = val % SectorSize;