1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 03:18:26 -06:00

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
29 changed files with 71 additions and 73 deletions

View File

@@ -828,5 +828,5 @@ namespace VeraCrypt
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<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

View File

@@ -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));

View File

@@ -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;

View File

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

View File

@@ -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;

View File

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

View File

@@ -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;

View File

@@ -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))
{

View File

@@ -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:

View File

@@ -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)
{

View File

@@ -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 &);

View File

@@ -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: