Commit f534e17d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: avoid integer overflow on V4L2 slider min and max

Ideally, we should subclass QAbstractSpinBox to support 64-bits values.
But in the mean time, lets at least support the int32_t range.
parent 88aa00e4
...@@ -765,15 +765,18 @@ void ExtV4l2::Refresh( void ) ...@@ -765,15 +765,18 @@ void ExtV4l2::Refresh( void )
vlc_value_t val2; vlc_value_t val2;
var_Change( p_obj, psz_var, VLC_VAR_GETMIN, var_Change( p_obj, psz_var, VLC_VAR_GETMIN,
&val2, NULL ); &val2, NULL );
if( val2.i_int < INT_MIN )
val2.i_int = INT_MIN; /* FIXME */
slider->setMinimum( val2.i_int ); slider->setMinimum( val2.i_int );
var_Change( p_obj, psz_var, VLC_VAR_GETMAX, var_Change( p_obj, psz_var, VLC_VAR_GETMAX,
&val2, NULL ); &val2, NULL );
if( val2.i_int > INT_MAX )
val2.i_int = INT_MAX; /* FIXME */
slider->setMaximum( val2.i_int ); slider->setMaximum( val2.i_int );
if( !var_Change( p_obj, psz_var, VLC_VAR_GETSTEP, if( !var_Change( p_obj, psz_var, VLC_VAR_GETSTEP,
&val2, NULL ) ) &val2, NULL ) )
slider->setSingleStep( val2.i_int ); slider->setSingleStep( val2.i_int );
slider->setValue( i_val ); slider->setValue( i_val );
CONNECT( slider, valueChanged( int ), this, CONNECT( slider, valueChanged( int ), this,
ValueChange( int ) ); ValueChange( int ) );
hlayout->addWidget( slider ); hlayout->addWidget( slider );
......
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