Ticket #3466: mc-3466-cleanup-pointer_arith-warning.patch

File mc-3466-cleanup-pointer_arith-warning.patch, 2.8 KB (added by and, 9 years ago)
  • m4.include/mc-cflags.m4

    fix -Wpointer-arith compiler warnings and add to mc cflags
    
    panel.c:1538:51: error: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
    growbuf.c:159:65: error: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
    growbuf.c:296:77: error: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
    growbuf.c:299:77: error: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
    config_parser.c:167:31: error: arithmetic on a pointer to void is a GNU libtool
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    
    a b  
    7070    MC_CHECK_ONE_CFLAG([-Wno-long-long]) 
    7171    MC_CHECK_ONE_CFLAG([-Wno-unreachable-code]) 
    7272    MC_CHECK_ONE_CFLAG([-Wparentheses]) 
     73    MC_CHECK_ONE_CFLAG([-Wpointer-arith]) 
    7374    MC_CHECK_ONE_CFLAG([-Wpointer-sign]) 
    7475    MC_CHECK_ONE_CFLAG([-Wredundant-decls]) 
    7576    MC_CHECK_ONE_CFLAG([-Wreturn-type]) 
  • src/filemanager/panel.c

    a b  
    15351535 
    15361536        hkey = strchr (translated_title, '&'); 
    15371537        if (hkey != NULL && hkey[1] != '\0') 
    1538             memmove ((void *) hkey, (void *) hkey + 1, strlen (hkey)); 
     1538            memmove (hkey, hkey + 1, strlen (hkey)); 
    15391539    } 
    15401540 
    15411541    return translated_title; 
  • src/viewer/growbuf.c

    a b  
    155155            g_ptr_array_add (view->growbuf_blockptr, newblock); 
    156156            view->growbuf_lastindex = 0; 
    157157        } 
    158         p = g_ptr_array_index (view->growbuf_blockptr, 
     158        p = (byte *) g_ptr_array_index (view->growbuf_blockptr, 
    159159                               view->growbuf_blockptr->len - 1) + view->growbuf_lastindex; 
    160160 
    161161        bytesfree = VIEW_PAGE_SIZE - view->growbuf_lastindex; 
     
    293293    if (view->growbuf_blockptr->len == 0) 
    294294        return NULL; 
    295295    if (pageno < (off_t) view->growbuf_blockptr->len - 1) 
    296         return (char *) (g_ptr_array_index (view->growbuf_blockptr, pageno) + pageindex); 
     296        return (char *) ((char *)g_ptr_array_index (view->growbuf_blockptr, pageno) + pageindex); 
    297297    if (pageno == (off_t) view->growbuf_blockptr->len - 1 
    298298        && pageindex < (off_t) view->growbuf_lastindex) 
    299         return (char *) (g_ptr_array_index (view->growbuf_blockptr, pageno) + pageindex); 
     299        return (char *) ((char *)g_ptr_array_index (view->growbuf_blockptr, pageno) + pageindex); 
    300300    return NULL; 
    301301} 
    302302 
  • src/vfs/sftpfs/config_parser.c

    a b  
    132132/* --------------------------------------------------------------------------------------------- */ 
    133133 
    134134#define POINTER_TO_STRUCTURE_MEMBER(type)  \ 
    135     ((type) ((void *) config_entity + (off_t) config_variables[i].offset)) 
     135    ((type) (config_entity + (off_t) config_variables[i].offset)) 
    136136 
    137137/** 
    138138 * Parse string and filling one config entity by parsed data.