Repository navigation
Conversation
Building with -Wconversion on 32-bit targets (e.g. armv7 Android in the vcpkg CI) fails because several int64_t values are passed to functions that take size_t (memcpy, memset, snprintf, malloc, fread and flatcc builder helpers). Cast these explicitly. Closes apache#797.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #797.
Building nanoarrow with
-Wconversionon a 32-bit target (the armv7 Android build in the vcpkg CI from the issue) fails with-Wshorten-64-to-32errors, because a number ofint64_tsizes are passed straight to functions that takesize_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 incommon/,device/device.candipc/. There's no behaviour change on 64-bit platforms. InArrowArrayViewCompareBuffer()thesize_bytes > 0check stays on the signed value and only the length handed tomemcmp()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) oversrc/nanoarrow/common/*.c,device/device.candipc/{codecs,decoder,encoder,reader,writer}.c: 40 distinct-Wshorten-64-to-32warning locations onmain, 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.NANOARROW_BUILD_TESTS=ON NANOARROW_IPC=ON NANOARROW_DEVICE=ON:ctest422/422 passed.This PR was prepared with AI assistance; I reviewed the changes and ran the checks above.