Skip to content

Commit

Permalink
fix sign conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed Aug 2, 2024
1 parent 3a7d150 commit fdf7e45
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/nanoarrow/ipc/encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ ArrowErrorCode ArrowIpcEncoderFinalizeBuffer(struct ArrowIpcEncoder* encoder,
struct ArrowIpcEncoderPrivate* private =
(struct ArrowIpcEncoderPrivate*)encoder->private_data;

int64_t size = (int64_t)flatcc_builder_get_buffer_size(&private->builder);
int32_t header[] = {-1, ArrowIpcSystemEndianness() == NANOARROW_IPC_ENDIANNESS_BIG
? bswap32((int32_t)size)
: (int32_t)size};
int32_t size = (int32_t)flatcc_builder_get_buffer_size(&private->builder);
int32_t header[] = {-1, size};
if (ArrowIpcSystemEndianness() == NANOARROW_IPC_ENDIANNESS_BIG) {
header[1] = (int32_t)bswap32((uint32_t)size);
}

if (size == 0) {
// Finalizing an empty flatcc_builder_t triggers an assertion
Expand Down

0 comments on commit fdf7e45

Please sign in to comment.