From 16b62e5a8472fca3b4c0d2f7328dcb443903a02f Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 3 Jul 2015 14:57:24 +0200 Subject: [PATCH] Renamed actualSizeOfPrefix to sizeAsEncoded. --- libdevcore/RLP.cpp | 10 +++++----- libdevcore/RLP.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libdevcore/RLP.cpp b/libdevcore/RLP.cpp index e3dc09a13..7e419e42b 100644 --- a/libdevcore/RLP.cpp +++ b/libdevcore/RLP.cpp @@ -50,7 +50,7 @@ RLP::iterator& RLP::iterator::operator++() if (m_remaining) { m_currentItem.retarget(m_currentItem.next().data(), m_remaining); - m_currentItem = m_currentItem.cropped(0, actualSizeOfPrefix(m_currentItem)); + m_currentItem = m_currentItem.cropped(0, sizeAsEncoded(m_currentItem)); m_remaining -= std::min(m_remaining, m_currentItem.size()); } else @@ -63,7 +63,7 @@ RLP::iterator::iterator(RLP const& _parent, bool _begin) if (_begin && _parent.isList()) { auto pl = _parent.payload(); - m_currentItem = pl.cropped(0, actualSizeOfPrefix(pl)); + m_currentItem = pl.cropped(0, sizeAsEncoded(pl)); m_remaining = pl.size() - m_currentItem.size(); } else @@ -77,14 +77,14 @@ RLP RLP::operator[](size_t _i) const { if (_i < m_lastIndex) { - m_lastEnd = actualSizeOfPrefix(payload()); + m_lastEnd = sizeAsEncoded(payload()); m_lastItem = payload().cropped(0, m_lastEnd); m_lastIndex = 0; } for (; m_lastIndex < _i && m_lastItem.size(); ++m_lastIndex) { m_lastItem = payload().cropped(m_lastEnd); - m_lastItem = m_lastItem.cropped(0, actualSizeOfPrefix(m_lastItem)); + m_lastItem = m_lastItem.cropped(0, sizeAsEncoded(m_lastItem)); m_lastEnd += m_lastItem.size(); } return RLP(m_lastItem, ThrowOnFail | FailIfTooSmall); @@ -206,7 +206,7 @@ size_t RLP::items() const bytesConstRef d = payload().cropped(0, length()); size_t i = 0; for (; d.size(); ++i) - d = d.cropped(actualSizeOfPrefix(d)); + d = d.cropped(sizeAsEncoded(d)); return i; } return 0; diff --git a/libdevcore/RLP.h b/libdevcore/RLP.h index e124ea2b6..0a4d1b88b 100644 --- a/libdevcore/RLP.h +++ b/libdevcore/RLP.h @@ -327,8 +327,8 @@ private: /// @returns the number of data items. size_t items() const; - /// @returns the "actualSize" of the RLP encoded in the largest prefix of @a _data and throws on error. - static size_t actualSizeOfPrefix(bytesConstRef _data) { return RLP(_data, ThrowOnFail | FailIfTooSmall).actualSize(); } + /// @returns the size encoded into the RLP in @a _data and throws if _data is too short. + static size_t sizeAsEncoded(bytesConstRef _data) { return RLP(_data, ThrowOnFail | FailIfTooSmall).actualSize(); } /// Our byte data. bytesConstRef m_data;