Skip to content

Fix building the repo with Android NDK R29#121194

Merged
MichalStrehovsky merged 2 commits intodotnet:mainfrom
MichalStrehovsky:androidbreaks
Oct 30, 2025
Merged

Fix building the repo with Android NDK R29#121194
MichalStrehovsky merged 2 commits intodotnet:mainfrom
MichalStrehovsky:androidbreaks

Conversation

@MichalStrehovsky
Copy link
Member

Drive-by fix while I'm looking at #121172.

  D:/git/runtime1/src/native/libs/System.Security.Cryptography.Native.Android/pal_ecc_import_export.c:444:59: error: format specifies type 'int' but the argument has underlying type 'unsigned int' [-Werror,-Wformat]
    444 |         LOG_ERROR("Unuspported curve type specified: %d", curveType);
        |                                                      ~~   ^~~~~~~~~
        |                                                      %u

  D:/git/runtime1/src/native/libs/System.Native/pal_ifaddrs.c:460:46: error: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'ssize_t' (aka 'long') [-Werror,-Wformat]
    460 |     LOG_DEBUG("   address data length: %zu", length);
        |                                        ~~~   ^~~~~~
        |                                        %zd

Cc @dotnet/ncl @dotnet/area-system-security

Drive-by fix while I'm looking at dotnet#121172.

```
  D:/git/runtime1/src/native/libs/System.Security.Cryptography.Native.Android/pal_ecc_import_export.c:444:59: error: format specifies type 'int' but the argument has underlying type 'unsigned int' [-Werror,-Wformat]
    444 |         LOG_ERROR("Unuspported curve type specified: %d", curveType);
        |                                                      ~~   ^~~~~~~~~
        |                                                      %u

  D:/git/runtime1/src/native/libs/System.Native/pal_ifaddrs.c:460:46: error: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'ssize_t' (aka 'long') [-Werror,-Wformat]
    460 |     LOG_DEBUG("   address data length: %zu", length);
        |                                        ~~~   ^~~~~~
        |                                        %zd
```
Copilot AI review requested due to automatic review settings October 30, 2025 07:56
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 30, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR corrects printf format specifiers in log statements to match their corresponding argument types, improving type safety and preventing potential undefined behavior or incorrect output.

  • Changed format specifier from %zu to %zd for ssize_t variable
  • Changed format specifier from %d to %u for ECCurveType enum variable

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/native/libs/System.Security.Cryptography.Native.Android/pal_ecc_import_export.c Updated format specifier for curveType enum parameter to use %u instead of %d
src/native/libs/System.Native/pal_ifaddrs.c Updated format specifier for length variable to use %zd instead of %zu

…l_ecc_import_export.c

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MichalStrehovsky
Copy link
Member Author

/ba-g uninteresting leg infrastructure timeouts

@MichalStrehovsky MichalStrehovsky merged commit e3d86c1 into dotnet:main Oct 30, 2025
108 of 113 checks passed
@MichalStrehovsky MichalStrehovsky deleted the androidbreaks branch October 30, 2025 20:34
@github-actions github-actions bot locked and limited conversation to collaborators Nov 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants