aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet.h')
-rw-r--r--src/wallet.h44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/wallet.h b/src/wallet.h
index cea61afed3..2fc953c516 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -609,21 +609,18 @@ public:
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- bool fRead = ser_action.ForRead();
-
- CWalletTx* pthis = const_cast<CWalletTx*>(this);
- if (fRead)
- pthis->Init(NULL);
+ if (ser_action.ForRead())
+ Init(NULL);
char fSpent = false;
- if (!fRead)
+ if (!ser_action.ForRead())
{
- pthis->mapValue["fromaccount"] = pthis->strFromAccount;
+ mapValue["fromaccount"] = strFromAccount;
- WriteOrderPos(pthis->nOrderPos, pthis->mapValue);
+ WriteOrderPos(nOrderPos, mapValue);
if (nTimeSmart)
- pthis->mapValue["timesmart"] = strprintf("%u", nTimeSmart);
+ mapValue["timesmart"] = strprintf("%u", nTimeSmart);
}
READWRITE(*(CMerkleTx*)this);
@@ -636,13 +633,13 @@ public:
READWRITE(fFromMe);
READWRITE(fSpent);
- if (fRead)
+ if (ser_action.ForRead())
{
- pthis->strFromAccount = pthis->mapValue["fromaccount"];
+ strFromAccount = mapValue["fromaccount"];
- ReadOrderPos(pthis->nOrderPos, pthis->mapValue);
+ ReadOrderPos(nOrderPos, mapValue);
- pthis->nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(pthis->mapValue["timesmart"]) : 0;
+ nTimeSmart = mapValue.count("timesmart") ? (unsigned int)atoi64(mapValue["timesmart"]) : 0;
}
mapValue.erase("fromaccount");
@@ -979,9 +976,6 @@ public:
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- bool fRead = ser_action.ForRead();
-
- CAccountingEntry& me = *const_cast<CAccountingEntry*>(this);
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
// Note: strAccount is serialized as part of the key, not here.
@@ -989,9 +983,9 @@ public:
READWRITE(nTime);
READWRITE(LIMITED_STRING(strOtherAccount, 65536));
- if (!fRead)
+ if (!ser_action.ForRead())
{
- WriteOrderPos(nOrderPos, me.mapValue);
+ WriteOrderPos(nOrderPos, mapValue);
if (!(mapValue.empty() && _ssExtra.empty()))
{
@@ -999,26 +993,26 @@ public:
ss.insert(ss.begin(), '\0');
ss << mapValue;
ss.insert(ss.end(), _ssExtra.begin(), _ssExtra.end());
- me.strComment.append(ss.str());
+ strComment.append(ss.str());
}
}
READWRITE(LIMITED_STRING(strComment, 65536));
size_t nSepPos = strComment.find("\0", 0, 1);
- if (fRead)
+ if (ser_action.ForRead())
{
- me.mapValue.clear();
+ mapValue.clear();
if (std::string::npos != nSepPos)
{
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());
+ ss >> mapValue;
+ _ssExtra = std::vector<char>(ss.begin(), ss.end());
}
- ReadOrderPos(me.nOrderPos, me.mapValue);
+ ReadOrderPos(nOrderPos, mapValue);
}
if (std::string::npos != nSepPos)
- me.strComment.erase(nSepPos);
+ strComment.erase(nSepPos);
mapValue.erase("n");
}