[vlc-commits] Don't check unsigned variables for negativeness
Hugo Beauzée-Luyssen
git at videolan.org
Tue Feb 14 15:30:36 CET 2017
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Feb 13 14:35:01 2017 +0100| [eed4f1018b714c356b3ff9539a3f4df9e63823b9] | committer: Hugo Beauzée-Luyssen
Don't check unsigned variables for negativeness
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eed4f1018b714c356b3ff9539a3f4df9e63823b9
---
modules/codec/araw.c | 4 ++--
modules/codec/flac.c | 2 +-
modules/codec/g711.c | 4 ++--
modules/demux/rawaud.c | 4 ++--
modules/demux/wav.c | 8 ++++----
modules/stream_out/smem.c | 2 +-
modules/video_chroma/swscale.c | 4 ++--
7 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index 0c46f94..50f8e85 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -244,7 +244,7 @@ static int DecoderOpen( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- if( p_dec->fmt_in.audio.i_channels <= 0 ||
+ if( p_dec->fmt_in.audio.i_channels == 0 ||
p_dec->fmt_in.audio.i_channels > AOUT_CHAN_MAX )
{
msg_Err( p_dec, "bad channels count (1-%i): %i",
@@ -252,7 +252,7 @@ static int DecoderOpen( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- if( p_dec->fmt_in.audio.i_rate <= 0 || p_dec->fmt_in.audio.i_rate > 384000 )
+ if( p_dec->fmt_in.audio.i_rate == 0 || p_dec->fmt_in.audio.i_rate > 384000 )
{
msg_Err( p_dec, "bad samplerate: %d Hz", p_dec->fmt_in.audio.i_rate );
return VLC_EGENERIC;
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 92b7aa6..0046b10 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -172,7 +172,7 @@ DecoderWriteCallback( const FLAC__StreamDecoder *decoder,
decoder_t *p_dec = (decoder_t *)client_data;
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_dec->fmt_out.audio.i_channels <= 0 ||
+ if( p_dec->fmt_out.audio.i_channels == 0 ||
p_dec->fmt_out.audio.i_channels > 8 )
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
if( date_Get( &p_sys->end_date ) <= VLC_TS_INVALID )
diff --git a/modules/codec/g711.c b/modules/codec/g711.c
index 6154e45..13e7562 100644
--- a/modules/codec/g711.c
+++ b/modules/codec/g711.c
@@ -160,7 +160,7 @@ static int DecoderOpen( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- if( p_dec->fmt_in.audio.i_channels <= 0 ||
+ if( p_dec->fmt_in.audio.i_channels == 0 ||
p_dec->fmt_in.audio.i_channels > AOUT_CHAN_MAX )
{
msg_Err( p_dec, "bad channels count (1-%i): %i",
@@ -168,7 +168,7 @@ static int DecoderOpen( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- if( p_dec->fmt_in.audio.i_rate <= 0 )
+ if( p_dec->fmt_in.audio.i_rate == 0 )
{
msg_Err( p_dec, "bad samplerate: %d Hz", p_dec->fmt_in.audio.i_rate );
return VLC_EGENERIC;
diff --git a/modules/demux/rawaud.c b/modules/demux/rawaud.c
index 91b622e..c219518 100644
--- a/modules/demux/rawaud.c
+++ b/modules/demux/rawaud.c
@@ -167,7 +167,7 @@ static int Open( vlc_object_t * p_this )
p_sys->fmt.audio.i_channels = var_CreateGetInteger( p_demux, "rawaud-channels" );
p_sys->fmt.audio.i_rate = var_CreateGetInteger( p_demux, "rawaud-samplerate" );
- if( p_sys->fmt.audio.i_rate <= 0 || p_sys->fmt.audio.i_rate > 384000 )
+ if( p_sys->fmt.audio.i_rate == 0 || p_sys->fmt.audio.i_rate > 384000 )
{
msg_Err( p_demux, "invalid sample rate");
es_format_Clean( &p_sys->fmt );
@@ -175,7 +175,7 @@ static int Open( vlc_object_t * p_this )
return VLC_EGENERIC;
}
- if( p_sys->fmt.audio.i_channels <= 0 || p_sys->fmt.audio.i_channels > 32 )
+ if( p_sys->fmt.audio.i_channels == 0 || p_sys->fmt.audio.i_channels > 32 )
{
msg_Err( p_demux, "invalid number of channels");
es_format_Clean( &p_sys->fmt );
diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index f12abe7..db7a32c 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -393,7 +393,7 @@ static int Open( vlc_object_t * p_this )
p_sys->i_frame_samples );
goto error;
}
- if( p_sys->fmt.audio.i_rate <= 0 )
+ if( p_sys->fmt.audio.i_rate == 0 )
{
msg_Dbg( p_demux, "invalid sample rate: %i", p_sys->fmt.audio.i_rate );
goto error;
@@ -578,7 +578,7 @@ static int FrameInfo_PCM( unsigned int *pi_size, int *pi_samples,
static int FrameInfo_MS_ADPCM( unsigned int *pi_size, int *pi_samples,
const es_format_t *p_fmt )
{
- if( p_fmt->audio.i_channels <= 0 )
+ if( p_fmt->audio.i_channels == 0 )
return VLC_EGENERIC;
*pi_samples = 2 + 2 * ( p_fmt->audio.i_blockalign -
@@ -591,7 +591,7 @@ static int FrameInfo_MS_ADPCM( unsigned int *pi_size, int *pi_samples,
static int FrameInfo_IMA_ADPCM( unsigned int *pi_size, int *pi_samples,
const es_format_t *p_fmt )
{
- if( p_fmt->audio.i_channels <= 0 )
+ if( p_fmt->audio.i_channels == 0 )
return VLC_EGENERIC;
*pi_samples = 2 * ( p_fmt->audio.i_blockalign -
@@ -604,7 +604,7 @@ static int FrameInfo_IMA_ADPCM( unsigned int *pi_size, int *pi_samples,
static int FrameInfo_Creative_ADPCM( unsigned int *pi_size, int *pi_samples,
const es_format_t *p_fmt )
{
- if( p_fmt->audio.i_channels <= 0 )
+ if( p_fmt->audio.i_channels == 0 )
return VLC_EGENERIC;
/* 4 bits / sample */
diff --git a/modules/stream_out/smem.c b/modules/stream_out/smem.c
index 61431ff..9bf4be3 100644
--- a/modules/stream_out/smem.c
+++ b/modules/stream_out/smem.c
@@ -395,7 +395,7 @@ static int SendAudio( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
int i_samples = 0;
i_size = p_buffer->i_buffer;
- if (id->format->audio.i_channels <= 0)
+ if (id->format->audio.i_channels == 0)
{
msg_Warn( p_stream, "No buffer given!" );
block_ChainRelease( p_buffer );
diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index bacb157..8993d11 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -375,8 +375,8 @@ static int Init( filter_t *p_filter )
msg_Err( p_filter, "format not supported" );
return VLC_EGENERIC;
}
- if( p_fmti->i_visible_width <= 0 || p_fmti->i_visible_height <= 0 ||
- p_fmto->i_visible_width <= 0 || p_fmto->i_visible_height <= 0 )
+ if( p_fmti->i_visible_width == 0 || p_fmti->i_visible_height == 0 ||
+ p_fmto->i_visible_width == 0 || p_fmto->i_visible_height == 0 )
{
msg_Err( p_filter, "invalid scaling: %ix%i -> %ix%i",
p_fmti->i_visible_width, p_fmti->i_visible_height,
More information about the vlc-commits
mailing list