Require -std=c++11 and use std::shared_ptr instead of SharedHandle

This commit is contained in:
Tatsuhiro Tsujikawa 2013-06-22 01:10:38 +09:00
parent 126a4bde61
commit 07d270c87e
709 changed files with 6305 additions and 6878 deletions

View file

@ -27,7 +27,7 @@ private:
char buf[20];
void checkToLocalnode
(std::istream& ss, const SharedHandle<DHTNode>& localNode);
(std::istream& ss, const std::shared_ptr<DHTNode>& localNode);
void checkNumNodes(std::istream& ss, size_t expected);
public:
@ -47,7 +47,7 @@ public:
CPPUNIT_TEST_SUITE_REGISTRATION(DHTRoutingTableSerializerTest);
void DHTRoutingTableSerializerTest::checkToLocalnode
(std::istream& ss, const SharedHandle<DHTNode>& localNode)
(std::istream& ss, const std::shared_ptr<DHTNode>& localNode)
{
// header
ss.read(buf, 8);
@ -98,16 +98,16 @@ void DHTRoutingTableSerializerTest::checkNumNodes
void DHTRoutingTableSerializerTest::testSerialize()
{
SharedHandle<DHTNode> localNode(new DHTNode());
std::shared_ptr<DHTNode> localNode(new DHTNode());
SharedHandle<DHTNode> nodesSrc[3];
std::shared_ptr<DHTNode> nodesSrc[3];
for(size_t i = 0; i < A2_ARRAY_LEN(nodesSrc); ++i) {
nodesSrc[i].reset(new DHTNode());
nodesSrc[i]->setIPAddress("192.168.0."+util::uitos(i+1));
nodesSrc[i]->setPort(6881+i);
}
nodesSrc[1]->setIPAddress("non-numerical-name");
std::vector<SharedHandle<DHTNode> > nodes(vbegin(nodesSrc), vend(nodesSrc));
std::vector<std::shared_ptr<DHTNode> > nodes(vbegin(nodesSrc), vend(nodesSrc));
DHTRoutingTableSerializer s(AF_INET);
s.setLocalNode(localNode);
@ -226,16 +226,16 @@ void DHTRoutingTableSerializerTest::testSerialize()
void DHTRoutingTableSerializerTest::testSerialize6()
{
SharedHandle<DHTNode> localNode(new DHTNode());
std::shared_ptr<DHTNode> localNode(new DHTNode());
SharedHandle<DHTNode> nodesSrc[2];
std::shared_ptr<DHTNode> nodesSrc[2];
for(size_t i = 0; i < A2_ARRAY_LEN(nodesSrc); ++i) {
nodesSrc[i].reset(new DHTNode());
nodesSrc[i]->setIPAddress("2001::100"+util::uitos(i+1));
nodesSrc[i]->setPort(6881+i);
}
nodesSrc[1]->setIPAddress("non-numerical-name");
std::vector<SharedHandle<DHTNode> > nodes(vbegin(nodesSrc), vend(nodesSrc));
std::vector<std::shared_ptr<DHTNode> > nodes(vbegin(nodesSrc), vend(nodesSrc));
DHTRoutingTableSerializer s(AF_INET6);
s.setLocalNode(localNode);