]> git.sesse.net Git - vlc/blobdiff - modules/access/ftp.c
New spanish translation, by Antonio Javier Varela.
[vlc] / modules / access / ftp.c
index 6120fe95f2ceb0e30defc12d51488ccfc7ae85a4..ec99402eafd8a16f2fc04d1a79b4e222c8e388d8 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * ftp.c:
  *****************************************************************************
- * Copyright (C) 2001, 2002 VideoLAN
- * $Id: ftp.c,v 1.14 2003/03/30 18:14:35 gbazin Exp $
+ * Copyright (C) 2001-2003 VideoLAN
+ * $Id: ftp.c,v 1.21 2003/09/10 21:09:05 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -28,7 +28,6 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
-#include <string.h>
 #include <errno.h>
 #include <fcntl.h>
 
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Open        ( vlc_object_t * );
-static void Close       ( vlc_object_t * );
+static int     Open     ( vlc_object_t * );
+static void    Close    ( vlc_object_t * );
 
-static int  Read        ( input_thread_t * p_input, byte_t * p_buffer,
+static ssize_t Read     ( input_thread_t * p_input, byte_t * p_buffer,
                           size_t i_len );
-static void Seek        ( input_thread_t *, off_t );
+static void    Seek     ( input_thread_t *, off_t );
 
 
 static ssize_t NetRead ( input_thread_t *, input_socket_t *, byte_t *, size_t );
@@ -83,7 +82,7 @@ static int  ftp_StopStream ( input_thread_t *);
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-#define CACHING_TEXT N_("caching value in ms")
+#define CACHING_TEXT N_("Caching value in ms")
 #define CACHING_LONGTEXT N_( \
     "Allows you to modify the default caching value for ftp streams. This " \
     "value should be set in miliseconds units." )
@@ -200,6 +199,7 @@ static int Open( vlc_object_t *p_this )
     socket_desc.i_server_port   = p_url->i_server_port;
     socket_desc.psz_bind_addr   = "";
     socket_desc.i_bind_port     = 0;
+    socket_desc.i_ttl           = 0;
     p_input->p_private = (void*)&socket_desc;
     if( !( p_network = module_Need( p_input, "network", psz_network ) ) )
     {
@@ -334,23 +334,7 @@ static int Open( vlc_object_t *p_this )
         goto exit_error;
     }
 
-#ifdef HAVE_ATOLL
     p_access->i_filesize = atoll( psz_arg + 4 );
-#else
-    {
-        int64_t i_size = 0;
-        char    *psz_parser = psz_arg + 4;
-
-        while( *psz_parser == ' ' ) psz_parser++;
-
-        while( psz_parser[0] >= '0' && psz_parser[0] <= '9' )
-        {
-            i_size *= 10;
-            i_size += psz_parser[0] - '0';
-        }
-        p_access->i_filesize = i_size;
-    }
-#endif
 
     msg_Dbg( p_input, "file size: "I64Fd, p_access->i_filesize );
     FREE( psz_arg );
@@ -437,7 +421,7 @@ static void Seek( input_thread_t * p_input, off_t i_pos )
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 }
 
-static int  Read        ( input_thread_t * p_input, byte_t * p_buffer,
+static ssize_t Read     ( input_thread_t * p_input, byte_t * p_buffer,
                           size_t i_len )
 {
     access_t    *p_access = (access_t*)p_input->p_access_data;
@@ -453,13 +437,13 @@ static int  ftp_SendCommand( input_thread_t *p_input, char *psz_fmt, ... )
     access_t        *p_access = (access_t*)p_input->p_access_data;
     va_list args;
     char    *psz_buffer;
-#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN)
+#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
         size_t  i_size;
 #endif
 
     va_start( args, psz_fmt );
 
-#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN)
+#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN) && !defined(SYS_BEOS)
     vasprintf( &psz_buffer, psz_fmt, args );
 #else
     i_size = strlen( psz_fmt ) + 2048;
@@ -643,6 +627,7 @@ static int  ftp_StartStream( input_thread_t *p_input, off_t i_start )
     socket_desc.i_server_port   = i_port;
     socket_desc.psz_bind_addr   = "";
     socket_desc.i_bind_port     = 0;
+    socket_desc.i_ttl           = 0;
     p_input->p_private = (void*)&socket_desc;
     if( !( p_network = module_Need( p_input, "network", "" ) ) )
     {