bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

some warning fixes


From: Bruno Haible
Subject: some warning fixes
Date: Sat, 05 Sep 2020 16:30:28 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; )

Building libunistring with clang on 64-bit Windows, a couple of warnings
show up. In particular, clang's -Wshorten-64-to-32 warning is useful,
because it highlights places where 64-bit sizes are implicitly truncated
to 32-bit. Which means that strings longer than 4 GiB likely trigger bugs.

Here are patches to fix some of these.


2020-09-05  Bruno Haible  <bruno@clisp.org>

        uniname/uniname: Fix -Wshadow warning.
        * lib/uniname/uniname.c (unicode_name_word): Don't declare i upfront.
        * modules/uniname/uniname (Depends-on): Add c99.

2020-09-05  Bruno Haible  <bruno@clisp.org>

        uniname/uniname: Fix -Wshorten-64-to-32 warnings.
        * lib/uniname/uniname.c (unicode_name_word_lookup): Change type of last
        argument to size_t.
        (unicode_name_character): Change type of len, n1, n2, n3, words_length,
        n to size_t.

2020-09-05  Bruno Haible  <bruno@clisp.org>

        unistr/u{8,16,32}-uctomb: Avoid possible trouble with huge strings.
        * lib/unistr.in.h (u8_uctomb_aux, u8_uctomb, u16_uctomb_aux, u16_uctomb,
        u32_uctomb): Change type of last argument to ptrdiff_t.
        * lib/unistr/u8-uctomb.c (u8_uctomb): Likewise.
        * lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise.
        * lib/unistr/u16-uctomb.c (u16_uctomb): Likewise.
        * lib/unistr/u16-uctomb-aux.c (u16_uctomb_aux): Likewise.
        * lib/unistr/u32-uctomb.c (u32_uctomb): Likewise.

Attachment: 0001-unistr-u-8-16-32-uctomb-Avoid-possible-trouble-with-.patch
Description: Text Data

Attachment: 0002-uniname-uniname-Fix-Wshorten-64-to-32-warnings.patch
Description: Text Data

Attachment: 0003-uniname-uniname-Fix-Wshadow-warning.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]