face/rib/tools: avoid deprecate Block::fromBuffer overloads
refs #2553
Change-Id: I32ea424ab7547f59fea2fca70ad6f41cd90bab58
diff --git a/daemon/face/stream-face.hpp b/daemon/face/stream-face.hpp
index fb51afd..fa743de 100644
--- a/daemon/face/stream-face.hpp
+++ b/daemon/face/stream-face.hpp
@@ -268,22 +268,21 @@
bool isOk = true;
Block element;
- while (m_inputBufferSize - offset > 0)
- {
- isOk = Block::fromBuffer(m_inputBuffer + offset, m_inputBufferSize - offset, element);
- if (!isOk)
- break;
+ while (m_inputBufferSize - offset > 0) {
+ std::tie(isOk, element) = Block::fromBuffer(m_inputBuffer + offset, m_inputBufferSize - offset);
+ if (!isOk)
+ break;
- offset += element.size();
+ offset += element.size();
- BOOST_ASSERT(offset <= m_inputBufferSize);
+ BOOST_ASSERT(offset <= m_inputBufferSize);
- if (!this->decodeAndDispatchInput(element))
- {
- NFD_LOG_FACE_WARN("Received unrecognized TLV block of type " << element.type());
- // ignore unknown packet and proceed
- }
+ if (!this->decodeAndDispatchInput(element)) {
+ NFD_LOG_FACE_WARN("Received unrecognized TLV block of type " << element.type());
+ // ignore unknown packet and proceed
}
+ }
+
if (!isOk && m_inputBufferSize == ndn::MAX_NDN_PACKET_SIZE && offset == 0)
{
NFD_LOG_FACE_WARN("Failed to parse incoming packet or packet too large to process");