Skip to content

Commit

Permalink
Replace deprecated std::auto_ptr with std::unique_ptr
Browse files Browse the repository at this point in the history
This is to avoid getting flooded with deprecation warnings when
compiling this project.
  • Loading branch information
guitargeek committed Dec 29, 2021
1 parent 51f58a6 commit f5903ed
Show file tree
Hide file tree
Showing 89 changed files with 270 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void CredentialsTable::listCredentials( const std::string& physConStr,
coral::AttributeList rowBuffer;
m_table.dataEditor().rowBuffer( rowBuffer );

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->defineOutput( rowBuffer );
query->addToTableList( defaultTableName(), "db" );
Expand Down Expand Up @@ -204,7 +204,7 @@ bool CredentialsTable::existCredentials( const std::string& physConStr,
coral::AttributeList rowBuffer;
m_table.dataEditor().rowBuffer( rowBuffer );

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->defineOutput( rowBuffer );
query->addToTableList( defaultTableName(), "db" );
Expand All @@ -231,7 +231,7 @@ const AuthenticationCredentials CredentialsTable::getCredentials( const std::str
coral::AttributeList rowBuffer;
m_table.dataEditor().rowBuffer( rowBuffer );

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->defineOutput( rowBuffer );
query->addToTableList( defaultTableName(), "db" );
Expand Down
6 changes: 3 additions & 3 deletions CORAL_SERVER/CoralAuthenticationService/src/LC2PCTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bool LC2PCTable::LC2PCExists( bool wildcards,
coral::AttributeList rowBuffer;
m_table.dataEditor().rowBuffer( rowBuffer );

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->defineOutput( rowBuffer );
query->addToTableList( defaultTableName(), "" );
Expand Down Expand Up @@ -241,7 +241,7 @@ DatabaseServiceSet* LC2PCTable::lookup( const std::string& logicalName, AccessMo
coral::AttributeList whereData;
std::string whereString="";

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->addToTableList( defaultTableName(), "" );

Expand Down Expand Up @@ -286,7 +286,7 @@ unsigned int LC2PCTable::getNextOrderNo( const std::string& logConStr)
coral::AttributeList whereData;
std::string whereString="";

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->addToTableList( defaultTableName(), "" );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool LogConTable::logConExists( const std::string& logConStr )
coral::AttributeList rowBuffer;
m_table.dataEditor().rowBuffer( rowBuffer );

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->defineOutput( rowBuffer );
query->addToTableList( defaultTableName(), "" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ bool PhysConTable::physConExists( const std::string& physConStr )
coral::AttributeList rowBuffer;
m_table.dataEditor().rowBuffer( rowBuffer );

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->defineOutput( rowBuffer );
query->addToTableList( defaultTableName(), "" );
Expand Down
8 changes: 4 additions & 4 deletions CORAL_SERVER/CoralAuthenticationService/src/QueryMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ void QueryMgr::addPermission( const std::string& lcString, const std::string& pc
{
// we have to resolve a logical connection string

//std::auto_ptr<IOperationWithQuery> operation( m_permTable.dataEditor().insertWithQuery() );
std::auto_ptr<IOperationWithQuery> operation( m_schema.tableHandle(PermissionsTable::defaultTableName()).dataEditor().insertWithQuery() );
//std::unique_ptr<IOperationWithQuery> operation( m_permTable.dataEditor().insertWithQuery() );
std::unique_ptr<IOperationWithQuery> operation( m_schema.tableHandle(PermissionsTable::defaultTableName()).dataEditor().insertWithQuery() );

IQueryDefinition *query( &operation->query() );
coral::AttributeList outputBuffer;
Expand Down Expand Up @@ -451,7 +451,7 @@ void QueryMgr::queryConnections(
const std::string& user, const std::string& dbRole )
{

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

// main query is on credentials table
query->addToTableList( m_crTable.defaultTableName(), "cr" );
Expand Down Expand Up @@ -642,7 +642,7 @@ const AuthenticationCredentials QueryMgr::getCredentials( const std::string& phy
if ( cert == 0 )
return m_crTable.getCredentials( physConStr, dbRole );

std::auto_ptr<IQuery> query( m_schema.newQuery() );
std::unique_ptr<IQuery> query( m_schema.newQuery() );

query->addToTableList( m_crTable.defaultTableName(), "cr" );
query->addToTableList( m_permTable.defaultTableName(), "perm" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace coral
CPPUNIT_FAIL("test logical 2 connection not added");

{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 2, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -221,7 +221,7 @@ namespace coral
if ( !mgr.m_pcTable.physConExists( "roTestPhysConStr" ) )
CPPUNIT_FAIL("test connection 3 not added");
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 2, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -230,7 +230,7 @@ namespace coral
set->replica(1).connectionString() );
}
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 3, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -248,7 +248,7 @@ namespace coral
if ( !mgr.m_pcTable.physConExists( "roTestPhysConStr2" ) )
CPPUNIT_FAIL("test connection 4 not added");
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 2, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -257,7 +257,7 @@ namespace coral
set->replica(1).connectionString() );
}
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 4, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand Down Expand Up @@ -303,7 +303,7 @@ namespace coral
CPPUNIT_FAIL("test logical connection not deleted");

{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 0, set->numberOfReplicas() );
}
Expand Down Expand Up @@ -331,7 +331,7 @@ namespace coral
CPPUNIT_FAIL("test logical 2 connection not added");

{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 2, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -347,7 +347,7 @@ namespace coral
if ( !mgr.m_pcTable.physConExists( "roTestPhysConStr" ) )
CPPUNIT_FAIL("test connection 3 not added");
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 2, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -356,7 +356,7 @@ namespace coral
set->replica(1).connectionString() );
}
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 3, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -375,7 +375,7 @@ namespace coral
CPPUNIT_FAIL("test connection 4 not added");

{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 2, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -384,7 +384,7 @@ namespace coral
set->replica(1).connectionString() );
}
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 4, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr"),
Expand All @@ -401,14 +401,14 @@ namespace coral
mgr.delConnection("testLogConStr" /* lcString*/, "testPhysConStr" /*pcString*/,
"" /*user*/, "" /*role*/ );
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 1, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 2 ", std::string("testPhysConStr2"),
set->replica(0).connectionString() );
}
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 3, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 2 ", std::string("testPhysConStr2"),
Expand All @@ -423,14 +423,14 @@ namespace coral
mgr.delConnection("testLogConStr" /* lcString*/, "roTestPhysConStr2" /*pcString*/,
"" /*user*/, "" /*role*/ );
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 1, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 2 ", std::string("testPhysConStr2"),
set->replica(0).connectionString() );
}
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 2, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 2 ", std::string("testPhysConStr2"),
Expand All @@ -442,14 +442,14 @@ namespace coral
mgr.delConnection("testLogConStr" /* lcString*/, "roTestPhysConStr" /*pcString*/,
"" /*user*/, "" /*role*/ );
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 1, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 2 ", std::string("testPhysConStr2"),
set->replica(0).connectionString() );
}
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 1, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 2 ", std::string("testPhysConStr2"),
Expand All @@ -459,12 +459,12 @@ namespace coral
mgr.delConnection("testLogConStr" /* lcString*/, "testPhysConStr2" /*pcString*/,
"" /*user*/, "" /*role*/ );
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 0, set->numberOfReplicas() );
}
{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("testLogConStr", ReadOnly, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 0, set->numberOfReplicas() );
}
Expand Down Expand Up @@ -582,7 +582,7 @@ namespace coral
CPPUNIT_FAIL("test logical connection not added");

{
std::auto_ptr<DatabaseServiceSet> set( mgr.lookup("alias1", Update, "") );
std::unique_ptr<DatabaseServiceSet> set( mgr.lookup("alias1", Update, "") );

CPPUNIT_ASSERT_EQUAL_MESSAGE( "number of replicas", 1, set->numberOfReplicas() );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "replica 1 ", std::string("testPhysConStr25"),
Expand Down
4 changes: 2 additions & 2 deletions CORAL_SERVER/CoralServer/src/CoralServerFacade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ CoralServerFacade::fetchAllRows( coral::Token sessionID,
IQuery* query = QueryMgr::newQuery( pOutputBuffer, *session, qd );
return IRowIteratorPtr( new CursorIterator( *query ) );
/*
std::auto_ptr<IQuery> query( QueryMgr::newQuery( pOutputBuffer, *session, qd ) );
std::unique_ptr<IQuery> query( QueryMgr::newQuery( pOutputBuffer, *session, qd ) );
ICursor& cursor = query->execute();
std::vector<AttributeList> rows;
while ( cursor.next() ) rows.push_back( cursor.currentRow() );
Expand Down Expand Up @@ -372,7 +372,7 @@ CoralServerFacade::fetchAllRows( coral::Token sessionID,
IQuery* query = QueryMgr::newQuery( outputTypes, *session, qd );
return IRowIteratorPtr( new CursorIterator( *query ) );
/*
std::auto_ptr<IQuery> query( QueryMgr::newQuery( outputTypes, *session, qd ) );
std::unique_ptr<IQuery> query( QueryMgr::newQuery( outputTypes, *session, qd ) );
ICursor& cursor = query->execute();
std::vector<AttributeList> rows;
while ( cursor.next() ) rows.push_back( cursor.currentRow() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace coral
typedef unsigned int Token;

/// Row iterator pointer.
typedef std::auto_ptr<IRowIterator> IRowIteratorPtr;
typedef std::unique_ptr<IRowIterator> IRowIteratorPtr;

/** @class ICoralFacade
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace coral
class ICertificateData;

/// Buffer iterator pointer.
typedef std::auto_ptr<IByteBufferIterator> IByteBufferIteratorPtr;
typedef std::unique_ptr<IByteBufferIterator> IByteBufferIteratorPtr;

/** @class IRequestHandler
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ namespace coral
AttributeList m_conditionData;
std::string m_groupBy;
std::vector< std::string > m_orderList;
std::auto_ptr< std::pair<int,int> > m_rowLimitAndOffset;
std::auto_ptr< std::pair<SetOperation,QueryDefinition> > m_setOperation;
std::unique_ptr< std::pair<int,int> > m_rowLimitAndOffset;
std::unique_ptr< std::pair<SetOperation,QueryDefinition> > m_setOperation;

};

Expand Down
2 changes: 1 addition & 1 deletion CORAL_SERVER/CoralServerProxy/src/Packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ Packet::write ( NetSocket& socket, const CTLPacketHeader& ctlh )

// make buffer big enough
#ifdef __APPLE__
std::auto_ptr<unsigned char> aBuf( new unsigned char[psize] );
std::unique_ptr<unsigned char> aBuf( new unsigned char[psize] );
unsigned char* buf = aBuf.get();
#else
unsigned char buf[psize] ;
Expand Down
2 changes: 1 addition & 1 deletion CORAL_SERVER/CoralSockets/CoralSockets/SocketServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace coral {
int m_nHandlerThreadsPerSocket;

/// a thread manager
std::auto_ptr<ThreadManager> m_thrManager;
std::unique_ptr<ThreadManager> m_thrManager;

};

Expand Down
4 changes: 2 additions & 2 deletions CORAL_SERVER/CoralSockets/src/DummyRequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ DummyRequestHandler::replyToRequest( const ByteBuffer& request )
num=10;

unsigned int count=0;
std::auto_ptr<SimpleReplyIterator> iterator;
std::unique_ptr<SimpleReplyIterator> iterator;
do {
std::stringstream stream;
stream <<"Thank you for your request " << count << " '";
Expand All @@ -165,7 +165,7 @@ DummyRequestHandler::replyToRequest( const ByteBuffer& request )

count++;
if ( iterator.get() == 0 )
iterator = std::auto_ptr<SimpleReplyIterator>(
iterator = std::unique_ptr<SimpleReplyIterator>(
new SimpleReplyIterator( reply, false ) );
else
iterator->addBuffer( reply, count>=num );
Expand Down
2 changes: 1 addition & 1 deletion CORAL_SERVER/CoralSockets/src/PacketSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ PacketPtr PacketSocket::receivePacket( )
throw GenericSocketException("PANIC! packet size ==0?!",
"PacketSocket::receivePacket()");
// receive the payload
std::auto_ptr<ByteBuffer> payload( new ByteBuffer(
std::unique_ptr<ByteBuffer> payload( new ByteBuffer(
ctlHeader.packetSize()-CTLPACKET_HEADER_SIZE ) );
DEBUG("reading payload" << std::endl);
m_socket->readAll( payload->data(), payload->freeSize() );
Expand Down
6 changes: 3 additions & 3 deletions CORAL_SERVER/CoralSockets/src/PacketSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace coral

/// constructor for receiving
PacketSLAC( CTLPacketHeader & header,
std::auto_ptr<ByteBuffer> payload)
std::unique_ptr<ByteBuffer> payload)
: m_payload( payload )
, m_payloadRef( *m_payload)
, m_header( header)
Expand Down Expand Up @@ -79,15 +79,15 @@ namespace coral
return m_payloadRef;
}

std::auto_ptr<ByteBuffer>& getPayloadPointer()
std::unique_ptr<ByteBuffer>& getPayloadPointer()
{
return m_payload;
}

private:

/// payload buffer (only when owned by PacketSLAC)
std::auto_ptr<ByteBuffer> m_payload;
std::unique_ptr<ByteBuffer> m_payload;

/// payload reference
const ByteBuffer& m_payloadRef;
Expand Down

0 comments on commit f5903ed

Please sign in to comment.