ump45nose opened a new pull request, #983:
URL: https://github.com/apache/arrow-nanoarrow/pull/983
Closes #797.
Building nanoarrow with `-Wconversion` on a 32-bit target (the armv7 Android
build in the vcpkg CI from the issue) fails with `-Wshorten-64-to-32` errors,
because a number of `int64_t` sizes are passed straight to functions that take
`size_t`: `memcpy`/`memset`/`memmove`, `snprintf`, `malloc`/`realloc`,
`fread`/`fwrite`, `strncmp`, and the flatcc builder/vector helpers.
This adds explicit `(size_t)` casts at those call sites in `common/`,
`device/device.c` and `ipc/`. There's no behaviour change on 64-bit platforms.
In `ArrowArrayViewCompareBuffer()` the `size_bytes > 0` check stays on the
signed value and only the length handed to `memcmp()` is converted, so the
stringified comparison message the tests check doesn't change.
### Testing
- `clang -m32 -std=gnu99 -fsyntax-only -Wall -Wextra -Wpedantic -Wconversion
-Wno-sign-conversion` (clang 19, i386) over `src/nanoarrow/common/*.c`,
`device/device.c` and `ipc/{codecs,decoder,encoder,reader,writer}.c`: 40
distinct `-Wshorten-64-to-32` warning locations on `main`, none with this
change. I don't have the Android NDK setup locally, so this is a 32-bit x86
stand-in for the armv7 build.
- Native 64-bit Debug build with `NANOARROW_BUILD_TESTS=ON NANOARROW_IPC=ON
NANOARROW_DEVICE=ON`: `ctest` 422/422 passed.
- clang-format 16.0.6 (the pre-commit version) applied.
This PR was prepared with AI assistance; I reviewed the changes and ran the
checks above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]