Avoid deprecated ndn-cxx functions
Change-Id: Ib148262999a691760821a2ce1c05a5e6332e7e34
diff --git a/src/encrypted-content.cpp b/src/encrypted-content.cpp
index 4bc3d44..beaeda5 100644
--- a/src/encrypted-content.cpp
+++ b/src/encrypted-content.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* NAC library is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -26,7 +26,6 @@
namespace ndn {
namespace nac {
-BOOST_CONCEPT_ASSERT((boost::EqualityComparable<EncryptedContent>));
BOOST_CONCEPT_ASSERT((WireEncodable<EncryptedContent>));
BOOST_CONCEPT_ASSERT((WireDecodable<EncryptedContent>));
static_assert(std::is_base_of<ndn::tlv::Error, EncryptedContent::Error>::value,
@@ -42,7 +41,7 @@
{
m_wire.reset();
if (payload.type() != tlv::EncryptedPayload) {
- m_payload = Block(tlv::EncryptedPayload, std::move(payload));
+ m_payload = Block(tlv::EncryptedPayload, payload);
}
else {
m_payload = std::move(payload);
@@ -63,7 +62,7 @@
{
m_wire.reset();
if (iv.type() != tlv::InitializationVector) {
- m_iv = Block(tlv::InitializationVector, std::move(iv));
+ m_iv = Block(tlv::InitializationVector, iv);
}
else {
m_iv = std::move(iv);
@@ -75,7 +74,7 @@
EncryptedContent::setIv(ConstBufferPtr iv)
{
m_wire.reset();
- m_iv = Block(tlv::InitializationVector, iv);
+ m_iv = Block(tlv::InitializationVector, std::move(iv));
return *this;
}
@@ -83,7 +82,7 @@
EncryptedContent::unsetIv()
{
m_wire.reset();
- m_iv = Block();
+ m_iv = {};
return *this;
}
@@ -92,7 +91,7 @@
{
m_wire.reset();
if (key.type() != tlv::EncryptedPayloadKey) {
- m_payloadKey = Block(tlv::EncryptedPayloadKey, std::move(key));
+ m_payloadKey = Block(tlv::EncryptedPayloadKey, key);
}
else {
m_payloadKey = std::move(key);
@@ -112,7 +111,7 @@
EncryptedContent::unsetPayloadKey()
{
m_wire.reset();
- m_payloadKey = Block();
+ m_payloadKey = {};
return *this;
}
@@ -128,37 +127,37 @@
EncryptedContent::unsetKeyLocator()
{
m_wire.reset();
- m_keyLocator = Name();
+ m_keyLocator = {};
return *this;
}
template<encoding::Tag TAG>
size_t
-EncryptedContent::wireEncode(EncodingImpl<TAG>& block) const
+EncryptedContent::wireEncode(EncodingImpl<TAG>& encoder) const
{
size_t totalLength = 0;
if (hasKeyLocator()) {
- totalLength += m_keyLocator.wireEncode(block);
+ totalLength += m_keyLocator.wireEncode(encoder);
}
if (hasPayloadKey()) {
- totalLength += block.prependBlock(m_payloadKey);
+ totalLength += prependBlock(encoder, m_payloadKey);
}
if (hasIv()) {
- totalLength += block.prependBlock(m_iv);
+ totalLength += prependBlock(encoder, m_iv);
}
if (m_payload.isValid()) {
- totalLength += block.prependBlock(m_payload);
+ totalLength += prependBlock(encoder, m_payload);
}
else {
NDN_THROW(Error("Required EncryptedPayload is not set on EncryptedContent"));
}
- totalLength += block.prependVarNumber(totalLength);
- totalLength += block.prependVarNumber(tlv::EncryptedContent);
+ totalLength += encoder.prependVarNumber(totalLength);
+ totalLength += encoder.prependVarNumber(tlv::EncryptedContent);
return totalLength;
}
@@ -221,11 +220,5 @@
}
}
-bool
-EncryptedContent::operator==(const EncryptedContent& rhs) const
-{
- return wireEncode() == rhs.wireEncode();
-}
-
} // namespace nac
} // namespace ndn