Skip to content

fix: correct attribute, format specifiers, const qualifiers, and header guards - #76

Merged
volschin merged 2 commits into
mainfrom
claude/simplify-review
Apr 2, 2026
Merged

fix: correct attribute, format specifiers, const qualifiers, and header guards#76
volschin merged 2 commits into
mainfrom
claude/simplify-review

Conversation

@volschin

@volschin volschin commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • nibble_to_ascii: __attribute__((const))__attribute__((pure)) — the function reads from a local array, which is memory beyond its arguments; const is too strict per GCC semantics
  • flash-ota.c: fix mixed %u/%d format specifiers for int-typed fw_blocks and block variables, remove unnecessary (unsigned int) casts (3 sites)
  • hexdump.h, version.h: add missing #ifndef header guards (only two headers without them after prior modernization)
  • All syntax() functions + socket_server(): add const qualifier to char *prog / char *iface parameters for consistency with other read-only string parameters

Test plan

  • make test passes (24/24 tests)
  • gcc -fsyntax-only -Wall -Wextra clean on non-libusb files
  • CI build (gcc + clang) passes
  • CI cross-compile (armhf, arm64) passes

volschin and others added 2 commits April 2, 2026 17:23
…er guards

- nibble_to_ascii: __attribute__((const)) → __attribute__((pure)) since
  the function reads from a local array (memory beyond its arguments)
- flash-ota.c: fix mixed %u/%d for int-typed fw_blocks and block vars,
  remove unnecessary (unsigned int) casts
- Add missing #ifndef header guards to hexdump.h and version.h
- Add const qualifier to prog parameter in all syntax() functions and
  socket_server() for consistency with other read-only string parameters
@volschin
volschin merged commit 3eb7896 into main Apr 2, 2026
11 of 12 checks passed
@volschin
volschin deleted the claude/simplify-review branch April 2, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant