Merge bitcoin/bitcoin#34454: wallet: Rename RecordType::DELETE to RecordType::DELETE_FLAG
516be10bb5wallet: Rename `RecordType::DELETE` to `RecordType::DELETE_FLAG` (Hennadii Stepanov) Pull request description: On Windows, the `winnt.h` header defines `DELETE` as a macro for a "Standard Access Right" bitmask (0x00010000L). This introduces a fragile dependency on header inclusion order: if Windows headers happen to be included before the `RecordType` enum definition, the preprocessor expands `DELETE` into a numeric literal, causing syntax errors. Rename the enumerator to `DELETE_FLAG` to remove this fragility and avoid the collision entirely. Split from https://github.com/bitcoin/bitcoin/pull/34448. ACKs for top commit: maflcko: re-lgtm ACK516be10bb5achow101: ACK516be10bb5Tree-SHA512: eba054b395e18c07efb2901b28f542b042b62d85e1a798eeff35f8431530cb667fa791c47c4125cecdb689213b458ba396715495415e9b83bb322509a9376222
This commit is contained in:
1 file changed
+5
-5
@@ -50,7 +50,7 @@ enum class RecordType : uint8_t {
|
|||||||
KEYDATA = 1,
|
KEYDATA = 1,
|
||||||
// DUPLICATE = 2, Unused as our databases do not support duplicate records
|
// DUPLICATE = 2, Unused as our databases do not support duplicate records
|
||||||
OVERFLOW_DATA = 3,
|
OVERFLOW_DATA = 3,
|
||||||
DELETE = 0x80, // Indicate this record is deleted. This is OR'd with the real type.
|
DELETE_FLAG = 0x80, // Indicate this record is deleted. This is OR'd with the real type.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class BTreeFlags : uint32_t {
|
enum class BTreeFlags : uint32_t {
|
||||||
@@ -208,8 +208,8 @@ class RecordHeader
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
uint16_t len; // Key/data item length
|
uint16_t len; // Key/data item length
|
||||||
RecordType type; // Page type (BDB has this include a DELETE FLAG that we track separately)
|
RecordType type; // Page type (BDB has this; includes a DELETE_FLAG that we track separately)
|
||||||
bool deleted; // Whether the DELETE flag was set on type
|
bool deleted; // Whether the DELETE_FLAG was set on type
|
||||||
|
|
||||||
static constexpr size_t SIZE = 3; // The record header is 3 bytes
|
static constexpr size_t SIZE = 3; // The record header is 3 bytes
|
||||||
|
|
||||||
@@ -225,8 +225,8 @@ public:
|
|||||||
|
|
||||||
uint8_t uint8_type;
|
uint8_t uint8_type;
|
||||||
s >> uint8_type;
|
s >> uint8_type;
|
||||||
type = static_cast<RecordType>(uint8_type & ~static_cast<uint8_t>(RecordType::DELETE));
|
type = static_cast<RecordType>(uint8_type & ~static_cast<uint8_t>(RecordType::DELETE_FLAG));
|
||||||
deleted = uint8_type & static_cast<uint8_t>(RecordType::DELETE);
|
deleted = uint8_type & static_cast<uint8_t>(RecordType::DELETE_FLAG);
|
||||||
|
|
||||||
if (other_endian) {
|
if (other_endian) {
|
||||||
len = internal_bswap_16(len);
|
len = internal_bswap_16(len);
|
||||||
|
|||||||
Reference in new issue
Block a user