Skip to content

Conversation

@icing
Copy link
Contributor

@icing icing commented Nov 12, 2025

Add new functions in curlx/warnless.h for controlled type conversions:

  • curlx_uitouz, convert unsigned into to size_t (should always work)
  • curlx_uztoso, convert size_t to curl_off_t, capping at CURL_OFF_T_MAX
  • curlx_sztouz, convert ssize_t to size_t, return TRUE when ok
  • curlx_sotouz_range, convert curl_off_t to size_t interval, capping values to interval bounds

Remove some unnecesary casts, convert some internal recv functions to the "return result, have size_t* arg" pattern.

@icing
Copy link
Contributor Author

icing commented Nov 13, 2025

Thanks for the review, @vszakats !

Add new functions in `curlx/warnless.h` for controlled type
conversions:

* curlx_uitouz, convert unsigned into to size_t (should always work)
* curlx_uztoso, convert size_t to curl_off_t, capping at CURL_OFF_T_MAX
* curlx_sztouz, convert ssize_t to size_t, return TRUE when ok
* curlx_sotouz_range, convert curl_off_t to size_t interval, capping
  values to interval bounds

Remove some unnecesary casts, convert some internal recv functions
to the "return result, have size_t* arg" pattern.
@icing icing force-pushed the avoid-size_t-casts branch from 2f80ca3 to 6d57575 Compare November 13, 2025 10:12
@bagder bagder closed this in cb2bcb6 Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants