From 0a2c565aa98fa7bc9623a753370e565fc5ed1e63 Mon Sep 17 00:00:00 2001 From: Christopher Bergqvist Date: Thu, 11 Jun 2020 18:02:28 +0200 Subject: Switch from auto_ptr to unique_ptr (#638) --- src/Common/BaseCom.cpp | 4 +-- src/Common/Dlgcode.c | 2 +- src/Common/SecurityToken.cpp | 12 ++++----- src/Common/SecurityToken.h | 8 +++--- src/Core/Core.h | 4 +-- src/Core/Unix/CoreService.cpp | 30 +++++++++++------------ src/Core/Unix/CoreService.h | 12 ++++----- src/Core/Unix/FreeBSD/CoreFreeBSD.cpp | 4 +-- src/Core/Unix/Linux/CoreLinux.cpp | 4 +-- src/Core/Unix/MacOSX/CoreMacOSX.cpp | 4 +-- src/Core/Unix/Solaris/CoreSolaris.cpp | 4 +-- src/Driver/Fuse/FuseService.cpp | 2 +- src/Driver/Fuse/FuseService.h | 2 +- src/Main/CommandLineInterface.cpp | 2 +- src/Main/CommandLineInterface.h | 2 +- src/Main/Forms/MainFrame.cpp | 2 +- src/Main/Forms/MainFrame.h | 4 +-- src/Main/Forms/PreferencesDialog.h | 2 +- src/Main/Forms/ProgressWizardPage.h | 2 +- src/Main/Forms/VolumeCreationProgressWizardPage.h | 2 +- src/Main/Forms/VolumeCreationWizard.h | 4 +-- src/Main/GraphicUserInterface.cpp | 10 ++++---- src/Main/GraphicUserInterface.h | 4 +-- src/Main/TextUserInterface.cpp | 2 +- src/Main/TextUserInterface.h | 4 +-- src/Main/Xml.h | 4 +-- src/Platform/Unix/Process.cpp | 2 +- src/Volume/EncryptionThreadPool.cpp | 4 +-- src/Volume/EncryptionThreadPool.h | 2 +- 29 files changed, 71 insertions(+), 73 deletions(-) (limited to 'src') 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 (device ? new Device (filePath, !write) : new File (filePath, !write)); + unique_ptr 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 (device ? new Device (filePath, readOnly == TRUE) : new File (filePath, readOnly == TRUE)); + unique_ptr 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 (new PinRequestHandler(MainDlg)), auto_ptr (new WarningHandler(MainDlg))); + SecurityToken::InitLibrary (SecurityTokenLibraryPath, unique_ptr (new PinRequestHandler(MainDlg)), unique_ptr (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 pinCallback, auto_ptr warningCallback) + void SecurityToken::InitLibrary (const wstring &pkcs11LibraryPath, unique_ptr pinCallback, unique_ptr warningCallback) #else - void SecurityToken::InitLibrary (const string &pkcs11LibraryPath, auto_ptr pinCallback, auto_ptr warningCallback) + void SecurityToken::InitLibrary (const string &pkcs11LibraryPath, unique_ptr pinCallback, unique_ptr 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 SecurityToken::PinCallback; - auto_ptr SecurityToken::WarningCallback; + unique_ptr SecurityToken::PinCallback; + unique_ptr 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 GetAvailableTokens (); static SecurityTokenInfo GetTokenInfo (CK_SLOT_ID slotId); #ifdef TC_WINDOWS - static void InitLibrary (const wstring &pkcs11LibraryPath, auto_ptr pinCallback, auto_ptr warningCallback); + static void InitLibrary (const wstring &pkcs11LibraryPath, unique_ptr pinCallback, unique_ptr warningCallback); #else - static void InitLibrary (const string &pkcs11LibraryPath, auto_ptr pinCallback, auto_ptr warningCallback); + static void InitLibrary (const string &pkcs11LibraryPath, unique_ptr pinCallback, unique_ptr 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 PinCallback; + static unique_ptr 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 Sessions; - static auto_ptr WarningCallback; + static unique_ptr 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 Core; - extern auto_ptr CoreDirect; + extern unique_ptr Core; + extern unique_ptr 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 - auto_ptr CoreService::GetResponse () + unique_ptr CoreService::GetResponse () { - auto_ptr deserializedObject (Serializable::DeserializeNew (ServiceOutputStream)); + unique_ptr deserializedObject (Serializable::DeserializeNew (ServiceOutputStream)); Exception *deserializedException = dynamic_cast (deserializedObject.get()); if (deserializedException) @@ -39,7 +39,7 @@ namespace VeraCrypt if (dynamic_cast (deserializedObject.get()) == nullptr) throw ParameterIncorrect (SRC_POS); - return auto_ptr (dynamic_cast (deserializedObject.release())); + return unique_ptr (dynamic_cast (deserializedObject.release())); } void CoreService::ProcessElevatedRequests () @@ -90,7 +90,7 @@ namespace VeraCrypt { try { - Core = CoreDirect; + Core = std::move(CoreDirect); shared_ptr inputStream (new FileStream (inputFD != -1 ? inputFD : InputPipe->GetReadFD())); shared_ptr outputStream (new FileStream (outputFD != -1 ? outputFD : OutputPipe->GetWriteFD())); @@ -278,7 +278,7 @@ namespace VeraCrypt } template - auto_ptr CoreService::SendRequest (CoreServiceRequest &request) + unique_ptr CoreService::SendRequest (CoreServiceRequest &request) { static Mutex mutex; ScopeLock lock (mutex); @@ -341,7 +341,7 @@ namespace VeraCrypt try { request.Serialize (ServiceInputStream); - auto_ptr response (GetResponse ()); + unique_ptr response (GetResponse ()); ElevatedServiceAvailable = true; return response; } @@ -390,8 +390,8 @@ namespace VeraCrypt void CoreService::StartElevated (const CoreServiceRequest &request) { - auto_ptr inPipe (new Pipe()); - auto_ptr outPipe (new Pipe()); + unique_ptr inPipe (new Pipe()); + unique_ptr outPipe (new Pipe()); Pipe errPipe; int forkedPid = fork(); @@ -533,7 +533,7 @@ namespace VeraCrypt if (!errOutput.empty()) { - auto_ptr deserializedObject; + unique_ptr 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 CoreService::AdminPasswordCallback; - auto_ptr CoreService::AdminInputPipe; - auto_ptr CoreService::AdminOutputPipe; + unique_ptr CoreService::AdminInputPipe; + unique_ptr CoreService::AdminOutputPipe; - auto_ptr CoreService::InputPipe; - auto_ptr CoreService::OutputPipe; + unique_ptr CoreService::InputPipe; + unique_ptr CoreService::OutputPipe; shared_ptr CoreService::ServiceInputStream; shared_ptr 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 static auto_ptr GetResponse (); - template static auto_ptr SendRequest (CoreServiceRequest &request); + template static unique_ptr GetResponse (); + template static unique_ptr SendRequest (CoreServiceRequest &request); static void StartElevated (const CoreServiceRequest &request); static shared_ptr AdminPasswordCallback; - static auto_ptr AdminInputPipe; - static auto_ptr AdminOutputPipe; + static unique_ptr AdminInputPipe; + static unique_ptr AdminOutputPipe; - static auto_ptr InputPipe; - static auto_ptr OutputPipe; + static unique_ptr InputPipe; + static unique_ptr OutputPipe; static shared_ptr ServiceInputStream; static shared_ptr 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 Core (new CoreServiceProxy ); - auto_ptr CoreDirect (new CoreFreeBSD); + unique_ptr Core (new CoreServiceProxy ); + unique_ptr 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 Core (new CoreServiceProxy ); - auto_ptr CoreDirect (new CoreLinux); + unique_ptr Core (new CoreServiceProxy ); + unique_ptr 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 Core (new CoreServiceProxy ); - auto_ptr CoreDirect (new CoreMacOSX); + unique_ptr Core (new CoreServiceProxy ); + unique_ptr 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 Core (new CoreServiceProxy ); - auto_ptr CoreDirect (new CoreSolaris); + unique_ptr Core (new CoreServiceProxy ); + unique_ptr 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 FuseService::SignalHandlerPipe; + unique_ptr 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 SignalHandlerPipe; + static unique_ptr 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(new SecureBuffer ()); } - auto_ptr CmdLine; + unique_ptr 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 ToUTF8Password (const wchar_t* str, size_t charCount, size_t maxUtf8Len); shared_ptr ToUTF8Buffer (const wchar_t* str, size_t charCount, size_t maxUtf8Len); - extern auto_ptr CmdLine; + extern unique_ptr 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 popup (new wxMenu); + unique_ptr 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 FavoriteVolumesMenuMap; bool ListItemRightClickEventPending; VolumeInfoList MountedVolumes; - auto_ptr mTaskBarIcon; - auto_ptr mTimer; + unique_ptr mTaskBarIcon; + unique_ptr 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 mTimer; + unique_ptr 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 mTimer; + unique_ptr 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 RandomPoolTimer; + unique_ptr 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 ProgressTimer; - auto_ptr RandomPoolUpdateTimer; + unique_ptr ProgressTimer; + unique_ptr RandomPoolUpdateTimer; shared_ptr 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 arrowWaitCursor; + static unique_ptr 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 arrowCursor; + static unique_ptr arrowCursor; if (arrowCursor.get() == nullptr) arrowCursor.reset (new wxCursor (wxCURSOR_ARROW)); @@ -632,7 +632,7 @@ namespace VeraCrypt try { - SecurityToken::InitLibrary (Preferences.SecurityTokenModule, auto_ptr (new PinRequestHandler), auto_ptr (new WarningHandler)); + SecurityToken::InitLibrary (Preferences.SecurityTokenModule, unique_ptr (new PinRequestHandler), unique_ptr (new WarningHandler)); } catch (Exception &e) { @@ -965,8 +965,8 @@ namespace VeraCrypt wxConnectionBase *OnMakeConnection () { return new Connection; } }; - auto_ptr client (new Client); - auto_ptr connection (client->MakeConnection (L"localhost", serverName, L"raise")); + unique_ptr client (new Client); + unique_ptr 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 DDEServer; + unique_ptr DDEServer; #endif wxFrame *mMainFrame; - auto_ptr SingleInstanceChecker; + unique_ptr 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 (new PinRequestHandler (this)), auto_ptr (new WarningHandler (this))); + SecurityToken::InitLibrary (Preferences.SecurityTokenModule, unique_ptr (new PinRequestHandler (this)), unique_ptr (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 FInputStream; - auto_ptr TextInputStream; + unique_ptr FInputStream; + unique_ptr 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 MemOutStream; - auto_ptr TextOutStream; + unique_ptr MemOutStream; + unique_ptr 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 deserializedObject; + unique_ptr 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 itemException; - if (firstFragmentWorkItem->ItemException.get()) - itemException = firstFragmentWorkItem->ItemException; + unique_ptr 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 ItemException; + unique_ptr ItemException; SyncEvent ItemCompletedEvent; SharedVal OutstandingFragmentCount; SharedVal State; -- cgit v1.2.3