mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
More work on the SHAMap/Serialize classes.
This commit is contained in:
@@ -83,6 +83,14 @@ bool Serializer::get256(uint256& o, int offset) const
|
||||
return true;
|
||||
}
|
||||
|
||||
uint256 Serializer::get256(int offset) const
|
||||
{
|
||||
uint256 ret;
|
||||
if((offset+sizeof(ret))>mData.size()) return ret;
|
||||
memcpy(&ret, &(mData.front())+offset, sizeof(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Serializer::getRaw(std::vector<unsigned char>& o, int offset, int length) const
|
||||
{
|
||||
if((offset+length)>mData.size()) return false;
|
||||
@@ -90,6 +98,14 @@ bool Serializer::getRaw(std::vector<unsigned char>& o, int offset, int length) c
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> Serializer::getRaw(int offset, int length) const
|
||||
{
|
||||
std::vector<unsigned char> o;
|
||||
if((offset+length)>mData.size()) return o;
|
||||
o.assign(mData.begin()+offset, mData.begin()+offset+length);
|
||||
return o;
|
||||
}
|
||||
|
||||
uint160 Serializer::getRIPEMD160(int size) const
|
||||
{
|
||||
uint160 ret;
|
||||
@@ -141,3 +157,8 @@ bool Serializer::addSignature(CKey& key)
|
||||
addRaw(signature);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Serializer::TestSerializer(void)
|
||||
{
|
||||
Serializer s(64);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user