all: avoid usage of deprecated namespace ndn::Tlv
refs #2079
Change-Id: I3d8748929706726b55fe1a9a0f6ae00857ea3547
diff --git a/common.hpp b/common.hpp
index 3b9d2ce..cf236ca 100644
--- a/common.hpp
+++ b/common.hpp
@@ -84,8 +84,9 @@
using ndn::Block;
namespace tlv {
-using namespace ndn::Tlv;
-}
+// Don't write "namespace tlv = ndn::tlv", because NFD can add other members into this namespace.
+using namespace ndn::tlv;
+} // namespace tlv
namespace name = ndn::name;
namespace time = ndn::time;
diff --git a/daemon/mgmt/manager-base.cpp b/daemon/mgmt/manager-base.cpp
index ca1e00d..04e2705 100644
--- a/daemon/mgmt/manager-base.cpp
+++ b/daemon/mgmt/manager-base.cpp
@@ -52,7 +52,7 @@
Block rawParameters = parameterComponent.blockFromValue();
extractedParameters.wireDecode(rawParameters);
}
- catch (const ndn::Tlv::Error& e)
+ catch (const tlv::Error&)
{
return false;
}
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 14dbaf3..9f09442 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -373,7 +373,7 @@
Block rawParameters = parameterComponent.blockFromValue();
extractedParameters.wireDecode(rawParameters);
}
- catch (const ndn::Tlv::Error& e)
+ catch (const tlv::Error&)
{
return false;
}
diff --git a/tests/core/segment-publisher.cpp b/tests/core/segment-publisher.cpp
index 8817669..08fc226 100644
--- a/tests/core/segment-publisher.cpp
+++ b/tests/core/segment-publisher.cpp
@@ -75,7 +75,7 @@
size_t totalLength = 0;
for (int64_t i = 0; i < N; i++)
{
- totalLength += prependNonNegativeIntegerBlock(outBuffer, ndn::Tlv::Content, i);
+ totalLength += prependNonNegativeIntegerBlock(outBuffer, tlv::Content, i);
}
m_totalPayloadLength += totalLength;
return totalLength;
@@ -113,7 +113,7 @@
// wrap data in a single Content TLV for easy parsing
m_buffer.prependVarNumber(m_buffer.size());
- m_buffer.prependVarNumber(ndn::Tlv::Content);
+ m_buffer.prependVarNumber(tlv::Content);
BOOST_TEST_CHECKPOINT("creating parser");
ndn::Block parser(m_buffer.buf(), m_buffer.size());
diff --git a/tests/daemon/mgmt/channel-status-publisher.cpp b/tests/daemon/mgmt/channel-status-publisher.cpp
index 6d33f4d..370efe1 100644
--- a/tests/daemon/mgmt/channel-status-publisher.cpp
+++ b/tests/daemon/mgmt/channel-status-publisher.cpp
@@ -73,7 +73,7 @@
// wrap the Channel Status entries in a single Content TLV for easy parsing
m_buffer.prependVarNumber(m_buffer.size());
- m_buffer.prependVarNumber(ndn::Tlv::Content);
+ m_buffer.prependVarNumber(tlv::Content);
ndn::Block parser(m_buffer.buf(), m_buffer.size());
parser.parse();
diff --git a/tests/daemon/mgmt/face-status-publisher-common.hpp b/tests/daemon/mgmt/face-status-publisher-common.hpp
index e2f19f1..11f4913 100644
--- a/tests/daemon/mgmt/face-status-publisher-common.hpp
+++ b/tests/daemon/mgmt/face-status-publisher-common.hpp
@@ -82,7 +82,7 @@
}
std::stringstream error;
error << "expected type " << type << " got " << block.type();
- throw ndn::Tlv::Error(error.str());
+ throw tlv::Error(error.str());
}
static inline uint64_t
@@ -96,7 +96,7 @@
++i;
return readNonNegativeIntegerType(block, type);
}
- throw ndn::Tlv::Error("Unexpected end of FaceStatus");
+ throw tlv::Error("Unexpected end of FaceStatus");
}
class FaceStatusPublisherFixture : public BaseFixture
@@ -179,7 +179,7 @@
// wrap the Face Statuses in a single Content TLV for easy parsing
m_buffer.prependVarNumber(m_buffer.size());
- m_buffer.prependVarNumber(ndn::Tlv::Content);
+ m_buffer.prependVarNumber(tlv::Content);
ndn::Block parser(m_buffer.buf(), m_buffer.size());
parser.parse();
diff --git a/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp b/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
index bfb19d9..cbb7280 100644
--- a/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
+++ b/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
@@ -51,7 +51,7 @@
}
std::stringstream error;
error << "Expected type " << type << " got " << block.type();
- throw ndn::Tlv::Error(error.str());
+ throw tlv::Error(error.str());
}
static inline uint64_t
@@ -68,7 +68,7 @@
std::stringstream error;
error << "Unexpected end of Block while attempting to read type #"
<< type;
- throw ndn::Tlv::Error(error.str());
+ throw tlv::Error(error.str());
}
class FibEnumerationPublisherFixture : public BaseFixture
@@ -120,7 +120,7 @@
BOOST_REQUIRE(i != entry.elements_end());
- BOOST_REQUIRE(i->type() == ndn::Tlv::Name);
+ BOOST_REQUIRE(i->type() == tlv::Name);
Name prefix(*i);
++i;
@@ -181,7 +181,7 @@
// wrap the FIB Entry blocks in a single Content TLV for easy parsing
m_buffer.prependVarNumber(m_buffer.size());
- m_buffer.prependVarNumber(ndn::Tlv::Content);
+ m_buffer.prependVarNumber(tlv::Content);
ndn::Block parser(m_buffer.buf(), m_buffer.size());
parser.parse();
diff --git a/tests/daemon/mgmt/strategy-choice-publisher.cpp b/tests/daemon/mgmt/strategy-choice-publisher.cpp
index fda3e1e..e85bc4a 100644
--- a/tests/daemon/mgmt/strategy-choice-publisher.cpp
+++ b/tests/daemon/mgmt/strategy-choice-publisher.cpp
@@ -79,7 +79,7 @@
// wrap the Strategy Choice entries in a single Content TLV for easy parsing
m_buffer.prependVarNumber(m_buffer.size());
- m_buffer.prependVarNumber(ndn::Tlv::Content);
+ m_buffer.prependVarNumber(tlv::Content);
ndn::Block parser(m_buffer.buf(), m_buffer.size());
parser.parse();
diff --git a/tests/rib/rib-status-publisher-common.hpp b/tests/rib/rib-status-publisher-common.hpp
index 11728a0..58ccd68 100644
--- a/tests/rib/rib-status-publisher-common.hpp
+++ b/tests/rib/rib-status-publisher-common.hpp
@@ -70,7 +70,7 @@
buffer.appendByteArray(payload.value(), payload.value_size());
buffer.prependVarNumber(buffer.size());
- buffer.prependVarNumber(ndn::Tlv::Content);
+ buffer.prependVarNumber(tlv::Content);
ndn::Block parser(buffer.buf(), buffer.size());
parser.parse();