VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Core
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 /src/Core
parent8250e83e6188dffd26d6310e36af3132d93412dd (diff)
downloadVeraCrypt-0a2c565aa98fa7bc9623a753370e565fc5ed1e63.tar.gz
VeraCrypt-0a2c565aa98fa7bc9623a753370e565fc5ed1e63.zip
Switch from auto_ptr to unique_ptr (#638)
Diffstat (limited to 'src/Core')
-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
7 files changed, 31 insertions, 31 deletions
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);
}