Skip to content

Commit

Permalink
Test on checked sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
carlopi committed Aug 4, 2024
1 parent 566eb85 commit a179b4c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/row_operations/row_external.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void RowOperations::SwizzleColumns(const RowLayout &layout, const data_ptr_t bas
data_ptr_t heap_ptr_ptr = row_ptr + layout.GetHeapOffset();
for (idx_t i = 0; i < next; i++) {
heap_row_ptrs[i] = Load<data_ptr_t>(heap_ptr_ptr);
static_assert(sizeof(data_ptr_t) == 8, "data_ptr_t are 8 bytes");
heap_ptr_ptr += row_width;
}
// Loop through the blob columns
Expand Down
2 changes: 2 additions & 0 deletions src/common/serializer/binary_serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace duckdb {
void BinarySerializer::OnPropertyBegin(const field_id_t field_id, const char *tag) {
// Just write the field id straight up
Write<field_id_t>(field_id);
static_assert(sizeof(field_id_t) == 2, "field_id_t should be 2 bytes");
#ifdef DEBUG
// First of check that we are inside an object
if (debug_stack.empty()) {
Expand Down Expand Up @@ -93,6 +94,7 @@ void BinarySerializer::WriteNull() {

void BinarySerializer::WriteValue(bool value) {
Write<uint8_t>(value);
static_assert(sizeof(uint8_t) == 1, "uint8_t should be 1 bytes");
}

void BinarySerializer::WriteValue(uint8_t value) {
Expand Down
1 change: 1 addition & 0 deletions src/transaction/duck_transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void DuckTransaction::PushCatalogEntry(CatalogEntry &entry, data_ptr_t extra_dat
auto baseptr = undo_buffer.CreateEntry(UndoFlags::CATALOG_ENTRY, alloc_size);
// store the pointer to the catalog entry
Store<CatalogEntry *>(&entry, baseptr);
static_assert(sizeof(CatalogEntry *) == 8, "Pointer have size 8");
if (extra_data_size > 0) {
// copy the extra data behind the catalog entry pointer (if any)
baseptr += sizeof(CatalogEntry *);
Expand Down

0 comments on commit a179b4c

Please sign in to comment.