11// Copyright (c) 2009-2016 The Bitcoin Core developers
2+ // Copyright (c) 2018 The BitZeny Core developers
23// Distributed under the MIT software license, see the accompanying
34// file COPYING or http://www.opensource.org/licenses/mit-license.php.
45
1112
1213#include " compat.h"
1314#include " serialize.h"
15+ #include " span.h"
1416
1517#include < stdint.h>
1618#include < string>
@@ -93,7 +95,7 @@ class CNetAddr
9395
9496 template <typename Stream, typename Operation>
9597 inline void SerializationOp (Stream& s, Operation ser_action) {
96- READWRITE (FLATDATA (ip) );
98+ READWRITE (ip );
9799 }
98100
99101 friend class CSubNet ;
@@ -131,16 +133,16 @@ class CSubNet
131133 template <typename Stream, typename Operation>
132134 inline void SerializationOp (Stream& s, Operation ser_action) {
133135 READWRITE (network);
134- READWRITE (FLATDATA ( netmask) );
135- READWRITE (FLATDATA ( valid) );
136+ READWRITE (netmask);
137+ READWRITE (valid);
136138 }
137139};
138140
139141/* * A combination of a network address (CNetAddr) and a (TCP) port */
140142class CService : public CNetAddr
141143{
142144 protected:
143- unsigned short port; // host order
145+ uint16_t port; // host order
144146
145147 public:
146148 CService ();
@@ -166,11 +168,8 @@ class CService : public CNetAddr
166168
167169 template <typename Stream, typename Operation>
168170 inline void SerializationOp (Stream& s, Operation ser_action) {
169- READWRITE (FLATDATA (ip));
170- unsigned short portN = htons (port);
171- READWRITE (FLATDATA (portN));
172- if (ser_action.ForRead ())
173- port = ntohs (portN);
171+ READWRITE (ip);
172+ READWRITE (WrapBigEndian (port));
174173 }
175174};
176175
0 commit comments