diff options
author | Christopher Bergqvist <chris@digitalpoetry.se> | 2020-06-11 18:02:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 18:02:28 +0200 |
commit | 0a2c565aa98fa7bc9623a753370e565fc5ed1e63 (patch) | |
tree | f89c65090af0da4ef3c1915ba797b9a2cda75f9c /src | |
parent | 8250e83e6188dffd26d6310e36af3132d93412dd (diff) | |
download | VeraCrypt-0a2c565aa98fa7bc9623a753370e565fc5ed1e63.tar.gz VeraCrypt-0a2c565aa98fa7bc9623a753370e565fc5ed1e63.zip |
Switch from auto_ptr to unique_ptr (#638)
Diffstat (limited to 'src')
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 @@ -130,7 +130,7 @@ DWORD BaseCom::ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *buff { 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); @@ -194,7 +194,7 @@ DWORD BaseCom::DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD { 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 @@ -12104,7 +12104,7 @@ 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) { 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 @@ -513,9 +513,9 @@ 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) @@ -548,8 +548,8 @@ namespace VeraCrypt if (status != CKR_OK) throw Pkcs11Exception (status); - PinCallback = pinCallback; - WarningCallback = warningCallback; + PinCallback = std::move(pinCallback); + WarningCallback = std::move(warningCallback); Initialized = true; } @@ -728,8 +728,8 @@ 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; 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 @@ -191,9 +191,9 @@ namespace VeraCrypt 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); @@ -211,7 +211,7 @@ namespace VeraCrypt 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; @@ -219,7 +219,7 @@ namespace VeraCrypt static void *Pkcs11LibraryHandle; #endif static map <CK_SLOT_ID, Pkcs11Session> Sessions; - static auto_ptr <SendExceptionFunctor> WarningCallback; + static unique_ptr <SendExceptionFunctor> WarningCallback; }; } 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 @@ -17,8 +17,8 @@ namespace VeraCrypt { - extern auto_ptr <CoreBase> Core; - extern auto_ptr <CoreBase> CoreDirect; + extern unique_ptr <CoreBase> Core; + extern unique_ptr <CoreBase> CoreDirect; class WaitThreadRoutine { 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 @@ -28,9 +28,9 @@ 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) @@ -39,7 +39,7 @@ namespace VeraCrypt 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 () @@ -90,7 +90,7 @@ namespace VeraCrypt { 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())); @@ -278,7 +278,7 @@ namespace VeraCrypt } template <class T> - auto_ptr <T> CoreService::SendRequest (CoreServiceRequest &request) + unique_ptr <T> CoreService::SendRequest (CoreServiceRequest &request) { static Mutex mutex; ScopeLock lock (mutex); @@ -341,7 +341,7 @@ namespace VeraCrypt try { request.Serialize (ServiceInputStream); - auto_ptr <T> response (GetResponse <T>()); + unique_ptr <T> response (GetResponse <T>()); ElevatedServiceAvailable = true; return response; } @@ -390,8 +390,8 @@ 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(); @@ -533,7 +533,7 @@ namespace VeraCrypt if (!errOutput.empty()) { - auto_ptr <Serializable> deserializedObject; + unique_ptr <Serializable> deserializedObject; Exception *deserializedException = nullptr; try @@ -573,8 +573,8 @@ namespace VeraCrypt 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 () @@ -585,11 +585,11 @@ 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; 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 @@ -39,17 +39,17 @@ namespace VeraCrypt 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; 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 @@ -200,7 +200,7 @@ 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 @@ -489,6 +489,6 @@ namespace VeraCrypt } } - 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 @@ -229,6 +229,6 @@ namespace VeraCrypt } } - 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 @@ -173,6 +173,6 @@ namespace VeraCrypt } } - 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 @@ -592,5 +592,5 @@ namespace VeraCrypt 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 @@ -70,7 +70,7 @@ namespace VeraCrypt static VolumeSlotNumber SlotNumber; static uid_t UserId; static gid_t GroupId; - static auto_ptr <Pipe> SignalHandlerPipe; + static unique_ptr <Pipe> SignalHandlerPipe; }; } 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 @@ -828,5 +828,5 @@ namespace VeraCrypt 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 @@ -105,7 +105,7 @@ 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 @@ -509,7 +509,7 @@ 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)); 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 @@ -214,8 +214,8 @@ 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; 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 @@ -54,7 +54,7 @@ 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 @@ -36,7 +36,7 @@ namespace VeraCrypt 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 @@ -48,7 +48,7 @@ namespace VeraCrypt int PreviousGaugeValue; uint64 ProgressBarRange; - auto_ptr <wxTimer> RandomPoolTimer; + unique_ptr <wxTimer> RandomPoolTimer; int RealProgressBarRange; wxLongLong StartTime; bool VolumeCreatorRunning; 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 @@ -67,8 +67,8 @@ namespace VeraCrypt 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; 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 @@ -344,7 +344,7 @@ 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)); @@ -409,7 +409,7 @@ 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)); @@ -632,7 +632,7 @@ 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) { @@ -965,8 +965,8 @@ namespace VeraCrypt 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)) { 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 @@ -129,10 +129,10 @@ 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: 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 @@ -1156,7 +1156,7 @@ 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) { 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 @@ -69,8 +69,8 @@ namespace VeraCrypt 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 &); 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 @@ -66,8 +66,8 @@ namespace VeraCrypt protected: int CurrentIndentLevel; - auto_ptr <wxMemoryOutputStream> MemOutStream; - auto_ptr <wxTextOutputStream> TextOutStream; + unique_ptr <wxMemoryOutputStream> MemOutStream; + unique_ptr <wxTextOutputStream> TextOutStream; File OutFile; private: 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 @@ -170,7 +170,7 @@ namespace VeraCrypt 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 @@ -125,9 +125,7 @@ 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 @@ -44,7 +44,7 @@ namespace VeraCrypt }; struct WorkItem *FirstFragment; - auto_ptr <Exception> ItemException; + unique_ptr <Exception> ItemException; SyncEvent ItemCompletedEvent; SharedVal <size_t> OutstandingFragmentCount; SharedVal <State::Enum> State; |