VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Bergqvist <chris@digitalpoetry.se>2020-06-11 18:02:28 +0200
committerGitHub <noreply@github.com>2020-06-11 18:02:28 +0200
commit0a2c565aa98fa7bc9623a753370e565fc5ed1e63 (patch)
treef89c65090af0da4ef3c1915ba797b9a2cda75f9c
parent8250e83e6188dffd26d6310e36af3132d93412dd (diff)
downloadVeraCrypt-0a2c565aa98fa7bc9623a753370e565fc5ed1e63.tar.gz
VeraCrypt-0a2c565aa98fa7bc9623a753370e565fc5ed1e63.zip
Switch from auto_ptr to unique_ptr (#638)
-rw-r--r--src/Common/BaseCom.cpp4
-rw-r--r--src/Common/Dlgcode.c2
-rw-r--r--src/Common/SecurityToken.cpp12
-rw-r--r--src/Common/SecurityToken.h8
-rw-r--r--src/Core/Core.h4
-rw-r--r--src/Core/Unix/CoreService.cpp30
-rw-r--r--src/Core/Unix/CoreService.h12
-rw-r--r--src/Core/Unix/FreeBSD/CoreFreeBSD.cpp4
-rw-r--r--src/Core/Unix/Linux/CoreLinux.cpp4
-rw-r--r--src/Core/Unix/MacOSX/CoreMacOSX.cpp4
-rw-r--r--src/Core/Unix/Solaris/CoreSolaris.cpp4
-rw-r--r--src/Driver/Fuse/FuseService.cpp2
-rw-r--r--src/Driver/Fuse/FuseService.h2
-rw-r--r--src/Main/CommandLineInterface.cpp2
-rw-r--r--src/Main/CommandLineInterface.h2
-rw-r--r--src/Main/Forms/MainFrame.cpp2
-rw-r--r--src/Main/Forms/MainFrame.h4
-rw-r--r--src/Main/Forms/PreferencesDialog.h2
-rw-r--r--src/Main/Forms/ProgressWizardPage.h2
-rw-r--r--src/Main/Forms/VolumeCreationProgressWizardPage.h2
-rw-r--r--src/Main/Forms/VolumeCreationWizard.h4
-rwxr-xr-xsrc/Main/GraphicUserInterface.cpp10
-rw-r--r--src/Main/GraphicUserInterface.h4
-rw-r--r--src/Main/TextUserInterface.cpp2
-rw-r--r--src/Main/TextUserInterface.h4
-rw-r--r--src/Main/Xml.h4
-rw-r--r--src/Platform/Unix/Process.cpp2
-rw-r--r--src/Volume/EncryptionThreadPool.cpp4
-rw-r--r--src/Volume/EncryptionThreadPool.h2
29 files changed, 71 insertions, 73 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 7a74e293..32859b11 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -129,9 +129,9 @@ BOOL BaseCom::IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly)
DWORD BaseCom::ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *bufferBstr, unsigned __int64 offset, unsigned __int32 size, DWORD *sizeDone)
{
try
{
- auto_ptr <File> file (device ? new Device (filePath, !write) : new File (filePath, !write));
+ unique_ptr <File> file (device ? new Device (filePath, !write) : new File (filePath, !write));
file->CheckOpened (SRC_POS);
file->SeekAt (offset);
if (write)
@@ -193,9 +193,9 @@ DWORD BaseCom::GetFileSize (BSTR filePath, unsigned __int64 *pSize)
DWORD BaseCom::DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD dwIoControlCode, BSTR input, BSTR *output)
{
try
{
- auto_ptr <File> file (device ? new Device (filePath, readOnly == TRUE) : new File (filePath, readOnly == TRUE));
+ unique_ptr <File> file (device ? new Device (filePath, readOnly == TRUE) : new File (filePath, readOnly == TRUE));
file->CheckOpened (SRC_POS);
if (!file->IoCtl (dwIoControlCode, (BYTE *) input, !(BYTE *) input ? 0 : ((DWORD *) ((BYTE *) input))[-1],
(BYTE *) *output, !(BYTE *) *output ? 0 : ((DWORD *) ((BYTE *) *output))[-1]))
{
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 3c4928e2..17a2f3fd 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -12103,9 +12103,9 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg)
};
try
{
- SecurityToken::InitLibrary (SecurityTokenLibraryPath, auto_ptr <GetPinFunctor> (new PinRequestHandler(MainDlg)), auto_ptr <SendExceptionFunctor> (new WarningHandler(MainDlg)));
+ SecurityToken::InitLibrary (SecurityTokenLibraryPath, unique_ptr <GetPinFunctor> (new PinRequestHandler(MainDlg)), unique_ptr <SendExceptionFunctor> (new WarningHandler(MainDlg)));
}
catch (Exception &e)
{
e.Show (hwndDlg);
diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp
index 841ca720..a6759bf8 100644
--- a/src/Common/SecurityToken.cpp
+++ b/src/Common/SecurityToken.cpp
@@ -512,11 +512,11 @@ namespace VeraCrypt
}
}
#ifdef TC_WINDOWS
- void SecurityToken::InitLibrary (const wstring &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback)
+ void SecurityToken::InitLibrary (const wstring &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback)
#else
- void SecurityToken::InitLibrary (const string &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback)
+ void SecurityToken::InitLibrary (const string &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback)
#endif
{
if (Initialized)
CloseLibrary();
@@ -547,10 +547,10 @@ namespace VeraCrypt
status = Pkcs11Functions->C_Initialize (NULL_PTR);
if (status != CKR_OK)
throw Pkcs11Exception (status);
- PinCallback = pinCallback;
- WarningCallback = warningCallback;
+ PinCallback = std::move(pinCallback);
+ WarningCallback = std::move(warningCallback);
Initialized = true;
}
@@ -727,10 +727,10 @@ namespace VeraCrypt
}
}
#endif // TC_HEADER_Common_Exception
- auto_ptr <GetPinFunctor> SecurityToken::PinCallback;
- auto_ptr <SendExceptionFunctor> SecurityToken::WarningCallback;
+ unique_ptr <GetPinFunctor> SecurityToken::PinCallback;
+ unique_ptr <SendExceptionFunctor> SecurityToken::WarningCallback;
bool SecurityToken::Initialized;
CK_FUNCTION_LIST_PTR SecurityToken::Pkcs11Functions;
map <CK_SLOT_ID, Pkcs11Session> SecurityToken::Sessions;
diff --git a/src/Common/SecurityToken.h b/src/Common/SecurityToken.h
index 1112f11c..6b228895 100644
--- a/src/Common/SecurityToken.h
+++ b/src/Common/SecurityToken.h
@@ -190,11 +190,11 @@ namespace VeraCrypt
static void GetKeyfileData (const SecurityTokenKeyfile &keyfile, vector <byte> &keyfileData);
static list <SecurityTokenInfo> GetAvailableTokens ();
static SecurityTokenInfo GetTokenInfo (CK_SLOT_ID slotId);
#ifdef TC_WINDOWS
- static void InitLibrary (const wstring &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback);
+ static void InitLibrary (const wstring &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback);
#else
- static void InitLibrary (const string &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback);
+ static void InitLibrary (const string &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback);
#endif
static bool IsInitialized () { return Initialized; }
static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath);
@@ -210,17 +210,17 @@ namespace VeraCrypt
static void OpenSession (CK_SLOT_ID slotId);
static void CheckLibraryStatus ();
static bool Initialized;
- static auto_ptr <GetPinFunctor> PinCallback;
+ static unique_ptr <GetPinFunctor> PinCallback;
static CK_FUNCTION_LIST_PTR Pkcs11Functions;
#ifdef TC_WINDOWS
static HMODULE Pkcs11LibraryHandle;
#else
static void *Pkcs11LibraryHandle;
#endif
static map <CK_SLOT_ID, Pkcs11Session> Sessions;
- static auto_ptr <SendExceptionFunctor> WarningCallback;
+ static unique_ptr <SendExceptionFunctor> WarningCallback;
};
}
#endif // TC_HEADER_Common_SecurityToken
diff --git a/src/Core/Core.h b/src/Core/Core.h
index 97e35b25..3a2235a5 100644
--- a/src/Core/Core.h
+++ b/src/Core/Core.h
@@ -16,10 +16,10 @@
#include "CoreBase.h"
namespace VeraCrypt
{
- extern auto_ptr <CoreBase> Core;
- extern auto_ptr <CoreBase> CoreDirect;
+ extern unique_ptr <CoreBase> Core;
+ extern unique_ptr <CoreBase> CoreDirect;
class WaitThreadRoutine
{
public:
diff --git a/src/Core/Unix/CoreService.cpp b/src/Core/Unix/CoreService.cpp
index 2a77c90a..41cc5ec9 100644
--- a/src/Core/Unix/CoreService.cpp
+++ b/src/Core/Unix/CoreService.cpp
@@ -27,20 +27,20 @@
namespace VeraCrypt
{
template <class T>
- auto_ptr <T> CoreService::GetResponse ()
+ unique_ptr <T> CoreService::GetResponse ()
{
- auto_ptr <Serializable> deserializedObject (Serializable::DeserializeNew (ServiceOutputStream));
+ unique_ptr <Serializable> deserializedObject (Serializable::DeserializeNew (ServiceOutputStream));
Exception *deserializedException = dynamic_cast <Exception*> (deserializedObject.get());
if (deserializedException)
deserializedException->Throw();
if (dynamic_cast <T *> (deserializedObject.get()) == nullptr)
throw ParameterIncorrect (SRC_POS);
- return auto_ptr <T> (dynamic_cast <T *> (deserializedObject.release()));
+ return unique_ptr <T> (dynamic_cast <T *> (deserializedObject.release()));
}
void CoreService::ProcessElevatedRequests ()
{
@@ -89,9 +89,9 @@ namespace VeraCrypt
void CoreService::ProcessRequests (int inputFD, int outputFD)
{
try
{
- Core = CoreDirect;
+ Core = std::move(CoreDirect);
shared_ptr <Stream> inputStream (new FileStream (inputFD != -1 ? inputFD : InputPipe->GetReadFD()));
shared_ptr <Stream> outputStream (new FileStream (outputFD != -1 ? outputFD : OutputPipe->GetWriteFD()));
@@ -277,9 +277,9 @@ namespace VeraCrypt
SendRequest <SetFileOwnerResponse> (request);
}
template <class T>
- auto_ptr <T> CoreService::SendRequest (CoreServiceRequest &request)
+ unique_ptr <T> CoreService::SendRequest (CoreServiceRequest &request)
{
static Mutex mutex;
ScopeLock lock (mutex);
@@ -340,9 +340,9 @@ namespace VeraCrypt
#endif
try
{
request.Serialize (ServiceInputStream);
- auto_ptr <T> response (GetResponse <T>());
+ unique_ptr <T> response (GetResponse <T>());
ElevatedServiceAvailable = true;
return response;
}
catch (ElevationFailed &e)
@@ -389,10 +389,10 @@ namespace VeraCrypt
}
void CoreService::StartElevated (const CoreServiceRequest &request)
{
- auto_ptr <Pipe> inPipe (new Pipe());
- auto_ptr <Pipe> outPipe (new Pipe());
+ unique_ptr <Pipe> inPipe (new Pipe());
+ unique_ptr <Pipe> outPipe (new Pipe());
Pipe errPipe;
int forkedPid = fork();
throw_sys_if (forkedPid == -1);
@@ -532,9 +532,9 @@ namespace VeraCrypt
}
if (!errOutput.empty())
{
- auto_ptr <Serializable> deserializedObject;
+ unique_ptr <Serializable> deserializedObject;
Exception *deserializedException = nullptr;
try
{
@@ -572,10 +572,10 @@ namespace VeraCrypt
// Send sync code
byte sync[] = { 0, 0x11, 0x22 };
ServiceInputStream->Write (ConstBufferPtr (sync, array_capacity (sync)));
- AdminInputPipe = inPipe;
- AdminOutputPipe = outPipe;
+ AdminInputPipe = std::move(inPipe);
+ AdminOutputPipe = std::move(outPipe);
}
void CoreService::Stop ()
{
@@ -584,13 +584,13 @@ namespace VeraCrypt
}
shared_ptr <GetStringFunctor> CoreService::AdminPasswordCallback;
- auto_ptr <Pipe> CoreService::AdminInputPipe;
- auto_ptr <Pipe> CoreService::AdminOutputPipe;
+ unique_ptr <Pipe> CoreService::AdminInputPipe;
+ unique_ptr <Pipe> CoreService::AdminOutputPipe;
- auto_ptr <Pipe> CoreService::InputPipe;
- auto_ptr <Pipe> CoreService::OutputPipe;
+ unique_ptr <Pipe> CoreService::InputPipe;
+ unique_ptr <Pipe> CoreService::OutputPipe;
shared_ptr <Stream> CoreService::ServiceInputStream;
shared_ptr <Stream> CoreService::ServiceOutputStream;
bool CoreService::ElevatedPrivileges = false;
diff --git a/src/Core/Unix/CoreService.h b/src/Core/Unix/CoreService.h
index e25b856a..dfb8b350 100644
--- a/src/Core/Unix/CoreService.h
+++ b/src/Core/Unix/CoreService.h
@@ -38,19 +38,19 @@ namespace VeraCrypt
static void Start ();
static void Stop ();
protected:
- template <class T> static auto_ptr <T> GetResponse ();
- template <class T> static auto_ptr <T> SendRequest (CoreServiceRequest &request);
+ template <class T> static unique_ptr <T> GetResponse ();
+ template <class T> static unique_ptr <T> SendRequest (CoreServiceRequest &request);
static void StartElevated (const CoreServiceRequest &request);
static shared_ptr <GetStringFunctor> AdminPasswordCallback;
- static auto_ptr <Pipe> AdminInputPipe;
- static auto_ptr <Pipe> AdminOutputPipe;
+ static unique_ptr <Pipe> AdminInputPipe;
+ static unique_ptr <Pipe> AdminOutputPipe;
- static auto_ptr <Pipe> InputPipe;
- static auto_ptr <Pipe> OutputPipe;
+ static unique_ptr <Pipe> InputPipe;
+ static unique_ptr <Pipe> OutputPipe;
static shared_ptr <Stream> ServiceInputStream;
static shared_ptr <Stream> ServiceOutputStream;
static bool ElevatedPrivileges;
diff --git a/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp b/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
index ff3e04bc..01463c35 100644
--- a/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
+++ b/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
@@ -199,8 +199,8 @@ namespace VeraCrypt
}
}
#ifdef TC_FREEBSD
- auto_ptr <CoreBase> Core (new CoreServiceProxy <CoreFreeBSD>);
- auto_ptr <CoreBase> CoreDirect (new CoreFreeBSD);
+ unique_ptr <CoreBase> Core (new CoreServiceProxy <CoreFreeBSD>);
+ unique_ptr <CoreBase> CoreDirect (new CoreFreeBSD);
#endif
}
diff --git a/src/Core/Unix/Linux/CoreLinux.cpp b/src/Core/Unix/Linux/CoreLinux.cpp
index 7f18fff4..47ec8fb8 100644
--- a/src/Core/Unix/Linux/CoreLinux.cpp
+++ b/src/Core/Unix/Linux/CoreLinux.cpp
@@ -488,7 +488,7 @@ namespace VeraCrypt
throw;
}
}
- auto_ptr <CoreBase> Core (new CoreServiceProxy <CoreLinux>);
- auto_ptr <CoreBase> CoreDirect (new CoreLinux);
+ unique_ptr <CoreBase> Core (new CoreServiceProxy <CoreLinux>);
+ unique_ptr <CoreBase> CoreDirect (new CoreLinux);
}
diff --git a/src/Core/Unix/MacOSX/CoreMacOSX.cpp b/src/Core/Unix/MacOSX/CoreMacOSX.cpp
index 251e4c65..c3809ef3 100644
--- a/src/Core/Unix/MacOSX/CoreMacOSX.cpp
+++ b/src/Core/Unix/MacOSX/CoreMacOSX.cpp
@@ -228,7 +228,7 @@ namespace VeraCrypt
throw;
}
}
- auto_ptr <CoreBase> Core (new CoreServiceProxy <CoreMacOSX>);
- auto_ptr <CoreBase> CoreDirect (new CoreMacOSX);
+ unique_ptr <CoreBase> Core (new CoreServiceProxy <CoreMacOSX>);
+ unique_ptr <CoreBase> CoreDirect (new CoreMacOSX);
}
diff --git a/src/Core/Unix/Solaris/CoreSolaris.cpp b/src/Core/Unix/Solaris/CoreSolaris.cpp
index 5705e1c6..15a79c49 100644
--- a/src/Core/Unix/Solaris/CoreSolaris.cpp
+++ b/src/Core/Unix/Solaris/CoreSolaris.cpp
@@ -172,7 +172,7 @@ namespace VeraCrypt
CoreUnix::MountFilesystem (devicePath, mountPoint, filesystemType, readOnly, systemMountOptions);
}
}
- auto_ptr <CoreBase> Core (new CoreServiceProxy <CoreSolaris>);
- auto_ptr <CoreBase> CoreDirect (new CoreSolaris);
+ unique_ptr <CoreBase> Core (new CoreServiceProxy <CoreSolaris>);
+ unique_ptr <CoreBase> CoreDirect (new CoreSolaris);
}
diff --git a/src/Driver/Fuse/FuseService.cpp b/src/Driver/Fuse/FuseService.cpp
index 026883d1..a2c769f8 100644
--- a/src/Driver/Fuse/FuseService.cpp
+++ b/src/Driver/Fuse/FuseService.cpp
@@ -591,6 +591,6 @@ namespace VeraCrypt
shared_ptr <Volume> FuseService::MountedVolume;
VolumeSlotNumber FuseService::SlotNumber;
uid_t FuseService::UserId;
gid_t FuseService::GroupId;
- auto_ptr <Pipe> FuseService::SignalHandlerPipe;
+ unique_ptr <Pipe> FuseService::SignalHandlerPipe;
}
diff --git a/src/Driver/Fuse/FuseService.h b/src/Driver/Fuse/FuseService.h
index 4b844013..872cb368 100644
--- a/src/Driver/Fuse/FuseService.h
+++ b/src/Driver/Fuse/FuseService.h
@@ -69,9 +69,9 @@ namespace VeraCrypt
static shared_ptr <Volume> MountedVolume;
static VolumeSlotNumber SlotNumber;
static uid_t UserId;
static gid_t GroupId;
- static auto_ptr <Pipe> SignalHandlerPipe;
+ static unique_ptr <Pipe> SignalHandlerPipe;
};
}
#endif // TC_HEADER_Driver_Fuse_FuseService
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index b5f18dd3..dd284734 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -827,6 +827,6 @@ namespace VeraCrypt
else
return shared_ptr<SecureBuffer>(new SecureBuffer ());
}
- auto_ptr <CommandLineInterface> CmdLine;
+ unique_ptr <CommandLineInterface> CmdLine;
}
diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h
index 00dabfd6..23693330 100644
--- a/src/Main/CommandLineInterface.h
+++ b/src/Main/CommandLineInterface.h
@@ -104,8 +104,8 @@ namespace VeraCrypt
shared_ptr<VolumePassword> ToUTF8Password (const wchar_t* str, size_t charCount, size_t maxUtf8Len);
shared_ptr<SecureBuffer> ToUTF8Buffer (const wchar_t* str, size_t charCount, size_t maxUtf8Len);
- extern auto_ptr <CommandLineInterface> CmdLine;
+ extern unique_ptr <CommandLineInterface> CmdLine;
}
#endif // TC_HEADER_Main_CommandInterface
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index 25853193..417c2a63 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -508,9 +508,9 @@ namespace VeraCrypt
}
wxMenu *CreatePopupMenu ()
{
- auto_ptr <wxMenu> popup (new wxMenu);
+ unique_ptr <wxMenu> popup (new wxMenu);
Gui->AppendToMenu (*popup, LangString[Gui->IsInBackgroundMode() ? "SHOW_TC" : "HIDE_TC"], this, wxCommandEventHandler (TaskBarIcon::OnShowHideMenuItemSelected));
popup->AppendSeparator();
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index 414ecca3..9089ce72 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -213,10 +213,10 @@ namespace VeraCrypt
map <int, FavoriteVolume> FavoriteVolumesMenuMap;
bool ListItemRightClickEventPending;
VolumeInfoList MountedVolumes;
- auto_ptr <wxTaskBarIcon> mTaskBarIcon;
- auto_ptr <wxTimer> mTimer;
+ unique_ptr <wxTaskBarIcon> mTaskBarIcon;
+ unique_ptr <wxTimer> mTimer;
long SelectedItemIndex;
VolumeSlotNumber SelectedSlotNumber;
int ShowRequestFifo;
map <wstring, VolumeActivityMapEntry> VolumeActivityMap;
diff --git a/src/Main/Forms/PreferencesDialog.h b/src/Main/Forms/PreferencesDialog.h
index 25a0f85f..0cd1482a 100644
--- a/src/Main/Forms/PreferencesDialog.h
+++ b/src/Main/Forms/PreferencesDialog.h
@@ -53,9 +53,9 @@ namespace VeraCrypt
};
KeyfilesPanel *DefaultKeyfilesPanel;
int LastVirtualKeyPressed;
- auto_ptr <wxTimer> mTimer;
+ unique_ptr <wxTimer> mTimer;
UserPreferences Preferences;
bool RestoreValidatorBell;
HotkeyList UnregisteredHotkeys;
};
diff --git a/src/Main/Forms/ProgressWizardPage.h b/src/Main/Forms/ProgressWizardPage.h
index cc50fa62..34f5cf4d 100644
--- a/src/Main/Forms/ProgressWizardPage.h
+++ b/src/Main/Forms/ProgressWizardPage.h
@@ -35,9 +35,9 @@ namespace VeraCrypt
protected:
void OnAbortButtonClick (wxCommandEvent& event);
void OnTimer ();
- auto_ptr <wxTimer> mTimer;
+ unique_ptr <wxTimer> mTimer;
int PreviousGaugeValue;
uint64 ProgressBarRange;
int RealProgressBarRange;
};
diff --git a/src/Main/Forms/VolumeCreationProgressWizardPage.h b/src/Main/Forms/VolumeCreationProgressWizardPage.h
index 345ee593..fad4ac93 100644
--- a/src/Main/Forms/VolumeCreationProgressWizardPage.h
+++ b/src/Main/Forms/VolumeCreationProgressWizardPage.h
@@ -47,9 +47,9 @@ namespace VeraCrypt
static const size_t MaxDisplayedKeyBytes = 13;
int PreviousGaugeValue;
uint64 ProgressBarRange;
- auto_ptr <wxTimer> RandomPoolTimer;
+ unique_ptr <wxTimer> RandomPoolTimer;
int RealProgressBarRange;
wxLongLong StartTime;
bool VolumeCreatorRunning;
int MouseEventsCounter;
diff --git a/src/Main/Forms/VolumeCreationWizard.h b/src/Main/Forms/VolumeCreationWizard.h
index c4087426..70abc9ef 100644
--- a/src/Main/Forms/VolumeCreationWizard.h
+++ b/src/Main/Forms/VolumeCreationWizard.h
@@ -66,10 +66,10 @@ namespace VeraCrypt
shared_ptr <VolumeCreator> Creator;
bool CrossPlatformSupport;
static bool DeviceWarningConfirmed;
bool DisplayKeyInfo;
- auto_ptr <wxTimer> ProgressTimer;
- auto_ptr <wxTimer> RandomPoolUpdateTimer;
+ unique_ptr <wxTimer> ProgressTimer;
+ unique_ptr <wxTimer> RandomPoolUpdateTimer;
shared_ptr <KeyfileList> Keyfiles;
bool LargeFilesSupport;
uint64 MaxHiddenVolumeSize;
shared_ptr <VolumeInfo> MountedOuterVolume;
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index b7b4cf45..f1bb87b2 100755
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -343,9 +343,9 @@ namespace VeraCrypt
}
void GraphicUserInterface::BeginInteractiveBusyState (wxWindow *window)
{
- static auto_ptr <wxCursor> arrowWaitCursor;
+ static unique_ptr <wxCursor> arrowWaitCursor;
if (arrowWaitCursor.get() == nullptr)
arrowWaitCursor.reset (new wxCursor (wxCURSOR_ARROWWAIT));
@@ -408,9 +408,9 @@ namespace VeraCrypt
}
void GraphicUserInterface::EndInteractiveBusyState (wxWindow *window) const
{
- static auto_ptr <wxCursor> arrowCursor;
+ static unique_ptr <wxCursor> arrowCursor;
if (arrowCursor.get() == nullptr)
arrowCursor.reset (new wxCursor (wxCURSOR_ARROW));
@@ -631,9 +631,9 @@ namespace VeraCrypt
};
try
{
- SecurityToken::InitLibrary (Preferences.SecurityTokenModule, auto_ptr <GetPinFunctor> (new PinRequestHandler), auto_ptr <SendExceptionFunctor> (new WarningHandler));
+ SecurityToken::InitLibrary (Preferences.SecurityTokenModule, unique_ptr <GetPinFunctor> (new PinRequestHandler), unique_ptr <SendExceptionFunctor> (new WarningHandler));
}
catch (Exception &e)
{
ShowError (e);
@@ -964,10 +964,10 @@ namespace VeraCrypt
Client() {};
wxConnectionBase *OnMakeConnection () { return new Connection; }
};
- auto_ptr <wxDDEClient> client (new Client);
- auto_ptr <wxConnectionBase> connection (client->MakeConnection (L"localhost", serverName, L"raise"));
+ unique_ptr <wxDDEClient> client (new Client);
+ unique_ptr <wxConnectionBase> connection (client->MakeConnection (L"localhost", serverName, L"raise"));
if (connection.get() && connection->Execute (nullptr))
{
connection->Disconnect();
diff --git a/src/Main/GraphicUserInterface.h b/src/Main/GraphicUserInterface.h
index 01f385a3..06ea6772 100644
--- a/src/Main/GraphicUserInterface.h
+++ b/src/Main/GraphicUserInterface.h
@@ -128,12 +128,12 @@ namespace VeraCrypt
wxFrame *ActiveFrame;
bool BackgroundMode;
#ifdef TC_WINDOWS
- auto_ptr <wxDDEServer> DDEServer;
+ unique_ptr <wxDDEServer> DDEServer;
#endif
wxFrame *mMainFrame;
- auto_ptr <wxSingleInstanceChecker> SingleInstanceChecker;
+ unique_ptr <wxSingleInstanceChecker> SingleInstanceChecker;
mutable WaitDialog* mWaitDialog;
public:
#ifdef TC_MACOSX
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 4de2cb2d..e946d6fc 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -1155,9 +1155,9 @@ namespace VeraCrypt
};
try
{
- SecurityToken::InitLibrary (Preferences.SecurityTokenModule, auto_ptr <GetPinFunctor> (new PinRequestHandler (this)), auto_ptr <SendExceptionFunctor> (new WarningHandler (this)));
+ SecurityToken::InitLibrary (Preferences.SecurityTokenModule, unique_ptr <GetPinFunctor> (new PinRequestHandler (this)), unique_ptr <SendExceptionFunctor> (new WarningHandler (this)));
}
catch (Exception &e)
{
ShowError (e);
diff --git a/src/Main/TextUserInterface.h b/src/Main/TextUserInterface.h
index 78874b8c..14eb2c0e 100644
--- a/src/Main/TextUserInterface.h
+++ b/src/Main/TextUserInterface.h
@@ -68,10 +68,10 @@ namespace VeraCrypt
static void OnSignal (int signal);
virtual void ReadInputStreamLine (wxString &line) const;
virtual wxString ReadInputStreamLine () const;
- auto_ptr <wxFFileInputStream> FInputStream;
- auto_ptr <wxTextInputStream> TextInputStream;
+ unique_ptr <wxFFileInputStream> FInputStream;
+ unique_ptr <wxTextInputStream> TextInputStream;
private:
TextUserInterface (const TextUserInterface &);
TextUserInterface &operator= (const TextUserInterface &);
diff --git a/src/Main/Xml.h b/src/Main/Xml.h
index 78c30278..27f0b828 100644
--- a/src/Main/Xml.h
+++ b/src/Main/Xml.h
@@ -65,10 +65,10 @@ namespace VeraCrypt
void WriteNodes (const XmlNodeList &xmlNodes);
protected:
int CurrentIndentLevel;
- auto_ptr <wxMemoryOutputStream> MemOutStream;
- auto_ptr <wxTextOutputStream> TextOutStream;
+ unique_ptr <wxMemoryOutputStream> MemOutStream;
+ unique_ptr <wxTextOutputStream> TextOutStream;
File OutFile;
private:
XmlWriter (const XmlWriter &);
diff --git a/src/Platform/Unix/Process.cpp b/src/Platform/Unix/Process.cpp
index a21e118d..d148a686 100644
--- a/src/Platform/Unix/Process.cpp
+++ b/src/Platform/Unix/Process.cpp
@@ -169,9 +169,9 @@ namespace VeraCrypt
throw_sys_if (waitRes == -1);
if (!exOutput.empty())
{
- auto_ptr <Serializable> deserializedObject;
+ unique_ptr <Serializable> deserializedObject;
Exception *deserializedException = nullptr;
try
{
diff --git a/src/Volume/EncryptionThreadPool.cpp b/src/Volume/EncryptionThreadPool.cpp
index 4219c7d7..04c32c7d 100644
--- a/src/Volume/EncryptionThreadPool.cpp
+++ b/src/Volume/EncryptionThreadPool.cpp
@@ -124,11 +124,9 @@ namespace VeraCrypt
}
firstFragmentWorkItem->ItemCompletedEvent.Wait();
- auto_ptr <Exception> itemException;
- if (firstFragmentWorkItem->ItemException.get())
- itemException = firstFragmentWorkItem->ItemException;
+ unique_ptr <Exception> itemException = std::move(firstFragmentWorkItem->ItemException);
firstFragmentWorkItem->State.Set (WorkItem::State::Free);
WorkItemCompletedEvent.Signal();
diff --git a/src/Volume/EncryptionThreadPool.h b/src/Volume/EncryptionThreadPool.h
index 43aa4c80..baf31e23 100644
--- a/src/Volume/EncryptionThreadPool.h
+++ b/src/Volume/EncryptionThreadPool.h
@@ -43,9 +43,9 @@ namespace VeraCrypt
};
};
struct WorkItem *FirstFragment;
- auto_ptr <Exception> ItemException;
+ unique_ptr <Exception> ItemException;
SyncEvent ItemCompletedEvent;
SharedVal <size_t> OutstandingFragmentCount;
SharedVal <State::Enum> State;
WorkType::Enum Type;