On Sun, Jan 18, 2026 at 6:23 AM Branko Čibej <[email protected]> wrote:

> On 17. 1. 26 18:11, [email protected] wrote:
>
> Author: rinrab
> Date: Sat Jan 17 17:11:02 2026
> New Revision: 1931389
>
> Log:
> Handle SHA1 checksum update with APR backend (whose update consumes size as
> `unsigned int`, not a size_t) if a buffer with a size more than the limit of
> unsigned integer by iterating trough data via blocks and invoking the backend
> multiple times.
>
> [...]
>
>  /*** SHA1 checksum ***/
> +static void
> +sha1_update(apr_sha1_ctx_t *ctx,
> +            const void *data,
> +            apr_size_t len)
> +{
> +  while (len > 0)
> +    {
> +      unsigned int block;
> +
> +      if (len < UINT_MAX)
> +        block = len;
>
>
> .../subversion/libsvn_subr/checksum_apr.c:98:17: warning: implicit conversion 
> loses integer precision: 'apr_size_t' (aka 'unsigned long') to 'unsigned int' 
> [-Wshorten-64-to-32]
>    98 |         block = len;
>       |               ~ ^~~
>
>
> This is one of those rare cases where it's perfectly fine and expected to
> use a typecast; it's guaranteed to be safe, since you just compared 'len'
> with UINT_MAX.
>
>
That makes sense... Followed-up fix in r1931403. Thanks!

How do you enable extra warnings? I tried -Wall but only -Wshorten-64-to-32
revealed this message.

-- 
Timofei Zhakov

Reply via email to