X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Ftcp.c;h=e8690e6c1f685f54bb5ff82968a86768908a5eff;hb=dc723a84d4d51c3db68193966c46be82dd0f7e15;hp=2eff261f4f37f59037945041fab1b0d20dbcfbd8;hpb=a90a19a6b0468ea9fedadc27cfc1118d70295263;p=vlc diff --git a/modules/access/tcp.c b/modules/access/tcp.c index 2eff261f4f..e8690e6c1f 100644 --- a/modules/access/tcp.c +++ b/modules/access/tcp.c @@ -1,7 +1,7 @@ /***************************************************************************** * tcp.c: TCP input module ***************************************************************************** - * Copyright (C) 2003-2004 VideoLAN + * Copyright (C) 2003-2004 the VideoLAN team * $Id$ * * Authors: Laurent Aimar @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** @@ -36,14 +36,14 @@ *****************************************************************************/ #define CACHING_TEXT N_("Caching value in ms") #define CACHING_LONGTEXT N_( \ - "Allows you to modify the default caching value for TCP streams. This " \ - "value should be set in millisecond units." ) + "Caching value for TCP streams. This " \ + "value should be set in milliseconds." ) static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); vlc_module_begin(); - set_name( _("TCP") ); + set_shortname( _("TCP") ); set_description( _("TCP input") ); set_category( CAT_INPUT ); set_subcategory( SUBCAT_INPUT_ACCESS ); @@ -80,33 +80,23 @@ 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 ) - { - msg_Err( p_access, "you have to provide server:port addresse" ); - free( psz_dup ); - return VLC_EGENERIC; - } - *psz_parser++ = '\0'; + psz_parser = strchr( psz_parser, ':' ); - if( atoi( psz_parser ) <= 0 ) + if( psz_parser == NULL ) { - msg_Err( p_access, "invalid port number (%d)", atoi( psz_parser ) ); + msg_Err( p_access, "missing port number : %s", psz_dup ); free( psz_dup ); return VLC_EGENERIC; } + *psz_parser++ = '\0'; + /* Init p_access */ p_access->pf_read = Read; p_access->pf_block = NULL; @@ -120,7 +110,7 @@ static int Open( vlc_object_t *p_this ) p_access->info.i_seekpoint = 0; p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) ); - p_sys->fd = net_OpenTCP( p_access, psz_dup, atoi( psz_parser ) ); + p_sys->fd = net_ConnectTCP( p_access, psz_dup, atoi( psz_parser ) ); free( psz_dup ); if( p_sys->fd < 0 )