wok-next view truecrypt/stuff/patches/wxwidgets3.patch @ rev 20036

Fix truecrypt. Although cryptography is not easy. Use it at your own risk.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Oct 22 19:31:48 2017 +0300 (2017-10-22)
parents
children
line source
1 From 084a8ee85c24fbc7077d6c789c97aacdb31b4e39 Mon Sep 17 00:00:00 2001
2 From: Mounir IDRASSI <mounir.idrassi@idrix.fr>
3 Date: Sun, 8 Jun 2014 00:45:49 +0200
4 Subject: [PATCH] wxWidgets 3.0 compatibility modifications
6 ---
7 src/Main/Application.cpp | 6 +++---
8 src/Main/CommandLineInterface.cpp | 12 ++++++------
9 src/Main/Forms/MainFrame.cpp | 2 +-
10 src/Main/Forms/SelectDirectoryWizardPage.cpp | 2 +-
11 src/Main/Forms/SelectDirectoryWizardPage.h | 2 +-
12 src/Main/GraphicUserInterface.cpp | 6 +++---
13 src/Main/TextUserInterface.cpp | 2 +-
14 src/Main/UserPreferences.cpp | 2 +-
15 8 files changed, 17 insertions(+), 17 deletions(-)
17 diff --git a/src/Main/Application.cpp b/src/Main/Application.cpp
18 index 8c6dea1..2d49169 100644
19 --- a/src/Main/Application.cpp
20 +++ b/src/Main/Application.cpp
21 @@ -36,7 +36,7 @@ namespace TrueCrypt
23 FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir)
24 {
25 - wxStandardPaths stdPaths;
26 + wxStandardPaths& stdPaths = wxStandardPaths::Get();
27 DirectoryPath configDir;
29 if (!Core->IsInPortableMode())
30 @@ -61,12 +61,12 @@ namespace TrueCrypt
32 DirectoryPath Application::GetExecutableDirectory ()
33 {
34 - return wstring (wxFileName (wxStandardPaths().GetExecutablePath()).GetPath());
35 + return wstring (wxFileName (wxStandardPaths::Get().GetExecutablePath()).GetPath());
36 }
38 FilePath Application::GetExecutablePath ()
39 {
40 - return wstring (wxStandardPaths().GetExecutablePath());
41 + return wstring (wxStandardPaths::Get().GetExecutablePath());
42 }
44 void Application::Initialize (UserInterfaceType::Enum type)
45 diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
46 index ccb0317..61cbd31 100644
47 --- a/src/Main/CommandLineInterface.cpp
48 +++ b/src/Main/CommandLineInterface.cpp
49 @@ -380,7 +380,7 @@ namespace TrueCrypt
50 ArgQuick = parser.Found (L"quick");
52 if (parser.Found (L"random-source", &str))
53 - ArgRandomSourcePath = FilesystemPath (str);
54 + ArgRandomSourcePath = FilesystemPath (str.wc_str());
56 if (parser.Found (L"restore-headers"))
57 {
58 @@ -471,7 +471,7 @@ namespace TrueCrypt
60 if (param1IsFile)
61 {
62 - ArgFilePath.reset (new FilePath (parser.GetParam (0)));
63 + ArgFilePath.reset (new FilePath (parser.GetParam (0).wc_str()));
64 }
65 }
67 @@ -524,7 +524,7 @@ namespace TrueCrypt
68 arr.Add (L"");
69 continue;
70 }
71 - arr.Last() += token.empty() ? L',' : token;
72 + arr.Last() += token.empty() ? L"," : token.wc_str();
73 }
74 else
75 arr.Add (token);
76 @@ -562,12 +562,12 @@ namespace TrueCrypt
77 {
78 filteredVolumes.push_back (volume);
79 }
80 - else if (wxString (volume->Path) == pathFilter.GetFullPath())
81 + else if (wxString (wstring(volume->Path)) == pathFilter.GetFullPath())
82 {
83 filteredVolumes.push_back (volume);
84 }
85 - else if (wxString (volume->MountPoint) == pathFilter.GetFullPath()
86 - || (wxString (volume->MountPoint) + wxFileName::GetPathSeparator()) == pathFilter.GetFullPath())
87 + else if (wxString (wstring(volume->MountPoint)) == pathFilter.GetFullPath()
88 + || (wxString (wstring(volume->MountPoint)) + wxFileName::GetPathSeparator()) == pathFilter.GetFullPath())
89 {
90 filteredVolumes.push_back (volume);
91 }
92 diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
93 index 6100a7a..3443ea3 100644
94 --- a/src/Main/Forms/MainFrame.cpp
95 +++ b/src/Main/Forms/MainFrame.cpp
96 @@ -828,7 +828,7 @@ namespace TrueCrypt
97 // File-hosted volumes
98 if (!volume->Path.IsDevice() && !mountPoint.IsEmpty())
99 {
100 - if (wxString (volume->Path).Upper().StartsWith (wstring (mountPoint).c_str()))
101 + if (wxString (wstring(volume->Path)).Upper().StartsWith (wstring (mountPoint).c_str()))
102 {
103 removedVolumes.push_back (volume);
104 continue;
105 diff --git a/src/Main/Forms/SelectDirectoryWizardPage.cpp b/src/Main/Forms/SelectDirectoryWizardPage.cpp
106 index a6a3ab0..1299e22 100644
107 --- a/src/Main/Forms/SelectDirectoryWizardPage.cpp
108 +++ b/src/Main/Forms/SelectDirectoryWizardPage.cpp
109 @@ -16,7 +16,7 @@ namespace TrueCrypt
110 {
111 if (!DirectoryTextCtrl->IsEmpty())
112 {
113 - return FilesystemPath (DirectoryTextCtrl->GetValue()).IsDirectory();
114 + return FilesystemPath (DirectoryTextCtrl->GetValue().wc_str()).IsDirectory();
115 }
117 return false;
118 diff --git a/src/Main/Forms/SelectDirectoryWizardPage.h b/src/Main/Forms/SelectDirectoryWizardPage.h
119 index 52335fc..2ea8b0d 100644
120 --- a/src/Main/Forms/SelectDirectoryWizardPage.h
121 +++ b/src/Main/Forms/SelectDirectoryWizardPage.h
122 @@ -18,7 +18,7 @@ namespace TrueCrypt
123 public:
124 SelectDirectoryWizardPage (wxPanel* parent) : SelectDirectoryWizardPageBase (parent) { }
126 - DirectoryPath GetDirectory () const { return DirectoryPath (DirectoryTextCtrl->GetValue()); }
127 + DirectoryPath GetDirectory () const { return DirectoryPath (DirectoryTextCtrl->GetValue().wc_str()); }
128 bool IsValid ();
129 void SetDirectory (const DirectoryPath &path) { DirectoryTextCtrl->SetValue (wstring (path)); }
130 void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); }
131 diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
132 index 41eb780..64e9e4b 100644
133 --- a/src/Main/GraphicUserInterface.cpp
134 +++ b/src/Main/GraphicUserInterface.cpp
135 @@ -1384,7 +1384,7 @@ namespace TrueCrypt
136 #else
137 L"",
138 #endif
139 - L"", wxDD_DEFAULT_STYLE | (existingOnly ? wxDD_DIR_MUST_EXIST : 0), wxDefaultPosition, parent));
140 + L"", wxDD_DEFAULT_STYLE | (existingOnly ? wxDD_DIR_MUST_EXIST : 0), wxDefaultPosition, parent).wc_str());
141 }
143 FilePathList GraphicUserInterface::SelectFiles (wxWindow *parent, const wxString &caption, bool saveMode, bool allowMultiple, const list < pair <wstring, wstring> > &fileExtensions, const DirectoryPath &directory) const
144 @@ -1428,14 +1428,14 @@ namespace TrueCrypt
145 if (dialog.ShowModal() == wxID_OK)
146 {
147 if (!allowMultiple)
148 - files.push_back (make_shared <FilePath> (dialog.GetPath()));
149 + files.push_back (make_shared <FilePath> (dialog.GetPath().wc_str()));
150 else
151 {
152 wxArrayString paths;
153 dialog.GetPaths (paths);
155 foreach (const wxString &path, paths)
156 - files.push_back (make_shared <FilePath> (path));
157 + files.push_back (make_shared <FilePath> (path.wc_str()));
158 }
159 }
161 diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
162 index d9e93e6..c7af099 100644
163 --- a/src/Main/TextUserInterface.cpp
164 +++ b/src/Main/TextUserInterface.cpp
165 @@ -116,7 +116,7 @@ namespace TrueCrypt
166 for (size_t i = 0; i < length && i < VolumePassword::MaxSize; ++i)
167 {
168 passwordBuf[i] = (wchar_t) passwordStr[i];
169 - const_cast <wchar_t *> (passwordStr.c_str())[i] = L'X';
170 + const_cast <wchar_t *> (passwordStr.wc_str())[i] = L'X';
171 }
173 if (verify && verPhase)
174 diff --git a/src/Main/UserPreferences.cpp b/src/Main/UserPreferences.cpp
175 index e0e8233..6608f79 100644
176 --- a/src/Main/UserPreferences.cpp
177 +++ b/src/Main/UserPreferences.cpp
178 @@ -219,7 +219,7 @@ namespace TrueCrypt
180 foreach_ref (const Keyfile &keyfile, DefaultKeyfiles)
181 {
182 - keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (FilesystemPath (keyfile))));
183 + keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (wstring(FilesystemPath (keyfile)))));
184 }
186 XmlWriter keyfileWriter (keyfilesCfgPath);
187 --- a/src/Main/Forms/Forms.cpp
188 +++ b/src/Main/Forms/Forms.cpp
189 @@ -263,8 +263,6 @@
190 VolumeStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, _("Volume") ), wxVERTICAL );
192 VolumeGridBagSizer = new wxGridBagSizer( 0, 0 );
193 - VolumeGridBagSizer->AddGrowableCol( 1 );
194 - VolumeGridBagSizer->AddGrowableRow( 0 );
195 VolumeGridBagSizer->SetFlexibleDirection( wxBOTH );
196 VolumeGridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
198 @@ -307,6 +305,8 @@
200 VolumeGridBagSizer->Add( bSizer21, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
202 + VolumeGridBagSizer->AddGrowableCol( 1 );
203 + VolumeGridBagSizer->AddGrowableRow( 0 );
204 VolumeStaticBoxSizer->Add( VolumeGridBagSizer, 1, wxEXPAND|wxALL, 4 );
206 LowStaticBoxSizer->Add( VolumeStaticBoxSizer, 1, wxEXPAND, 5 );
207 @@ -1442,7 +1442,6 @@
208 bSizer54->Add( bSizer55, 1, wxEXPAND, 5 );
210 FilesystemOptionsSizer = new wxGridBagSizer( 0, 0 );
211 - FilesystemOptionsSizer->AddGrowableCol( 1 );
212 FilesystemOptionsSizer->SetFlexibleDirection( wxBOTH );
213 FilesystemOptionsSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
214 FilesystemOptionsSizer->SetEmptyCellSize( wxSize( 0,0 ) );
215 @@ -1468,6 +1467,7 @@
216 FilesystemOptionsTextCtrl = new wxTextCtrl( m_panel8, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
217 FilesystemOptionsSizer->Add( FilesystemOptionsTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
219 + FilesystemOptionsSizer->AddGrowableCol( 1 );
220 bSizer54->Add( FilesystemOptionsSizer, 0, wxEXPAND, 5 );
222 sbSizer28->Add( bSizer54, 0, wxEXPAND|wxBOTTOM, 5 );
223 @@ -2892,7 +2892,6 @@
224 bSizer7 = new wxBoxSizer( wxVERTICAL );
226 GridBagSizer = new wxGridBagSizer( 0, 0 );
227 - GridBagSizer->AddGrowableCol( 1 );
228 GridBagSizer->SetFlexibleDirection( wxBOTH );
229 GridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
230 GridBagSizer->SetEmptyCellSize( wxSize( 0,0 ) );
231 @@ -2950,6 +2949,7 @@
233 GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 );
235 + GridBagSizer->AddGrowableCol( 1 );
236 bSizer7->Add( GridBagSizer, 1, wxALL|wxEXPAND, 5 );
238 this->SetSizer( bSizer7 );
239 --- a/src/Main/Forms/PreferencesDialog.h
240 +++ b/src/Main/Forms/PreferencesDialog.h
241 @@ -26,7 +26,7 @@ namespace VeraCrypt
242 protected:
243 void OnAssignHotkeyButtonClick (wxCommandEvent& event);
244 void OnBackgroundTaskEnabledCheckBoxClick (wxCommandEvent& event);
245 - void OnCancelButtonClick (wxCommandEvent& event) { Close(); }
246 + void OnCancelButtonClick (wxCommandEvent& event) { EndModal (wxID_CANCEL); }
247 void OnClose (wxCloseEvent& event);
248 void OnDismountOnPowerSavingCheckBoxClick (wxCommandEvent& event);
249 void OnDismountOnScreenSaverCheckBoxClick (wxCommandEvent& event);