Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/nanoarrow/ipc/encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1234,13 +1234,12 @@ ArrowErrorCode ArrowIpcEncoderEncodeFooter(struct ArrowIpcEncoder* encoder,
struct ns(Block)* flatcc_RecordBatch_blocks =
ns(Footer_recordBatches_extend(builder, _ArrowInt64ToSizeT(n_blocks)));
FLATCC_RETURN_IF_NULL(flatcc_RecordBatch_blocks, error);
// Zero the vector first so that the padding after metaDataLength is
// deterministic, then set each field
memset(flatcc_RecordBatch_blocks, 0, (size_t)n_blocks * sizeof(struct ns(Block)));
for (int64_t i = 0; i < n_blocks; i++) {
struct ns(Block) block = {
blocks[i].offset,
blocks[i].metadata_length,
blocks[i].body_length,
};
flatcc_RecordBatch_blocks[i] = block;
ns(Block_assign)(&flatcc_RecordBatch_blocks[i], blocks[i].offset,
blocks[i].metadata_length, blocks[i].body_length);
}
FLATCC_RETURN_UNLESS_0(Footer_recordBatches_end(builder), error);

Expand All @@ -1253,13 +1252,12 @@ ArrowErrorCode ArrowIpcEncoderEncodeFooter(struct ArrowIpcEncoder* encoder,
struct ns(Block)* flatcc_dict_blocks =
ns(Footer_dictionaries_extend(builder, _ArrowInt64ToSizeT(n_dict_blocks)));
FLATCC_RETURN_IF_NULL(flatcc_dict_blocks, error);
// Zero the vector first so that the padding after metaDataLength is
// deterministic, then set each field
memset(flatcc_dict_blocks, 0, (size_t)n_dict_blocks * sizeof(struct ns(Block)));
for (int64_t i = 0; i < n_dict_blocks; i++) {
struct ns(Block) block = {
dict_blocks[i].offset,
dict_blocks[i].metadata_length,
dict_blocks[i].body_length,
};
flatcc_dict_blocks[i] = block;
ns(Block_assign)(&flatcc_dict_blocks[i], dict_blocks[i].offset,
dict_blocks[i].metadata_length, dict_blocks[i].body_length);
}
FLATCC_RETURN_UNLESS_0(Footer_dictionaries_end(builder), error);

Expand Down
Loading