bug: Fix Face::put warning
Change-Id: I5918fac25025510fb48f5e5e256d20f597782962
diff --git a/debug-tools/dump-local-prefix.cc b/debug-tools/dump-local-prefix.cc
index 7f3af3f..d5d4664 100644
--- a/debug-tools/dump-local-prefix.cc
+++ b/debug-tools/dump-local-prefix.cc
@@ -26,12 +26,12 @@
Name name("/local/ndn/prefix");
name.appendVersion().appendSegment(0);
- Data data(name);
+ shared_ptr<Data> data = make_shared<Data>(name);
std::string prefix("/ndn/test");
- data.setContent(reinterpret_cast<const uint8_t*>(prefix.c_str()), prefix.size());
- keyChain.signByIdentity(data, root);
+ data->setContent(reinterpret_cast<const uint8_t*>(prefix.c_str()), prefix.size());
+ keyChain.signByIdentity(*data, root);
- face.put(data);
+ face.put(*data);
face.getIoService().run();
}
diff --git a/src/chat-dialog.cpp b/src/chat-dialog.cpp
index 93d7dd0..334f345 100644
--- a/src/chat-dialog.cpp
+++ b/src/chat-dialog.cpp
@@ -544,11 +544,11 @@
OBufferStream os;
msg.SerializeToOstream(&os);
- Data data(interest.getName());
- data.setContent(os.buf());
- m_keyChain.sign(data, m_myCertificate.getName());
+ shared_ptr<Data> data = make_shared<Data>(interest.getName());
+ data->setContent(os.buf());
+ m_keyChain.sign(*data, m_myCertificate.getName());
- m_face->put(data);
+ m_face->put(*data);
}
void
@@ -563,10 +563,11 @@
try {
Name certName = interest.getName().getSubName(prefix.size());
const Sync::IntroCertificate& introCert = m_sock->getIntroCertificate(certName);
- Data data(interest.getName());
- data.setContent(introCert.wireEncode());
- m_keyChain.sign(data, m_myCertificate.getName());
- m_face->put(data);
+
+ shared_ptr<Data> data = make_shared<Data>(interest.getName());
+ data->setContent(introCert.wireEncode());
+ m_keyChain.sign(*data, m_myCertificate.getName());
+ m_face->put(*data);
}
catch(Sync::SyncSocket::Error& e) {
return;
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index a6fec03..742b7c3 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -407,8 +407,8 @@
Name dnsName = m_identity;
dnsName.append("DNS").append("ENDORSED").appendVersion();
- Data data;
- data.setName(dnsName);
+ shared_ptr<Data> data = make_shared<Data>();
+ data->setName(dnsName);
EndorseCollection endorseCollection;
m_contactStorage->getCollectEndorse(endorseCollection);
@@ -416,11 +416,11 @@
OBufferStream os;
endorseCollection.SerializeToOstream(&os);
- data.setContent(os.buf());
- m_keyChain.signByIdentity(data, m_identity);
+ data->setContent(os.buf());
+ m_keyChain.signByIdentity(*data, m_identity);
- m_contactStorage->updateDnsOthersEndorse(data);
- m_face->put(data);
+ m_contactStorage->updateDnsOthersEndorse(*data);
+ m_face->put(*data);
}
void
@@ -499,15 +499,15 @@
Name dnsName = m_identity;
dnsName.append("DNS").append("PROFILE").appendVersion();
- Data data;
- data.setName(dnsName);
- data.setContent(selfEndorseCertificate.wireEncode());
- data.setFreshnessPeriod(time::milliseconds(1000));
+ shared_ptr<Data> data = make_shared<Data>();
+ data->setName(dnsName);
+ data->setContent(selfEndorseCertificate.wireEncode());
+ data->setFreshnessPeriod(time::milliseconds(1000));
- m_keyChain.signByIdentity(data, m_identity);
+ m_keyChain.signByIdentity(*data, m_identity);
- m_contactStorage->updateDnsSelfProfileData(data);
- m_face->put(data);
+ m_contactStorage->updateDnsSelfProfileData(*data);
+ m_face->put(*data);
}
shared_ptr<EndorseCertificate>
@@ -545,14 +545,14 @@
.append("ENDORSEE")
.appendVersion();
- Data data;
- data.setName(dnsName);
- data.setContent(endorseCertificate.wireEncode());
+ shared_ptr<Data> data = make_shared<Data>();
+ data->setName(dnsName);
+ data->setContent(endorseCertificate.wireEncode());
- m_keyChain.signByIdentity(data, m_identity);
+ m_keyChain.signByIdentity(*data, m_identity);
- m_contactStorage->updateDnsEndorseOthers(data, dnsName.get(-3).toUri());
- m_face->put(data);
+ m_contactStorage->updateDnsEndorseOthers(*data, dnsName.get(-3).toUri());
+ m_face->put(*data);
}
void
diff --git a/src/controller.cpp b/src/controller.cpp
index 22af126..483bc61 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -738,7 +738,7 @@
void
Controller::onInvitationResponded(const ndn::Name& invitationName, bool accepted)
{
- Data response;
+ shared_ptr<Data> response = make_shared<Data>();
shared_ptr<IdentityCertificate> chatroomCert;
// generate reply;
@@ -746,41 +746,41 @@
Name responseName = invitationName;
responseName.append(m_localPrefix.wireEncode());
- response.setName(responseName);
+ response->setName(responseName);
// We should create a particular certificate for this chatroom,
//but let's use default one for now.
chatroomCert
= m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(m_identity));
- response.setContent(chatroomCert->wireEncode());
- response.setFreshnessPeriod(time::milliseconds(1000));
+ response->setContent(chatroomCert->wireEncode());
+ response->setFreshnessPeriod(time::milliseconds(1000));
}
else {
- response.setName(invitationName);
- response.setFreshnessPeriod(time::milliseconds(1000));
+ response->setName(invitationName);
+ response->setFreshnessPeriod(time::milliseconds(1000));
}
- m_keyChain.signByIdentity(response, m_identity);
+ m_keyChain.signByIdentity(*response, m_identity);
// Check if we need a wrapper
Name invitationRoutingPrefix = getInvitationRoutingPrefix();
if (invitationRoutingPrefix.isPrefixOf(m_identity))
- m_face->put(response);
+ m_face->put(*response);
else {
Name wrappedName;
wrappedName.append(invitationRoutingPrefix)
.append(ROUTING_PREFIX_SEPARATOR, 2)
- .append(response.getName());
+ .append(response->getName());
// _LOG_DEBUG("onInvitationResponded: prepare reply " << wrappedName);
- Data wrappedData(wrappedName);
- wrappedData.setContent(response.wireEncode());
- wrappedData.setFreshnessPeriod(time::milliseconds(1000));
+ shared_ptr<Data> wrappedData = make_shared<Data>(wrappedName);
+ wrappedData->setContent(response->wireEncode());
+ wrappedData->setFreshnessPeriod(time::milliseconds(1000));
- m_keyChain.signByIdentity(wrappedData, m_identity);
- m_face->put(wrappedData);
+ m_keyChain.signByIdentity(*wrappedData, m_identity);
+ m_face->put(*wrappedData);
}
// create chatroom