encoding: change Block::fromBuffer return type
Block::fromBuffer is changed from taking constructed Block as output parameter
to returning the constructed Block as part of returned tuple.
Old API becomes deprecated.
refs #2553
Change-Id: I64610353b8c0780ee09ebe9089c539fa27506a5e
diff --git a/src/transport/stream-transport.hpp b/src/transport/stream-transport.hpp
index b4e3d09..737842c 100644
--- a/src/transport/stream-transport.hpp
+++ b/src/transport/stream-transport.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -204,16 +204,16 @@
bool
processAll(uint8_t* buffer, size_t& offset, size_t nBytesAvailable)
{
- while (offset < nBytesAvailable)
- {
- Block element;
- bool ok = Block::fromBuffer(buffer + offset, nBytesAvailable - offset, element);
- if (!ok)
- return false;
+ while (offset < nBytesAvailable) {
+ bool isOk = false;
+ Block element;
+ std::tie(isOk, element) = Block::fromBuffer(buffer + offset, nBytesAvailable - offset);
+ if (!isOk)
+ return false;
- m_transport.receive(element);
- offset += element.size();
- }
+ m_transport.receive(element);
+ offset += element.size();
+ }
return true;
}