Skip to content

Commit 7a898cb

Browse files
committed
Replace auto_ptr by unique_ptr
Solve also all ambiguous constructor std::unique_ptr(NULL) calls and fix the linting warnings produces after the find-and-replace of (std::)auto_ptr by (std::)unique_ptr.
1 parent 5fa67e5 commit 7a898cb

File tree

228 files changed

+701
-687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+701
-687
lines changed

common/http/OlaHTTPServer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace ola {
3030
namespace http {
3131

3232
using ola::ExportMap;
33-
using std::auto_ptr;
33+
using std::unique_ptr;
3434
using std::ostringstream;
3535
using std::string;
3636
using std::vector;
@@ -71,7 +71,7 @@ bool OlaHTTPServer::Init() {
7171
*/
7272
int OlaHTTPServer::DisplayDebug(const HTTPRequest*,
7373
HTTPResponse *raw_response) {
74-
auto_ptr<HTTPResponse> response(raw_response);
74+
unique_ptr<HTTPResponse> response(raw_response);
7575
ola::TimeStamp now;
7676
m_clock.CurrentMonotonicTime(&now);
7777
ola::TimeInterval diff = now - m_start_time;
@@ -98,7 +98,7 @@ int OlaHTTPServer::DisplayDebug(const HTTPRequest*,
9898
*/
9999
int OlaHTTPServer::DisplayHandlers(const HTTPRequest*,
100100
HTTPResponse *raw_response) {
101-
auto_ptr<HTTPResponse> response(raw_response);
101+
unique_ptr<HTTPResponse> response(raw_response);
102102
vector<string> handlers;
103103
m_server.Handlers(&handlers);
104104
vector<string>::const_iterator iter;

common/io/IOQueueTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
using ola::io::IOQueue;
3232
using ola::io::IOVec;
3333
using ola::io::MemoryBlockPool;
34-
using std::auto_ptr;
34+
using std::unique_ptr;
3535
using std::string;
3636

3737

@@ -59,7 +59,7 @@ class IOQueueTest: public CppUnit::TestFixture {
5959
void testStringRead();
6060

6161
private:
62-
auto_ptr<IOQueue> m_buffer;
62+
unique_ptr<IOQueue> m_buffer;
6363

6464
unsigned int SumLengthOfIOVec(const struct IOVec *iov, int iocnt);
6565
};

common/io/OutputStreamTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
using ola::io::IOQueue;
3333
using ola::io::BigEndianOutputStream;
3434
using ola::network::HostToNetwork;
35-
using std::auto_ptr;
35+
using std::unique_ptr;
3636
using std::string;
3737

3838

common/io/SelectServerTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ using ola::io::SelectServer;
5353
using ola::io::UnixSocket;
5454
using ola::io::WriteFileDescriptor;
5555
using ola::network::UDPSocket;
56-
using std::auto_ptr;
56+
using std::unique_ptr;
5757
using std::set;
5858

5959
/*
@@ -543,7 +543,7 @@ void SelectServerTest::testReadWriteInteraction() {
543543
m_ss->RemoveWriteDescriptor(&socket);
544544

545545
// now the Write end closes
546-
auto_ptr<UnixSocket> other_end(socket.OppositeEnd());
546+
unique_ptr<UnixSocket> other_end(socket.OppositeEnd());
547547
other_end->CloseClient();
548548

549549
m_ss->RegisterSingleTimeout(

common/network/AdvancedTCPConnectorTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using ola::network::IPV4Address;
4747
using ola::network::IPV4SocketAddress;
4848
using ola::network::TCPAcceptingSocket;
4949
using ola::network::TCPSocket;
50-
using std::auto_ptr;
50+
using std::unique_ptr;
5151
using std::string;
5252

5353
// used to set a timeout which aborts the tests
@@ -90,7 +90,7 @@ class AdvancedTCPConnectorTest: public CppUnit::TestFixture {
9090
private:
9191
ola::MockClock m_clock;
9292
SelectServer *m_ss;
93-
auto_ptr<ola::network::TCPSocketFactory> m_tcp_socket_factory;
93+
unique_ptr<ola::network::TCPSocketFactory> m_tcp_socket_factory;
9494
IPV4Address m_localhost;
9595
IPV4SocketAddress m_server_address;
9696
ola::thread::timeout_id m_timeout_id;

common/network/IPV4AddressTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
using ola::network::IPV4Address;
4242
using ola::network::HostToNetwork;
43-
using std::auto_ptr;
43+
using std::unique_ptr;
4444
using std::string;
4545
using std::vector;
4646

@@ -97,11 +97,11 @@ void IPAddressTest::testIPV4Address() {
9797
OLA_ASSERT_EQ(string("192.168.1.1"), str.str());
9898

9999
// test from string
100-
auto_ptr<IPV4Address> string_address(IPV4Address::FromString("10.0.0.1"));
100+
unique_ptr<IPV4Address> string_address(IPV4Address::FromString("10.0.0.1"));
101101
OLA_ASSERT_NOT_NULL(string_address.get());
102102
OLA_ASSERT_EQ(string("10.0.0.1"), string_address->ToString());
103103

104-
auto_ptr<IPV4Address> string_address2(IPV4Address::FromString("foo"));
104+
unique_ptr<IPV4Address> string_address2(IPV4Address::FromString("foo"));
105105
OLA_ASSERT_NULL(string_address2.get());
106106

107107
// and the second form

common/network/InterfacePickerTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ using ola::network::IPV4Address;
3636
using ola::network::Interface;
3737
using ola::network::InterfacePicker;
3838
using ola::network::MACAddress;
39-
using std::auto_ptr;
39+
using std::unique_ptr;
4040
using std::cout;
4141
using std::endl;
4242
using std::string;
@@ -62,7 +62,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(InterfacePickerTest);
6262
* Check that we find at least one candidate interface.
6363
*/
6464
void InterfacePickerTest::testGetInterfaces() {
65-
auto_ptr<InterfacePicker> picker(InterfacePicker::NewPicker());
65+
unique_ptr<InterfacePicker> picker(InterfacePicker::NewPicker());
6666
vector<Interface> interfaces = picker->GetInterfaces(true);
6767
#ifndef _WIN32
6868
// If a Windows box is not on a network, and doesn't have it's loopback, there
@@ -86,7 +86,7 @@ void InterfacePickerTest::testGetInterfaces() {
8686
* Check that we find a loopback interface.
8787
*/
8888
void InterfacePickerTest::testGetLoopbackInterfaces() {
89-
auto_ptr<InterfacePicker> picker(InterfacePicker::NewPicker());
89+
unique_ptr<InterfacePicker> picker(InterfacePicker::NewPicker());
9090
vector<Interface> interfaces = picker->GetInterfaces(true);
9191
#ifndef _WIN32
9292
// If a Windows box is not on a network, and doesn't have it's loopback, there

common/network/MACAddressTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "ola/testing/TestUtils.h"
3131

3232
using ola::network::MACAddress;
33-
using std::auto_ptr;
33+
using std::unique_ptr;
3434
using std::string;
3535
using std::vector;
3636

@@ -76,17 +76,17 @@ void MACAddressTest::testMACAddress() {
7676
OLA_ASSERT_EQ(string("01:23:45:67:89:ab"), str.str());
7777

7878
// test from string
79-
auto_ptr<MACAddress> string_address(
79+
unique_ptr<MACAddress> string_address(
8080
MACAddress::FromString("fe:dc:ba:98:76:54"));
8181
OLA_ASSERT_NOT_NULL(string_address.get());
8282
OLA_ASSERT_EQ(string("fe:dc:ba:98:76:54"), string_address->ToString());
8383

84-
auto_ptr<MACAddress> string_address2(
84+
unique_ptr<MACAddress> string_address2(
8585
MACAddress::FromString("98.76.54.fe.dc.ba"));
8686
OLA_ASSERT_NOT_NULL(string_address2.get());
8787
OLA_ASSERT_EQ(string("98:76:54:fe:dc:ba"), string_address2->ToString());
8888

89-
auto_ptr<MACAddress> string_address3(MACAddress::FromString("foo"));
89+
unique_ptr<MACAddress> string_address3(MACAddress::FromString("foo"));
9090
OLA_ASSERT_NULL(string_address3.get());
9191

9292
// and the second form

common/network/NetworkUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ static bool GetDefaultRouteWithNetlink(int32_t *if_index,
586586
return false;
587587
}
588588

589-
std::auto_ptr<NetlinkCallback> cb(
589+
std::unique_ptr<NetlinkCallback> cb(
590590
ola::NewCallback(MessageHandler, if_index, default_gateway));
591591
if (!ReadNetlinkSocket(sd, msg, BUFSIZE, nl_msg->nlmsg_seq, cb.get())) {
592592
return false;

common/network/TCPConnectorTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ using ola::io::SelectServer;
4545
using ola::network::TCPConnector;
4646
using ola::network::TCPAcceptingSocket;
4747
using ola::network::TCPSocket;
48-
using std::auto_ptr;
48+
using std::unique_ptr;
4949
using std::string;
5050

5151
// used to set a timeout which aborts the tests

0 commit comments

Comments
 (0)