[vlc-commits] access: access_t.psz_access is always

Rémi Denis-Courmont git at videolan.org
Wed Apr 27 21:07:02 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 27 22:06:13 2016 +0300| [2a35a5bd8ef0a9cd45bc43eab33d8831848aaf45] | committer: Rémi Denis-Courmont

access: access_t.psz_access is always

It cannot be NULL or empty (the default is typically "file").

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

 include/vlc_access.h         |    2 +-
 modules/access/cdda.c        |    4 ----
 modules/access/dvb/access.c  |    4 ----
 modules/access/mms/mms.c     |   21 ++++++---------------
 modules/access/mms/mmstu.c   |   15 ++++++---------
 modules/access/rtsp/access.c |    5 ++---
 6 files changed, 15 insertions(+), 36 deletions(-)

diff --git a/include/vlc_access.h b/include/vlc_access.h
index 995c1c9..4578734 100644
--- a/include/vlc_access.h
+++ b/include/vlc_access.h
@@ -79,7 +79,7 @@ struct access_t
     module_t    *p_module;
 
 
-    char        *psz_access; /**< Access name (empty if non forced) */
+    char        *psz_access; /**< Access name */
     char        *psz_url; /**< Full URL or MRL */
     const char  *psz_location; /**< Location (URL with the scheme stripped) */
     char        *psz_filepath; /**< Local file path (if applicable) */
diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index 90b334a..a9eaae9 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -132,10 +132,6 @@ static int Open( vlc_object_t *p_this )
 
     if( !p_access->psz_filepath || !*p_access->psz_filepath )
     {
-        /* Only when selected */
-        if( !p_access->psz_access || !*p_access->psz_access )
-            return VLC_EGENERIC;
-
         psz_name = var_InheritString( p_this, "cd-audio" );
         if( !psz_name )
             return VLC_EGENERIC;
diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index ff143c5..4341c6c 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -117,10 +117,6 @@ static int Open( vlc_object_t *p_this )
     access_t     *p_access = (access_t*)p_this;
     access_sys_t *p_sys;
 
-    /* Only if selected */
-    if( *p_access->psz_access == '\0' )
-        return VLC_EGENERIC;
-
     p_access->p_sys = p_sys = calloc( 1, sizeof( access_sys_t ) );
     if( !p_sys )
         return VLC_ENOMEM;
diff --git a/modules/access/mms/mms.c b/modules/access/mms/mms.c
index 3584a05..a6a0179 100644
--- a/modules/access/mms/mms.c
+++ b/modules/access/mms/mms.c
@@ -100,21 +100,12 @@ static int Open( vlc_object_t *p_this )
     access_t *p_access = (access_t*)p_this;
 
     /* use specified method */
-    if( *p_access->psz_access )
-    {
-        if( !strncmp( p_access->psz_access, "mmsu", 4 ) )
-        {
-            return  MMSTUOpen ( p_access );
-        }
-        else if( !strncmp( p_access->psz_access, "mmst", 4 ) )
-        {
-            return  MMSTUOpen ( p_access );
-        }
-        else if( !strncmp( p_access->psz_access, "mmsh", 4 ) )
-        {
-            return  MMSHOpen ( p_access );
-        }
-    }
+    if( !strncmp( p_access->psz_access, "mmsu", 4 ) )
+        return  MMSTUOpen ( p_access );
+    else if( !strncmp( p_access->psz_access, "mmst", 4 ) )
+        return  MMSTUOpen ( p_access );
+    else if( !strncmp( p_access->psz_access, "mmsh", 4 ) )
+        return  MMSHOpen ( p_access );
 
     if( MMSTUOpen ( p_access ) )
     {   /* try mmsh if mmstu failed */
diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index 8f79fdb..f34b110 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -123,16 +123,13 @@ int  MMSTUOpen( access_t *p_access )
     /* *** connect to this server *** */
     /* look at  requested protocol (udp/tcp) */
     i_proto = MMS_PROTO_AUTO;
-    if( *p_access->psz_access )
+    if( !strncmp( p_access->psz_access, "mmsu", 4 ) )
     {
-        if( !strncmp( p_access->psz_access, "mmsu", 4 ) )
-        {
-            i_proto = MMS_PROTO_UDP;
-        }
-        else if( !strncmp( p_access->psz_access, "mmst", 4 ) )
-        {
-            i_proto = MMS_PROTO_TCP;
-        }
+        i_proto = MMS_PROTO_UDP;
+    }
+    else if( !strncmp( p_access->psz_access, "mmst", 4 ) )
+    {
+        i_proto = MMS_PROTO_TCP;
     }
 
     /* connect */
diff --git a/modules/access/rtsp/access.c b/modules/access/rtsp/access.c
index 8814fda..dd3409e 100644
--- a/modules/access/rtsp/access.c
+++ b/modules/access/rtsp/access.c
@@ -148,10 +148,9 @@ static int Open( vlc_object_t *p_this )
     char* psz_server = NULL;
     int i_result;
 
-    if( !p_access->psz_access || (
-        strncmp( p_access->psz_access, "rtsp", 4 ) &&
+    if( strncmp( p_access->psz_access, "rtsp", 4 ) &&
         strncmp( p_access->psz_access, "pnm", 3 )  &&
-        strncmp( p_access->psz_access, "realrtsp", 8 ) ))
+        strncmp( p_access->psz_access, "realrtsp", 8 ) )
     {
             return VLC_EGENERIC;
     }



More information about the vlc-commits mailing list