diff options
Diffstat (limited to 'src/Main')
-rw-r--r-- | src/Main/Application.cpp | 2 | ||||
-rw-r--r-- | src/Main/CommandLineInterface.cpp | 10 | ||||
-rw-r--r-- | src/Main/Forms/PreferencesDialog.cpp | 18 | ||||
-rw-r--r-- | src/Main/Forms/VolumeCreationWizard.cpp | 2 | ||||
-rw-r--r-- | src/Main/Resources.cpp | 4 | ||||
-rw-r--r-- | src/Main/StringFormatter.h | 2 | ||||
-rw-r--r-- | src/Main/TextUserInterface.cpp | 18 | ||||
-rw-r--r-- | src/Main/UserInterface.cpp | 4 |
8 files changed, 39 insertions, 21 deletions
diff --git a/src/Main/Application.cpp b/src/Main/Application.cpp index c72e2cc6..27b8f55a 100644 --- a/src/Main/Application.cpp +++ b/src/Main/Application.cpp @@ -89,7 +89,7 @@ namespace VeraCrypt FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir) { - static wxScopedPtr<const wxString> configDirC; + static std::unique_ptr<const wxString> configDirC; static bool configDirExists = false; if (!configDirExists) diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index 2bbc73ea..17d7c147 100644 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -347,6 +347,16 @@ namespace VeraCrypt #elif defined (TC_FREEBSD) || defined (TC_SOLARIS) else if (str.IsSameAs (L"UFS", false)) ArgFilesystem = VolumeCreationOptions::FilesystemType::UFS; + else if (str.IsSameAs (L"Ext2", false)) + ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext2; + else if (str.IsSameAs (L"Ext3", false)) + ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext3; + else if (str.IsSameAs (L"Ext4", false)) + ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext4; + else if (str.IsSameAs (L"NTFS", false)) + ArgFilesystem = VolumeCreationOptions::FilesystemType::NTFS; + else if (str.IsSameAs (L"exFAT", false)) + ArgFilesystem = VolumeCreationOptions::FilesystemType::exFAT; #endif else throw_err (LangString["UNKNOWN_OPTION"] + L": " + str); diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp index 90a668e6..c4d5140f 100644 --- a/src/Main/Forms/PreferencesDialog.cpp +++ b/src/Main/Forms/PreferencesDialog.cpp @@ -82,14 +82,16 @@ namespace VeraCrypt LanguageListBox->Append("System default"); LanguageListBox->Append("English"); - size_t langCount; - langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES); - for (size_t i = 0; i < langCount; ++i) { - wxFileName filename(langArray[i]); - wxString langId = filename.GetName().AfterLast('.'); - wxString langNative = langEntries[langId]; - if (!langNative.empty()) { - LanguageListBox->Append(langNative); + if (wxDir::Exists(languagesFolder.GetName())) { + size_t langCount; + langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES); + for (size_t i = 0; i < langCount; ++i) { + wxFileName filename(langArray[i]); + wxString langId = filename.GetName().AfterLast('.'); + wxString langNative = langEntries[langId]; + if (!langNative.empty()) { + LanguageListBox->Append(langNative); + } } } #endif diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index 2653ff66..0eae11d6 100644 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -975,7 +975,7 @@ namespace VeraCrypt if (OuterVolume && VolumeSize > TC_MAX_FAT_SECTOR_COUNT * SectorSize) { uint64 limit = TC_MAX_FAT_SECTOR_COUNT * SectorSize / BYTES_PER_TB; - wstring err = StringFormatter (LangString["LINUX_ERROR_SIZE_HIDDEN_VOL"], limit, limit * 1024); + wstring err = static_cast<wstring>(StringFormatter (LangString["LINUX_ERROR_SIZE_HIDDEN_VOL"], limit, limit * 1024)); if (SectorSize < 4096) { diff --git a/src/Main/Resources.cpp b/src/Main/Resources.cpp index d8bab977..18a58181 100644 --- a/src/Main/Resources.cpp +++ b/src/Main/Resources.cpp @@ -71,12 +71,12 @@ namespace VeraCrypt UserPreferences Preferences; Preferences.Load(); - wstring preferredLang = Preferences.Language; + string preferredLang = string(Preferences.Language.begin(), Preferences.Language.end()); #ifdef DEBUG std::cout << "Config language: " << preferredLang << std::endl; #endif - if (preferredLang == L"system") { + if (preferredLang == "system") { if (const char *env_p = getenv("LANG")) { string lang(env_p); #ifdef DEBUG diff --git a/src/Main/StringFormatter.h b/src/Main/StringFormatter.h index 33a47a35..97c39ae2 100644 --- a/src/Main/StringFormatter.h +++ b/src/Main/StringFormatter.h @@ -52,7 +52,7 @@ namespace VeraCrypt StringFormatter (const wxString &format, StringFormatterArg arg0 = StringFormatterArg(), StringFormatterArg arg1 = StringFormatterArg(), StringFormatterArg arg2 = StringFormatterArg(), StringFormatterArg arg3 = StringFormatterArg(), StringFormatterArg arg4 = StringFormatterArg(), StringFormatterArg arg5 = StringFormatterArg(), StringFormatterArg arg6 = StringFormatterArg(), StringFormatterArg arg7 = StringFormatterArg(), StringFormatterArg arg8 = StringFormatterArg(), StringFormatterArg arg9 = StringFormatterArg()); virtual ~StringFormatter (); - operator wstring () const { return wstring (FormattedString); } + explicit operator wstring () const { return wstring (FormattedString); } operator wxString () const { return FormattedString; } operator StringFormatterArg () const { return FormattedString; } diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index 0de76c6b..94919296 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -668,7 +668,7 @@ namespace VeraCrypt { parentDir = wxT("."); } - if (wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace)) + if (options->Type == VolumeType::Normal && wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace)) { AvailableDiskSpace = (uint64) diskSpace.GetValue (); if (maxVolumeSize > AvailableDiskSpace) @@ -678,10 +678,13 @@ namespace VeraCrypt if (options->Size == (uint64) (-1)) { - if (AvailableDiskSpace) + if (options->Type == VolumeType::Hidden) { + throw_err (_("Please do not use maximum size for hidden volume. As we do not mount the outer volume to determine the available space, it is your responsibility to choose a value so that the hidden volume does not overlap the outer volume.")); + } + else if (AvailableDiskSpace) { // caller requesting maximum size - // we use maxVolumeSize because it is guaranteed to be less of equal to AvailableDiskSpace + // we use maxVolumeSize because it is guaranteed to be less or equal to AvailableDiskSpace for outer volumes options->Size = maxVolumeSize; } else @@ -702,14 +705,17 @@ namespace VeraCrypt throw MissingArgument (SRC_POS); uint64 multiplier = 1024 * 1024; - wxString sizeStr = AskString (options->Type == VolumeType::Hidden ? _("\nEnter hidden volume size (sizeK/size[M]/sizeG/sizeT/max): ") : _("\nEnter volume size (sizeK/size[M]/sizeG.sizeT/max): ")); + wxString sizeStr = AskString (options->Type == VolumeType::Hidden ? _("\nEnter hidden volume size (sizeK/size[M]/sizeG/sizeT): ") : _("\nEnter volume size (sizeK/size[M]/sizeG.sizeT/max): ")); if (sizeStr.CmpNoCase(wxT("max")) == 0) { multiplier = 1; - if (AvailableDiskSpace) + if (options->Type == VolumeType::Hidden) { + throw_err (_("Please do not use maximum size for hidden volume. As we do not mount the outer volume to determine the available space, it is your responsibility to choose a value so that the hidden volume does not overlap the outer volume.")); + } + else if (AvailableDiskSpace) { // caller requesting maximum size - // we use maxVolumeSize because it is guaranteed to be less of equal to AvailableDiskSpace + // we use maxVolumeSize because it is guaranteed to be less or equal to AvailableDiskSpace for outer volumes options->Size = maxVolumeSize; } else diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp index 3ec2e8dc..09b1fcdd 100644 --- a/src/Main/UserInterface.cpp +++ b/src/Main/UserInterface.cpp @@ -390,7 +390,7 @@ namespace VeraCrypt errOutput += StringConverter::ToWide (execEx->GetErrorOutput()); if (errOutput.empty()) - return errOutput + StringFormatter (LangString["LINUX_COMMAND_GET_ERROR"], execEx->GetCommand(), execEx->GetExitCode()); + return errOutput + static_cast<wstring>(StringFormatter (LangString["LINUX_COMMAND_GET_ERROR"], execEx->GetCommand(), execEx->GetExitCode())); return wxString (errOutput).Trim (true); } @@ -1516,7 +1516,7 @@ namespace VeraCrypt EncryptionTest::TestAll(); // StringFormatter - if (StringFormatter (L"{9} {8} {7} {6} {5} {4} {3} {2} {1} {0} {{0}}", "1", L"2", '3', L'4', 5, 6, 7, 8, 9, 10) != L"10 9 8 7 6 5 4 3 2 1 {0}") + if (static_cast<wstring>(StringFormatter (L"{9} {8} {7} {6} {5} {4} {3} {2} {1} {0} {{0}}", "1", L"2", '3', L'4', 5, 6, 7, 8, 9, 10)) != L"10 9 8 7 6 5 4 3 2 1 {0}") throw TestFailed (SRC_POS); try { |