[vlc-devel] commit: Split the test for user/passwd and the test for the port number ( the two tests are independent). ( Rémi Duraffort )

git version control git at videolan.org
Mon Jun 22 11:30:04 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Jun 22 10:25:40 2009 +0200| [e3787b90a0cd4b12af67513230cd0f36fea3d372] | committer: JP Dinger 

Split the test for user/passwd and the test for the port number (the two tests are independent).

Signed-off-by: JP Dinger <jpd at videolan.org>

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

 modules/demux/live555.cpp |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index f271dd1..d97a194 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -459,23 +459,28 @@ static int Connect( demux_t *p_demux )
     int  i_http_port  = 0;
     int  i_ret        = VLC_SUCCESS;
 
-    if( p_sys->url.i_port == 0 ) p_sys->url.i_port = 554;
-    if( p_sys->url.psz_username || p_sys->url.psz_password )
+    /* Create the url using the port number if available */
+    if( p_sys->url.i_port == 0 )
+    {
+        p_sys->url.i_port = 554;
+        if( asprintf( &psz_url, "rtsp://%s", p_sys->psz_path ) == -1 )
+            return VLC_ENOMEM;
+    }
+    else
     {
-        int err;
-        err = asprintf( &psz_url, "rtsp://%s:%d%s", p_sys->url.psz_host,
-                        p_sys->url.i_port, p_sys->url.psz_path );
-        if( err == -1 ) return VLC_ENOMEM;
+        if( asprintf( &psz_url, "rtsp://%s:%d%s", p_sys->url.psz_host,
+                      p_sys->url.i_port, p_sys->url.psz_path ) == -1 )
+            return VLC_ENOMEM;
+    }
 
+    /* Get the user name and password */
+    if( p_sys->url.psz_username || p_sys->url.psz_password )
+    {
         psz_user = strdup( p_sys->url.psz_username ? p_sys->url.psz_username : "" );
         psz_pwd  = strdup( p_sys->url.psz_password ? p_sys->url.psz_password : "");
     }
     else
     {
-        int err;
-        err = asprintf( &psz_url, "rtsp://%s", p_sys->psz_path );
-        if( err == -1 ) return VLC_ENOMEM;
-
         psz_user = var_CreateGetString( p_demux, "rtsp-user" );
         psz_pwd  = var_CreateGetString( p_demux, "rtsp-pwd" );
     }




More information about the vlc-devel mailing list