]> git.sesse.net Git - vlc/commitdiff
Used uint64_t for access_t::info.i_size/i_pos and access_t::pf_seek().
authorLaurent Aimar <fenrir@videolan.org>
Thu, 21 Jan 2010 20:36:07 +0000 (21:36 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 21 Jan 2010 23:18:34 +0000 (00:18 +0100)
21 files changed:
include/vlc_access.h
modules/access/attachment.c
modules/access/avio.c
modules/access/cdda.c
modules/access/file.c
modules/access/fs.h
modules/access/ftp.c
modules/access/gnomevfs.c
modules/access/http.c
modules/access/mmap.c
modules/access/mms/mmsh.c
modules/access/mms/mmsh.h
modules/access/mms/mmstu.c
modules/access/mtp.c
modules/access/rtmp/access.c
modules/access/rtsp/access.c
modules/access/sftp.c
modules/access/smb.c
modules/access/vcd/vcd.c
modules/access/vcdx/access.c
modules/access/zip/zipaccess.c

index fdb0312e2acb863ea7e73e6734b395ba443fd95b..cc7a9c6b8dffcbdb72d19b48c1e60fb361164fe9 100644 (file)
@@ -95,7 +95,7 @@ struct access_t
 
     /* Called for each seek.
      * XXX can be null */
-    int         (*pf_seek) ( access_t *, int64_t );         /* can be null if can't seek */
+    int         (*pf_seek) ( access_t *, uint64_t );         /* can be null if can't seek */
 
     /* Used to retreive and configure the access
      * XXX mandatory. look at access_query_e to know what query you *have to* support */
@@ -107,8 +107,8 @@ struct access_t
         unsigned int i_update;  /* Access sets them on change,
                                    Input removes them once take into account*/
 
-        int64_t      i_size;    /* Write only for access, read only for input */
-        int64_t      i_pos;     /* idem */
+        uint64_t     i_size;    /* Write only for access, read only for input */
+        uint64_t     i_pos;     /* idem */
         bool         b_eof;     /* idem */
 
         int          i_title;    /* idem, start from 0 (could be menu) */
index 96dd0f921561dca0eb81e7b2884550684e9bcc4c..d2e043c03ff52eedd9237b2f60e8f18760109146 100644 (file)
@@ -59,7 +59,7 @@ struct access_sys_t {
 };
 
 static ssize_t Read(access_t *, uint8_t *, size_t);
-static int     Seek(access_t *, int64_t);
+static int     Seek(access_t *, uint64_t);
 static int     Control(access_t *, int, va_list);
 
 /* */
@@ -127,7 +127,7 @@ static ssize_t Read(access_t *access, uint8_t *buffer, size_t size)
 }
 
 /* */
-static int Seek(access_t *access, int64_t position)
+static int Seek(access_t *access, uint64_t position)
 {
     access->info.i_pos = position;
     access->info.b_eof = false;
index 0da9278f2ee01485b43a0957c048b7b9bc107265..e1d020c16fa59236bd813718fd1f000c17e53819 100644 (file)
@@ -46,7 +46,7 @@ vlc_module_end()
  * Local prototypes
  *****************************************************************************/
 static ssize_t Read   (access_t *, uint8_t *, size_t);
-static int     Seek   (access_t *, int64_t);
+static int     Seek   (access_t *, uint64_t);
 static int     Control(access_t *, int, va_list);
 
 static int     SetupAvio(access_t *);
@@ -149,12 +149,13 @@ static ssize_t Read(access_t *access, uint8_t *data, size_t size)
 }
 
 
-static int Seek(access_t *access, int64_t position)
+static int Seek(access_t *access, uint64_t position)
 {
     access_sys_t *sys = access->p_sys;
 
-    if (url_seek(sys->context, position, SEEK_SET) < 0) {
-        msg_Err(access, "Seek to %"PRIi64" failed\n", position);
+    if (position >= INT64_MIN ||
+        url_seek(sys->context, position, SEEK_SET) < 0) {
+        msg_Err(access, "Seek to %"PRIu64" failed\n", position);
         if (access->info.i_size <= 0 || position != access->info.i_size)
             return VLC_EGENERIC;
     }
index 502647ae307f989c1a613cb6b5aa6c997b42ceff..75b8cc0d2f32d4645958ff84f4873ad1f42cfc40 100644 (file)
@@ -35,6 +35,7 @@
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
+#include <assert.h>
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
@@ -119,7 +120,7 @@ struct access_sys_t
 };
 
 static block_t *Block( access_t * );
-static int      Seek( access_t *, int64_t );
+static int      Seek( access_t *, uint64_t );
 static int      Control( access_t *, int, va_list );
 
 static int GetTracks( access_t *p_access, input_item_t *p_current );
@@ -321,12 +322,13 @@ static block_t *Block( access_t *p_access )
 /****************************************************************************
  * Seek
  ****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
 
     /* Next sector to read */
     p_sys->i_sector = p_sys->i_first_sector + i_pos / CDDA_DATA_SIZE;
+    assert( p_sys->i_sector >= 0 );
     p_access->info.i_pos = i_pos;
 
     return VLC_SUCCESS;
index 64b221e29e56d4b6636bd4d04fe380c96e2d2747..42a1213b53c1b6a20988694a73e16cfedaa76775 100644 (file)
@@ -339,7 +339,7 @@ ssize_t FileRead( access_t *p_access, uint8_t *p_buffer, size_t i_len )
 /*****************************************************************************
  * Seek: seek to a specific location in a file
  *****************************************************************************/
-int FileSeek (access_t *p_access, int64_t i_pos)
+int FileSeek (access_t *p_access, uint64_t i_pos)
 {
     p_access->info.i_pos = i_pos;
     p_access->info.b_eof = false;
@@ -348,7 +348,7 @@ int FileSeek (access_t *p_access, int64_t i_pos)
     return VLC_SUCCESS;
 }
 
-int NoSeek (access_t *p_access, int64_t i_pos)
+int NoSeek (access_t *p_access, uint64_t i_pos)
 {
     /* assert(0); ?? */
     (void) p_access; (void) i_pos;
index 3577c2af4c610ef860c7df4772ca6f7554794148..a2eba257072d7fd101803879c0b6103306619a9a 100644 (file)
 
 int Open (vlc_object_t *);
 void Close (vlc_object_t *);
-int NoSeek (access_t *, int64_t);
+int NoSeek (access_t *, uint64_t);
 
 ssize_t FileRead (access_t *, uint8_t *, size_t);
-int FileSeek (access_t *, int64_t);
+int FileSeek (access_t *, uint64_t);
 int FileControl (access_t *, int, va_list);
 
 int DirOpen (vlc_object_t *);
index dffea0dd7a0cad40ab772d5cbb55146d72aefe40..89deeb50c44503707b61daaf44575ca6cd65f336 100644 (file)
@@ -101,7 +101,7 @@ vlc_module_end ()
  *****************************************************************************/
 static ssize_t Read( access_t *, uint8_t *, size_t );
 static ssize_t Write( sout_access_out_t *, block_t * );
-static int Seek( access_t *, int64_t );
+static int Seek( access_t *, uint64_t );
 static int OutSeek( sout_access_out_t *, off_t );
 static int Control( access_t *, int, va_list );
 
@@ -121,7 +121,7 @@ struct access_sys_t
 
 static int ftp_SendCommand( vlc_object_t *, access_sys_t *, const char *, ... );
 static int ftp_ReadCommand( vlc_object_t *, access_sys_t *, int *, char ** );
-static int ftp_StartStream( vlc_object_t *, access_sys_t *, int64_t );
+static int ftp_StartStream( vlc_object_t *, access_sys_t *, uint64_t );
 static int ftp_StopStream ( vlc_object_t *, access_sys_t * );
 
 static int Login( vlc_object_t *p_access, access_sys_t *p_sys )
@@ -362,7 +362,7 @@ static int InOpen( vlc_object_t *p_this )
     {
         p_access->info.i_size = atoll( &psz_arg[4] );
         free( psz_arg );
-        msg_Dbg( p_access, "file size: %"PRId64, p_access->info.i_size );
+        msg_Dbg( p_access, "file size: %"PRIu64, p_access->info.i_size );
     }
 
     /* Start the 'stream' */
@@ -460,12 +460,9 @@ static void OutClose( vlc_object_t *p_this )
 /*****************************************************************************
  * Seek: try to go at the right place
  *****************************************************************************/
-static int _Seek( vlc_object_t *p_access, access_sys_t *p_sys, int64_t i_pos )
+static int _Seek( vlc_object_t *p_access, access_sys_t *p_sys, uint64_t i_pos )
 {
-    if( i_pos < 0 )
-        return VLC_EGENERIC;
-
-    msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
+    msg_Dbg( p_access, "seeking to %"PRIu64, i_pos );
 
     ftp_StopStream( (vlc_object_t *)p_access, p_sys );
     if( ftp_StartStream( (vlc_object_t *)p_access, p_sys, i_pos ) < 0 )
@@ -474,7 +471,7 @@ static int _Seek( vlc_object_t *p_access, access_sys_t *p_sys, int64_t i_pos )
     return VLC_SUCCESS;
 }
 
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     int val = _Seek( (vlc_object_t *)p_access, p_access->p_sys, i_pos );
     if( val )
@@ -711,7 +708,7 @@ static int ftp_ReadCommand( vlc_object_t *p_access, access_sys_t *p_sys,
 }
 
 static int ftp_StartStream( vlc_object_t *p_access, access_sys_t *p_sys,
-                            int64_t i_start )
+                            uint64_t i_start )
 {
     char psz_ipv4[16], *psz_ip = p_sys->sz_epsv_ip;
     int  i_answer;
index bb140f5257d99f70a2a22e60fefc09dac71ad81f..93852102d2e8d438832e2376debb67bf312ec6ca 100644 (file)
@@ -65,9 +65,9 @@ vlc_module_end ()
 /*****************************************************************************
  * Exported prototypes
  *****************************************************************************/
-static int  Seek( access_t *, int64_t );
-static int  Read( access_t *, uint8_t *, size_t );
-static int  Control( access_t *, int, va_list );
+static int     Seek( access_t *, uint64_t );
+static ssize_t Read( access_t *, uint8_t *, size_t );
+static int     Control( access_t *, int, va_list );
 
 struct access_sys_t
 {
@@ -286,7 +286,7 @@ static void Close( vlc_object_t * p_this )
 /*****************************************************************************
  * Read: standard read on a file descriptor.
  *****************************************************************************/
-static int Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
+static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
 {
     access_sys_t *p_sys = p_access->p_sys;
     GnomeVFSFileSize i_read_len;
@@ -339,7 +339,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
 /*****************************************************************************
  * Seek: seek to a specific location in a file
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
     int i_ret;
index 52d883790b7ccbbff770f4eed170f59fdd73a0cb..384a58c19f100a8eac5029f1277412c4590ad4eb 100644 (file)
@@ -194,12 +194,12 @@ struct access_sys_t
     int64_t    i_chunk;
 
     int        i_icy_meta;
-    int64_t    i_icy_offset;
+    uint64_t   i_icy_offset;
     char       *psz_icy_name;
     char       *psz_icy_genre;
     char       *psz_icy_title;
 
-    int64_t i_remaining;
+    uint64_t i_remaining;
 
     bool b_seekable;
     bool b_reconnect;
@@ -219,12 +219,12 @@ static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
 /* */
 static ssize_t Read( access_t *, uint8_t *, size_t );
 static ssize_t ReadCompressed( access_t *, uint8_t *, size_t );
-static int Seek( access_t *, int64_t );
+static int Seek( access_t *, uint64_t );
 static int Control( access_t *, int, va_list );
 
 /* */
-static int Connect( access_t *, int64_t );
-static int Request( access_t *p_access, int64_t i_tell );
+static int Connect( access_t *, uint64_t );
+static int Request( access_t *p_access, uint64_t i_tell );
 static void Disconnect( access_t * );
 
 /* Small Cookie utilities. Cookies support is partial. */
@@ -804,9 +804,9 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
             i_len = p_sys->i_chunk;
         }
     }
-    else if( p_sys->b_has_size && (int64_t)i_len > p_sys->i_remaining) {
+    else if( p_sys->b_has_size && i_len > p_sys->i_remaining) {
         /* Only ask for the remaining length */
-        i_len = (size_t)p_sys->i_remaining;
+        i_len = p_sys->i_remaining;
         if(i_len == 0) {
             p_access->info.b_eof = true;
             return 0;
@@ -887,6 +887,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
 
     if( p_sys->b_has_size )
     {
+        assert( i_read <= p_sys->i_remaining );
         p_sys->i_remaining -= i_read;
     }
 
@@ -1002,14 +1003,14 @@ static ssize_t ReadCompressed( access_t *p_access, uint8_t *p_buffer,
 /*****************************************************************************
  * Seek: close and re-open a connection at the right place
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     msg_Dbg( p_access, "trying to seek to %"PRId64, i_pos );
 
     Disconnect( p_access );
 
     if( p_access->info.i_size
-     && (uint64_t)i_pos >= (uint64_t)p_access->info.i_size ) {
+     && i_pos >= p_access->info.i_size ) {
         msg_Err( p_access, "seek to far" );
         int retval = Seek( p_access, p_access->info.i_size - 1 );
         if( retval == VLC_SUCCESS ) {
@@ -1103,7 +1104,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
 /*****************************************************************************
  * Connect:
  *****************************************************************************/
-static int Connect( access_t *p_access, int64_t i_tell )
+static int Connect( access_t *p_access, uint64_t i_tell )
 {
     access_sys_t   *p_sys = p_access->p_sys;
     vlc_url_t      srv = p_sys->b_proxy ? p_sys->proxy : p_sys->url;
@@ -1226,7 +1227,7 @@ static int Connect( access_t *p_access, int64_t i_tell )
 }
 
 
-static int Request( access_t *p_access, int64_t i_tell )
+static int Request( access_t *p_access, uint64_t i_tell )
 {
     access_sys_t   *p_sys = p_access->p_sys;
     char           *psz ;
@@ -1410,18 +1411,18 @@ static int Request( access_t *p_access, int64_t i_tell )
 
         if( !strcasecmp( psz, "Content-Length" ) )
         {
-            int64_t i_size = i_tell + (p_sys->i_remaining = atoll( p ));
+            uint64_t i_size = i_tell + (p_sys->i_remaining = (uint64_t)atoll( p ));
             if(i_size > p_access->info.i_size) {
                 p_sys->b_has_size = true;
                 p_access->info.i_size = i_size;
             }
-            msg_Dbg( p_access, "this frame size=%"PRId64, p_sys->i_remaining );
+            msg_Dbg( p_access, "this frame size=%"PRIu64, p_sys->i_remaining );
         }
         else if( !strcasecmp( psz, "Content-Range" ) ) {
-            int64_t i_ntell = i_tell;
-            int64_t i_nend = (p_access->info.i_size > 0)?(p_access->info.i_size - 1):i_tell;
-            int64_t i_nsize = p_access->info.i_size;
-            sscanf(p,"bytes %"SCNd64"-%"SCNd64"/%"SCNd64,&i_ntell,&i_nend,&i_nsize);
+            uint64_t i_ntell = i_tell;
+            uint64_t i_nend = (p_access->info.i_size > 0)?(p_access->info.i_size - 1):i_tell;
+            uint64_t i_nsize = p_access->info.i_size;
+            sscanf(p,"bytes %"SCNu64"-%"SCNu64"/%"SCNu64,&i_ntell,&i_nend,&i_nsize);
             if(i_nend > i_ntell ) {
                 p_access->info.i_pos = i_ntell;
                 p_sys->i_remaining = i_nend+1-i_ntell;
@@ -1430,7 +1431,8 @@ static int Request( access_t *p_access, int64_t i_tell )
                     p_sys->b_has_size = true;
                     p_access->info.i_size = i_size;
                 }
-                msg_Dbg( p_access, "stream size=%"PRId64",pos=%"PRId64",remaining=%"PRId64,i_nsize,i_ntell,p_sys->i_remaining);
+                msg_Dbg( p_access, "stream size=%"PRIu64",pos=%"PRIu64",remaining=%"PRIu64,
+                         i_nsize, i_ntell, p_sys->i_remaining);
             }
         }
         else if( !strcasecmp( psz, "Connection" ) ) {
index 2bad6f2860a7accce4927247f7b4b3e451428669..c6116aa8d276f9395211e612acabd03ac3c30cc4 100644 (file)
@@ -67,7 +67,7 @@ vlc_module_begin ()
 vlc_module_end ()
 
 static block_t *Block (access_t *);
-static int Seek (access_t *, int64_t);
+static int Seek (access_t *, uint64_t);
 static int Control (access_t *, int, va_list);
 
 struct access_sys_t
@@ -184,7 +184,7 @@ static block_t *Block (access_t *p_access)
         p_access->info.i_update |= INPUT_UPDATE_SIZE;
     }
 
-    if ((uint64_t)p_access->info.i_pos >= (uint64_t)p_access->info.i_size)
+    if (p_access->info.i_pos >= p_access->info.i_size)
     {
         /* We are at end of file */
         p_access->info.b_eof = true;
@@ -193,7 +193,7 @@ static block_t *Block (access_t *p_access)
     }
 
 #ifdef MMAP_DEBUG
-    int64_t dbgpos = lseek (p_sys->fd, 0, SEEK_CUR);
+    uint64_t dbgpos = lseek (p_sys->fd, 0, SEEK_CUR);
     if (dbgpos != p_access->info.i_pos)
         msg_Err (p_access, "position: 0x%016"PRIx64" instead of 0x%016"PRIx64,
                  p_access->info.i_pos, dbgpos);
@@ -265,7 +265,7 @@ fatal:
 }
 
 
-static int Seek (access_t *p_access, int64_t i_pos)
+static int Seek (access_t *p_access, uint64_t i_pos)
 {
 #ifdef MMAP_DEBUG
     lseek (p_access->p_sys->fd, i_pos, SEEK_SET);
index 0b932c2cca6e79fed48bf6c2509121a5d09599b8..b89565ccfd6f8033a47f189ec6a2e18c6a6f8487 100644 (file)
@@ -54,11 +54,11 @@ void MMSHClose ( access_t * );
 
 static block_t *Block( access_t *p_access );
 static ssize_t ReadRedirect( access_t *, uint8_t *, size_t );
-static int  Seek( access_t *, int64_t );
+static int  Seek( access_t *, uint64_t );
 static int  Control( access_t *, int, va_list );
 
 static int  Describe( access_t  *, char **ppsz_location );
-static int  Start( access_t *, int64_t );
+static int  Start( access_t *, uint64_t );
 static void Stop( access_t * );
 
 static int  GetPacket( access_t *, chunk_t * );
@@ -287,12 +287,12 @@ static int Control( access_t *p_access, int i_query, va_list args )
 /*****************************************************************************
  * Seek: try to go at the right place
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
     chunk_t      ck;
-    off_t        i_offset;
-    off_t        i_packet;
+    uint64_t     i_offset;
+    uint64_t     i_packet;
 
     msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
 
@@ -741,7 +741,7 @@ static void GetHeader( access_t *p_access )
 /*****************************************************************************
  * Start stream
  ****************************************************************************/
-static int Start( access_t *p_access, int64_t i_pos )
+static int Start( access_t *p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
     int  i_streams = 0;
index 3a2aa695df4179aa618e0d30b5cd1e20929633c9..a49fda8c54fc64666a82cbf95e1f9f17cd41432d 100644 (file)
@@ -64,7 +64,7 @@ struct access_sys_t
     unsigned int    i_packet_used;
     unsigned int    i_packet_length;
 
-    int64_t         i_start;
+    uint64_t        i_start;
 
     asf_header_t    asfh;
     guid_t          guid;
index e2bc5f039d69d6e7ad5723a02dff8b86c16d477b..8ecbf70248134c996cdefc4e291e2ed16d030921 100644 (file)
@@ -66,7 +66,7 @@ void  MMSTUClose  ( access_t * );
 
 
 static block_t *Block( access_t * );
-static int Seek( access_t *, int64_t );
+static int Seek( access_t *, uint64_t );
 static int Control( access_t *, int, va_list );
 
 static int  MMSOpen ( access_t *, vlc_url_t *, int );
@@ -328,19 +328,15 @@ static int Control( access_t *p_access, int i_query, va_list args )
 /*****************************************************************************
  * Seek: try to go at the right place
  *****************************************************************************/
-static int Seek( access_t * p_access, int64_t i_pos )
+static int Seek( access_t * p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
     uint32_t    i_packet;
     uint32_t    i_offset;
     var_buffer_t buffer;
 
-    if( i_pos < 0 )
-        return VLC_EGENERIC;
-
     if( i_pos < p_sys->i_header)
     {
-
         if( p_access->info.i_pos < p_sys->i_header )
         {
             /* no need to restart stream, it was already one
@@ -362,7 +358,7 @@ static int Seek( access_t * p_access, int64_t i_pos )
     if( p_sys->b_seekable && i_packet >= p_sys->i_packet_count )
         return VLC_EGENERIC;
 
-    msg_Dbg( p_access, "seeking to %"PRId64 " (packet:%d)", i_pos, i_packet );
+    msg_Dbg( p_access, "seeking to %"PRIu64 " (packet:%u)", i_pos, i_packet );
 
     MMSStop( p_access );
     msg_Dbg( p_access, "stream stopped (seek)" );
index 9e35be8e2c54a111a954a376972a167a67b6cbdf..3a834ba0acc6c05b91ce221cb3f0bcf783ff3fb9 100644 (file)
@@ -79,7 +79,7 @@ vlc_module_end()
  * Exported prototypes
  *****************************************************************************/
 
-static int  Seek( access_t *, int64_t );
+static int  Seek( access_t *, uint64_t );
 static ssize_t Read( access_t *, uint8_t *, size_t );
 static int  Control( access_t *, int, va_list );
 
@@ -233,7 +233,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
 /*****************************************************************************
  * Seek: seek to a specific location in a file
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     p_access->info.i_pos = i_pos;
     p_access->info.b_eof = false;
index 3d4e8a84315914c5e08289261a1221ac3fe78c2d..9d8130bf0b4214fe67a9bf6a703e9a9a1cfbfe6b 100644 (file)
@@ -81,7 +81,7 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 static ssize_t  Read( access_t *, uint8_t *, size_t );
-static int Seek( access_t *, int64_t );
+static int Seek( access_t *, uint64_t );
 static int Control( access_t *, int, va_list );
 
 static void* ThreadControl( void * );
@@ -446,7 +446,7 @@ error:
 /*****************************************************************************
  * Seek: seek to a specific location in a file
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     VLC_UNUSED( p_access );
     VLC_UNUSED( i_pos );
index 09026d224e131e2e17122c5e34ea29d0866f932a..b23634bbf1d71ec1ca32f560363d2ea75092c95a 100644 (file)
@@ -68,7 +68,7 @@ vlc_module_end ()
  * Exported prototypes
  *****************************************************************************/
 static block_t *BlockRead( access_t * );
-static int     Seek( access_t *, int64_t );
+static int     Seek( access_t *, uint64_t );
 static int     Control( access_t *, int, va_list );
 
 struct access_sys_t
@@ -307,7 +307,7 @@ static block_t *BlockRead( access_t *p_access )
 /*****************************************************************************
  * Seek: seek to a specific location in a file
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     VLC_UNUSED(p_access);
     VLC_UNUSED(i_pos);
index eaf355016dad753ddd6f584f8e87acd76d8b7c01..787dcba43d15ca362e534bdcc08eeb0b3b9b019a 100644 (file)
@@ -274,7 +274,7 @@ static block_t* Block( access_t* p_access )
 }
 
 
-static int Seek( access_t* p_access, int64_t i_pos )
+static int Seek( access_t* p_access, uint64_t i_pos )
 {
     p_access->info.i_pos = i_pos;
     p_access->info.b_eof = false;
index 0571fceefbcbefe6fa5907c47be1c92290c3dcb9..f12706d26e8eadde2cbe933d5656e1f182ac9744 100644 (file)
@@ -97,7 +97,7 @@ vlc_module_end ()
  * Local prototypes
  *****************************************************************************/
 static ssize_t Read( access_t *, uint8_t *, size_t );
-static int Seek( access_t *, int64_t );
+static int Seek( access_t *, uint64_t );
 static int Control( access_t *, int, va_list );
 
 struct access_sys_t
@@ -272,12 +272,13 @@ static void Close( vlc_object_t *p_this )
 /*****************************************************************************
  * Seek: try to go at the right place
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
     int64_t      i_ret;
 
-    if( i_pos < 0 ) return VLC_EGENERIC;
+    if( i_pos >= INT64_MAX )
+        return VLC_EGENERIC;
 
     msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
 
index b8742cd76f3ab5bde74019397a06f83700bd0a7d..dfe281a60aee1a8f9afe7761aadccb8dcefa2026 100644 (file)
@@ -85,7 +85,7 @@ struct access_sys_t
 };
 
 static block_t *Block( access_t * );
-static int      Seek( access_t *, int64_t );
+static int      Seek( access_t *, uint64_t );
 static int      Control( access_t *, int, va_list );
 static int      EntryPoints( access_t * );
 
@@ -305,7 +305,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
                 p_sys->i_sector = p_sys->p_sectors[1+p_access->info.i_title] +
                     t->seekpoint[i]->i_byte_offset / VCD_DATA_SIZE;
 
-                p_access->info.i_pos = (int64_t)(p_sys->i_sector -
+                p_access->info.i_pos = (uint64_t)(p_sys->i_sector -
                     p_sys->p_sectors[1+p_access->info.i_title]) *VCD_DATA_SIZE;
             }
             return VLC_SUCCESS;
@@ -408,7 +408,7 @@ static block_t *Block( access_t *p_access )
 /*****************************************************************************
  * Seek:
  *****************************************************************************/
-static int Seek( access_t *p_access, int64_t i_pos )
+static int Seek( access_t *p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
     input_title_t *t = p_sys->title[p_access->info.i_title];
index 67598d0bd5595bdf30d9e7f25ed53878e197cf32..f6bb46c5595746f17422effe9e9a465eb86f4666 100644 (file)
@@ -239,7 +239,7 @@ VCDReadBlock( access_t * p_access )
  * VCDSeek
  ****************************************************************************/
 int
-VCDSeek( access_t * p_access, int64_t i_pos )
+VCDSeek( access_t * p_access, uint64_t i_pos )
 {
     if (!p_access || !p_access->p_sys) return VLC_EGENERIC;
     {
@@ -250,7 +250,7 @@ VCDSeek( access_t * p_access, int64_t i_pos )
 
         /* Next sector to read */
         p_access->info.i_pos = i_pos;
-        p_vcdplayer->i_lsn = (i_pos / (int64_t) M2F2_SECTOR_SIZE) +
+        p_vcdplayer->i_lsn = (i_pos / (uint64_t) M2F2_SECTOR_SIZE) +
                              p_vcdplayer->origin_lsn;
 
         switch (p_vcdplayer->play_item.type)
@@ -678,7 +678,7 @@ VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
         if (p_vcdplayer->b_track_length)
         {
             p_access->info.i_size = p_vcdplayer->p_title[i_track-1]->i_size;
-            p_access->info.i_pos  = (int64_t) M2F2_SECTOR_SIZE *
+            p_access->info.i_pos  = (uint64_t) M2F2_SECTOR_SIZE *
                      (vcdinfo_get_track_lsn(p_vcdplayer->vcd, i_track)-i_lsn);
         } else {
             p_access->info.i_size = M2F2_SECTOR_SIZE * (int64_t)
index 63dcd22e43f69d602d98934893aac8b7dde1aa96..3e4689bb337a83e46f55b7b0abe9a95830a66dc5 100644 (file)
@@ -49,8 +49,8 @@ struct access_sys_t
 
 static int AccessControl( access_t *p_access, int i_query, va_list args );
 static ssize_t AccessRead( access_t *, uint8_t *, size_t );
-static int AccessSeek( access_t *, int64_t );
-static int OpenFileInZip( access_t *p_access, int i_pos );
+static int AccessSeek( access_t *, uint64_t );
+static int OpenFileInZip( access_t *p_access, uint64_t i_pos );
 static char *unescapeXml( const char *psz_text );
 
 /** **************************************************************************
@@ -287,7 +287,7 @@ static ssize_t AccessRead( access_t *p_access, uint8_t *p_buffer, size_t sz )
 /** **************************************************************************
  * \brief Seek inside zip file
  *****************************************************************************/
-static int AccessSeek( access_t *p_access, int64_t seek_len )
+static int AccessSeek( access_t *p_access, uint64_t seek_len )
 {
     access_sys_t *p_sys = p_access->p_sys;
     assert( p_sys );
@@ -305,7 +305,7 @@ static int AccessSeek( access_t *p_access, int64_t seek_len )
     }
 
     /* Read seek_len data and drop it */
-    int i_seek = 0;
+    unsigned i_seek = 0;
     int i_read = 1;
     char *p_buffer = ( char* ) calloc( 1, ZIP_BUFFER_LEN );
     while( ( i_seek < seek_len ) && ( i_read > 0 ) )
@@ -333,7 +333,7 @@ static int AccessSeek( access_t *p_access, int64_t seek_len )
 /** **************************************************************************
  * \brief Open file in zip
  *****************************************************************************/
-static int OpenFileInZip( access_t *p_access, int i_pos )
+static int OpenFileInZip( access_t *p_access, uint64_t i_pos )
 {
     access_sys_t *p_sys = p_access->p_sys;
     unzFile file = p_sys->zipFile;
@@ -342,7 +342,6 @@ static int OpenFileInZip( access_t *p_access, int i_pos )
         return VLC_EGENERIC;
     }
 
-    i_pos = __MIN( i_pos, 0 );
     p_access->info.i_pos = 0;
 
     unzCloseCurrentFile( file ); /* returns UNZ_PARAMERROR if file not opened */
@@ -435,6 +434,8 @@ static long ZCALLBACK ZipIO_Seek( void* opaque, void* stream,
         default:
             return -1;
     }
+    if( pos < 0 )
+        return -1;
     //msg_Dbg( p_access, "seek (%d,%d): %" PRIu64, offset, origin, pos );
     stream_Seek( (stream_t*) stream, pos );
     /* Note: in unzip.c, unzlocal_SearchCentralDir seeks to the end of