name: Converting name to use EncodingBuffer

Change-Id: I7dbc7bdd7198085235cbb0b7108cf4c6d5242a62
diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index 98c131a..e6a8b80 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -56,10 +56,11 @@
   : m_buffer(buffer)
   , m_begin(begin)
   , m_end(end)
+  , m_size(m_end - m_begin)
 {
   m_value_begin = m_buffer->begin();
   m_value_end   = m_buffer->end();
-  
+
   m_type = Tlv::readType(m_value_begin, m_value_end);
   uint64_t length = Tlv::readVarNumber(m_value_begin, m_value_end);
   if (length != static_cast<uint64_t>(m_value_end - m_value_begin))
diff --git a/src/encoding/block.hpp b/src/encoding/block.hpp
index b729bc2..45cf1ad 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -486,7 +486,7 @@
 Block::value() const
 {
   if (!hasValue())
-      throw Error("(Block::value) Underlying value buffer is empty");
+    return 0;
   
   return &*m_value_begin;
 }
diff --git a/src/encoding/encoding-buffer.hpp b/src/encoding/encoding-buffer.hpp
index 8870941..62d6a12 100644
--- a/src/encoding/encoding-buffer.hpp
+++ b/src/encoding/encoding-buffer.hpp
@@ -143,9 +143,6 @@
   }
 
   inline size_t
-  size () const;
-
-  inline size_t
   prependByte (uint8_t val);
 
   inline size_t
@@ -168,9 +165,6 @@
 
   inline size_t
   appendVarNumber (uint64_t varNumber);
-
-private:
-  size_t m_size;
 };
 
 
@@ -185,12 +179,6 @@
 }
 
 inline size_t
-EncodingImpl<encoding::Estimator>::size () const
-{
-  return m_size;
-}
-
-inline size_t
 EncodingImpl<encoding::Buffer>::capacity () const
 {
   return m_buffer->size ();
@@ -289,7 +277,6 @@
 inline size_t
 EncodingImpl<encoding::Estimator>::prependByte (uint8_t val)
 {
-  m_size += 1;
   return 1;
 }
 
@@ -307,7 +294,6 @@
 inline size_t
 EncodingImpl<encoding::Estimator>::prependByteArray (const uint8_t *arr, size_t len)
 {
-  m_size += len;
   return len;
 }
 
@@ -335,19 +321,15 @@
 EncodingImpl<encoding::Estimator>::prependNonNegativeInteger (uint64_t varNumber)
 {
   if (varNumber < 253) {
-    m_size += 1;
     return 1;
   }
   else if (varNumber <= std::numeric_limits<uint16_t>::max ()) {
-    m_size += 2;
     return 2;
   }
   else if (varNumber <= std::numeric_limits<uint32_t>::max ()) {
-    m_size += 4;
     return 4;
   }
   else {
-    m_size += 8;
     return 8;
   }
 }
@@ -383,19 +365,15 @@
 EncodingImpl<encoding::Estimator>::prependVarNumber (uint64_t varNumber)
 {
   if (varNumber < 253) {
-    m_size += 1;
     return 1;
   }
   else if (varNumber <= std::numeric_limits<uint16_t>::max ()) {
-    m_size += 3;
     return 3;
   }
   else if (varNumber <= std::numeric_limits<uint32_t>::max ()) {
-    m_size += 5;
     return 5;
   }
   else {
-    m_size += 9;
     return 9;
   }
 }