Convert to span and avoid deprecated ndn-cxx functions

Change-Id: I45c50527fe53498b53a3d951458bdff8e7d7778c
diff --git a/tests/daemon/face/datagram-transport.t.cpp b/tests/daemon/face/datagram-transport.t.cpp
index 28b73e1..6d41a1f 100644
--- a/tests/daemon/face/datagram-transport.t.cpp
+++ b/tests/daemon/face/datagram-transport.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -120,12 +120,12 @@
 {
   TRANSPORT_TEST_INIT();
 
-  std::vector<uint8_t> bytes(ndn::MAX_NDN_PACKET_SIZE, 0);
-  auto pkt1 = ndn::encoding::makeBinaryBlock(300, bytes.data(), bytes.size() - 6);
+  const std::vector<uint8_t> bytes(ndn::MAX_NDN_PACKET_SIZE, 0);
+  auto pkt1 = ndn::encoding::makeBinaryBlock(300, ndn::make_span(bytes).subspan(6));
   ndn::Buffer buf1(pkt1.begin(), pkt1.end());
   BOOST_REQUIRE_EQUAL(buf1.size(), ndn::MAX_NDN_PACKET_SIZE);
 
-  auto pkt2 = ndn::encoding::makeBinaryBlock(301, bytes.data(), bytes.size());
+  auto pkt2 = ndn::encoding::makeBinaryBlock(301, bytes);
   ndn::Buffer buf2(pkt2.begin(), pkt2.end());
   BOOST_REQUIRE_GT(buf2.size(), ndn::MAX_NDN_PACKET_SIZE);
 
diff --git a/tests/daemon/face/stream-transport.t.cpp b/tests/daemon/face/stream-transport.t.cpp
index 2a1d554..c8fa82b 100644
--- a/tests/daemon/face/stream-transport.t.cpp
+++ b/tests/daemon/face/stream-transport.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -141,12 +141,12 @@
 {
   TRANSPORT_TEST_INIT();
 
-  std::vector<uint8_t> bytes(ndn::MAX_NDN_PACKET_SIZE, 0);
-  auto pkt1 = ndn::encoding::makeBinaryBlock(300, bytes.data(), bytes.size() - 6);
+  const std::vector<uint8_t> bytes(ndn::MAX_NDN_PACKET_SIZE, 0);
+  auto pkt1 = ndn::encoding::makeBinaryBlock(300, ndn::make_span(bytes).subspan(6));
   ndn::Buffer buf1(pkt1.begin(), pkt1.end());
   BOOST_REQUIRE_EQUAL(buf1.size(), ndn::MAX_NDN_PACKET_SIZE);
 
-  auto pkt2 = ndn::encoding::makeBinaryBlock(301, bytes.data(), bytes.size());
+  auto pkt2 = ndn::encoding::makeBinaryBlock(301, bytes);
   ndn::Buffer buf2(pkt2.begin(), pkt2.end());
   BOOST_REQUIRE_GT(buf2.size(), ndn::MAX_NDN_PACKET_SIZE);
 
diff --git a/tests/daemon/mgmt/command-authenticator.t.cpp b/tests/daemon/mgmt/command-authenticator.t.cpp
index 4415b11..c52c81b 100644
--- a/tests/daemon/mgmt/command-authenticator.t.cpp
+++ b/tests/daemon/mgmt/command-authenticator.t.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,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -309,7 +309,8 @@
   BOOST_CHECK_EQUAL(authorize1(
     [] (Interest& interest) {
       ndn::KeyLocator kl;
-      kl.setKeyDigest(ndn::encoding::makeBinaryBlock(tlv::KeyDigest, "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD", 8));
+      kl.setKeyDigest(ndn::makeBinaryBlock(tlv::KeyDigest,
+                                           {0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD}));
       ndn::SignatureInfo sigInfo(tlv::SignatureSha256WithRsa);
       sigInfo.setKeyLocator(kl);
       setNameComponent(interest, ndn::signed_interest::POS_SIG_INFO,
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index 439c220..0e43944 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.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,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -217,15 +217,17 @@
   auto face3 = addFace(REMOVE_LAST_NOTIFICATION | SET_URI_TEST); // test://
 
   auto generateQuery = [] (const FaceQueryFilter& filter) {
-    return Interest(Name("/localhost/nfd/faces/query").append(filter.wireEncode()))
+    return Interest(Name("/localhost/nfd/faces/query")
+                    .append(filter.wireEncode().begin(), filter.wireEncode().end()))
            .setCanBePrefix(true);
   };
 
   auto schemeQuery = generateQuery(FaceQueryFilter().setUriScheme("dummy"));
   auto idQuery = generateQuery(FaceQueryFilter().setFaceId(face1->getId()));
   auto scopeQuery = generateQuery(FaceQueryFilter().setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL));
+  auto invalidContent = ndn::makeStringBlock(tlv::Content, "invalid");
   auto invalidQueryName = Name("/localhost/nfd/faces/query")
-                          .append(ndn::makeStringBlock(tlv::Content, "invalid"));
+                          .append(invalidContent.begin(), invalidContent.end());
   auto invalidQuery = Interest(invalidQueryName).setCanBePrefix(true);
 
   receiveInterest(schemeQuery); // face1 and face2 expected
diff --git a/tests/daemon/mgmt/manager-base.t.cpp b/tests/daemon/mgmt/manager-base.t.cpp
index 315bf28..8b57258 100644
--- a/tests/daemon/mgmt/manager-base.t.cpp
+++ b/tests/daemon/mgmt/manager-base.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -123,8 +123,7 @@
   auto post = m_manager.registerNotificationStream("test-notification");
   setTopPrefix();
 
-  const uint8_t buf[] = {0x82, 0x01, 0x02};
-  post(Block(buf, sizeof(buf)));
+  post(Block({0x82, 0x01, 0x02}));
   advanceClocks(1_ms);
 
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
diff --git a/tests/daemon/table/cs-fixture.hpp b/tests/daemon/table/cs-fixture.hpp
index 9819653..0dced9c 100644
--- a/tests/daemon/table/cs-fixture.hpp
+++ b/tests/daemon/table/cs-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -49,7 +49,7 @@
          bool isUnsolicited = false)
   {
     auto data = makeData(name);
-    data->setContent(reinterpret_cast<const uint8_t*>(&id), sizeof(id));
+    data->setContent(ndn::make_span(reinterpret_cast<const uint8_t*>(&id), sizeof(id)));
 
     if (modifyData != nullptr) {
       modifyData(*data);
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index c71f175..faca165 100644
--- a/tests/key-chain-fixture.cpp
+++ b/tests/key-chain-fixture.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,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -60,7 +60,7 @@
   cert.setFreshnessPeriod(1_h);
 
   // set content
-  cert.setContent(key.getPublicKey().data(), key.getPublicKey().size());
+  cert.setContent(key.getPublicKey());
 
   // set signature info
   ndn::SignatureInfo info;
diff --git a/tests/tools/mock-nfd-mgmt-fixture.hpp b/tests/tools/mock-nfd-mgmt-fixture.hpp
index 6798dd8..82ab19a 100644
--- a/tests/tools/mock-nfd-mgmt-fixture.hpp
+++ b/tests/tools/mock-nfd-mgmt-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -105,7 +105,7 @@
   void
   sendEmptyDataset(const Name& prefix)
   {
-    this->sendDatasetReply(prefix, nullptr, 0);
+    this->sendDatasetReply(prefix, span<uint8_t>{});
   }
 
   /** \brief send one WireEncodable in reply to StatusDataset request
@@ -141,7 +141,7 @@
     payload2.wireEncode(buffer);
     payload1.wireEncode(buffer);
 
-    this->sendDatasetReply(prefix, buffer.buf(), buffer.size());
+    this->sendDatasetReply(prefix, buffer);
   }
 
 private:
diff --git a/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp b/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp
index 0834bf5..9a0f5ac 100644
--- a/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp
+++ b/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -98,10 +98,9 @@
     }
 
     if (interest.getName() == "/localhop/ndn-autoconf/hub") {
-      const char FACEURI[] = "udp://router.example.net";
       auto data = makeData(Name("/localhop/ndn-autoconf/hub").appendVersion());
       data->setFreshnessPeriod(1_s);
-      data->setContent(makeBinaryBlock(tlv::nfd::Uri, FACEURI, ::strlen(FACEURI)));
+      data->setContent(makeStringBlock(tlv::nfd::Uri, "udp://router.example.net"));
       face.receive(*data);
       return;
     }