[neomutt-devel] [PATCH] copy: fix format warning on ILP32 with 64-bit off_t

наб nabijaczleweli at nabijaczleweli.xyz
Fri Dec 22 12:35:16 CET 2023


cc -fno-delete-null-pointer-checks -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D__EXTENSIONS__ -D_XOPEN_SOURCE_EXTENDED -I/usr/include/lua5.4 -I/usr/include -I/usr/include -DNCURSES_WIDECHAR -I/usr/include -I/usr/include/p11-kit-1 -I/usr/include -isystem
/usr/include/mit-krb5 -O2 -I. -I. -Wall -g  -I./test -MT copy.o -MD -MP -MF copy.Tpo -c -o copy.o copy.c
In file included from mutt/lib.h:86,
                 from copy.c:36:
copy.c: In function ‘mutt_copy_message_fp’:
copy.c:732:29: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘off_t’ {aka ‘long long int’} [-Wformat=]
  732 |                             "The length calculation was wrong by %ld bytes", fail),
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mutt/logging2.h:92:88: note: in definition of macro ‘mutt_error’
   92 | #define mutt_error(...)        MuttLogger(0, __FILE__, __LINE__, __func__, LL_ERROR,   __VA_ARGS__) ///< @ingroup logging_api
      |                                                                                        ^~~~~~~~~~~
copy.c:732:68: note: format string is defined here
  732 |                             "The length calculation was wrong by %ld bytes", fail),
      |                                                                  ~~^
      |                                                                    |
      |                                                                    long int
      |                                                                  %lld
copy.c:731:29: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘off_t’ {aka ‘long long int’} [-Wformat=]
  731 |         mutt_error(ngettext("The length calculation was wrong by %ld byte",
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mutt/logging2.h:92:88: note: in definition of macro ‘mutt_error’
   92 | #define mutt_error(...)        MuttLogger(0, __FILE__, __LINE__, __func__, LL_ERROR,   __VA_ARGS__) ///< @ingroup logging_api
      |                                                                                        ^~~~~~~~~~~
copy.c:731:68: note: format string is defined here
  731 |         mutt_error(ngettext("The length calculation was wrong by %ld byte",
      |                                                                  ~~^
      |                                                                    |
      |                                                                    long int
      |                                                                  %lld
---
 copy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/copy.c b/copy.c
index 7796cac..43f71c2 100644
--- a/copy.c
+++ b/copy.c
@@ -730,7 +730,7 @@ int mutt_copy_message_fp(FILE *fp_out, FILE *fp_in, struct Email *e,
       {
         mutt_error(ngettext("The length calculation was wrong by %ld byte",
                             "The length calculation was wrong by %ld bytes", fail),
-                   fail);
+                   (long)fail);
         new_length += fail;
       }
 
-- 
2.42.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mailman.neomutt.org/pipermail/neomutt-devel-neomutt.org/attachments/20231222/b8e3723b/attachment.sig>


More information about the neomutt-devel mailing list