aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.h
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-07-05 16:49:57 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2017-07-26 00:10:30 +0200
commit1e65f0f3396d5d7eaa8e8dd3668dfa180b541c18 (patch)
tree43cde6e010c80c898d49c7670ed9a63826c4e9b2 /src/protocol.h
parent1caafa6cde3b88d926611771f9b4c06fcc6e0007 (diff)
Use compile-time constants instead of unnamed enumerations (remove "enum hack")
Diffstat (limited to 'src/protocol.h')
-rw-r--r--src/protocol.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/protocol.h b/src/protocol.h
index 7890bb627d..640e8466d8 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];
CMessageHeader(const MessageStartChars& pchMessageStartIn);