Access base_uint through public members (RIPD-898):

* Updates many (but probably not all) locations that access base_uint
  private storage.
* More calls to access base_uint through members.
* Use an iterator to write Serializer collections.
This commit is contained in:
Edward Hennis
2016-04-29 17:02:48 -04:00
committed by seelabs
parent e38f01d1f4
commit 7e3dbce3d2
8 changed files with 44 additions and 23 deletions

View File

@@ -107,6 +107,8 @@ public:
int addVL (Blob const& vector);
int addVL (Slice const& slice);
template<class Iter>
int addVL (Iter begin, Iter end, int len);
int addVL (const void* ptr, int len);
// disassemble functions
@@ -280,6 +282,21 @@ private:
int addEncoded (int length);
};
template<class Iter>
int Serializer::addVL(Iter begin, Iter end, int len)
{
int ret = addEncoded(len);
for (; begin != end; ++begin)
{
addRaw(begin->data(), begin->size());
#ifndef NDEBUG
len -= begin->size();
#endif
}
assert(len == 0);
return ret;
}
//------------------------------------------------------------------------------
// DEPRECATED