On 18. 1. 26 12:23, Timofei Zhakov wrote:
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.


I use clang from Xcode on macOS, it has this extra warning that neither clang nor gcc have. Our autotools ./configure --enable-maintainer-mode adds this warning flag.

I'm sure MSVC emits a similar warning, too, but it also emits conversion warnings where it shouldn't, so the Windows build is cluttered with them.

-- Brane

Reply via email to