[vlc-devel] [PATCH 4/4] demux: mkv: ProcessNavAction: negate if to prevent nesting
Filip Roséen
filip at atch.se
Sun Jul 22 08:16:35 CEST 2018
By negating the protective if-condition we can get rid of one layer of
indentation.
---
modules/demux/mkv/events.cpp | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/modules/demux/mkv/events.cpp b/modules/demux/mkv/events.cpp
index 57e9503c28..d27a707279 100644
--- a/modules/demux/mkv/events.cpp
+++ b/modules/demux/mkv/events.cpp
@@ -173,21 +173,21 @@ void event_thread_t::ProcessNavAction( uint16 button, pci_t* pci )
{
demux_sys_t* p_sys = (demux_sys_t*)p_demux->p_sys;
- if ( button > 0 && button <= pci->hli.hl_gi.btn_ns )
+ if( button <= 0 || button > pci->hli.hl_gi.btn_ns )
+ return;
+
+ p_sys->dvd_interpretor.SetSPRM( 0x88, button );
+ btni_t button_ptr = pci->hli.btnit[button-1];
+ if ( button_ptr.auto_action_mode )
{
- p_sys->dvd_interpretor.SetSPRM( 0x88, button );
- btni_t button_ptr = pci->hli.btnit[button-1];
- if ( button_ptr.auto_action_mode )
- {
- vlc_mutex_unlock( &lock );
- vlc_mutex_lock( &p_sys->lock_demuxer );
+ vlc_mutex_unlock( &lock );
+ vlc_mutex_lock( &p_sys->lock_demuxer );
- // process the button action
- p_sys->dvd_interpretor.Interpret( button_ptr.cmd.bytes, 8 );
+ // process the button action
+ p_sys->dvd_interpretor.Interpret( button_ptr.cmd.bytes, 8 );
- vlc_mutex_unlock( &p_sys->lock_demuxer );
- vlc_mutex_lock( &lock );
- }
+ vlc_mutex_unlock( &p_sys->lock_demuxer );
+ vlc_mutex_lock( &lock );
}
}
--
2.18.0
More information about the vlc-devel
mailing list