build: fix ambiguous calls to std::make_shared
Change-Id: I21cb38bea2eeb265c312acd4a5aa4d2a1b014601
diff --git a/src/chat-dialog-backend.cpp b/src/chat-dialog-backend.cpp
index ff0a600..c72d7ed 100644
--- a/src/chat-dialog-backend.cpp
+++ b/src/chat-dialog-backend.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2013-2020, Regents of the University of California
+ * Copyright (c) 2013-2021, Regents of the University of California
* Yingdi Yu
*
* BSD license, See the LICENSE file for more information
@@ -104,20 +104,20 @@
{
BOOST_ASSERT(m_sock == nullptr);
- m_face = make_shared<ndn::Face>();
- m_scheduler = unique_ptr<ndn::Scheduler>(new ndn::Scheduler(m_face->getIoService()));
+ m_face = std::make_shared<ndn::Face>();
+ m_scheduler = std::make_unique<ndn::Scheduler>(m_face->getIoService());
// initialize validator
- m_validator = make_shared<ndn::security::ValidatorConfig>(*m_face);
+ m_validator = std::make_shared<ndn::security::ValidatorConfig>(*m_face);
m_validator->load("security/validation-chat.conf");
// create a new SyncSocket
- m_sock = make_shared<chronosync::Socket>(m_chatroomPrefix,
- m_routableUserChatPrefix,
- ref(*m_face),
- bind(&ChatDialogBackend::processSyncUpdate, this, _1),
- m_signingId,
- m_validator);
+ m_sock = std::make_shared<chronosync::Socket>(m_chatroomPrefix,
+ m_routableUserChatPrefix,
+ ref(*m_face),
+ bind(&ChatDialogBackend::processSyncUpdate, this, _1),
+ m_signingId,
+ m_validator);
// schedule a new join event
m_scheduler->schedule(time::milliseconds(600),
diff --git a/src/chatroom-discovery-backend.cpp b/src/chatroom-discovery-backend.cpp
index 8e2ad21..504a4c2 100644
--- a/src/chatroom-discovery-backend.cpp
+++ b/src/chatroom-discovery-backend.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2020, Regents of the University of California
+ * Copyright (c) 2013-2021, Regents of the University of California
*
* BSD license, See the LICENSE file for more information
*
@@ -99,11 +99,11 @@
m_face = shared_ptr<ndn::Face>(new ndn::Face);
m_scheduler = unique_ptr<ndn::Scheduler>(new ndn::Scheduler(m_face->getIoService()));
- m_sock = make_shared<chronosync::Socket>(m_discoveryPrefix,
- Name(),
- ref(*m_face),
- bind(&ChatroomDiscoveryBackend::processSyncUpdate,
- this, _1));
+ m_sock = std::make_shared<chronosync::Socket>(m_discoveryPrefix,
+ Name(),
+ ref(*m_face),
+ bind(&ChatroomDiscoveryBackend::processSyncUpdate,
+ this, _1));
// add an timer to refresh front end
m_refreshPanelId = m_scheduler->schedule(REFRESH_INTERVAL,
diff --git a/src/common.hpp b/src/common.hpp
index 90f5e54..8cd384e 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -1,7 +1,7 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2020, Regents of the University of California
- * Yingdi Yu
+ * Copyright (c) 2013-2021, Regents of the University of California
+ * Yingdi Yu
*
* BSD license, See the LICENSE file for more information
*
@@ -44,7 +44,6 @@
using std::shared_ptr;
using std::unique_ptr;
-using std::make_shared;
using std::function;
using std::bind;
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index 5a6b4b9..04700f5 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2013-2020, Regents of the University of California
+ * Copyright (c) 2013-2021, Regents of the University of California
* Yingdi Yu
*
* BSD license, See the LICENSE file for more information
@@ -58,7 +58,7 @@
void
ContactManager::initializeSecurity()
{
- m_validator = make_shared<ndn::security::ValidatorConfig>(m_face);
+ m_validator = std::make_shared<ndn::security::ValidatorConfig>(m_face);
m_validator->load("security/validation-contact-manager.conf");
}
@@ -113,7 +113,7 @@
{
const Profile& profile = m_bufferedContacts[identity].m_selfEndorseCert->getProfile();
- shared_ptr<EndorseInfo> endorseInfo = make_shared<EndorseInfo>();
+ auto endorseInfo = std::make_shared<EndorseInfo>();
m_bufferedContacts[identity].m_endorseInfo = endorseInfo;
map<string, size_t> endorseCount;
@@ -163,8 +163,7 @@
try {
Data plainData;
plainData.wireDecode(data.getContent().blockFromValue());
- shared_ptr<EndorseCertificate> selfEndorseCertificate =
- make_shared<EndorseCertificate>(boost::cref(plainData));
+ auto selfEndorseCertificate = std::make_shared<EndorseCertificate>(plainData);
if (ndn::security::verifySignature(plainData, *selfEndorseCertificate)) {
m_bufferedContacts[identity].m_selfEndorseCert = selfEndorseCertificate;
@@ -208,8 +207,7 @@
const Name& identity)
{
try {
- shared_ptr<EndorseCollection> endorseCollection =
- make_shared<EndorseCollection>(data.getContent().blockFromValue());
+ auto endorseCollection = std::make_shared<EndorseCollection>(data.getContent().blockFromValue());
m_bufferedContacts[identity].m_endorseCollection = endorseCollection;
fetchEndorseCertificateInternal(identity, 0);
}
@@ -245,7 +243,7 @@
}
if (ss.str() == hash) {
- auto endorseCertificate = make_shared<EndorseCertificate>(data);
+ auto endorseCertificate = std::make_shared<EndorseCertificate>(data);
m_bufferedContacts[identity].m_endorseCertList.push_back(std::move(endorseCertificate));
}
@@ -332,7 +330,7 @@
Name dnsName = m_identity;
dnsName.append("DNS").append("ENDORSED").appendVersion();
- shared_ptr<Data> data = make_shared<Data>();
+ auto data = std::make_shared<Data>();
data->setName(dnsName);
data->setFreshnessPeriod(time::milliseconds(1000));
@@ -350,7 +348,7 @@
void
ContactManager::onIdentityCertValidated(const Data& data)
{
- shared_ptr<Certificate> cert = make_shared<Certificate>(boost::cref(data));
+ auto cert = std::make_shared<Certificate>(data);
m_bufferedIdCerts[cert->getName()] = cert;
decreaseIdCertCount();
}
@@ -402,10 +400,7 @@
for (auto it = profile.begin(); it != profile.end(); it++)
endorseList.push_back(it->first);
- shared_ptr<EndorseCertificate> selfEndorseCertificate =
- make_shared<EndorseCertificate>(boost::cref(signCert),
- boost::cref(profile),
- boost::cref(endorseList));
+ auto selfEndorseCertificate = std::make_shared<EndorseCertificate>(signCert, profile, endorseList);
m_keyChain.sign(*selfEndorseCertificate,
ndn::security::signingByIdentity(m_identity).setSignatureInfo(
@@ -420,7 +415,7 @@
Name dnsName = m_identity;
dnsName.append("DNS").append("PROFILE").appendVersion();
- shared_ptr<Data> data = make_shared<Data>();
+ auto data = std::make_shared<Data>();
data->setName(dnsName);
data->setContent(selfEndorseCertificate.wireEncode());
data->setFreshnessPeriod(time::milliseconds(1000));
@@ -472,7 +467,7 @@
.append("ENDORSEE")
.appendVersion();
- shared_ptr<Data> data = make_shared<Data>();
+ auto data = std::make_shared<Data>();
data->setName(dnsName);
data->setContent(endorseCertificate.wireEncode());
data->setFreshnessPeriod(time::milliseconds(1000));
@@ -582,7 +577,7 @@
{
m_identity = Name(identity.toStdString());
- m_contactStorage = make_shared<ContactStorage>(m_identity);
+ m_contactStorage = std::make_shared<ContactStorage>(m_identity);
m_dnsListenerHandle = m_face.setInterestFilter(
Name(m_identity).append("DNS"),
diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index 6703f41..9357bed 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -1,7 +1,7 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2020, Regents of the University of California
- * Yingdi Yu
+ * Copyright (c) 2013-2021, Regents of the University of California
+ * Yingdi Yu
*
* BSD license, See the LICENSE file for more information
*
@@ -227,7 +227,7 @@
shared_ptr<Profile>
ContactStorage::getSelfProfile()
{
- shared_ptr<Profile> profile = make_shared<Profile>(m_identity);
+ auto profile = std::make_shared<Profile>(m_identity);
sqlite3_stmt *stmt;
sqlite3_prepare_v2(m_db, "SELECT profile_type, profile_value FROM SelfProfile",
-1, &stmt, nullptr);
@@ -268,7 +268,7 @@
sqlite3_bind_string(stmt, 1, m_identity.toUri(), SQLITE_TRANSIENT);
if (sqlite3_step(stmt) == SQLITE_ROW) {
- cert = make_shared<EndorseCertificate>();
+ cert = std::make_shared<EndorseCertificate>();
cert->wireDecode(sqlite3_column_block(stmt, 0));
}
@@ -347,7 +347,7 @@
sqlite3_bind_string(stmt, 1, name.toUri(), SQLITE_TRANSIENT);
if (sqlite3_step(stmt) == SQLITE_ROW) {
- cert = make_shared<EndorseCertificate>();
+ cert = std::make_shared<EndorseCertificate>();
cert->wireDecode(sqlite3_column_block(stmt, 1));
}
@@ -481,8 +481,8 @@
time::fromUnixTimestamp(time::milliseconds(sqlite3_column_int64 (stmt, 4)));
int isIntroducer = sqlite3_column_int (stmt, 5);
- contact = make_shared<Contact>(identity, alias, Name(keyName),
- notBefore, notAfter, key, isIntroducer);
+ contact = std::make_shared<Contact>(identity, alias, Name(keyName),
+ notBefore, notAfter, key, isIntroducer);
}
sqlite3_finalize(stmt);
@@ -617,7 +617,7 @@
sqlite3_bind_string(stmt, 1, dataName.toUri(), SQLITE_TRANSIENT);
if (sqlite3_step(stmt) == SQLITE_ROW) {
- data = make_shared<Data>();
+ data = std::make_shared<Data>();
data->wireDecode(sqlite3_column_block(stmt, 0));
}
sqlite3_finalize(stmt);
@@ -637,7 +637,7 @@
sqlite3_bind_string(stmt, 2, type, SQLITE_TRANSIENT);
if (sqlite3_step(stmt) == SQLITE_ROW) {
- data = make_shared<Data>();
+ data = std::make_shared<Data>();
data->wireDecode(sqlite3_column_block(stmt, 0));
}
sqlite3_finalize(stmt);
diff --git a/src/controller-backend.cpp b/src/controller-backend.cpp
index 9078cf2..f28ec8c 100644
--- a/src/controller-backend.cpp
+++ b/src/controller-backend.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2013-2020, Regents of the University of California
+ * Copyright (c) 2013-2021, Regents of the University of California
* Yingdi Yu
*
* BSD license, See the LICENSE file for more information
@@ -45,12 +45,10 @@
connect(&m_contactManager, SIGNAL(contactIdListReady(const QStringList&)),
this, SLOT(onContactIdListReady(const QStringList&)));
- m_validator = make_shared<ndn::security::ValidatorNull>();
+ m_validator = std::make_shared<ndn::security::ValidatorNull>();
}
-ControllerBackend::~ControllerBackend()
-{
-}
+ControllerBackend::~ControllerBackend() = default;
void
ControllerBackend::run()
@@ -160,8 +158,7 @@
const ndn::Interest& interest,
size_t routingPrefixOffset)
{
- shared_ptr<Interest> invitationInterest =
- make_shared<Interest>(interest.getName().getSubName(routingPrefixOffset));
+ auto invitationInterest = std::make_shared<Interest>(interest.getName().getSubName(routingPrefixOffset));
// check if the chatroom already exists;
try {
@@ -371,7 +368,7 @@
void
ControllerBackend::onInvitationResponded(const ndn::Name& invitationName, bool accepted)
{
- shared_ptr<Data> response = make_shared<Data>();
+ auto response = std::make_shared<Data>();
shared_ptr<ndn::security::Certificate> chatroomCert;
// generate reply;
@@ -383,7 +380,7 @@
// We should create a particular certificate for this chatroom,
//but let's use default one for now.
- chatroomCert = make_shared<ndn::security::Certificate>(
+ chatroomCert = std::make_shared<ndn::security::Certificate>(
m_keyChain.createIdentity(m_identity).getDefaultKey().getDefaultCertificate());
response->setContent(chatroomCert->wireEncode());
@@ -406,7 +403,7 @@
.append(ROUTING_HINT_SEPARATOR)
.append(response->getName());
- shared_ptr<Data> wrappedData = make_shared<Data>(wrappedName);
+ auto wrappedData = std::make_shared<Data>(wrappedName);
wrappedData->setContent(response->wireEncode());
wrappedData->setFreshnessPeriod(time::milliseconds(1000));
@@ -422,7 +419,7 @@
ControllerBackend::onInvitationRequestResponded(const ndn::Name& invitationResponseName,
bool accepted)
{
- shared_ptr<Data> response = make_shared<Data>(invitationResponseName);
+ auto response = std::make_shared<Data>(invitationResponseName);
if (accepted)
response->setContent(ndn::makeNonNegativeIntegerBlock(tlv::Content, 1));
else
@@ -466,7 +463,6 @@
// for (ContactList::const_iterator it = contactList.begin(); it != contactList.end(); it++)
// m_validator.addTrustAnchor((*it)->getPublicKeyName(), (*it)->getPublicKey());
-
}
void
@@ -476,7 +472,6 @@
m_isNfdConnected = true;
}
-
} // namespace chronochat
#if WAF