Commit 87d40a6e authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

modules/access/http.c:

modules/access/ftp.c:
* fixed a very serious bug in the atoll code. this contained a never ending while loop.
  It showed on systems without atoll() (MacOSX) as an inability to view http
  and ftp streams.
parent d1196f96
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ftp.c: * ftp.c:
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: ftp.c,v 1.14 2003/03/30 18:14:35 gbazin Exp $ * $Id: ftp.c,v 1.15 2003/04/30 04:13:12 hartman Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -340,15 +340,20 @@ static int Open( vlc_object_t *p_this ) ...@@ -340,15 +340,20 @@ static int Open( vlc_object_t *p_this )
{ {
int64_t i_size = 0; int64_t i_size = 0;
char *psz_parser = psz_arg + 4; 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' )
{ {
i_size *= 10; if( *psz_parser >= '0' && *psz_parser <= '9' )
i_size += psz_parser[0] - '0'; i_size = i_size *10 + *psz_parser++ - '0';
else
psz_parser++;
} }
p_access->i_filesize = i_size; p_access->i_filesize = i_size * sign;
} }
#endif #endif
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* http.c: HTTP access plug-in * http.c: HTTP access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: http.c,v 1.32 2003/03/30 18:14:35 gbazin Exp $ * $Id: http.c,v 1.33 2003/04/30 04:13:12 hartman Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -306,13 +306,22 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) ...@@ -306,13 +306,22 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
#ifdef HAVE_ATOLL #ifdef HAVE_ATOLL
i_size = i_tell + atoll( psz_value ); i_size = i_tell + atoll( psz_value );
#else #else
int sign = 1;
psz_parser = psz_value; psz_parser = psz_value;
while( psz_parser[0] >= '0' && psz_parser[0] <= '9' )
while( *psz_value == ' ' || *psz_value == '\t' )
psz_value++;
if( *psz_value == '-' )
sign = -1;
while( *psz_value != '\0')
{ {
i_size *= 10; if( *psz_value >= '0' && *psz_value <= '9' )
i_size += psz_parser[0] - '0'; i_size = i_size * 10 + *psz_value++ - '0';
else
psz_value++;
} }
i_size += i_tell; i_size = i_tell + ( i_size * sign );
#endif #endif
msg_Dbg( p_input, "stream size is "I64Fd, i_size ); msg_Dbg( p_input, "stream size is "I64Fd, i_size );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment