/*****************************************************************************
* 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.20 2003/07/31 23:44:49 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
/*****************************************************************************
* 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 );
/*****************************************************************************
* 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." )
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 ) ) )
{
{
int64_t i_size = 0;
char *psz_parser = psz_arg + 4;
+ int sign = 1;
- while( *psz_parser == ' ' ) psz_parser++;
+ while( *psz_parser == ' ' || *psz_parser == '\t' ) psz_parser++;
- while( psz_parser[0] >= '0' && psz_parser[0] <= '9' )
+ if( *psz_parser == '-' ) sign = -1;
+ while( *psz_parser >= '0' && *psz_parser <= '9' )
{
- i_size *= 10;
- i_size += psz_parser[0] - '0';
+ i_size = i_size * 10 + *psz_parser++ - '0';
}
- p_access->i_filesize = i_size;
+ p_access->i_filesize = i_size * sign;
}
#endif
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;
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;
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", "" ) ) )
{