Rename add1/get1 to add8/get8 to be consistent with other member functions.

This commit is contained in:
JoelKatz
2012-02-13 19:28:29 -08:00
parent db8763ef19
commit 9524df694a
3 changed files with 12 additions and 12 deletions

View File

@@ -108,7 +108,7 @@ SHAMapNode::SHAMapNode(const void *ptr, int len)
void SHAMapNode::addIDRaw(Serializer &s) const void SHAMapNode::addIDRaw(Serializer &s) const
{ {
s.add256(mNodeID); s.add256(mNodeID);
s.add1(mDepth); s.add8(mDepth);
} }
SHAMapNode SHAMapNode::getChildNodeID(int m) const SHAMapNode SHAMapNode::getChildNodeID(int m) const
@@ -204,7 +204,7 @@ SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned
for(int i=0; i<(len/33); i++) for(int i=0; i<(len/33); i++)
{ {
int pos; int pos;
s.get1(pos, 32+(i*33)); s.get8(pos, 32+(i*33));
if( (pos<0) || (pos>=16)) throw SHAMapException(InvalidNode); if( (pos<0) || (pos>=16)) throw SHAMapException(InvalidNode);
s.get256(mHashes[pos], i*33); s.get256(mHashes[pos], i*33);
} }
@@ -221,7 +221,7 @@ void SHAMapTreeNode::addRaw(Serializer &s)
if(mType==TRANSACTION) if(mType==TRANSACTION)
{ {
mItem->addRaw(s); mItem->addRaw(s);
s.add1(0); s.add8(0);
assert(s.getLength()>32); assert(s.getLength()>32);
return; return;
} }
@@ -230,7 +230,7 @@ void SHAMapTreeNode::addRaw(Serializer &s)
{ {
mItem->addRaw(s); mItem->addRaw(s);
s.add160(mItem->getTag().to160()); s.add160(mItem->getTag().to160());
s.add1(1); s.add8(1);
return; return;
} }
@@ -240,15 +240,15 @@ void SHAMapTreeNode::addRaw(Serializer &s)
if(mHashes[i].isNonZero()) if(mHashes[i].isNonZero())
{ {
s.add256(mHashes[i]); s.add256(mHashes[i]);
s.add1(i); s.add8(i);
} }
s.add1(3); s.add8(3);
return; return;
} }
for(int i=0; i<16; i++) for(int i=0; i<16; i++)
s.add256(mHashes[i]); s.add256(mHashes[i]);
s.add1(2); s.add8(2);
} }
bool SHAMapTreeNode::updateHash() bool SHAMapTreeNode::updateHash()

View File

@@ -114,14 +114,14 @@ uint256 Serializer::get256(int offset) const
return ret; return ret;
} }
int Serializer::add1(unsigned char byte) int Serializer::add8(unsigned char byte)
{ {
int ret=mData.size(); int ret=mData.size();
mData.push_back(byte); mData.push_back(byte);
return ret; return ret;
} }
bool Serializer::get1(int& byte, int offset) const bool Serializer::get8(int& byte, int offset) const
{ {
if(offset>=mData.size()) return false; if(offset>=mData.size()) return false;
byte=mData[offset]; byte=mData[offset];

View File

@@ -22,7 +22,7 @@ class Serializer
Serializer(const std::string& data) : mData(data.data(), (data.data()) + data.size()) { ; } Serializer(const std::string& data) : mData(data.data(), (data.data()) + data.size()) { ; }
// assemble functions // assemble functions
int add1(unsigned char byte); int add8(unsigned char byte);
int add16(uint16); int add16(uint16);
int add32(uint32); // ledger indexes, account sequence int add32(uint32); // ledger indexes, account sequence
int add64(uint64); // timestamps, amounts int add64(uint64); // timestamps, amounts
@@ -32,8 +32,8 @@ class Serializer
int addRaw(const void *ptr, int len); int addRaw(const void *ptr, int len);
// disassemble functions // disassemble functions
bool get1(int&, int offset) const; bool get8(int&, int offset) const;
bool get1(unsigned char&, int offset) const; bool get8(unsigned char&, int offset) const;
bool get16(uint16&, int offset) const; bool get16(uint16&, int offset) const;
bool get32(uint32&, int offset) const; bool get32(uint32&, int offset) const;
bool get64(uint64&, int offset) const; bool get64(uint64&, int offset) const;