Ticket #3547: mc-3547-cleanup-Wfloat-conversion-warning.patch

File mc-3547-cleanup-Wfloat-conversion-warning.patch, 2.3 KB (added by and, 6 years ago)
  • lib/widget/wtools.c

    From ec4626a9063bce918d8de32157bda28952cccd8b Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 27 Feb 2016 23:53:15 +0000
    Subject: [PATCH] cleanup -Wfloat-conversion warning
    
    wtools.c:591:23: error: implicit conversion turns floating-point number into integer: 'double' to 'guint64' (aka 'unsigned long') [-Werror,-Wfloat-conversion]
        sm->delay = delay * G_USEC_PER_SEC;
                  ~ ~~~~~~^~~~~~~~~~~~~~~~
    
    filegui.c:347:51: error: implicit conversion turns floating-point number into integer: 'double' to 'int' [-Werror,-Wfloat-conversion]
        eta_mins = (eta_secs - (eta_hours * 60 * 60)) / 60;
                 ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
    filegui.c:348:22: error: implicit conversion turns floating-point number into integer: 'double' to 'int' [-Werror,-Wfloat-conversion]
        eta_s = eta_secs - (eta_hours * 60 * 60 + eta_mins * 60);
              ~ ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     lib/widget/wtools.c       | 2 +-
     src/filemanager/filegui.c | 6 +++---
     2 files changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/lib/widget/wtools.c b/lib/widget/wtools.c
    index 21727a1..c3c1284 100644
    a b status_msg_init (status_msg_t * sm, const char *title, double delay, status_msg_ 
    588588    sm->dlg = dlg_create (TRUE, 0, 0, 7, min (max (40, COLS / 2), COLS), dialog_colors, 
    589589                          NULL, NULL, NULL, title, DLG_CENTER); 
    590590    sm->start = start; 
    591     sm->delay = delay * G_USEC_PER_SEC; 
     591    sm->delay = (guint64) (delay * G_USEC_PER_SEC); 
    592592    sm->block = FALSE; 
    593593 
    594594    sm->init = init_cb; 
  • src/filemanager/filegui.c

    diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c
    index 02089b2..5809454 100644
    a b static void 
    343343file_frmt_time (char *buffer, double eta_secs) 
    344344{ 
    345345    int eta_hours, eta_mins, eta_s; 
    346     eta_hours = eta_secs / (60 * 60); 
    347     eta_mins = (eta_secs - (eta_hours * 60 * 60)) / 60; 
    348     eta_s = eta_secs - (eta_hours * 60 * 60 + eta_mins * 60); 
     346    eta_hours = (int) (eta_secs / (60 * 60)); 
     347    eta_mins = (int) ((eta_secs - (eta_hours * 60 * 60)) / 60); 
     348    eta_s = (int) (eta_secs - (eta_hours * 60 * 60 + eta_mins * 60)); 
    349349    g_snprintf (buffer, BUF_TINY, _("%d:%02d.%02d"), eta_hours, eta_mins, eta_s); 
    350350} 
    351351