Repository navigation
Fix most remaining Clang -Wsign-conversion warnings - #1730
Conversation
seanm
commented
Dec 31, 2025
- added cast
- changed some types
- added asserts
Youw
left a comment
There was a problem hiding this comment.
Overall this is good from "fix the warning" point of view.
But there is also anothre thing - this actually affects overall consistency and code style across implementation. We might want to consider what to do with it in the future.
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce remaining Clang -Wsign-conversion warnings across the core POSIX event loop and several example programs by adding explicit casts, tightening types, and adding assertions for internal invariants.
Changes:
- Adjust POSIX event waiting logic to use unsigned types/casts and add assertions around internal pollfd layout.
- Refine example code integer types/casts to avoid signed/unsigned conversion warnings.
- Clarify API documentation for
libusb_transfer.actual_lengthto indicate it is never negative.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
libusb/os/events_posix.c |
Adds assertions and adjusts signed/unsigned handling around poll() results and internal fd bookkeeping. |
libusb/libusb.h |
Updates documentation for actual_length to state it is never negative. |
examples/xusb.c |
Adds casts / type changes around mass storage helpers and buffer display to address sign-conversion warnings. |
examples/sam3u_benchmark.c |
Adds casts/type adjustments in benchmark accounting and timing computations. |
examples/fxload.c |
Adjusts loop variable types/scope to reduce sign-conversion warnings. |
examples/ezusb.c |
Narrows variable scope and adds casts in IIC parsing to avoid sign-conversion warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1aaa937 to
ff63857
Compare
|
@sonatique @Youw ok I made some small changes today, this is ready for hopefully one last review. |
ff63857 to
e11ead4
Compare
- added cast - changed some types - added asserts
e11ead4 to
6170ee7
Compare
Declare internal_fds before the existing goto paths while preserving its unsigned type and assignment point. This fixes C++ builds after #1730. Assisted-by: codex:GPT-5.6-Sol