Avoid deprecated ndn-cxx functions
Change-Id: Ic9fab00b75e9519315ee776dbc464794a9e56f1c
diff --git a/examples/data-producer.cpp b/examples/data-producer.cpp
index e401603..0e1da2c 100644
--- a/examples/data-producer.cpp
+++ b/examples/data-producer.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.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -138,7 +138,7 @@
std::string name;
getline(insertStream, name);
- auto data = createData(ndn::Name(name));
+ auto data = createData(name);
m_face.put(*data);
m_scheduler.schedule(timeInterval, [this] { generateFromFile(); });
@@ -148,11 +148,10 @@
Publisher::createData(const ndn::Name& name)
{
static ndn::KeyChain keyChain;
- static std::vector<uint8_t> content(1500, '-');
+ static const std::vector<uint8_t> content(1500, '-');
- auto data = std::make_shared<ndn::Data>();
- data->setName(name);
- data->setContent(content.data(), content.size());
+ auto data = std::make_shared<ndn::Data>(name);
+ data->setContent(content);
keyChain.sign(*data);
return data;
}
@@ -203,7 +202,7 @@
generator.duration = milliseconds(boost::lexical_cast<uint64_t>(optarg));
}
catch (const boost::bad_lexical_cast&) {
- std::cerr << "-s option should be an integer" << std::endl;;
+ std::cerr << "-s option should be an integer" << std::endl;
return 1;
}
break;
@@ -212,7 +211,7 @@
generator.timeInterval = milliseconds(boost::lexical_cast<uint64_t>(optarg));
}
catch (const boost::bad_lexical_cast&) {
- std::cerr << "-t option should be an integer" << std::endl;;
+ std::cerr << "-t option should be an integer" << std::endl;
return 1;
}
break;