changeset 157:275e14f57f1e

replacing deprecated std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 06 Jul 2020 12:45:58 +0200
parents 710537acb488
children ceaa2e4458d5
files Framework/Common/DatabaseManager.cpp Framework/Common/DatabaseManager.h Framework/Common/ImplicitTransaction.cpp Framework/Common/ResultBase.cpp Framework/MySQL/MySQLDatabase.cpp Framework/MySQL/MySQLStatement.cpp Framework/MySQL/MySQLTransaction.cpp Framework/Plugins/GlobalProperties.cpp Framework/Plugins/IndexBackend.cpp Framework/Plugins/IndexUnitTests.h Framework/Plugins/StorageBackend.cpp Framework/PostgreSQL/PostgreSQLResult.cpp Framework/PostgreSQL/PostgreSQLStatement.cpp Framework/PostgreSQL/PostgreSQLTransaction.cpp Framework/SQLite/SQLiteStatement.h Framework/SQLite/SQLiteTransaction.cpp MySQL/Plugins/IndexPlugin.cpp MySQL/Plugins/MySQLIndex.cpp MySQL/Plugins/MySQLStorageArea.cpp MySQL/UnitTests/UnitTestsMain.cpp PostgreSQL/Plugins/IndexPlugin.cpp PostgreSQL/Plugins/PostgreSQLIndex.cpp PostgreSQL/Plugins/PostgreSQLStorageArea.cpp PostgreSQL/UnitTests/PostgreSQLTests.cpp SQLite/Plugins/IndexPlugin.cpp SQLite/Plugins/SQLiteIndex.cpp SQLite/UnitTests/UnitTestsMain.cpp
diffstat 27 files changed, 99 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Common/DatabaseManager.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/Common/DatabaseManager.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -23,6 +23,7 @@
 
 #include "../../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -141,7 +142,7 @@
   {
     LOG(TRACE) << "Caching statement from " << location.GetFile() << ":" << location.GetLine();
       
-    std::auto_ptr<IPrecompiledStatement> statement(GetDatabase().Compile(query));
+    std::unique_ptr<IPrecompiledStatement> statement(GetDatabase().Compile(query));
       
     IPrecompiledStatement* tmp = statement.get();
     if (tmp == NULL)
@@ -338,7 +339,7 @@
 
   void DatabaseManager::StatementBase::SetQuery(Query* query)
   {
-    std::auto_ptr<Query> protection(query);
+    std::unique_ptr<Query> protection(query);
     
     if (query_.get() != NULL)
     {
@@ -357,7 +358,7 @@
   
   void DatabaseManager::StatementBase::SetResult(IResult* result)
   {
-    std::auto_ptr<IResult> protection(result);
+    std::unique_ptr<IResult> protection(result);
     
     if (result_.get() != NULL)
     {
@@ -504,7 +505,7 @@
   {
     try
     {
-      std::auto_ptr<Query> query(ReleaseQuery());
+      std::unique_ptr<Query> query(ReleaseQuery());
       
       if (query.get() != NULL)
       {
@@ -556,7 +557,7 @@
   {
     try
     {
-      std::auto_ptr<Query> query(ReleaseQuery());
+      std::unique_ptr<Query> query(ReleaseQuery());
       assert(query.get() != NULL);
 
       // The "statement_" object must be kept as long as the "IResult"
--- a/Framework/Common/DatabaseManager.h	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/Common/DatabaseManager.h	Mon Jul 06 12:45:58 2020 +0200
@@ -24,6 +24,7 @@
 #include "IDatabaseFactory.h"
 #include "StatementLocation.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Enumerations.h>
 
 #include <boost/thread/recursive_mutex.hpp>
@@ -37,9 +38,9 @@
     typedef std::map<StatementLocation, IPrecompiledStatement*>  CachedStatements;
 
     boost::recursive_mutex           mutex_;
-    std::auto_ptr<IDatabaseFactory>  factory_;
-    std::auto_ptr<IDatabase>         database_;
-    std::auto_ptr<ITransaction>      transaction_;
+    std::unique_ptr<IDatabaseFactory>  factory_;
+    std::unique_ptr<IDatabase>         database_;
+    std::unique_ptr<ITransaction>      transaction_;
     CachedStatements                 cachedStatements_;
     Dialect                          dialect_;
 
@@ -117,8 +118,8 @@
       DatabaseManager&                     manager_;
       boost::recursive_mutex::scoped_lock  lock_;
       ITransaction&                        transaction_;
-      std::auto_ptr<Query>                 query_;
-      std::auto_ptr<IResult>               result_;
+      std::unique_ptr<Query>                 query_;
+      std::unique_ptr<IResult>               result_;
 
       IResult& GetResult() const;
 
@@ -200,7 +201,7 @@
     class StandaloneStatement : public StatementBase
     {
     private:
-      std::auto_ptr<IPrecompiledStatement>  statement_;
+      std::unique_ptr<IPrecompiledStatement>  statement_;
       
     public:
       StandaloneStatement(DatabaseManager& manager,
--- a/Framework/Common/ImplicitTransaction.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/Common/ImplicitTransaction.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -21,6 +21,7 @@
 
 #include "ImplicitTransaction.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -124,7 +125,7 @@
                                         const Dictionary& parameters)
   {
     CheckStateForExecution();    
-    std::auto_ptr<IResult> result(ExecuteInternal(statement, parameters));
+    std::unique_ptr<IResult> result(ExecuteInternal(statement, parameters));
 
     if (!statement.IsReadOnly())
     {
--- a/Framework/Common/ResultBase.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/Common/ResultBase.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -26,6 +26,7 @@
 #include "../Common/NullValue.h"
 #include "../Common/Utf8StringValue.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -66,7 +67,7 @@
           sourceType != ValueType_Null &&
           sourceType != targetType)
       {
-        std::auto_ptr<IValue> converted(fields_[i]->Convert(targetType));
+        std::unique_ptr<IValue> converted(fields_[i]->Convert(targetType));
         
         if (converted.get() == NULL)
         {
--- a/Framework/MySQL/MySQLDatabase.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/MySQL/MySQLDatabase.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -27,6 +27,7 @@
 #include "../Common/ImplicitTransaction.h"
 #include "../Common/Integer64Value.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 #include <Toolbox.h>
@@ -321,7 +322,7 @@
 
     {
       MySQLTransaction t(*this);
-      std::auto_ptr<IResult> result(t.Execute(statement, args));
+      std::unique_ptr<IResult> result(t.Execute(statement, args));
 
       success = (!result->IsDone() &&
                  result->GetField(0).GetType() == ValueType_Integer64 &&
@@ -382,7 +383,7 @@
     args.SetUtf8Value("database", parameters_.GetDatabase());
     args.SetUtf8Value("table", name);
 
-    std::auto_ptr<IResult> result(statement.Execute(transaction, args));
+    std::unique_ptr<IResult> result(statement.Execute(transaction, args));
     return (!result->IsDone() &&
             result->GetFieldsCount() == 1 &&
             result->GetField(0).GetType() == ValueType_Integer64 &&
@@ -412,7 +413,7 @@
     Dictionary args;
     args.SetUtf8Value("database", name);
 
-    std::auto_ptr<IResult> result(statement.Execute(transaction, args));
+    std::unique_ptr<IResult> result(statement.Execute(transaction, args));
     return (!result->IsDone() &&
             result->GetFieldsCount() == 1 &&
             result->GetField(0).GetType() == ValueType_Integer64 &&
@@ -442,7 +443,7 @@
     Dictionary args;
     args.SetUtf8Value("trigger", name);
 
-    std::auto_ptr<IResult> result(statement.Execute(transaction, args));
+    std::unique_ptr<IResult> result(statement.Execute(transaction, args));
     return (!result->IsDone() &&
             result->GetFieldsCount() == 1 &&
             result->GetField(0).GetType() == ValueType_Integer64 &&
--- a/Framework/MySQL/MySQLStatement.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/MySQL/MySQLStatement.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -28,6 +28,7 @@
 #include "../Common/Utf8StringValue.h"
 #include "MySQLResult.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -542,6 +543,6 @@
   void MySQLStatement::ExecuteWithoutResult(ITransaction& transaction,
                                             const Dictionary& parameters)
   {
-    std::auto_ptr<IResult> dummy(Execute(transaction, parameters));
+    std::unique_ptr<IResult> dummy(Execute(transaction, parameters));
   }
 }
--- a/Framework/MySQL/MySQLTransaction.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/MySQL/MySQLTransaction.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -23,6 +23,7 @@
 
 #include "MySQLStatement.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -93,7 +94,7 @@
   IResult* MySQLTransaction::Execute(IPrecompiledStatement& statement,
                                      const Dictionary& parameters)
   {
-    std::auto_ptr<IResult> result(dynamic_cast<MySQLStatement&>(statement).Execute(*this, parameters));
+    std::unique_ptr<IResult> result(dynamic_cast<MySQLStatement&>(statement).Execute(*this, parameters));
 
     if (!statement.IsReadOnly())
     {
--- a/Framework/Plugins/GlobalProperties.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/Plugins/GlobalProperties.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -23,6 +23,7 @@
 
 #include "../Common/Utf8StringValue.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -38,12 +39,12 @@
     Query query("SELECT value FROM GlobalProperties WHERE property=${property}", true);
     query.SetType("property", ValueType_Integer64);
 
-    std::auto_ptr<IPrecompiledStatement> statement(db.Compile(query));
+    std::unique_ptr<IPrecompiledStatement> statement(db.Compile(query));
 
     Dictionary args;
     args.SetIntegerValue("property", property);
 
-    std::auto_ptr<IResult> result(transaction.Execute(*statement, args));
+    std::unique_ptr<IResult> result(transaction.Execute(*statement, args));
 
     if (result->IsDone())
     {
@@ -127,7 +128,7 @@
       query.SetType("property", ValueType_Integer64);
       query.SetType("value", ValueType_Utf8String);
       
-      std::auto_ptr<IPrecompiledStatement> statement(db.Compile(query));
+      std::unique_ptr<IPrecompiledStatement> statement(db.Compile(query));
 
       Dictionary args;
       args.SetIntegerValue("property", static_cast<int>(property));
@@ -141,7 +142,7 @@
         Query query("DELETE FROM GlobalProperties WHERE property=${property}", false);
         query.SetType("property", ValueType_Integer64);
       
-        std::auto_ptr<IPrecompiledStatement> statement(db.Compile(query));
+        std::unique_ptr<IPrecompiledStatement> statement(db.Compile(query));
 
         Dictionary args;
         args.SetIntegerValue("property", static_cast<int>(property));
@@ -154,7 +155,7 @@
         query.SetType("property", ValueType_Integer64);
         query.SetType("value", ValueType_Utf8String);
       
-        std::auto_ptr<IPrecompiledStatement> statement(db.Compile(query));
+        std::unique_ptr<IPrecompiledStatement> statement(db.Compile(query));
 
         Dictionary args;
         args.SetIntegerValue("property", static_cast<int>(property));
--- a/Framework/Plugins/IndexBackend.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -27,6 +27,7 @@
 #include "../Common/Utf8StringValue.h"
 #include "GlobalProperties.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -692,7 +693,7 @@
     
   uint64_t IndexBackend::GetResourceCount(OrthancPluginResourceType resourceType)
   {
-    std::auto_ptr<DatabaseManager::CachedStatement> statement;
+    std::unique_ptr<DatabaseManager::CachedStatement> statement;
 
     switch (manager_.GetDialect())
     {
@@ -757,7 +758,7 @@
     
   uint64_t IndexBackend::GetTotalCompressedSize()
   {
-    std::auto_ptr<DatabaseManager::CachedStatement> statement;
+    std::unique_ptr<DatabaseManager::CachedStatement> statement;
 
     // NB: "COALESCE" is used to replace "NULL" by "0" if the number of rows is empty
 
@@ -794,7 +795,7 @@
     
   uint64_t IndexBackend::GetTotalUncompressedSize()
   {
-    std::auto_ptr<DatabaseManager::CachedStatement> statement;
+    std::unique_ptr<DatabaseManager::CachedStatement> statement;
 
     // NB: "COALESCE" is used to replace "NULL" by "0" if the number of rows is empty
 
@@ -1009,7 +1010,7 @@
                                       OrthancPluginIdentifierConstraint constraint,
                                       const char* value)
   {
-    std::auto_ptr<DatabaseManager::CachedStatement> statement;
+    std::unique_ptr<DatabaseManager::CachedStatement> statement;
 
     std::string header =
       "SELECT d.id FROM DicomIdentifiers AS d, Resources AS r WHERE "
@@ -1465,7 +1466,7 @@
   // For unit testing only!
   uint64_t IndexBackend::GetResourcesCount()
   {
-    std::auto_ptr<DatabaseManager::CachedStatement> statement;
+    std::unique_ptr<DatabaseManager::CachedStatement> statement;
 
     switch (manager_.GetDialect())
     {
@@ -1501,7 +1502,7 @@
   // For unit testing only!
   uint64_t IndexBackend::GetUnprotectedPatientsCount()
   {
-    std::auto_ptr<DatabaseManager::CachedStatement> statement;
+    std::unique_ptr<DatabaseManager::CachedStatement> statement;
 
     switch (manager_.GetDialect())
     {
--- a/Framework/Plugins/IndexUnitTests.h	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/Plugins/IndexUnitTests.h	Mon Jul 06 12:45:58 2020 +0200
@@ -24,6 +24,8 @@
 #include "../Common/ImplicitTransaction.h"
 #include "GlobalProperties.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
+
 #include <orthanc/OrthancCDatabasePlugin.h>
 
 #include <gtest/gtest.h>
@@ -45,9 +47,9 @@
 }
 
 
-static std::auto_ptr<OrthancPluginAttachment>  expectedAttachment;
+static std::unique_ptr<OrthancPluginAttachment>  expectedAttachment;
 static std::list<OrthancPluginDicomTag>  expectedDicomTags;
-static std::auto_ptr<OrthancPluginExportedResource>  expectedExported;
+static std::unique_ptr<OrthancPluginExportedResource>  expectedExported;
 
 static void CheckAttachment(const OrthancPluginAttachment& attachment)
 {
--- a/Framework/Plugins/StorageBackend.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/Plugins/StorageBackend.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -28,6 +28,7 @@
 #include "../../Framework/Common/BinaryStringValue.h"
 #include "../../Framework/Common/FileValue.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <OrthancException.h>
 
 
@@ -208,7 +209,7 @@
 
 
   static OrthancPluginContext* context_ = NULL;
-  static std::auto_ptr<StorageBackend>  backend_;
+  static std::unique_ptr<StorageBackend>  backend_;
     
 
   static OrthancPluginErrorCode StorageCreate(const char* uuid,
--- a/Framework/PostgreSQL/PostgreSQLResult.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/PostgreSQL/PostgreSQLResult.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -28,6 +28,7 @@
 #include "../Common/NullValue.h"
 #include "../Common/Utf8StringValue.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <OrthancException.h>
 #include <Logging.h>
 #include <Endianness.h>
@@ -230,7 +231,7 @@
 
       case OIDOID:
       {
-        std::auto_ptr<FileValue> value(new FileValue);
+        std::unique_ptr<FileValue> value(new FileValue);
         GetLargeObject(value->GetContent(), column);
         return value.release();
       }
--- a/Framework/PostgreSQL/PostgreSQLStatement.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/PostgreSQL/PostgreSQLStatement.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -30,6 +30,7 @@
 #include "../Common/Utf8StringValue.h"
 #include "PostgreSQLResult.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 #include <Toolbox.h>
@@ -466,7 +467,7 @@
   class PostgreSQLStatement::ResultWrapper : public ResultBase
   {
   private:
-    std::auto_ptr<PostgreSQLResult>  result_;
+    std::unique_ptr<PostgreSQLResult>  result_;
 
   protected:
     virtual IValue* FetchField(size_t index)
@@ -544,6 +545,6 @@
   void PostgreSQLStatement::ExecuteWithoutResult(ITransaction& transaction,
                                                  const Dictionary& parameters)
   {
-    std::auto_ptr<IResult> dummy(Execute(transaction, parameters));
+    std::unique_ptr<IResult> dummy(Execute(transaction, parameters));
   }
 }
--- a/Framework/PostgreSQL/PostgreSQLTransaction.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/PostgreSQL/PostgreSQLTransaction.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -23,6 +23,7 @@
 
 #include "PostgreSQLStatement.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -101,7 +102,7 @@
   IResult* PostgreSQLTransaction::Execute(IPrecompiledStatement& statement,
                                           const Dictionary& parameters)
   {
-    std::auto_ptr<IResult> result(dynamic_cast<PostgreSQLStatement&>(statement).Execute(*this, parameters));
+    std::unique_ptr<IResult> result(dynamic_cast<PostgreSQLStatement&>(statement).Execute(*this, parameters));
 
     if (!statement.IsReadOnly())
     {
--- a/Framework/SQLite/SQLiteStatement.h	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/SQLite/SQLiteStatement.h	Mon Jul 06 12:45:58 2020 +0200
@@ -29,6 +29,7 @@
 #include "SQLiteTransaction.h"
 #include "../Common/GenericFormatter.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <SQLite/Statement.h>
 
 #include <memory>
@@ -38,7 +39,7 @@
   class SQLiteStatement : public IPrecompiledStatement
   {
   private:
-    std::auto_ptr<Orthanc::SQLite::Statement>  statement_;
+    std::unique_ptr<Orthanc::SQLite::Statement>  statement_;
     bool                                       readOnly_;
     GenericFormatter                           formatter_;
 
--- a/Framework/SQLite/SQLiteTransaction.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/Framework/SQLite/SQLiteTransaction.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -24,6 +24,7 @@
 #include "SQLiteResult.h"
 #include "SQLiteStatement.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <OrthancException.h>
 
 namespace OrthancDatabases
@@ -43,7 +44,7 @@
   IResult* SQLiteTransaction::Execute(IPrecompiledStatement& statement,
                                       const Dictionary& parameters)
   {
-    std::auto_ptr<IResult> result(dynamic_cast<SQLiteStatement&>(statement).Execute(*this, parameters));
+    std::unique_ptr<IResult> result(dynamic_cast<SQLiteStatement&>(statement).Execute(*this, parameters));
 
     if (!statement.IsReadOnly())
     {
--- a/MySQL/Plugins/IndexPlugin.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/MySQL/Plugins/IndexPlugin.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -23,11 +23,12 @@
 #include "../../Framework/MySQL/MySQLDatabase.h"
 #include "../../Framework/Plugins/PluginInitialization.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <HttpClient.h>
 #include <Logging.h>
 #include <Toolbox.h>
 
-static std::auto_ptr<OrthancDatabases::MySQLIndex> backend_;
+static std::unique_ptr<OrthancDatabases::MySQLIndex> backend_;
 
 
 extern "C"
--- a/MySQL/Plugins/MySQLIndex.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/MySQL/Plugins/MySQLIndex.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -28,6 +28,7 @@
 
 #include <EmbeddedResources.h>  // Auto-generated file
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -77,7 +78,7 @@
       MySQLDatabase::ClearDatabase(parameters_);
     }
     
-    std::auto_ptr<MySQLDatabase> db(new MySQLDatabase(parameters_));
+    std::unique_ptr<MySQLDatabase> db(new MySQLDatabase(parameters_));
 
     db->Open();
     db->Execute("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE", false);
--- a/MySQL/Plugins/MySQLStorageArea.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/MySQL/Plugins/MySQLStorageArea.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -25,6 +25,7 @@
 #include "../../Framework/MySQL/MySQLTransaction.h"
 #include "MySQLDefinitions.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 
 #include <boost/math/special_functions/round.hpp>
@@ -34,7 +35,7 @@
 {
   IDatabase* MySQLStorageArea::OpenInternal()
   {
-    std::auto_ptr<MySQLDatabase> db(new MySQLDatabase(parameters_));
+    std::unique_ptr<MySQLDatabase> db(new MySQLDatabase(parameters_));
 
     db->Open();
 
--- a/MySQL/UnitTests/UnitTestsMain.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/MySQL/UnitTests/UnitTestsMain.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -31,6 +31,7 @@
 #include "../../Framework/MySQL/MySQLTransaction.h"
 #include "../../Framework/Plugins/IndexUnitTests.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <HttpClient.h>
 #include <Logging.h>
 #include <Toolbox.h>
@@ -138,7 +139,7 @@
   OrthancDatabases::MySQLStatement s(db, query);
   OrthancDatabases::MySQLTransaction t(db);
   OrthancDatabases::Dictionary d;
-  std::auto_ptr<OrthancDatabases::IResult> result(s.Execute(t, d));
+  std::unique_ptr<OrthancDatabases::IResult> result(s.Execute(t, d));
   return dynamic_cast<const OrthancDatabases::Integer64Value&>(result->GetField(0)).GetValue();
 }
 
@@ -215,15 +216,15 @@
   }
 
   {
-    std::auto_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(false));
+    std::unique_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(false));
     ASSERT_FALSE(t->IsImplicit());
   }
 
   {
     OrthancDatabases::Query query("CREATE TABLE test(id INT)", false);
-    std::auto_ptr<OrthancDatabases::IPrecompiledStatement> s(db.Compile(query));
+    std::unique_ptr<OrthancDatabases::IPrecompiledStatement> s(db.Compile(query));
     
-    std::auto_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(true));
+    std::unique_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(true));
     ASSERT_TRUE(t->IsImplicit());
     ASSERT_THROW(t->Commit(), Orthanc::OrthancException);
     ASSERT_THROW(t->Rollback(), Orthanc::OrthancException);
@@ -239,9 +240,9 @@
   {
     // An implicit transaction does not need to be explicitely committed
     OrthancDatabases::Query query("CREATE TABLE test2(id INT)", false);
-    std::auto_ptr<OrthancDatabases::IPrecompiledStatement> s(db.Compile(query));
+    std::unique_ptr<OrthancDatabases::IPrecompiledStatement> s(db.Compile(query));
     
-    std::auto_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(true));
+    std::unique_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(true));
 
     OrthancDatabases::Dictionary args;
     t->ExecuteWithoutResult(*s, args);
--- a/PostgreSQL/Plugins/IndexPlugin.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/PostgreSQL/Plugins/IndexPlugin.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -22,9 +22,10 @@
 #include "PostgreSQLIndex.h"
 #include "../../Framework/Plugins/PluginInitialization.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 
-static std::auto_ptr<OrthancDatabases::PostgreSQLIndex> backend_;
+static std::unique_ptr<OrthancDatabases::PostgreSQLIndex> backend_;
 
 
 extern "C"
--- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -28,6 +28,7 @@
 
 #include <EmbeddedResources.h>  // Auto-generated file
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -66,7 +67,7 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_Plugin);
     }
 
-    std::auto_ptr<PostgreSQLDatabase> db(new PostgreSQLDatabase(parameters_));
+    std::unique_ptr<PostgreSQLDatabase> db(new PostgreSQLDatabase(parameters_));
 
     db->Open();
 
--- a/PostgreSQL/Plugins/PostgreSQLStorageArea.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/PostgreSQL/Plugins/PostgreSQLStorageArea.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -25,6 +25,7 @@
 #include "../../Framework/PostgreSQL/PostgreSQLTransaction.h"
 #include "../../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 
 
@@ -32,7 +33,7 @@
 {
   IDatabase* PostgreSQLStorageArea::OpenInternal()
   {
-    std::auto_ptr<PostgreSQLDatabase> db(new PostgreSQLDatabase(parameters_));
+    std::unique_ptr<PostgreSQLDatabase> db(new PostgreSQLDatabase(parameters_));
 
     db->Open();
 
--- a/PostgreSQL/UnitTests/PostgreSQLTests.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/PostgreSQL/UnitTests/PostgreSQLTests.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -41,6 +41,7 @@
 #include "../Plugins/PostgreSQLIndex.h"
 #include "../Plugins/PostgreSQLStorageArea.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <OrthancException.h>
 
 #include <boost/lexical_cast.hpp>
@@ -52,7 +53,7 @@
 
 static PostgreSQLDatabase* CreateTestDatabase()
 {
-  std::auto_ptr<PostgreSQLDatabase> pg
+  std::unique_ptr<PostgreSQLDatabase> pg
     (new PostgreSQLDatabase(globalParameters_));
 
   pg->Open();
@@ -73,7 +74,7 @@
 
 TEST(PostgreSQL, Basic)
 {
-  std::auto_ptr<PostgreSQLDatabase> pg(CreateTestDatabase());
+  std::unique_ptr<PostgreSQLDatabase> pg(CreateTestDatabase());
 
   ASSERT_FALSE(pg->DoesTableExist("Test"));
   pg->Execute("CREATE TABLE Test(name INTEGER, value BIGINT)");
@@ -146,7 +147,7 @@
 
 TEST(PostgreSQL, String)
 {
-  std::auto_ptr<PostgreSQLDatabase> pg(CreateTestDatabase());
+  std::unique_ptr<PostgreSQLDatabase> pg(CreateTestDatabase());
 
   pg->Execute("CREATE TABLE Test(name INTEGER, value VARCHAR(40))");
 
@@ -192,7 +193,7 @@
 
 TEST(PostgreSQL, Transaction)
 {
-  std::auto_ptr<PostgreSQLDatabase> pg(CreateTestDatabase());
+  std::unique_ptr<PostgreSQLDatabase> pg(CreateTestDatabase());
 
   pg->Execute("CREATE TABLE Test(name INTEGER, value INTEGER)");
 
@@ -260,7 +261,7 @@
 
 TEST(PostgreSQL, LargeObject)
 {
-  std::auto_ptr<PostgreSQLDatabase> pg(CreateTestDatabase());
+  std::unique_ptr<PostgreSQLDatabase> pg(CreateTestDatabase());
   ASSERT_EQ(0, CountLargeObjects(*pg));
 
   pg->Execute("CREATE TABLE Test(name VARCHAR, value OID)");
@@ -397,21 +398,21 @@
 
 TEST(PostgreSQL, ImplicitTransaction)
 {
-  std::auto_ptr<PostgreSQLDatabase> db(CreateTestDatabase());
+  std::unique_ptr<PostgreSQLDatabase> db(CreateTestDatabase());
 
   ASSERT_FALSE(db->DoesTableExist("test"));
   ASSERT_FALSE(db->DoesTableExist("test2"));
 
   {
-    std::auto_ptr<OrthancDatabases::ITransaction> t(db->CreateTransaction(false));
+    std::unique_ptr<OrthancDatabases::ITransaction> t(db->CreateTransaction(false));
     ASSERT_FALSE(t->IsImplicit());
   }
 
   {
     Query query("CREATE TABLE test(id INT)", false);
-    std::auto_ptr<IPrecompiledStatement> s(db->Compile(query));
+    std::unique_ptr<IPrecompiledStatement> s(db->Compile(query));
     
-    std::auto_ptr<ITransaction> t(db->CreateTransaction(true));
+    std::unique_ptr<ITransaction> t(db->CreateTransaction(true));
     ASSERT_TRUE(t->IsImplicit());
     ASSERT_THROW(t->Commit(), Orthanc::OrthancException);
     ASSERT_THROW(t->Rollback(), Orthanc::OrthancException);
@@ -427,9 +428,9 @@
   {
     // An implicit transaction does not need to be explicitely committed
     Query query("CREATE TABLE test2(id INT)", false);
-    std::auto_ptr<IPrecompiledStatement> s(db->Compile(query));
+    std::unique_ptr<IPrecompiledStatement> s(db->Compile(query));
     
-    std::auto_ptr<ITransaction> t(db->CreateTransaction(true));
+    std::unique_ptr<ITransaction> t(db->CreateTransaction(true));
 
     Dictionary args;
     t->ExecuteWithoutResult(*s, args);
@@ -518,7 +519,7 @@
 
 TEST(PostgreSQL, Lock2)
 {
-  std::auto_ptr<PostgreSQLDatabase> db1(CreateTestDatabase());
+  std::unique_ptr<PostgreSQLDatabase> db1(CreateTestDatabase());
   db1->Open();
 
   ASSERT_FALSE(db1->ReleaseAdvisoryLock(43)); // lock counter = 0
@@ -534,7 +535,7 @@
   ASSERT_TRUE(db1->AcquireAdvisoryLock(43));  // lock counter = 1
 
   {
-    std::auto_ptr<PostgreSQLDatabase> db2(CreateTestDatabase());
+    std::unique_ptr<PostgreSQLDatabase> db2(CreateTestDatabase());
     db2->Open();
 
     // The "db1" is still actively locking
--- a/SQLite/Plugins/IndexPlugin.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/SQLite/Plugins/IndexPlugin.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -22,9 +22,10 @@
 #include "SQLiteIndex.h"
 #include "../../Framework/Plugins/PluginInitialization.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 
-static std::auto_ptr<OrthancDatabases::SQLiteIndex> backend_;
+static std::unique_ptr<OrthancDatabases::SQLiteIndex> backend_;
 
 
 extern "C"
--- a/SQLite/Plugins/SQLiteIndex.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/SQLite/Plugins/SQLiteIndex.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -28,6 +28,7 @@
 
 #include <EmbeddedResources.h>  // Auto-generated file
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <OrthancException.h>
 
@@ -56,7 +57,7 @@
     }
 
 
-    std::auto_ptr<SQLiteDatabase> db(new SQLiteDatabase);
+    std::unique_ptr<SQLiteDatabase> db(new SQLiteDatabase);
 
     if (path_.empty())
     {
--- a/SQLite/UnitTests/UnitTestsMain.cpp	Mon Jul 06 12:40:44 2020 +0200
+++ b/SQLite/UnitTests/UnitTestsMain.cpp	Mon Jul 06 12:45:58 2020 +0200
@@ -22,6 +22,7 @@
 #include "../../Framework/SQLite/SQLiteDatabase.h"
 #include "../Plugins/SQLiteIndex.h"
 
+#include <Compatibility.h>  // For std::unique_ptr<>
 #include <Logging.h>
 #include <SystemToolbox.h>
 
@@ -68,15 +69,15 @@
   ASSERT_FALSE(db.DoesTableExist("test2"));
 
   {
-    std::auto_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(false));
+    std::unique_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(false));
     ASSERT_FALSE(t->IsImplicit());
   }
 
   {
     OrthancDatabases::Query query("CREATE TABLE test(id INT)", false);
-    std::auto_ptr<OrthancDatabases::IPrecompiledStatement> s(db.Compile(query));
+    std::unique_ptr<OrthancDatabases::IPrecompiledStatement> s(db.Compile(query));
     
-    std::auto_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(true));
+    std::unique_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(true));
     ASSERT_TRUE(t->IsImplicit());
     ASSERT_THROW(t->Commit(), Orthanc::OrthancException);
     ASSERT_THROW(t->Rollback(), Orthanc::OrthancException);
@@ -92,9 +93,9 @@
   {
     // An implicit transaction does not need to be explicitely committed
     OrthancDatabases::Query query("CREATE TABLE test2(id INT)", false);
-    std::auto_ptr<OrthancDatabases::IPrecompiledStatement> s(db.Compile(query));
+    std::unique_ptr<OrthancDatabases::IPrecompiledStatement> s(db.Compile(query));
     
-    std::auto_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(true));
+    std::unique_ptr<OrthancDatabases::ITransaction> t(db.CreateTransaction(true));
 
     OrthancDatabases::Dictionary args;
     t->ExecuteWithoutResult(*s, args);