diff options
author | MarcoFalke <falke.marco@gmail.com> | 2017-11-11 18:07:23 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2017-11-11 18:07:28 -0500 |
commit | 2adbddb03840ad71e843c6c4a207a13e871cd1d4 (patch) | |
tree | e3ef2bbc3bd775e1e7ab36c2538ab5b248288eaa /src/protocol.h | |
parent | 13e352dc53dec0127c5f94a60055d0ca829420dc (diff) | |
parent | 1e65f0f3396d5d7eaa8e8dd3668dfa180b541c18 (diff) |
Merge #10749: Use compile-time constants instead of unnamed enumerations (remove "enum hack")
1e65f0f33 Use compile-time constants instead of unnamed enumerations (remove "enum hack") (practicalswift)
Pull request description:
Use compile-time constants instead of unnamed enumerations (remove "enum hack").
Tree-SHA512: 1b6ebb2755398c5ebab6cce125b1dfc39cbd1504d98d55136b32703fe935c4070360ab3b2f52b1da48ba9f3b01082d204f3d87c92ccb5c8c333731f7f972e128
Diffstat (limited to 'src/protocol.h')
-rw-r--r-- | src/protocol.h | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/protocol.h b/src/protocol.h index 56b59aed3f..558616eaf8 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -27,16 +27,13 @@ class CMessageHeader { public: - enum { - MESSAGE_START_SIZE = 4, - COMMAND_SIZE = 12, - MESSAGE_SIZE_SIZE = 4, - CHECKSUM_SIZE = 4, - - MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE, - CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE, - HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE - }; + static constexpr size_t MESSAGE_START_SIZE = 4; + static constexpr size_t COMMAND_SIZE = 12; + static constexpr size_t MESSAGE_SIZE_SIZE = 4; + static constexpr size_t CHECKSUM_SIZE = 4; + static constexpr size_t MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE; + static constexpr size_t CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE; + 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(const MessageStartChars& pchMessageStartIn); |