]> git.sesse.net Git - vlc/commitdiff
Minor bugfix and cleanup
authorRémi Denis-Courmont <rem@videolan.org>
Tue, 2 Aug 2005 17:31:33 +0000 (17:31 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Tue, 2 Aug 2005 17:31:33 +0000 (17:31 +0000)
modules/access/tcp.c

index 30699a8f0b50a1f70684659fd75a88b456bc6a5a..af93a152ff59b860f08123c051f21a34028783f8 100644 (file)
@@ -80,32 +80,22 @@ static int Open( vlc_object_t *p_this )
     char         *psz_parser = psz_dup;
 
     /* Parse server:port */
-    while( *psz_parser && *psz_parser != ':' )
+    if( *psz_parser == '[' )
     {
-        if( *psz_parser == '[' )
-        {
-            /* IPV6 */
-            while( *psz_parser && *psz_parser  != ']' )
-            {
-                psz_parser++;
-            }
-        }
-        psz_parser++;
+        psz_parser = strchr( psz_parser, ']' );
+        if( psz_parser == NULL )
+            psz_parser = psz_dup;
     }
-    if( *psz_parser != ':' || psz_parser == psz_dup )
+    psz_parser = strchr( psz_parser, ':' );
+    
+    if( psz_parser == NULL )
     {
-        msg_Err( p_access, "you have to provide server:port addresse" );
+        msg_Err( p_access, "missing port number : %s", psz_dup );
         free( psz_dup );
         return VLC_EGENERIC;
     }
-    *psz_parser++ = '\0';
 
-    if( atoi( psz_parser ) <= 0 )
-    {
-        msg_Err( p_access, "invalid port number (%d)", atoi( psz_parser ) );
-        free( psz_dup );
-        return VLC_EGENERIC;
-    }
+    *psz_parser++ = '\0';
 
     /* Init p_access */
     p_access->pf_read = Read;