Ticket #3598: mc-3598-0016-filemanager-file.c-cleanup-Wcast-qual-warning.patch

File mc-3598-0016-filemanager-file.c-cleanup-Wcast-qual-warning.patch, 2.7 KB (added by and, 8 years ago)
  • src/filemanager/file.c

    From eb505b5706b642fdd65ce61bb449ae07bdb26e8b Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 20 Feb 2016 17:27:20 +0000
    Subject: [PATCH] filemanager/file.c: cleanup -Wcast-qual warning
    
    file.c:241:16: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
         fnsource = (char *) x_basename (s);
                    ^
    file.c: In function 'is_in_linklist':
    /usr/include/glib-2.0/glib/gslist.h:139:52: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
     #define  g_slist_next(slist)          ((slist) ? (((GSList *)(slist))->next) : NULL)
                                                        ^
    file.c:296:29: note: in expansion of macro 'g_slist_next'
         for (; lp != NULL; lp = g_slist_next (lp))
                                 ^
    file.c: In function 'panel_operate_generate_prompt':
    file.c:1426:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
         sp = (char *) (src_stat != NULL ? one_format : many_format);
              ^
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/file.c | 10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/src/filemanager/file.c b/src/filemanager/file.c
    index d124ef4..fb9103c 100644
    a b static char * 
    228228transform_source (file_op_context_t * ctx, const vfs_path_t * source_vpath) 
    229229{ 
    230230    char *s, *q; 
    231     char *fnsource; 
     231    const char *fnsource; 
    232232 
    233233    s = g_strdup (vfs_path_as_str (source_vpath)); 
    234234 
    transform_source (file_op_context_t * ctx, const vfs_path_t * source_vpath) 
    238238        if (*q == '\n') 
    239239            *q = ' '; 
    240240 
    241     fnsource = (char *) x_basename (s); 
     241    fnsource = x_basename (s); 
    242242 
    243243    if (mc_search_run (ctx->search_handle, fnsource, 0, strlen (fnsource), NULL)) 
    244244    { 
    free_linklist (GSList * lp) 
    285285/* --------------------------------------------------------------------------------------------- */ 
    286286 
    287287static gboolean 
    288 is_in_linklist (const GSList * lp, const vfs_path_t * vpath, const struct stat *sb) 
     288is_in_linklist (GSList * lp, const vfs_path_t * vpath, const struct stat *sb) 
    289289{ 
    290290    const struct vfs_class *class; 
    291291    ino_t ino = sb->st_ino; 
    panel_operate_generate_prompt (const WPanel * panel, FileOperation operation, 
    14231423     *       "Delete %d files/directories?" 
    14241424     */ 
    14251425 
    1426     sp = (char *) (src_stat != NULL ? one_format : many_format); 
     1426    cp = (src_stat != NULL ? one_format : many_format); 
    14271427 
    14281428    /* 1. Substitute %o */ 
    1429     format_string = str_replace_all (sp, "%o", op_names1[(int) operation]); 
     1429    format_string = str_replace_all (cp, "%o", op_names1[(int) operation]); 
    14301430 
    14311431    /* 2. Substitute %n */ 
    14321432    cp = operation == OP_DELETE ? "\n" : " ";