Refactor uses of strCopy (RIPD-1256)

Replace the sparsely used strCopy function with Slice. Change some of
the SHAMap interface to use Slice instead of Blob, which should
eliminate a copy.
This commit is contained in:
Mike Ellery
2016-08-05 10:46:41 -07:00
committed by Nik Bougalis
parent c1b8efb7af
commit 0d803e0fa2
13 changed files with 47 additions and 92 deletions

View File

@@ -98,7 +98,7 @@ SHAMapTreeNode::SHAMapTreeNode (std::shared_ptr<SHAMapItem const> const& item,
}
std::shared_ptr<SHAMapAbstractNode>
SHAMapAbstractNode::make(Blob const& rawNode, std::uint32_t seq, SHANodeFormat format,
SHAMapAbstractNode::make(Slice const& rawNode, std::uint32_t seq, SHANodeFormat format,
SHAMapHash const& hash, bool hashValid, beast::Journal j,
SHAMapNodeID const& id)
{
@@ -108,7 +108,7 @@ SHAMapAbstractNode::make(Blob const& rawNode, std::uint32_t seq, SHANodeFormat f
return {};
Serializer s (rawNode.data(), rawNode.size() - 1);
int type = rawNode.back ();
int type = rawNode[rawNode.size() - 1];
int len = s.getLength ();
if ((type < 0) || (type > 6))
@@ -265,7 +265,7 @@ SHAMapAbstractNode::make(Blob const& rawNode, std::uint32_t seq, SHANodeFormat f
if (prefix == HashPrefix::transactionID)
{
auto item = std::make_shared<SHAMapItem const>(
sha512Half(makeSlice(rawNode)),
sha512Half(rawNode),
s.peekData ());
if (hashValid)
return std::make_shared<SHAMapTreeNode>(item, tnTRANSACTION_NM, seq, hash);