[vlc-devel] commit: Shore up code and remove early returns. (JP Dinger )

git version control git at videolan.org
Tue Jul 14 12:53:54 CEST 2009


vlc | branch: master | JP Dinger <jpd at videolan.org> | Tue Jul 14 12:40:20 2009 +0200| [8f556b71551cb564f99ec9610d2bb45b788ab8b9] | committer: JP Dinger 

Shore up code and remove early returns.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8f556b71551cb564f99ec9610d2bb45b788ab8b9
---

 modules/access/dv.c |   29 ++++++++---------------------
 1 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/modules/access/dv.c b/modules/access/dv.c
index b0a6273..b23d6fd 100644
--- a/modules/access/dv.c
+++ b/modules/access/dv.c
@@ -303,33 +303,27 @@ static void Close( vlc_object_t *p_this )
  *****************************************************************************/
 static int Control( access_t *p_access, int i_query, va_list args )
 {
-    access_sys_t *p_sys = p_access->p_sys;
-    bool   *pb_bool;
-    int64_t      *pi_64;
-
     switch( i_query )
     {
         /* */
         case ACCESS_CAN_PAUSE:
-            pb_bool = (bool*)va_arg( args, bool* );
-            *pb_bool = true;
+            *va_arg( args, bool* ) = true;
             break;
 
        case ACCESS_CAN_SEEK:
        case ACCESS_CAN_FASTSEEK:
        case ACCESS_CAN_CONTROL_PACE:
-            pb_bool = (bool*)va_arg( args, bool* );
-            *pb_bool = false;
+            *va_arg( args, bool* ) = false;
             break;
 
         case ACCESS_GET_PTS_DELAY:
-            pi_64 = (int64_t*)va_arg( args, int64_t * );
-            *pi_64 = (int64_t)var_GetInteger( p_access, "dv-caching" ) * 1000;
+            *va_arg( args, int64_t * )
+                   = (int64_t)var_GetInteger( p_access, "dv-caching" ) * 1000;
             break;
 
         /* */
         case ACCESS_SET_PAUSE_STATE:
-            AVCPause( p_access, p_sys->i_node );
+            AVCPause( p_access, p_access->p_sys->i_node );
             break;
 
         case ACCESS_GET_TITLE_INFO:
@@ -642,10 +636,8 @@ static int AVCPlay( access_t *p_access, int phyID )
     access_sys_t *p_sys = p_access->p_sys;
 
     msg_Dbg( p_access, "send play command over Digital Video control channel" );
-    if( !p_sys->p_avc1394 )
-        return 0;
 
-    if( phyID >= 0 )
+    if( p_sys->p_avc1394 && phyID >= 0 )
     {
         if( !avc1394_vcr_is_recording( p_sys->p_avc1394, phyID ) &&
             avc1394_vcr_is_playing( p_sys->p_avc1394, phyID ) != AVC1394_VCR_OPERAND_PLAY_FORWARD )
@@ -658,10 +650,7 @@ static int AVCPause( access_t *p_access, int phyID )
 {
     access_sys_t *p_sys = p_access->p_sys;
 
-    if( !p_sys->p_avc1394 )
-        return 0;
-
-    if( phyID >= 0 )
+    if( p_sys->p_avc1394 && phyID >= 0 )
     {
         if( !avc1394_vcr_is_recording( p_sys->p_avc1394, phyID ) &&
             ( avc1394_vcr_is_playing( p_sys->p_avc1394, phyID ) != AVC1394_VCR_OPERAND_PLAY_FORWARD_PAUSE ) )
@@ -676,10 +665,8 @@ static int AVCStop( access_t *p_access, int phyID )
     access_sys_t *p_sys = p_access->p_sys;
 
     msg_Dbg( p_access, "closing Digital Video control channel" );
-    if( !p_sys->p_avc1394 )
-        return 0;
 
-    if ( phyID >= 0 )
+    if ( p_sys->p_avc1394 && phyID >= 0 )
         avc1394_vcr_stop( p_sys->p_avc1394, phyID );
 
     return 0;




More information about the vlc-devel mailing list