Ticket #4179: mc-4179-filegui.c-fix-cast-qual-warning.patch

File mc-4179-filegui.c-fix-cast-qual-warning.patch, 2.0 KB (added by and, 21 months ago)
  • src/filemanager/filegui.c

    From 644b4f3aac650157734c66c2f4458fe963c13cb7 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Tue, 22 Dec 2020 16:09:19 +0000
    Subject: [PATCH] (filegui.c) Fix -Wcast-qual warning
    
    filegui.c:531:19: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
        s1 = (char *) file_date (ui->src_stat->st_mtime);
                      ^
    filegui.c:546:19: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
        s1 = (char *) file_date (ui->dst_stat->st_mtime);
                      ^
    
    Found by Clang-11
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/filegui.c | 9 +++++----
     1 file changed, 5 insertions(+), 4 deletions(-)
    
    diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c
    index 313bb407d..de590aede 100644
    a b overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode) 
    492492 
    493493    vfs_path_t *p; 
    494494    char *s1; 
     495    const char *cs1; 
    495496    char s2[BUF_SMALL]; 
    496497    int w, bw1, bw2; 
    497498    unsigned short i; 
    overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode) 
    528529    size_trunc_len (s2, sizeof (s2), ui->src_stat->st_size, 0, panels_options.kilobyte_si); 
    529530    NEW_LABEL (2, s2); 
    530531    /* new file modification date & time */ 
    531     s1 = (char *) file_date (ui->src_stat->st_mtime); 
    532     NEW_LABEL (3, s1); 
     532    cs1 = file_date (ui->src_stat->st_mtime); 
     533    NEW_LABEL (3, cs1); 
    533534 
    534535    /* existing file */ 
    535536    NEW_LABEL (4, dlg_widgets[4].text); 
    overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode) 
    543544    size_trunc_len (s2, sizeof (s2), ui->dst_stat->st_size, 0, panels_options.kilobyte_si); 
    544545    NEW_LABEL (6, s2); 
    545546    /* existing file modification date & time */ 
    546     s1 = (char *) file_date (ui->dst_stat->st_mtime); 
    547     NEW_LABEL (7, s1); 
     547    cs1 = file_date (ui->dst_stat->st_mtime); 
     548    NEW_LABEL (7, cs1); 
    548549 
    549550    /* will "Append" and "Reget" buttons be in the dialog? */ 
    550551    do_append = !S_ISDIR (ui->dst_stat->st_mode);