mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Use compile-time constants instead of unnamed enumerations (remove "enum hack")
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user