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

File mc-4179-group.c-fix-cast-qual-warning.patch, 2.6 KB (added by and, 14 months ago)
  • lib/widget/group.c

    From 1abe24d5246c5a5bb78ff7f1db5b5772b1b7c70e Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Tue, 22 Dec 2020 15:12:20 +0000
    Subject: [PATCH] (group.c) Fix -Wcast-qual warning
    
    group.c:199:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
            for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
                        ^
    ../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
    #define GROUP(x) ((WGroup *)(x))
                                ^
    group.c:231:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
            for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
                        ^
    ../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
    #define GROUP(x) ((WGroup *)(x))
                                ^
    group.c:263:21: warning: cast from 'const struct Widget *' to 'struct WGroup *' drops const qualifier [-Wcast-qual]
            for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter))
                        ^
    ../../lib/widget/group.h:16:29: note: expanded from macro 'GROUP'
    #define GROUP(x) ((WGroup *)(x))
                                ^
    
    Found by Clang-11
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     lib/widget/group.c | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/lib/widget/group.c b/lib/widget/group.c
    index f8e318bd9..96d2f2770 100644
    a b group_default_find (const Widget * w, const Widget * what) 
    196196    { 
    197197        GList *iter; 
    198198 
    199         for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter)) 
     199        for (iter = CONST_GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter)) 
    200200        { 
    201201            w0 = widget_find (WIDGET (iter->data), what); 
    202202            if (w0 != NULL) 
    group_default_find_by_type (const Widget * w, widget_cb_fn cb) 
    228228    { 
    229229        GList *iter; 
    230230 
    231         for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter)) 
     231        for (iter = CONST_GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter)) 
    232232        { 
    233233            w0 = widget_find_by_type (WIDGET (iter->data), cb); 
    234234            if (w0 != NULL) 
    group_default_find_by_id (const Widget * w, unsigned long id) 
    260260    { 
    261261        GList *iter; 
    262262 
    263         for (iter = GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter)) 
     263        for (iter = CONST_GROUP (w)->widgets; iter != NULL; iter = g_list_next (iter)) 
    264264        { 
    265265            w0 = widget_find_by_id (WIDGET (iter->data), id); 
    266266            if (w0 != NULL)