]> git.sesse.net Git - vlc/commitdiff
* modules/access/ftp.c, modules/access/http.c: slightly changed atoll() replacement.
authorGildas Bazin <gbazin@videolan.org>
Wed, 30 Apr 2003 09:11:13 +0000 (09:11 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 30 Apr 2003 09:11:13 +0000 (09:11 +0000)
modules/access/ftp.c
modules/access/http.c

index f4f04954f75bdf0056e19b83b901cd42978454e6..c49618ce0c3a01832809f5abdf7473784e5ef8e5 100644 (file)
@@ -2,7 +2,7 @@
  * ftp.c:
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: ftp.c,v 1.15 2003/04/30 04:13:12 hartman Exp $
+ * $Id: ftp.c,v 1.16 2003/04/30 09:11:13 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -340,18 +340,14 @@ static int Open( vlc_object_t *p_this )
     {
         int64_t i_size = 0;
         char    *psz_parser = psz_arg + 4;
-       int     sign = 1;
+        int     sign = 1;
 
         while( *psz_parser == ' ' || *psz_parser == '\t' ) psz_parser++;
 
-        if( *psz_parser == '-' )
-            sign = -1;
-        while( *psz_parser != '\0' )
+        if( *psz_parser == '-' ) sign = -1;
+        while( *psz_parser >= '0' && *psz_parser <= '9' )
         {
-            if( *psz_parser >= '0' && *psz_parser <= '9' )
-                i_size = i_size *10 + *psz_parser++ - '0';
-            else
-                psz_parser++;
+            i_size = i_size * 10 + *psz_parser++ - '0';
         }
         p_access->i_filesize = i_size * sign;
     }
index 5871e28b178d2f1264c5d7b46e19e0e98dfdccc1..f66b3792b6bdcc5f9a75913752601d3f3c1e68e2 100644 (file)
@@ -2,7 +2,7 @@
  * http.c: HTTP access plug-in
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: http.c,v 1.33 2003/04/30 04:13:12 hartman Exp $
+ * $Id: http.c,v 1.34 2003/04/30 09:11:13 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -307,19 +307,11 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
             i_size = i_tell + atoll( psz_value );
 #else
             int sign = 1;
-            psz_parser = psz_value;
-            
-            while( *psz_value == ' ' || *psz_value == '\t' )
-                psz_value++;
-
-            if( *psz_value == '-' )
-                sign = -1;
-            while( *psz_value != '\0')
+
+            if( *psz_value == '-' ) sign = -1;
+            while( *psz_value >= '0' && *psz_value <= '9' )
             {
-                if( *psz_value >= '0' && *psz_value <= '9' )
-                    i_size = i_size * 10 + *psz_value++ - '0';
-                else
-                    psz_value++;
+                i_size = i_size * 10 + *psz_value++ - '0';
             }
             i_size = i_tell + ( i_size * sign );
 #endif