Ticket #3641: mc-3641-cleanup-Wformat-signedness-info_c.patch

File mc-3641-cleanup-Wformat-signedness-info_c.patch, 3.1 KB (added by and, 8 years ago)
  • src/filemanager/info.c

    From bd353aedb50d29f2be2d06dd64f0c17aa3c2c483 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 17 Sep 2016 12:06:19 +0000
    Subject: [PATCH] (info.c) Cleanup -Wformat-signedness warning
    
    Cleanup -Wformat-signedness warning.
    
    info.c: In function 'info_show_info':
    info.c:193:29: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int' [-Werror=format=]
                 tty_printf (" (%Xh)", myfs_stats.type);
                                 ^
    
    info.c:239:51: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'long unsigned int' [-Werror=format=]
                 tty_printf (ngettext (" (%ld block)", " (%ld blocks)",
                                                       ^
    info.c:239:35: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'long unsigned int' [-Werror=format=]
                 tty_printf (ngettext (" (%ld block)", " (%ld blocks)",
                                       ^
    
    info.c:259:23: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int' [-Werror=format=]
             tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                           ^
    info.c:259:21: note: in expansion of macro '_'
             tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                         ^
    info.c:259:23: error: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'int' [-Werror=format=]
             tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                           ^
    info.c:259:21: note: in expansion of macro '_'
             tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
                         ^
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/info.c | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/src/filemanager/info.c b/src/filemanager/info.c
    index f6da163..9d98a56 100644
    a b info_show_info (WInfo * info) 
    190190        tty_printf (_("Type:       %s"), 
    191191                    myfs_stats.typename ? myfs_stats.typename : _("non-local vfs")); 
    192192        if (myfs_stats.type != 0xffff && myfs_stats.type != -1) 
    193             tty_printf (" (%Xh)", myfs_stats.type); 
     193            tty_printf (" (%Xh)", (unsigned int) myfs_stats.type); 
    194194 
    195195    case 13: 
    196196        widget_move (w, 13, 3); 
    info_show_info (WInfo * info) 
    236236            size_trunc_len (buffer, 9, st.st_size, 0, panels_options.kilobyte_si); 
    237237            tty_printf (_("Size:       %s"), buffer); 
    238238#ifdef HAVE_STRUCT_STAT_ST_BLOCKS 
    239             tty_printf (ngettext (" (%ld block)", " (%ld blocks)", 
     239            tty_printf (ngettext (" (%lu block)", " (%lu blocks)", 
    240240                                  (unsigned long) st.st_blocks), (unsigned long) st.st_blocks); 
    241241#endif 
    242242        } 
    info_show_info (WInfo * info) 
    256256 
    257257    case 4: 
    258258        widget_move (w, 4, 3); 
    259         tty_printf (_("Location:   %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino); 
     259        tty_printf (_("Location:   %Xh:%Xh"), (unsigned int) st.st_dev, (unsigned int) st.st_ino); 
    260260 
    261261    case 3: 
    262262        {