[dvblast-devel] Stop clang from complaining about enum usage.
Georgi Chorbadzhiyski
git at videolan.org
Sun Oct 27 20:50:06 CET 2013
dvblast | branch: master | Georgi Chorbadzhiyski <gf at unixsol.org> | Sun Oct 27 21:42:10 2013 +0200| [2fa11e64d85a26e90a1e6ae0a87c1fdbed540581] | committer: Georgi Chorbadzhiyski
Stop clang from complaining about enum usage.
This commit stops clang from complaining about:
> demux.c:2033:23: warning: comparison of constant -1 with expression of type 'enum print_type_t' is always true [-Wtautological-constant-out-of-range-compare]
> if ( i_print_type != -1 )
> ~~~~~~~~~~~~ ^ ~~
> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=2fa11e64d85a26e90a1e6ae0a87c1fdbed540581
---
demux.c | 10 +++++-----
dvblast.c | 7 ++++++-
dvblast.h | 1 +
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/demux.c b/demux.c
index fbe03be..4b59712 100644
--- a/demux.c
+++ b/demux.c
@@ -2030,7 +2030,7 @@ static void HandlePAT( mtime_t i_dts )
}
pat_table_print( pp_current_pat_sections, msg_Dbg, NULL, PRINT_TEXT );
- if ( i_print_type != -1 )
+ if ( b_print_enabled )
{
pat_table_print( pp_current_pat_sections, demux_Print, NULL,
i_print_type );
@@ -2168,7 +2168,7 @@ static void HandleCAT( mtime_t i_dts )
}
cat_table_print( pp_current_cat_sections, msg_Dbg, NULL, PRINT_TEXT );
- if ( i_print_type != -1 )
+ if ( b_print_enabled )
{
cat_table_print( pp_current_cat_sections, demux_Print, NULL,
i_print_type );
@@ -2363,7 +2363,7 @@ static void HandlePMT( uint16_t i_pid, uint8_t *p_pmt, mtime_t i_dts )
UpdatePMT( i_sid );
pmt_print( p_pmt, msg_Dbg, NULL, demux_Iconv, NULL, PRINT_TEXT );
- if ( i_print_type != -1 )
+ if ( b_print_enabled )
{
pmt_print( p_pmt, demux_Print, NULL, demux_Iconv, NULL,
i_print_type );
@@ -2411,7 +2411,7 @@ static void HandleNIT( mtime_t i_dts )
nit_table_print( pp_current_nit_sections, msg_Dbg, NULL,
demux_Iconv, NULL, PRINT_TEXT );
- if ( i_print_type != -1 )
+ if ( b_print_enabled )
{
nit_table_print( pp_current_nit_sections, demux_Print, NULL,
demux_Iconv, NULL, i_print_type );
@@ -2535,7 +2535,7 @@ static void HandleSDT( mtime_t i_dts )
sdt_table_print( pp_current_sdt_sections, msg_Dbg, NULL,
demux_Iconv, NULL, PRINT_TEXT );
- if ( i_print_type != -1 )
+ if ( b_print_enabled )
{
sdt_table_print( pp_current_sdt_sections, demux_Print, NULL,
demux_Iconv, NULL, i_print_type );
diff --git a/dvblast.c b/dvblast.c
index 8bc2b7e..e2357a3 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -95,7 +95,8 @@ int i_asi_adapter = 0;
const char *psz_native_charset = "UTF-8";
const char *psz_dvb_charset = "ISO_8859-1";
const char *psz_provider_name = NULL;
-print_type_t i_print_type = -1;
+print_type_t i_print_type = PRINT_TEXT;
+bool b_print_enabled = false;
volatile sig_atomic_t b_conf_reload = 0;
volatile sig_atomic_t b_exit_now = 0;
@@ -940,12 +941,16 @@ int main( int i_argc, char **pp_argv )
break;
case 'x':
+ b_print_enabled = true;
if ( !strcmp(optarg, "text") )
i_print_type = PRINT_TEXT;
else if ( !strcmp(optarg, "xml") )
i_print_type = PRINT_XML;
else
+ {
+ b_print_enabled = false;
msg_Warn( NULL, "unrecognized print type %s", optarg );
+ }
/* Make stdout line-buffered */
setvbuf(stdout, NULL, _IOLBF, 0);
break;
diff --git a/dvblast.h b/dvblast.h
index e7f0c68..6543df1 100644
--- a/dvblast.h
+++ b/dvblast.h
@@ -221,6 +221,7 @@ extern int i_asi_adapter;
extern const char *psz_native_charset;
extern const char *psz_dvb_charset;
extern enum print_type_t i_print_type;
+extern bool b_print_enabled;
/* pid mapping */
extern bool b_do_remap;
More information about the dvblast-devel
mailing list