Repository navigation
Conversation
```
tests/test_simple.c:84:56: error: operand of ? changes signedness: 'int' to 'unsigned long' [clang-diagnostic-sign-conversion]
84 | gcry_mpi_t f = gcry_mpi_set_ui(NULL, fi >= 0 ? fi : -fi);
| ~~~~~~~~~~~~~~~ ^~
tests/test_simple.c:84:61: error: operand of ? changes signedness: 'int' to 'unsigned long' [clang-diagnostic-sign-conversion]
84 | gcry_mpi_t f = gcry_mpi_set_ui(NULL, fi >= 0 ? fi : -fi);
| ~~~~~~~~~~~~~~~ ^~~
tests/test_simple.c:85:46: error: implicit conversion changes signedness: 'int' to 'unsigned long' [clang-diagnostic-sign-conversion]
85 | gcry_mpi_t p = gcry_mpi_set_ui(NULL, atoi(tests[i].p));
| ~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
```
Ref: https://github.com/libssh2/libssh2/actions/runs/30043871895/job/89330114459#step:24:124
Follow-up to 76d30e5 libssh2#2417
Follow-up to fcf8307 libssh2#2239
-Wsign-conversion-Wsign-conversion (clang-tidy)
There was a problem hiding this comment.
Pull request overview
This PR updates the LIBSSH2_LIBGCRYPT test path in test_simple.c to silence Clang -Wsign-conversion warnings when passing int values (from atoi() and a ternary) into gcry_mpi_set_ui(), which takes an unsigned long.
Changes:
- Add explicit casts to
unsigned longfor arguments passed togcry_mpi_set_ui()in the libgcrypt test path. - Keep existing sign handling for negative
fvalues viagcry_mpi_neg().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Fixing:
Ref: https://github.com/libssh2/libssh2/actions/runs/30043871895/job/89330114459#step:24:124
Also add intermediate current test holder var to keep code readable.
Follow-up to 76d30e5 #2417
Follow-up to fcf8307 #2239