# HG changeset patch # User Sebastien Jodogne # Date 1594032358 -7200 # Node ID 275e14f57f1e683671381cd0d3193ce64fa3d360 # Parent 710537acb488fef8ed2b118e80b8df19e4a0eebb replacing deprecated std::auto_ptr by std::unique_ptr diff -r 710537acb488 -r 275e14f57f1e Framework/Common/DatabaseManager.cpp --- 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 // For std::unique_ptr<> #include #include @@ -141,7 +142,7 @@ { LOG(TRACE) << "Caching statement from " << location.GetFile() << ":" << location.GetLine(); - std::auto_ptr statement(GetDatabase().Compile(query)); + std::unique_ptr statement(GetDatabase().Compile(query)); IPrecompiledStatement* tmp = statement.get(); if (tmp == NULL) @@ -338,7 +339,7 @@ void DatabaseManager::StatementBase::SetQuery(Query* query) { - std::auto_ptr protection(query); + std::unique_ptr protection(query); if (query_.get() != NULL) { @@ -357,7 +358,7 @@ void DatabaseManager::StatementBase::SetResult(IResult* result) { - std::auto_ptr protection(result); + std::unique_ptr protection(result); if (result_.get() != NULL) { @@ -504,7 +505,7 @@ { try { - std::auto_ptr query(ReleaseQuery()); + std::unique_ptr query(ReleaseQuery()); if (query.get() != NULL) { @@ -556,7 +557,7 @@ { try { - std::auto_ptr query(ReleaseQuery()); + std::unique_ptr query(ReleaseQuery()); assert(query.get() != NULL); // The "statement_" object must be kept as long as the "IResult" diff -r 710537acb488 -r 275e14f57f1e Framework/Common/DatabaseManager.h --- 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 // For std::unique_ptr<> #include #include @@ -37,9 +38,9 @@ typedef std::map CachedStatements; boost::recursive_mutex mutex_; - std::auto_ptr factory_; - std::auto_ptr database_; - std::auto_ptr transaction_; + std::unique_ptr factory_; + std::unique_ptr database_; + std::unique_ptr transaction_; CachedStatements cachedStatements_; Dialect dialect_; @@ -117,8 +118,8 @@ DatabaseManager& manager_; boost::recursive_mutex::scoped_lock lock_; ITransaction& transaction_; - std::auto_ptr query_; - std::auto_ptr result_; + std::unique_ptr query_; + std::unique_ptr result_; IResult& GetResult() const; @@ -200,7 +201,7 @@ class StandaloneStatement : public StatementBase { private: - std::auto_ptr statement_; + std::unique_ptr statement_; public: StandaloneStatement(DatabaseManager& manager, diff -r 710537acb488 -r 275e14f57f1e Framework/Common/ImplicitTransaction.cpp --- 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 // For std::unique_ptr<> #include #include @@ -124,7 +125,7 @@ const Dictionary& parameters) { CheckStateForExecution(); - std::auto_ptr result(ExecuteInternal(statement, parameters)); + std::unique_ptr result(ExecuteInternal(statement, parameters)); if (!statement.IsReadOnly()) { diff -r 710537acb488 -r 275e14f57f1e Framework/Common/ResultBase.cpp --- 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 // For std::unique_ptr<> #include #include @@ -66,7 +67,7 @@ sourceType != ValueType_Null && sourceType != targetType) { - std::auto_ptr converted(fields_[i]->Convert(targetType)); + std::unique_ptr converted(fields_[i]->Convert(targetType)); if (converted.get() == NULL) { diff -r 710537acb488 -r 275e14f57f1e Framework/MySQL/MySQLDatabase.cpp --- 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 // For std::unique_ptr<> #include #include #include @@ -321,7 +322,7 @@ { MySQLTransaction t(*this); - std::auto_ptr result(t.Execute(statement, args)); + std::unique_ptr 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 result(statement.Execute(transaction, args)); + std::unique_ptr 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 result(statement.Execute(transaction, args)); + std::unique_ptr 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 result(statement.Execute(transaction, args)); + std::unique_ptr result(statement.Execute(transaction, args)); return (!result->IsDone() && result->GetFieldsCount() == 1 && result->GetField(0).GetType() == ValueType_Integer64 && diff -r 710537acb488 -r 275e14f57f1e Framework/MySQL/MySQLStatement.cpp --- 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 // For std::unique_ptr<> #include #include @@ -542,6 +543,6 @@ void MySQLStatement::ExecuteWithoutResult(ITransaction& transaction, const Dictionary& parameters) { - std::auto_ptr dummy(Execute(transaction, parameters)); + std::unique_ptr dummy(Execute(transaction, parameters)); } } diff -r 710537acb488 -r 275e14f57f1e Framework/MySQL/MySQLTransaction.cpp --- 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 // For std::unique_ptr<> #include #include @@ -93,7 +94,7 @@ IResult* MySQLTransaction::Execute(IPrecompiledStatement& statement, const Dictionary& parameters) { - std::auto_ptr result(dynamic_cast(statement).Execute(*this, parameters)); + std::unique_ptr result(dynamic_cast(statement).Execute(*this, parameters)); if (!statement.IsReadOnly()) { diff -r 710537acb488 -r 275e14f57f1e Framework/Plugins/GlobalProperties.cpp --- 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 // For std::unique_ptr<> #include #include @@ -38,12 +39,12 @@ Query query("SELECT value FROM GlobalProperties WHERE property=${property}", true); query.SetType("property", ValueType_Integer64); - std::auto_ptr statement(db.Compile(query)); + std::unique_ptr statement(db.Compile(query)); Dictionary args; args.SetIntegerValue("property", property); - std::auto_ptr result(transaction.Execute(*statement, args)); + std::unique_ptr 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 statement(db.Compile(query)); + std::unique_ptr statement(db.Compile(query)); Dictionary args; args.SetIntegerValue("property", static_cast(property)); @@ -141,7 +142,7 @@ Query query("DELETE FROM GlobalProperties WHERE property=${property}", false); query.SetType("property", ValueType_Integer64); - std::auto_ptr statement(db.Compile(query)); + std::unique_ptr statement(db.Compile(query)); Dictionary args; args.SetIntegerValue("property", static_cast(property)); @@ -154,7 +155,7 @@ query.SetType("property", ValueType_Integer64); query.SetType("value", ValueType_Utf8String); - std::auto_ptr statement(db.Compile(query)); + std::unique_ptr statement(db.Compile(query)); Dictionary args; args.SetIntegerValue("property", static_cast(property)); diff -r 710537acb488 -r 275e14f57f1e Framework/Plugins/IndexBackend.cpp --- 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 // For std::unique_ptr<> #include #include @@ -692,7 +693,7 @@ uint64_t IndexBackend::GetResourceCount(OrthancPluginResourceType resourceType) { - std::auto_ptr statement; + std::unique_ptr statement; switch (manager_.GetDialect()) { @@ -757,7 +758,7 @@ uint64_t IndexBackend::GetTotalCompressedSize() { - std::auto_ptr statement; + std::unique_ptr 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 statement; + std::unique_ptr 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 statement; + std::unique_ptr 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 statement; + std::unique_ptr statement; switch (manager_.GetDialect()) { @@ -1501,7 +1502,7 @@ // For unit testing only! uint64_t IndexBackend::GetUnprotectedPatientsCount() { - std::auto_ptr statement; + std::unique_ptr statement; switch (manager_.GetDialect()) { diff -r 710537acb488 -r 275e14f57f1e Framework/Plugins/IndexUnitTests.h --- 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 // For std::unique_ptr<> + #include #include @@ -45,9 +47,9 @@ } -static std::auto_ptr expectedAttachment; +static std::unique_ptr expectedAttachment; static std::list expectedDicomTags; -static std::auto_ptr expectedExported; +static std::unique_ptr expectedExported; static void CheckAttachment(const OrthancPluginAttachment& attachment) { diff -r 710537acb488 -r 275e14f57f1e Framework/Plugins/StorageBackend.cpp --- 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 // For std::unique_ptr<> #include @@ -208,7 +209,7 @@ static OrthancPluginContext* context_ = NULL; - static std::auto_ptr backend_; + static std::unique_ptr backend_; static OrthancPluginErrorCode StorageCreate(const char* uuid, diff -r 710537acb488 -r 275e14f57f1e Framework/PostgreSQL/PostgreSQLResult.cpp --- 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 // For std::unique_ptr<> #include #include #include @@ -230,7 +231,7 @@ case OIDOID: { - std::auto_ptr value(new FileValue); + std::unique_ptr value(new FileValue); GetLargeObject(value->GetContent(), column); return value.release(); } diff -r 710537acb488 -r 275e14f57f1e Framework/PostgreSQL/PostgreSQLStatement.cpp --- 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 // For std::unique_ptr<> #include #include #include @@ -466,7 +467,7 @@ class PostgreSQLStatement::ResultWrapper : public ResultBase { private: - std::auto_ptr result_; + std::unique_ptr result_; protected: virtual IValue* FetchField(size_t index) @@ -544,6 +545,6 @@ void PostgreSQLStatement::ExecuteWithoutResult(ITransaction& transaction, const Dictionary& parameters) { - std::auto_ptr dummy(Execute(transaction, parameters)); + std::unique_ptr dummy(Execute(transaction, parameters)); } } diff -r 710537acb488 -r 275e14f57f1e Framework/PostgreSQL/PostgreSQLTransaction.cpp --- 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 // For std::unique_ptr<> #include #include @@ -101,7 +102,7 @@ IResult* PostgreSQLTransaction::Execute(IPrecompiledStatement& statement, const Dictionary& parameters) { - std::auto_ptr result(dynamic_cast(statement).Execute(*this, parameters)); + std::unique_ptr result(dynamic_cast(statement).Execute(*this, parameters)); if (!statement.IsReadOnly()) { diff -r 710537acb488 -r 275e14f57f1e Framework/SQLite/SQLiteStatement.h --- 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 // For std::unique_ptr<> #include #include @@ -38,7 +39,7 @@ class SQLiteStatement : public IPrecompiledStatement { private: - std::auto_ptr statement_; + std::unique_ptr statement_; bool readOnly_; GenericFormatter formatter_; diff -r 710537acb488 -r 275e14f57f1e Framework/SQLite/SQLiteTransaction.cpp --- 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 // For std::unique_ptr<> #include namespace OrthancDatabases @@ -43,7 +44,7 @@ IResult* SQLiteTransaction::Execute(IPrecompiledStatement& statement, const Dictionary& parameters) { - std::auto_ptr result(dynamic_cast(statement).Execute(*this, parameters)); + std::unique_ptr result(dynamic_cast(statement).Execute(*this, parameters)); if (!statement.IsReadOnly()) { diff -r 710537acb488 -r 275e14f57f1e MySQL/Plugins/IndexPlugin.cpp --- 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 // For std::unique_ptr<> #include #include #include -static std::auto_ptr backend_; +static std::unique_ptr backend_; extern "C" diff -r 710537acb488 -r 275e14f57f1e MySQL/Plugins/MySQLIndex.cpp --- 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 // Auto-generated file +#include // For std::unique_ptr<> #include #include @@ -77,7 +78,7 @@ MySQLDatabase::ClearDatabase(parameters_); } - std::auto_ptr db(new MySQLDatabase(parameters_)); + std::unique_ptr db(new MySQLDatabase(parameters_)); db->Open(); db->Execute("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE", false); diff -r 710537acb488 -r 275e14f57f1e MySQL/Plugins/MySQLStorageArea.cpp --- 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 // For std::unique_ptr<> #include #include @@ -34,7 +35,7 @@ { IDatabase* MySQLStorageArea::OpenInternal() { - std::auto_ptr db(new MySQLDatabase(parameters_)); + std::unique_ptr db(new MySQLDatabase(parameters_)); db->Open(); diff -r 710537acb488 -r 275e14f57f1e MySQL/UnitTests/UnitTestsMain.cpp --- 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 // For std::unique_ptr<> #include #include #include @@ -138,7 +139,7 @@ OrthancDatabases::MySQLStatement s(db, query); OrthancDatabases::MySQLTransaction t(db); OrthancDatabases::Dictionary d; - std::auto_ptr result(s.Execute(t, d)); + std::unique_ptr result(s.Execute(t, d)); return dynamic_cast(result->GetField(0)).GetValue(); } @@ -215,15 +216,15 @@ } { - std::auto_ptr t(db.CreateTransaction(false)); + std::unique_ptr t(db.CreateTransaction(false)); ASSERT_FALSE(t->IsImplicit()); } { OrthancDatabases::Query query("CREATE TABLE test(id INT)", false); - std::auto_ptr s(db.Compile(query)); + std::unique_ptr s(db.Compile(query)); - std::auto_ptr t(db.CreateTransaction(true)); + std::unique_ptr 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 s(db.Compile(query)); + std::unique_ptr s(db.Compile(query)); - std::auto_ptr t(db.CreateTransaction(true)); + std::unique_ptr t(db.CreateTransaction(true)); OrthancDatabases::Dictionary args; t->ExecuteWithoutResult(*s, args); diff -r 710537acb488 -r 275e14f57f1e PostgreSQL/Plugins/IndexPlugin.cpp --- 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 // For std::unique_ptr<> #include -static std::auto_ptr backend_; +static std::unique_ptr backend_; extern "C" diff -r 710537acb488 -r 275e14f57f1e PostgreSQL/Plugins/PostgreSQLIndex.cpp --- 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 // Auto-generated file +#include // For std::unique_ptr<> #include #include @@ -66,7 +67,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_Plugin); } - std::auto_ptr db(new PostgreSQLDatabase(parameters_)); + std::unique_ptr db(new PostgreSQLDatabase(parameters_)); db->Open(); diff -r 710537acb488 -r 275e14f57f1e PostgreSQL/Plugins/PostgreSQLStorageArea.cpp --- 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 // For std::unique_ptr<> #include @@ -32,7 +33,7 @@ { IDatabase* PostgreSQLStorageArea::OpenInternal() { - std::auto_ptr db(new PostgreSQLDatabase(parameters_)); + std::unique_ptr db(new PostgreSQLDatabase(parameters_)); db->Open(); diff -r 710537acb488 -r 275e14f57f1e PostgreSQL/UnitTests/PostgreSQLTests.cpp --- 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 // For std::unique_ptr<> #include #include @@ -52,7 +53,7 @@ static PostgreSQLDatabase* CreateTestDatabase() { - std::auto_ptr pg + std::unique_ptr pg (new PostgreSQLDatabase(globalParameters_)); pg->Open(); @@ -73,7 +74,7 @@ TEST(PostgreSQL, Basic) { - std::auto_ptr pg(CreateTestDatabase()); + std::unique_ptr 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 pg(CreateTestDatabase()); + std::unique_ptr pg(CreateTestDatabase()); pg->Execute("CREATE TABLE Test(name INTEGER, value VARCHAR(40))"); @@ -192,7 +193,7 @@ TEST(PostgreSQL, Transaction) { - std::auto_ptr pg(CreateTestDatabase()); + std::unique_ptr pg(CreateTestDatabase()); pg->Execute("CREATE TABLE Test(name INTEGER, value INTEGER)"); @@ -260,7 +261,7 @@ TEST(PostgreSQL, LargeObject) { - std::auto_ptr pg(CreateTestDatabase()); + std::unique_ptr 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 db(CreateTestDatabase()); + std::unique_ptr db(CreateTestDatabase()); ASSERT_FALSE(db->DoesTableExist("test")); ASSERT_FALSE(db->DoesTableExist("test2")); { - std::auto_ptr t(db->CreateTransaction(false)); + std::unique_ptr t(db->CreateTransaction(false)); ASSERT_FALSE(t->IsImplicit()); } { Query query("CREATE TABLE test(id INT)", false); - std::auto_ptr s(db->Compile(query)); + std::unique_ptr s(db->Compile(query)); - std::auto_ptr t(db->CreateTransaction(true)); + std::unique_ptr 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 s(db->Compile(query)); + std::unique_ptr s(db->Compile(query)); - std::auto_ptr t(db->CreateTransaction(true)); + std::unique_ptr t(db->CreateTransaction(true)); Dictionary args; t->ExecuteWithoutResult(*s, args); @@ -518,7 +519,7 @@ TEST(PostgreSQL, Lock2) { - std::auto_ptr db1(CreateTestDatabase()); + std::unique_ptr 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 db2(CreateTestDatabase()); + std::unique_ptr db2(CreateTestDatabase()); db2->Open(); // The "db1" is still actively locking diff -r 710537acb488 -r 275e14f57f1e SQLite/Plugins/IndexPlugin.cpp --- 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 // For std::unique_ptr<> #include -static std::auto_ptr backend_; +static std::unique_ptr backend_; extern "C" diff -r 710537acb488 -r 275e14f57f1e SQLite/Plugins/SQLiteIndex.cpp --- 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 // Auto-generated file +#include // For std::unique_ptr<> #include #include @@ -56,7 +57,7 @@ } - std::auto_ptr db(new SQLiteDatabase); + std::unique_ptr db(new SQLiteDatabase); if (path_.empty()) { diff -r 710537acb488 -r 275e14f57f1e SQLite/UnitTests/UnitTestsMain.cpp --- 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 // For std::unique_ptr<> #include #include @@ -68,15 +69,15 @@ ASSERT_FALSE(db.DoesTableExist("test2")); { - std::auto_ptr t(db.CreateTransaction(false)); + std::unique_ptr t(db.CreateTransaction(false)); ASSERT_FALSE(t->IsImplicit()); } { OrthancDatabases::Query query("CREATE TABLE test(id INT)", false); - std::auto_ptr s(db.Compile(query)); + std::unique_ptr s(db.Compile(query)); - std::auto_ptr t(db.CreateTransaction(true)); + std::unique_ptr 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 s(db.Compile(query)); + std::unique_ptr s(db.Compile(query)); - std::auto_ptr t(db.CreateTransaction(true)); + std::unique_ptr t(db.CreateTransaction(true)); OrthancDatabases::Dictionary args; t->ExecuteWithoutResult(*s, args);