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

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

    From 6ccd53fe780c40e4a92e84e6c7dd46595e710f7a Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 17 Sep 2016 12:05:30 +0000
    Subject: [PATCH] (find.c) Cleanup -Wformat-signedness warning
    
    Cleanup -Wformat-signedness warning.
    
    find.c: In function 'found_num_update':
    find.c:373:44: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'long unsigned int' [-Werror=format=]
         g_snprintf (buffer, sizeof (buffer), _("Found: %ld"), matches);
                                                ^
    
    find.c: In function 'do_search':
    find.c:1306:51: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
                                                       "Finished (ignored %zd directories)",
                                                       ^
    find.c:1305:51: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
                                             ngettext ("Finished (ignored %zd directory)",
                                                       ^
    
    file.c:2526:41: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
         label_set_textv (dsm->count_size, _("Directories: %zd, total size: %s"),
                                             ^
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/find.c | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/src/filemanager/find.c b/src/filemanager/find.c
    index 1db7ccc..78d8a07 100644
    a b static void 
    370370found_num_update (void) 
    371371{ 
    372372    char buffer[BUF_TINY]; 
    373     g_snprintf (buffer, sizeof (buffer), _("Found: %ld"), matches); 
     373    g_snprintf (buffer, sizeof (buffer), _("Found: %lu"), matches); 
    374374    label_set_text (found_num_label, buffer); 
    375375} 
    376376 
    do_search (WDialog * h) 
    13021302                        { 
    13031303                            char msg[BUF_SMALL]; 
    13041304                            g_snprintf (msg, sizeof (msg), 
    1305                                         ngettext ("Finished (ignored %zd directory)", 
    1306                                                   "Finished (ignored %zd directories)", 
     1305                                        ngettext ("Finished (ignored %zu directory)", 
     1306                                                  "Finished (ignored %zu directories)", 
    13071307                                                  ignore_count), ignore_count); 
    13081308                            status_update (msg); 
    13091309                        }