Avoid deprecated ndn-cxx functions
Change-Id: Ib9220786a724327b89dcc328c8f34a5c8fe1fdd9
diff --git a/src/clients/response.cpp b/src/clients/response.cpp
index b183b1d..48b8a7d 100644
--- a/src/clients/response.cpp
+++ b/src/clients/response.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.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -20,6 +20,8 @@
#include "response.hpp"
#include "logger.hpp"
+#include <ndn-cxx/encoding/block-helpers.hpp>
+
namespace ndn {
namespace ndns {
@@ -39,13 +41,13 @@
{
}
-template<encoding::Tag T>
+template<encoding::Tag TAG>
size_t
-Response::wireEncode(EncodingImpl<T>& block) const
+Response::wireEncode(EncodingImpl<TAG>& encoder) const
{
if (m_contentType == NDNS_BLOB || m_contentType == NDNS_KEY) {
// Raw application content
- return block.prependBlock(m_appContent);
+ return prependBlock(encoder, m_appContent);
}
// Content :: = CONTENT-TYPE TLV-LENGTH
@@ -53,16 +55,15 @@
size_t totalLength = 0;
for (auto iter = m_rrs.rbegin(); iter != m_rrs.rend(); ++iter) {
- totalLength += block.prependBlock(*iter);
+ totalLength += prependBlock(encoder, *iter);
}
- totalLength += block.prependVarNumber(totalLength);
- totalLength += block.prependVarNumber(::ndn::tlv::Content);
-
+ totalLength += encoder.prependVarNumber(totalLength);
+ totalLength += encoder.prependVarNumber(ndn::tlv::Content);
return totalLength;
}
-const Block
+Block
Response::wireEncode() const
{
if (m_contentType == NDNS_BLOB || m_contentType == NDNS_KEY) {
@@ -86,7 +87,7 @@
wire.parse();
- Block::element_const_iterator iter = wire.elements().begin();
+ auto iter = wire.elements().begin();
for (; iter != wire.elements().end(); ++iter) {
m_rrs.push_back(*iter);
}
@@ -99,7 +100,7 @@
if (wire.elements().size() != 2) {
NDN_THROW(Error("Unexpected number of elements while decoding DOE record"));
}
- return std::make_pair(Name(wire.elements().front()), Name(wire.elements().back()));
+ return {Name(wire.elements().front()), Name(wire.elements().back())};
}
bool