diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2021-05-13 08:44:34 +0100 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2021-05-13 12:42:21 +0100 |
commit | 1c9255c7dd2d4f12bfb508bcc8d123a6354d8842 (patch) | |
tree | 84a9005eeb275aead306fe277bbb25bb39a74448 /src/protocol.h | |
parent | 9c891b64ffd14bc8216dbd5eb60816043af265b6 (diff) |
refactor: Replace memset calls with array initialization
Diffstat (limited to 'src/protocol.h')
-rw-r--r-- | src/protocol.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/protocol.h b/src/protocol.h index c73484bdf6..aaa9f1df40 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -38,7 +38,7 @@ public: static constexpr size_t HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE; typedef unsigned char MessageStartChars[MESSAGE_START_SIZE]; - explicit CMessageHeader(); + explicit CMessageHeader() = default; /** Construct a P2P message header from message-start characters, a command and the size of the message. * @note Passing in a `pszCommand` longer than COMMAND_SIZE will result in a run-time assertion error. @@ -50,10 +50,10 @@ public: SERIALIZE_METHODS(CMessageHeader, obj) { READWRITE(obj.pchMessageStart, obj.pchCommand, obj.nMessageSize, obj.pchChecksum); } - char pchMessageStart[MESSAGE_START_SIZE]; - char pchCommand[COMMAND_SIZE]; + char pchMessageStart[MESSAGE_START_SIZE]{}; + char pchCommand[COMMAND_SIZE]{}; uint32_t nMessageSize{std::numeric_limits<uint32_t>::max()}; - uint8_t pchChecksum[CHECKSUM_SIZE]; + uint8_t pchChecksum[CHECKSUM_SIZE]{}; }; /** |