Commit f453ab54 authored by gates's avatar gates

Set extra warnings on by default, with configure option to disable them.

Also fix build.
Only warnings about comparisons between signed and unsigned integers needed to
be fixed.
parent 9c039f2b
......@@ -24,6 +24,12 @@ AC_ARG_ENABLE([werror],
[use_werror=$enableval],
[use_werror=yes])
AC_ARG_ENABLE([extra-warnings],
[AS_HELP_STRING([--enable-extra-warnings],
[set extra warnings (default is yes)])],
[use_extra_warnings=$enableval],
[use_extra_warnings=yes])
AC_ARG_ENABLE([optimizations],
[AS_HELP_STRING([--enable-optimizations],
[enable optimizations (default is yes)])],
......@@ -77,6 +83,11 @@ if [[ $use_werror = "yes" ]]; then
WERROR="-Werror"
fi
# use extra warnings
if [[ $use_extra_warnings = "yes" ]]; then
EXTRA_WARNINGS="-Wextra -Winline"
fi
# use optimizations
if [[ $use_optimizations = "yes" ]]; then
OPTIMIZATIONS="-O3 -fomit-frame-pointer"
......@@ -85,6 +96,7 @@ fi
# generate output files
AC_SUBST(DLOPEN_LDFLAGS)
AC_SUBST(WERROR)
AC_SUBST(EXTRA_WARNINGS)
AC_SUBST(OPTIMIZATIONS)
AC_CONFIG_FILES([Makefile src/Makefile src/examples/Makefile src/libbluray.pc])
AC_OUTPUT
......@@ -2,7 +2,8 @@ SUBDIRS= . examples
SET_FEATURES = -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112L -D_REENTRANT
SET_WARNINGS = -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls \
-Wcast-qual -Wwrite-strings -Wtype-limits -Wundef @WERROR@
-Wcast-qual -Wwrite-strings -Wtype-limits -Wundef @WERROR@ \
@EXTRA_WARNINGS@
SET_OPTIMIZATIONS = @OPTIMIZATIONS@
SET_INCLUDES = -I$(top_srcdir)/src
......
SET_FEATURES = -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112L -D_REENTRANT
SET_WARNINGS = -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls \
-Wcast-qual -Wwrite-strings -Wtype-limits -Wundef @WERROR@
-Wcast-qual -Wwrite-strings -Wtype-limits -Wundef @WERROR@ \
@EXTRA_WARNINGS@
SET_OPTIMIZATIONS = @OPTIMIZATIONS@
SET_INCLUDES = -I$(top_srcdir)/src
......
......@@ -55,7 +55,8 @@ static void _usage(char *cmd)
int main(int argc, char *argv[])
{
BLURAY *bd;
int count, ii, opt, seconds = 0;
int count, ii, opt;
unsigned int seconds = 0;
char *bd_dir = NULL;
DEBUG(DBG_BLURAY,"\nListing titles:\n");
......
......@@ -379,7 +379,7 @@ _find_repeats(MPLS_PL *pl, const char *m2ts)
}
static int
_filter_short(MPLS_PL *pl, int seconds)
_filter_short(MPLS_PL *pl, unsigned int seconds)
{
// Ignore short playlists
if (_pl_duration(pl) / 45000 <= seconds) {
......
......@@ -124,10 +124,10 @@ NAV_TITLE_LIST* nav_get_title_list(char *root, uint32_t flags)
char *path = NULL;
MPLS_PL **pl_list = NULL;
MPLS_PL *pl = NULL;
int ii, pl_list_size = 0;
unsigned int ii, pl_list_size = 0;
int res;
NAV_TITLE_LIST *title_list;
int title_info_alloc = 100;
unsigned int title_info_alloc = 100;
title_list = calloc(1, sizeof(NAV_TITLE_LIST));
title_list->title_info = calloc(title_info_alloc, sizeof(NAV_TITLE_INFO));
......
......@@ -114,7 +114,7 @@ typedef struct {
} NAV_TITLE_INFO;
typedef struct {
int count;
unsigned int count;
NAV_TITLE_INFO *title_info;
} NAV_TITLE_LIST;
......
......@@ -468,7 +468,6 @@ static int64_t _clip_seek_time(BLURAY *bd, uint64_t tick)
int bd_read(BLURAY *bd, unsigned char *buf, int len)
{
int size;
int out_len;
if (bd->fp) {
......@@ -478,7 +477,7 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
while (len > 0) {
uint32_t clip_pkt;
size = len;
unsigned int size = len;
// Do we need to read more data?
clip_pkt = bd->clip_pos / 192;
if (bd->seamless_angle_change) {
......@@ -496,9 +495,9 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
bd->angle = bd->request_angle;
bd->seamless_angle_change = 0;
} else {
int64_t angle_pos;
uint64_t angle_pos;
angle_pos = (int64_t)bd->angle_change_pkt * 192;
angle_pos = bd->angle_change_pkt * 192;
if (angle_pos - bd->clip_pos < size)
{
size = angle_pos - bd->clip_pos;
......@@ -526,7 +525,7 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
return out_len;
}
}
if (size > 6144 - bd->int_buf_off) {
if (size > (unsigned int)6144 - bd->int_buf_off) {
size = 6144 - bd->int_buf_off;
}
memcpy(buf, bd->int_buf + bd->int_buf_off, size);
......@@ -655,7 +654,7 @@ BD_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx)
{
NAV_TITLE *title;
BD_TITLE_INFO *title_info;
int ii;
unsigned int ii;
if (bd->title_list == NULL) {
DEBUG(DBG_BLURAY, "Title list not yet read! (%p)\n", bd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment