aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.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/protocol.h
parent5d96b4ae0188fcad36105642c5d69249d37fdbb5 (diff)
downloadbitcoin-84881f8c472cc67dc757686eb7dc3b495b13cab8.tar.xz
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/protocol.h')
-rw-r--r--src/protocol.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/protocol.h b/src/protocol.h
index 851fca9d9e..0f5c5559d1 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -35,15 +35,15 @@ class CMessageHeader
std::string GetCommand() const;
bool IsValid() const;
- 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;
- READWRITE(FLATDATA(thisPtr->pchMessageStart));
- READWRITE(FLATDATA(thisPtr->pchCommand));
- READWRITE(thisPtr->nMessageSize);
- READWRITE(thisPtr->nChecksum);
+ READWRITE(FLATDATA(pchMessageStart));
+ READWRITE(FLATDATA(pchCommand));
+ READWRITE(nMessageSize);
+ READWRITE(nChecksum);
return nSerSize;
}
@@ -87,14 +87,14 @@ class CAddress : public CService
void Init();
- 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>();
- CAddress* pthis = const_cast<CAddress*>(thisPtr);
+ CAddress* pthis = const_cast<CAddress*>(this);
CService* pip = (CService*)pthis;
if (fRead)
pthis->Init();
@@ -102,8 +102,8 @@ class CAddress : public CService
READWRITE(nVersion);
if ((nType & SER_DISK) ||
(nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH)))
- READWRITE(thisPtr->nTime);
- READWRITE(thisPtr->nServices);
+ READWRITE(nTime);
+ READWRITE(nServices);
READWRITE(*pip);
return nSerSize;
@@ -128,13 +128,13 @@ class CInv
CInv(int typeIn, const uint256& hashIn);
CInv(const std::string& strType, const uint256& hashIn);
- 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;
- READWRITE(thisPtr->type);
- READWRITE(thisPtr->hash);
+ READWRITE(type);
+ READWRITE(hash);
return nSerSize;
}