Skip to content

Replace atol/atoi/sscanf with strtol/strtoul for clang-tidy compliance#63

Merged
ferronn-dev merged 1 commit into
mainfrom
claude/strtol-conversions
May 18, 2026
Merged

Replace atol/atoi/sscanf with strtol/strtoul for clang-tidy compliance#63
ferronn-dev merged 1 commit into
mainfrom
claude/strtol-conversions

Conversation

@ferronn-dev

@ferronn-dev ferronn-dev commented Apr 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace atol() with strtol() in collect_header_callback for Content-Length parsing
  • Replace sscanf("%02x", ...) with a char[3] buffer + strtoul(..., 16) in parse_hash
  • Replace sscanf("|%d.%d.%d.%d|", ...) with chained strtol calls in parse_versions
  • Replace atoi() with strtol() in the fdid command for FDID argument parsing

All changes allow callers to detect parse failures via endptr, satisfying the clang-tidy bugprone-unchecked-string-to-number-conversion check.

@ferronn-dev ferronn-dev force-pushed the claude/strtol-conversions branch from ff15623 to 6dc3387 Compare May 18, 2026 02:36
@ferronn-dev ferronn-dev changed the title Replace atol/sscanf with strtol/strtoul Replace atol/atoi with strtol for clang-tidy compliance May 18, 2026
@ferronn-dev ferronn-dev force-pushed the claude/strtol-conversions branch from 6dc3387 to 741cfb9 Compare May 18, 2026 02:39
- Replace `atol()` with `strtol()` in `collect_header_callback` for Content-Length parsing
- Replace `sscanf("%02x", ...)` with a `char[3]` buffer + `strtoul(..., 16)` in `parse_hash`
- Replace `sscanf("|%d.%d.%d.%d|", ...)` with chained `strtol` calls in `parse_versions`
- Replace `atoi()` with `strtol()` in the `fdid` command for FDID argument parsing

All changes allow callers to detect parse failures via `endptr`, satisfying
the clang-tidy `bugprone-unchecked-string-to-number-conversion` check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ferronn-dev ferronn-dev changed the title Replace atol/atoi with strtol for clang-tidy compliance Replace atol/atoi/sscanf with strtol/strtoul for clang-tidy compliance May 18, 2026
@ferronn-dev ferronn-dev merged commit 630282a into main May 18, 2026
6 checks passed
@ferronn-dev ferronn-dev deleted the claude/strtol-conversions branch May 18, 2026 02:50
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