Switch from auto_ptr to unique_ptr (#638)

This commit is contained in:
Christopher Bergqvist 2020-06-11 18:02:28 +02:00 committed by GitHub
parent 8250e83e61
commit 0a2c565aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 71 additions and 73 deletions

View File

@ -130,7 +130,7 @@ DWORD BaseCom::ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *buff
{ {
try 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->CheckOpened (SRC_POS);
file->SeekAt (offset); file->SeekAt (offset);
@ -194,7 +194,7 @@ DWORD BaseCom::DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD
{ {
try 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); file->CheckOpened (SRC_POS);
if (!file->IoCtl (dwIoControlCode, (BYTE *) input, !(BYTE *) input ? 0 : ((DWORD *) ((BYTE *) input))[-1], if (!file->IoCtl (dwIoControlCode, (BYTE *) input, !(BYTE *) input ? 0 : ((DWORD *) ((BYTE *) input))[-1],
(BYTE *) *output, !(BYTE *) *output ? 0 : ((DWORD *) ((BYTE *) *output))[-1])) (BYTE *) *output, !(BYTE *) *output ? 0 : ((DWORD *) ((BYTE *) *output))[-1]))

View File

@ -12104,7 +12104,7 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg)
try 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) catch (Exception &e)
{ {

View File

@ -513,9 +513,9 @@ namespace VeraCrypt
} }
#ifdef TC_WINDOWS #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 #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 #endif
{ {
if (Initialized) if (Initialized)
@ -548,8 +548,8 @@ namespace VeraCrypt
if (status != CKR_OK) if (status != CKR_OK)
throw Pkcs11Exception (status); throw Pkcs11Exception (status);
PinCallback = pinCallback; PinCallback = std::move(pinCallback);
WarningCallback = warningCallback; WarningCallback = std::move(warningCallback);
Initialized = true; Initialized = true;
} }
@ -728,8 +728,8 @@ namespace VeraCrypt
} }
#endif // TC_HEADER_Common_Exception #endif // TC_HEADER_Common_Exception
auto_ptr <GetPinFunctor> SecurityToken::PinCallback; unique_ptr <GetPinFunctor> SecurityToken::PinCallback;
auto_ptr <SendExceptionFunctor> SecurityToken::WarningCallback; unique_ptr <SendExceptionFunctor> SecurityToken::WarningCallback;
bool SecurityToken::Initialized; bool SecurityToken::Initialized;
CK_FUNCTION_LIST_PTR SecurityToken::Pkcs11Functions; CK_FUNCTION_LIST_PTR SecurityToken::Pkcs11Functions;

View File

@ -191,9 +191,9 @@ namespace VeraCrypt
static list <SecurityTokenInfo> GetAvailableTokens (); static list <SecurityTokenInfo> GetAvailableTokens ();
static SecurityTokenInfo GetTokenInfo (CK_SLOT_ID slotId); static SecurityTokenInfo GetTokenInfo (CK_SLOT_ID slotId);
#ifdef TC_WINDOWS #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 #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 #endif
static bool IsInitialized () { return Initialized; } static bool IsInitialized () { return Initialized; }
static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath); static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath);
@ -211,7 +211,7 @@ namespace VeraCrypt
static void CheckLibraryStatus (); static void CheckLibraryStatus ();
static bool Initialized; static bool Initialized;
static auto_ptr <GetPinFunctor> PinCallback; static unique_ptr <GetPinFunctor> PinCallback;
static CK_FUNCTION_LIST_PTR Pkcs11Functions; static CK_FUNCTION_LIST_PTR Pkcs11Functions;
#ifdef TC_WINDOWS #ifdef TC_WINDOWS
static HMODULE Pkcs11LibraryHandle; static HMODULE Pkcs11LibraryHandle;
@ -219,7 +219,7 @@ namespace VeraCrypt
static void *Pkcs11LibraryHandle; static void *Pkcs11LibraryHandle;
#endif #endif
static map <CK_SLOT_ID, Pkcs11Session> Sessions; static map <CK_SLOT_ID, Pkcs11Session> Sessions;
static auto_ptr <SendExceptionFunctor> WarningCallback; static unique_ptr <SendExceptionFunctor> WarningCallback;
}; };
} }

View File

@ -17,8 +17,8 @@
namespace VeraCrypt namespace VeraCrypt
{ {
extern auto_ptr <CoreBase> Core; extern unique_ptr <CoreBase> Core;
extern auto_ptr <CoreBase> CoreDirect; extern unique_ptr <CoreBase> CoreDirect;
class WaitThreadRoutine class WaitThreadRoutine
{ {

View File

@ -28,9 +28,9 @@
namespace VeraCrypt namespace VeraCrypt
{ {
template <class T> 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()); Exception *deserializedException = dynamic_cast <Exception*> (deserializedObject.get());
if (deserializedException) if (deserializedException)
@ -39,7 +39,7 @@ namespace VeraCrypt
if (dynamic_cast <T *> (deserializedObject.get()) == nullptr) if (dynamic_cast <T *> (deserializedObject.get()) == nullptr)
throw ParameterIncorrect (SRC_POS); 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 () void CoreService::ProcessElevatedRequests ()
@ -90,7 +90,7 @@ namespace VeraCrypt
{ {
try try
{ {
Core = CoreDirect; Core = std::move(CoreDirect);
shared_ptr <Stream> inputStream (new FileStream (inputFD != -1 ? inputFD : InputPipe->GetReadFD())); shared_ptr <Stream> inputStream (new FileStream (inputFD != -1 ? inputFD : InputPipe->GetReadFD()));
shared_ptr <Stream> outputStream (new FileStream (outputFD != -1 ? outputFD : OutputPipe->GetWriteFD())); shared_ptr <Stream> outputStream (new FileStream (outputFD != -1 ? outputFD : OutputPipe->GetWriteFD()));
@ -278,7 +278,7 @@ namespace VeraCrypt
} }
template <class T> template <class T>
auto_ptr <T> CoreService::SendRequest (CoreServiceRequest &request) unique_ptr <T> CoreService::SendRequest (CoreServiceRequest &request)
{ {
static Mutex mutex; static Mutex mutex;
ScopeLock lock (mutex); ScopeLock lock (mutex);
@ -341,7 +341,7 @@ namespace VeraCrypt
try try
{ {
request.Serialize (ServiceInputStream); request.Serialize (ServiceInputStream);
auto_ptr <T> response (GetResponse <T>()); unique_ptr <T> response (GetResponse <T>());
ElevatedServiceAvailable = true; ElevatedServiceAvailable = true;
return response; return response;
} }
@ -390,8 +390,8 @@ namespace VeraCrypt
void CoreService::StartElevated (const CoreServiceRequest &request) void CoreService::StartElevated (const CoreServiceRequest &request)
{ {
auto_ptr <Pipe> inPipe (new Pipe()); unique_ptr <Pipe> inPipe (new Pipe());
auto_ptr <Pipe> outPipe (new Pipe()); unique_ptr <Pipe> outPipe (new Pipe());
Pipe errPipe; Pipe errPipe;
int forkedPid = fork(); int forkedPid = fork();
@ -533,7 +533,7 @@ namespace VeraCrypt
if (!errOutput.empty()) if (!errOutput.empty())
{ {
auto_ptr <Serializable> deserializedObject; unique_ptr <Serializable> deserializedObject;
Exception *deserializedException = nullptr; Exception *deserializedException = nullptr;
try try
@ -573,8 +573,8 @@ namespace VeraCrypt
byte sync[] = { 0, 0x11, 0x22 }; byte sync[] = { 0, 0x11, 0x22 };
ServiceInputStream->Write (ConstBufferPtr (sync, array_capacity (sync))); ServiceInputStream->Write (ConstBufferPtr (sync, array_capacity (sync)));
AdminInputPipe = inPipe; AdminInputPipe = std::move(inPipe);
AdminOutputPipe = outPipe; AdminOutputPipe = std::move(outPipe);
} }
void CoreService::Stop () void CoreService::Stop ()
@ -585,11 +585,11 @@ namespace VeraCrypt
shared_ptr <GetStringFunctor> CoreService::AdminPasswordCallback; shared_ptr <GetStringFunctor> CoreService::AdminPasswordCallback;
auto_ptr <Pipe> CoreService::AdminInputPipe; unique_ptr <Pipe> CoreService::AdminInputPipe;
auto_ptr <Pipe> CoreService::AdminOutputPipe; unique_ptr <Pipe> CoreService::AdminOutputPipe;
auto_ptr <Pipe> CoreService::InputPipe; unique_ptr <Pipe> CoreService::InputPipe;
auto_ptr <Pipe> CoreService::OutputPipe; unique_ptr <Pipe> CoreService::OutputPipe;
shared_ptr <Stream> CoreService::ServiceInputStream; shared_ptr <Stream> CoreService::ServiceInputStream;
shared_ptr <Stream> CoreService::ServiceOutputStream; shared_ptr <Stream> CoreService::ServiceOutputStream;

View File

@ -39,17 +39,17 @@ namespace VeraCrypt
static void Stop (); static void Stop ();
protected: protected:
template <class T> static auto_ptr <T> GetResponse (); template <class T> static unique_ptr <T> GetResponse ();
template <class T> static auto_ptr <T> SendRequest (CoreServiceRequest &request); template <class T> static unique_ptr <T> SendRequest (CoreServiceRequest &request);
static void StartElevated (const CoreServiceRequest &request); static void StartElevated (const CoreServiceRequest &request);
static shared_ptr <GetStringFunctor> AdminPasswordCallback; static shared_ptr <GetStringFunctor> AdminPasswordCallback;
static auto_ptr <Pipe> AdminInputPipe; static unique_ptr <Pipe> AdminInputPipe;
static auto_ptr <Pipe> AdminOutputPipe; static unique_ptr <Pipe> AdminOutputPipe;
static auto_ptr <Pipe> InputPipe; static unique_ptr <Pipe> InputPipe;
static auto_ptr <Pipe> OutputPipe; static unique_ptr <Pipe> OutputPipe;
static shared_ptr <Stream> ServiceInputStream; static shared_ptr <Stream> ServiceInputStream;
static shared_ptr <Stream> ServiceOutputStream; static shared_ptr <Stream> ServiceOutputStream;

View File

@ -200,7 +200,7 @@ namespace VeraCrypt
} }
#ifdef TC_FREEBSD #ifdef TC_FREEBSD
auto_ptr <CoreBase> Core (new CoreServiceProxy <CoreFreeBSD>); unique_ptr <CoreBase> Core (new CoreServiceProxy <CoreFreeBSD>);
auto_ptr <CoreBase> CoreDirect (new CoreFreeBSD); unique_ptr <CoreBase> CoreDirect (new CoreFreeBSD);
#endif #endif
} }

View File

@ -489,6 +489,6 @@ namespace VeraCrypt
} }
} }
auto_ptr <CoreBase> Core (new CoreServiceProxy <CoreLinux>); unique_ptr <CoreBase> Core (new CoreServiceProxy <CoreLinux>);
auto_ptr <CoreBase> CoreDirect (new CoreLinux); unique_ptr <CoreBase> CoreDirect (new CoreLinux);
} }

View File

@ -229,6 +229,6 @@ namespace VeraCrypt
} }
} }
auto_ptr <CoreBase> Core (new CoreServiceProxy <CoreMacOSX>); unique_ptr <CoreBase> Core (new CoreServiceProxy <CoreMacOSX>);
auto_ptr <CoreBase> CoreDirect (new CoreMacOSX); unique_ptr <CoreBase> CoreDirect (new CoreMacOSX);
} }

View File

@ -173,6 +173,6 @@ namespace VeraCrypt
} }
} }
auto_ptr <CoreBase> Core (new CoreServiceProxy <CoreSolaris>); unique_ptr <CoreBase> Core (new CoreServiceProxy <CoreSolaris>);
auto_ptr <CoreBase> CoreDirect (new CoreSolaris); unique_ptr <CoreBase> CoreDirect (new CoreSolaris);
} }

View File

@ -592,5 +592,5 @@ namespace VeraCrypt
VolumeSlotNumber FuseService::SlotNumber; VolumeSlotNumber FuseService::SlotNumber;
uid_t FuseService::UserId; uid_t FuseService::UserId;
gid_t FuseService::GroupId; gid_t FuseService::GroupId;
auto_ptr <Pipe> FuseService::SignalHandlerPipe; unique_ptr <Pipe> FuseService::SignalHandlerPipe;
} }

View File

@ -70,7 +70,7 @@ namespace VeraCrypt
static VolumeSlotNumber SlotNumber; static VolumeSlotNumber SlotNumber;
static uid_t UserId; static uid_t UserId;
static gid_t GroupId; static gid_t GroupId;
static auto_ptr <Pipe> SignalHandlerPipe; static unique_ptr <Pipe> SignalHandlerPipe;
}; };
} }

View File

@ -828,5 +828,5 @@ namespace VeraCrypt
return shared_ptr<SecureBuffer>(new SecureBuffer ()); return shared_ptr<SecureBuffer>(new SecureBuffer ());
} }
auto_ptr <CommandLineInterface> CmdLine; unique_ptr <CommandLineInterface> CmdLine;
} }

View File

@ -105,7 +105,7 @@ namespace VeraCrypt
shared_ptr<VolumePassword> ToUTF8Password (const wchar_t* str, size_t charCount, size_t maxUtf8Len); 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); 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 #endif // TC_HEADER_Main_CommandInterface

View File

@ -509,7 +509,7 @@ namespace VeraCrypt
wxMenu *CreatePopupMenu () 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)); Gui->AppendToMenu (*popup, LangString[Gui->IsInBackgroundMode() ? "SHOW_TC" : "HIDE_TC"], this, wxCommandEventHandler (TaskBarIcon::OnShowHideMenuItemSelected));

View File

@ -214,8 +214,8 @@ namespace VeraCrypt
map <int, FavoriteVolume> FavoriteVolumesMenuMap; map <int, FavoriteVolume> FavoriteVolumesMenuMap;
bool ListItemRightClickEventPending; bool ListItemRightClickEventPending;
VolumeInfoList MountedVolumes; VolumeInfoList MountedVolumes;
auto_ptr <wxTaskBarIcon> mTaskBarIcon; unique_ptr <wxTaskBarIcon> mTaskBarIcon;
auto_ptr <wxTimer> mTimer; unique_ptr <wxTimer> mTimer;
long SelectedItemIndex; long SelectedItemIndex;
VolumeSlotNumber SelectedSlotNumber; VolumeSlotNumber SelectedSlotNumber;
int ShowRequestFifo; int ShowRequestFifo;

View File

@ -54,7 +54,7 @@ namespace VeraCrypt
KeyfilesPanel *DefaultKeyfilesPanel; KeyfilesPanel *DefaultKeyfilesPanel;
int LastVirtualKeyPressed; int LastVirtualKeyPressed;
auto_ptr <wxTimer> mTimer; unique_ptr <wxTimer> mTimer;
UserPreferences Preferences; UserPreferences Preferences;
bool RestoreValidatorBell; bool RestoreValidatorBell;
HotkeyList UnregisteredHotkeys; HotkeyList UnregisteredHotkeys;

View File

@ -36,7 +36,7 @@ namespace VeraCrypt
void OnAbortButtonClick (wxCommandEvent& event); void OnAbortButtonClick (wxCommandEvent& event);
void OnTimer (); void OnTimer ();
auto_ptr <wxTimer> mTimer; unique_ptr <wxTimer> mTimer;
int PreviousGaugeValue; int PreviousGaugeValue;
uint64 ProgressBarRange; uint64 ProgressBarRange;
int RealProgressBarRange; int RealProgressBarRange;

View File

@ -48,7 +48,7 @@ namespace VeraCrypt
int PreviousGaugeValue; int PreviousGaugeValue;
uint64 ProgressBarRange; uint64 ProgressBarRange;
auto_ptr <wxTimer> RandomPoolTimer; unique_ptr <wxTimer> RandomPoolTimer;
int RealProgressBarRange; int RealProgressBarRange;
wxLongLong StartTime; wxLongLong StartTime;
bool VolumeCreatorRunning; bool VolumeCreatorRunning;

View File

@ -67,8 +67,8 @@ namespace VeraCrypt
bool CrossPlatformSupport; bool CrossPlatformSupport;
static bool DeviceWarningConfirmed; static bool DeviceWarningConfirmed;
bool DisplayKeyInfo; bool DisplayKeyInfo;
auto_ptr <wxTimer> ProgressTimer; unique_ptr <wxTimer> ProgressTimer;
auto_ptr <wxTimer> RandomPoolUpdateTimer; unique_ptr <wxTimer> RandomPoolUpdateTimer;
shared_ptr <KeyfileList> Keyfiles; shared_ptr <KeyfileList> Keyfiles;
bool LargeFilesSupport; bool LargeFilesSupport;
uint64 MaxHiddenVolumeSize; uint64 MaxHiddenVolumeSize;

View File

@ -344,7 +344,7 @@ namespace VeraCrypt
void GraphicUserInterface::BeginInteractiveBusyState (wxWindow *window) void GraphicUserInterface::BeginInteractiveBusyState (wxWindow *window)
{ {
static auto_ptr <wxCursor> arrowWaitCursor; static unique_ptr <wxCursor> arrowWaitCursor;
if (arrowWaitCursor.get() == nullptr) if (arrowWaitCursor.get() == nullptr)
arrowWaitCursor.reset (new wxCursor (wxCURSOR_ARROWWAIT)); arrowWaitCursor.reset (new wxCursor (wxCURSOR_ARROWWAIT));
@ -409,7 +409,7 @@ namespace VeraCrypt
void GraphicUserInterface::EndInteractiveBusyState (wxWindow *window) const void GraphicUserInterface::EndInteractiveBusyState (wxWindow *window) const
{ {
static auto_ptr <wxCursor> arrowCursor; static unique_ptr <wxCursor> arrowCursor;
if (arrowCursor.get() == nullptr) if (arrowCursor.get() == nullptr)
arrowCursor.reset (new wxCursor (wxCURSOR_ARROW)); arrowCursor.reset (new wxCursor (wxCURSOR_ARROW));
@ -632,7 +632,7 @@ namespace VeraCrypt
try 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) catch (Exception &e)
{ {
@ -965,8 +965,8 @@ namespace VeraCrypt
wxConnectionBase *OnMakeConnection () { return new Connection; } wxConnectionBase *OnMakeConnection () { return new Connection; }
}; };
auto_ptr <wxDDEClient> client (new Client); unique_ptr <wxDDEClient> client (new Client);
auto_ptr <wxConnectionBase> connection (client->MakeConnection (L"localhost", serverName, L"raise")); unique_ptr <wxConnectionBase> connection (client->MakeConnection (L"localhost", serverName, L"raise"));
if (connection.get() && connection->Execute (nullptr)) if (connection.get() && connection->Execute (nullptr))
{ {

View File

@ -129,10 +129,10 @@ namespace VeraCrypt
wxFrame *ActiveFrame; wxFrame *ActiveFrame;
bool BackgroundMode; bool BackgroundMode;
#ifdef TC_WINDOWS #ifdef TC_WINDOWS
auto_ptr <wxDDEServer> DDEServer; unique_ptr <wxDDEServer> DDEServer;
#endif #endif
wxFrame *mMainFrame; wxFrame *mMainFrame;
auto_ptr <wxSingleInstanceChecker> SingleInstanceChecker; unique_ptr <wxSingleInstanceChecker> SingleInstanceChecker;
mutable WaitDialog* mWaitDialog; mutable WaitDialog* mWaitDialog;
public: public:

View File

@ -1156,7 +1156,7 @@ namespace VeraCrypt
try 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) catch (Exception &e)
{ {

View File

@ -69,8 +69,8 @@ namespace VeraCrypt
virtual void ReadInputStreamLine (wxString &line) const; virtual void ReadInputStreamLine (wxString &line) const;
virtual wxString ReadInputStreamLine () const; virtual wxString ReadInputStreamLine () const;
auto_ptr <wxFFileInputStream> FInputStream; unique_ptr <wxFFileInputStream> FInputStream;
auto_ptr <wxTextInputStream> TextInputStream; unique_ptr <wxTextInputStream> TextInputStream;
private: private:
TextUserInterface (const TextUserInterface &); TextUserInterface (const TextUserInterface &);

View File

@ -66,8 +66,8 @@ namespace VeraCrypt
protected: protected:
int CurrentIndentLevel; int CurrentIndentLevel;
auto_ptr <wxMemoryOutputStream> MemOutStream; unique_ptr <wxMemoryOutputStream> MemOutStream;
auto_ptr <wxTextOutputStream> TextOutStream; unique_ptr <wxTextOutputStream> TextOutStream;
File OutFile; File OutFile;
private: private:

View File

@ -170,7 +170,7 @@ namespace VeraCrypt
if (!exOutput.empty()) if (!exOutput.empty())
{ {
auto_ptr <Serializable> deserializedObject; unique_ptr <Serializable> deserializedObject;
Exception *deserializedException = nullptr; Exception *deserializedException = nullptr;
try try

View File

@ -125,9 +125,7 @@ namespace VeraCrypt
firstFragmentWorkItem->ItemCompletedEvent.Wait(); firstFragmentWorkItem->ItemCompletedEvent.Wait();
auto_ptr <Exception> itemException; unique_ptr <Exception> itemException = std::move(firstFragmentWorkItem->ItemException);
if (firstFragmentWorkItem->ItemException.get())
itemException = firstFragmentWorkItem->ItemException;
firstFragmentWorkItem->State.Set (WorkItem::State::Free); firstFragmentWorkItem->State.Set (WorkItem::State::Free);
WorkItemCompletedEvent.Signal(); WorkItemCompletedEvent.Signal();

View File

@ -44,7 +44,7 @@ namespace VeraCrypt
}; };
struct WorkItem *FirstFragment; struct WorkItem *FirstFragment;
auto_ptr <Exception> ItemException; unique_ptr <Exception> ItemException;
SyncEvent ItemCompletedEvent; SyncEvent ItemCompletedEvent;
SharedVal <size_t> OutstandingFragmentCount; SharedVal <size_t> OutstandingFragmentCount;
SharedVal <State::Enum> State; SharedVal <State::Enum> State;