Skip to content

Commit 36e6d55

Browse files
committed
A bit denser header layout. This also should fix alignment incompatibility between 32-bit and 64-bit builds spotted by the CI workflow.
1 parent 30448b5 commit 36e6d55

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/jrd/ods.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ struct header_page
474474
UCHAR hdr_replica_mode;
475475
ULONG hdr_PAGES; // Page number of PAGES relation
476476
ULONG hdr_page_buffers; // Page buffers for database cache
477+
USHORT hdr_end; // Offset of HDR_end in page
477478
FB_UINT64 hdr_next_transaction; // Next transaction id
478479
FB_UINT64 hdr_oldest_transaction; // Oldest interesting transaction
479480
FB_UINT64 hdr_oldest_active; // Oldest transaction thought active
@@ -489,13 +490,12 @@ struct header_page
489490
UCHAR hdr_guid[16]; // Database GUID
490491
SLONG hdr_creation_date[2]; // Date/time of creation
491492
SLONG hdr_shadow_count; // Event count for shadow synchronization
492-
USHORT hdr_end; // offset of HDR_end in page
493493
ULONG hdr_crypt_page; // Page at which processing is in progress
494494
TEXT hdr_crypt_plugin[32]; // Name of plugin used to crypt this DB
495495
UCHAR hdr_data[1]; // Misc data
496496
};
497497

498-
static_assert(sizeof(struct header_page) == 160, "struct header_page size mismatch");
498+
static_assert(sizeof(struct header_page) == 152, "struct header_page size mismatch");
499499
static_assert(offsetof(struct header_page, hdr_header) == 0, "hdr_header offset mismatch");
500500
static_assert(offsetof(struct header_page, hdr_page_size) == 16, "hdr_page_size offset mismatch");
501501
static_assert(offsetof(struct header_page, hdr_ods_version) == 18, "hdr_ods_version offset mismatch");
@@ -506,6 +506,7 @@ static_assert(offsetof(struct header_page, hdr_shutdown_mode) == 25, "hdr_shutdo
506506
static_assert(offsetof(struct header_page, hdr_replica_mode) == 26, "hdr_replica_mode offset mismatch");
507507
static_assert(offsetof(struct header_page, hdr_PAGES) == 28, "hdr_PAGES offset mismatch");
508508
static_assert(offsetof(struct header_page, hdr_page_buffers) == 32, "hdr_page_buffers offset mismatch");
509+
static_assert(offsetof(struct header_page, hdr_end) == 36, "hdr_end offset mismatch");
509510
static_assert(offsetof(struct header_page, hdr_next_transaction) == 40, "hdr_next_transaction offset mismatch");
510511
static_assert(offsetof(struct header_page, hdr_oldest_transaction) == 48, "hdr_oldest_transaction offset mismatch");
511512
static_assert(offsetof(struct header_page, hdr_oldest_active) == 56, "hdr_oldest_active offset mismatch");
@@ -515,10 +516,9 @@ static_assert(offsetof(struct header_page, hdr_db_impl) == 80, "hdr_shadow_count
515516
static_assert(offsetof(struct header_page, hdr_guid) == 84, "hdr_guid offset mismatch");
516517
static_assert(offsetof(struct header_page, hdr_creation_date) == 100, "hdr_creation_date offset mismatch");
517518
static_assert(offsetof(struct header_page, hdr_shadow_count) == 108, "hdr_shadow_count offset mismatch");
518-
static_assert(offsetof(struct header_page, hdr_end) == 112, "hdr_end offset mismatch");
519-
static_assert(offsetof(struct header_page, hdr_crypt_page) == 116, "hdr_crypt_page offset mismatch");
520-
static_assert(offsetof(struct header_page, hdr_crypt_plugin) == 120, "hdr_crypt_plugin offset mismatch");
521-
static_assert(offsetof(struct header_page, hdr_data) == 152, "hdr_data offset mismatch");
519+
static_assert(offsetof(struct header_page, hdr_crypt_page) == 112, "hdr_crypt_page offset mismatch");
520+
static_assert(offsetof(struct header_page, hdr_crypt_plugin) == 116, "hdr_crypt_plugin offset mismatch");
521+
static_assert(offsetof(struct header_page, hdr_data) == 148, "hdr_data offset mismatch");
522522

523523
static_assert(sizeof(header_page::hdr_guid) == Firebird::Guid::SIZE, "hdr_guid size mismatch");
524524

0 commit comments

Comments
 (0)