Ticket #3466: add -Wpointer-arith option and fix relative warnings.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andreas Mohr 2015-05-10 18:01:11 +03:00 committed by Andrew Borodin
parent f1b73ffe6e
commit dd8521b92d
4 changed files with 8 additions and 6 deletions

View File

@ -71,6 +71,7 @@ dnl Sorted -W options:
MC_CHECK_ONE_CFLAG([-Wno-long-long])
MC_CHECK_ONE_CFLAG([-Wno-unreachable-code])
MC_CHECK_ONE_CFLAG([-Wparentheses])
MC_CHECK_ONE_CFLAG([-Wpointer-arith])
MC_CHECK_ONE_CFLAG([-Wpointer-sign])
MC_CHECK_ONE_CFLAG([-Wredundant-decls])
MC_CHECK_ONE_CFLAG([-Wreturn-type])

View File

@ -1544,7 +1544,7 @@ panel_get_title_without_hotkey (const char *title)
hkey = strchr (translated_title, '&');
if (hkey != NULL && hkey[1] != '\0')
memmove ((void *) hkey, (void *) hkey + 1, strlen (hkey));
memmove (hkey, hkey + 1, strlen (hkey));
}
return translated_title;

View File

@ -131,8 +131,9 @@ sftpfs_correct_file_name (const char *filename)
/* --------------------------------------------------------------------------------------------- */
/* FIXME: is pointer arith correct here? */
#define POINTER_TO_STRUCTURE_MEMBER(type) \
((type) ((void *) config_entity + (off_t) config_variables[i].offset))
((type) (config_entity + (off_t) config_variables[i].offset))
/**
* Parse string and filling one config entity by parsed data.

View File

@ -155,8 +155,8 @@ mcview_growbuf_read_until (mcview_t * view, off_t ofs)
g_ptr_array_add (view->growbuf_blockptr, newblock);
view->growbuf_lastindex = 0;
}
p = g_ptr_array_index (view->growbuf_blockptr,
view->growbuf_blockptr->len - 1) + view->growbuf_lastindex;
p = (byte *) g_ptr_array_index (view->growbuf_blockptr, view->growbuf_blockptr->len - 1) + view->growbuf_lastindex;
bytesfree = VIEW_PAGE_SIZE - view->growbuf_lastindex;
@ -293,10 +293,10 @@ mcview_get_ptr_growing_buffer (mcview_t * view, off_t byte_index)
if (view->growbuf_blockptr->len == 0)
return NULL;
if (pageno < (off_t) view->growbuf_blockptr->len - 1)
return (char *) (g_ptr_array_index (view->growbuf_blockptr, pageno) + pageindex);
return ((char *) g_ptr_array_index (view->growbuf_blockptr, pageno) + pageindex);
if (pageno == (off_t) view->growbuf_blockptr->len - 1
&& pageindex < (off_t) view->growbuf_lastindex)
return (char *) (g_ptr_array_index (view->growbuf_blockptr, pageno) + pageindex);
return ((char *) g_ptr_array_index (view->growbuf_blockptr, pageno) + pageindex);
return NULL;
}