aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
diff options
context:
space:
mode:
authorKamil Domanski <kdomanski@kdemail.net>2014-08-20 22:44:38 +0200
committerKamil Domanski <kdomanski@kdemail.net>2014-08-31 02:16:17 +0200
commit84881f8c472cc67dc757686eb7dc3b495b13cab8 (patch)
tree9aa2ae012cc4817464cb60e9d838fa92464a9477 /src/wallet.h
parent5d96b4ae0188fcad36105642c5d69249d37fdbb5 (diff)
rework overhauled serialization methods to non-static
Thanks to Pieter Wuille for most of the work on this commit. I did not fixup the overhaul commit, because a rebase conflicted with "remove fields of ser_streamplaceholder". I prefer not to risk making a mistake while resolving it.
Diffstat (limited to 'src/wallet.h')
-rw-r--r--src/wallet.h102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/wallet.h b/src/wallet.h
index 36b0bafe5a..d30a28218f 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -63,15 +63,15 @@ public:
CKeyPool();
CKeyPool(const CPubKey& vchPubKeyIn);
- IMPLEMENT_SERIALIZE
+ IMPLEMENT_SERIALIZE;
- template <typename T, typename Stream, typename Operation>
- inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) {
+ template <typename Stream, typename Operation>
+ inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
size_t nSerSize = 0;
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
- READWRITE(thisPtr->nTime);
- READWRITE(thisPtr->vchPubKey);
+ READWRITE(nTime);
+ READWRITE(vchPubKey);
return nSerSize;
}
};
@@ -493,17 +493,17 @@ public:
fMerkleVerified = false;
}
- IMPLEMENT_SERIALIZE
+ IMPLEMENT_SERIALIZE;
- template <typename T, typename Stream, typename Operation>
- inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) {
+ template <typename Stream, typename Operation>
+ inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
size_t nSerSize = 0;
- nSerSize += SerReadWrite(s, *(CTransaction*)thisPtr, nType, nVersion, ser_action);
- nVersion = thisPtr->nVersion;
- READWRITE(thisPtr->hashBlock);
- READWRITE(thisPtr->vMerkleBranch);
- READWRITE(thisPtr->nIndex);
+ nSerSize += SerReadWrite(s, *(CTransaction*)this, nType, nVersion, ser_action);
+ nVersion = this->nVersion;
+ READWRITE(hashBlock);
+ READWRITE(vMerkleBranch);
+ READWRITE(nIndex);
return nSerSize;
}
@@ -610,14 +610,14 @@ public:
nOrderPos = -1;
}
- IMPLEMENT_SERIALIZE
+ IMPLEMENT_SERIALIZE;
- template <typename T, typename Stream, typename Operation>
- inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) {
+ template <typename Stream, typename Operation>
+ inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
size_t nSerSize = 0;
bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
- CWalletTx* pthis = const_cast<CWalletTx*>(thisPtr);
+ CWalletTx* pthis = const_cast<CWalletTx*>(this);
if (fRead)
pthis->Init(NULL);
char fSpent = false;
@@ -628,18 +628,18 @@ public:
WriteOrderPos(pthis->nOrderPos, pthis->mapValue);
- if (thisPtr->nTimeSmart)
- pthis->mapValue["timesmart"] = strprintf("%u", thisPtr->nTimeSmart);
+ if (nTimeSmart)
+ pthis->mapValue["timesmart"] = strprintf("%u", nTimeSmart);
}
- nSerSize += SerReadWrite(s, *(CMerkleTx*)thisPtr, nType, nVersion,ser_action);
+ nSerSize += SerReadWrite(s, *(CMerkleTx*)this, nType, nVersion,ser_action);
std::vector<CMerkleTx> vUnused; // Used to be vtxPrev
READWRITE(vUnused);
- READWRITE(thisPtr->mapValue);
- READWRITE(thisPtr->vOrderForm);
- READWRITE(thisPtr->fTimeReceivedIsTxTime);
- READWRITE(thisPtr->nTimeReceived);
- READWRITE(thisPtr->fFromMe);
+ READWRITE(mapValue);
+ READWRITE(vOrderForm);
+ READWRITE(fTimeReceivedIsTxTime);
+ READWRITE(nTimeReceived);
+ READWRITE(fFromMe);
READWRITE(fSpent);
if (fRead)
@@ -648,7 +648,7 @@ public:
ReadOrderPos(pthis->nOrderPos, pthis->mapValue);
- pthis->nTimeSmart = thisPtr->mapValue.count("timesmart") ? (unsigned int)atoi64(pthis->mapValue["timesmart"]) : 0;
+ pthis->nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(pthis->mapValue["timesmart"]) : 0;
}
pthis->mapValue.erase("fromaccount");
@@ -904,17 +904,17 @@ public:
CWalletKey(int64_t nExpires=0);
- IMPLEMENT_SERIALIZE
+ IMPLEMENT_SERIALIZE;
- template <typename T, typename Stream, typename Operation>
- inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) {
+ template <typename Stream, typename Operation>
+ inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
size_t nSerSize = 0;
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
- READWRITE(thisPtr->vchPrivKey);
- READWRITE(thisPtr->nTimeCreated);
- READWRITE(thisPtr->nTimeExpires);
- READWRITE(LIMITED_STRING(thisPtr->strComment, 65536));
+ READWRITE(vchPrivKey);
+ READWRITE(nTimeCreated);
+ READWRITE(nTimeExpires);
+ READWRITE(LIMITED_STRING(strComment, 65536));
return nSerSize;
}
};
@@ -942,14 +942,14 @@ public:
vchPubKey = CPubKey();
}
- IMPLEMENT_SERIALIZE
+ IMPLEMENT_SERIALIZE;
- template <typename T, typename Stream, typename Operation>
- inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) {
+ template <typename Stream, typename Operation>
+ inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
size_t nSerSize = 0;
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
- READWRITE(thisPtr->vchPubKey);
+ READWRITE(vchPubKey);
return nSerSize;
}
};
@@ -987,44 +987,44 @@ public:
nEntryNo = 0;
}
- IMPLEMENT_SERIALIZE
+ IMPLEMENT_SERIALIZE;
- template <typename T, typename Stream, typename Operation>
- inline static size_t SerializationOp(T thisPtr, Stream& s, Operation ser_action, int nType, int nVersion) {
+ template <typename Stream, typename Operation>
+ inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
size_t nSerSize = 0;
bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
- CAccountingEntry& me = *const_cast<CAccountingEntry*>(thisPtr);
+ CAccountingEntry& me = *const_cast<CAccountingEntry*>(this);
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
// Note: strAccount is serialized as part of the key, not here.
- READWRITE(thisPtr->nCreditDebit);
- READWRITE(thisPtr->nTime);
- READWRITE(LIMITED_STRING(thisPtr->strOtherAccount, 65536));
+ READWRITE(nCreditDebit);
+ READWRITE(nTime);
+ READWRITE(LIMITED_STRING(strOtherAccount, 65536));
if (!fRead)
{
- WriteOrderPos(thisPtr->nOrderPos, me.mapValue);
+ WriteOrderPos(nOrderPos, me.mapValue);
- if (!(thisPtr->mapValue.empty() && thisPtr->_ssExtra.empty()))
+ if (!(mapValue.empty() && _ssExtra.empty()))
{
CDataStream ss(nType, nVersion);
ss.insert(ss.begin(), '\0');
- ss << thisPtr->mapValue;
- ss.insert(ss.end(), thisPtr->_ssExtra.begin(), thisPtr->_ssExtra.end());
+ ss << mapValue;
+ ss.insert(ss.end(), _ssExtra.begin(), _ssExtra.end());
me.strComment.append(ss.str());
}
}
- READWRITE(LIMITED_STRING(thisPtr->strComment, 65536));
+ READWRITE(LIMITED_STRING(strComment, 65536));
- size_t nSepPos = thisPtr->strComment.find("\0", 0, 1);
+ size_t nSepPos = strComment.find("\0", 0, 1);
if (fRead)
{
me.mapValue.clear();
if (std::string::npos != nSepPos)
{
- CDataStream ss(std::vector<char>(thisPtr->strComment.begin() + nSepPos + 1, thisPtr->strComment.end()), nType, nVersion);
+ CDataStream ss(std::vector<char>(strComment.begin() + nSepPos + 1, strComment.end()), nType, nVersion);
ss >> me.mapValue;
me._ssExtra = std::vector<char>(ss.begin(), ss.end());
}