From 2e847d8484163b50d8fe98350f3dc96ac8a1a43f Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Thu, 21 Jan 2010 21:36:07 +0100 Subject: [PATCH] Used uint64_t for access_t::info.i_size/i_pos and access_t::pf_seek(). --- include/vlc_access.h | 6 +++--- modules/access/attachment.c | 4 ++-- modules/access/avio.c | 9 ++++---- modules/access/cdda.c | 6 ++++-- modules/access/file.c | 4 ++-- modules/access/fs.h | 4 ++-- modules/access/ftp.c | 17 +++++++-------- modules/access/gnomevfs.c | 10 ++++----- modules/access/http.c | 38 ++++++++++++++++++---------------- modules/access/mmap.c | 8 +++---- modules/access/mms/mmsh.c | 12 +++++------ modules/access/mms/mmsh.h | 2 +- modules/access/mms/mmstu.c | 10 +++------ modules/access/mtp.c | 4 ++-- modules/access/rtmp/access.c | 4 ++-- modules/access/rtsp/access.c | 4 ++-- modules/access/sftp.c | 2 +- modules/access/smb.c | 7 ++++--- modules/access/vcd/vcd.c | 6 +++--- modules/access/vcdx/access.c | 6 +++--- modules/access/zip/zipaccess.c | 13 ++++++------ 21 files changed, 88 insertions(+), 88 deletions(-) diff --git a/include/vlc_access.h b/include/vlc_access.h index fdb0312e2a..cc7a9c6b8d 100644 --- a/include/vlc_access.h +++ b/include/vlc_access.h @@ -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) */ diff --git a/modules/access/attachment.c b/modules/access/attachment.c index 96dd0f9215..d2e043c03f 100644 --- a/modules/access/attachment.c +++ b/modules/access/attachment.c @@ -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; diff --git a/modules/access/avio.c b/modules/access/avio.c index 0da9278f2e..e1d020c16f 100644 --- a/modules/access/avio.c +++ b/modules/access/avio.c @@ -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; } diff --git a/modules/access/cdda.c b/modules/access/cdda.c index 502647ae30..75b8cc0d2f 100644 --- a/modules/access/cdda.c +++ b/modules/access/cdda.c @@ -35,6 +35,7 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include #include #include @@ -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; diff --git a/modules/access/file.c b/modules/access/file.c index 64b221e29e..42a1213b53 100644 --- a/modules/access/file.c +++ b/modules/access/file.c @@ -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; diff --git a/modules/access/fs.h b/modules/access/fs.h index 3577c2af4c..a2eba25707 100644 --- a/modules/access/fs.h +++ b/modules/access/fs.h @@ -22,10 +22,10 @@ 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 *); diff --git a/modules/access/ftp.c b/modules/access/ftp.c index dffea0dd7a..89deeb50c4 100644 --- a/modules/access/ftp.c +++ b/modules/access/ftp.c @@ -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; diff --git a/modules/access/gnomevfs.c b/modules/access/gnomevfs.c index bb140f5257..93852102d2 100644 --- a/modules/access/gnomevfs.c +++ b/modules/access/gnomevfs.c @@ -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; diff --git a/modules/access/http.c b/modules/access/http.c index 52d883790b..384a58c19f 100644 --- a/modules/access/http.c +++ b/modules/access/http.c @@ -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" ) ) { diff --git a/modules/access/mmap.c b/modules/access/mmap.c index 2bad6f2860..c6116aa8d2 100644 --- a/modules/access/mmap.c +++ b/modules/access/mmap.c @@ -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); diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c index 0b932c2cca..b89565ccfd 100644 --- a/modules/access/mms/mmsh.c +++ b/modules/access/mms/mmsh.c @@ -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; diff --git a/modules/access/mms/mmsh.h b/modules/access/mms/mmsh.h index 3a2aa695df..a49fda8c54 100644 --- a/modules/access/mms/mmsh.h +++ b/modules/access/mms/mmsh.h @@ -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; diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c index e2bc5f039d..8ecbf70248 100644 --- a/modules/access/mms/mmstu.c +++ b/modules/access/mms/mmstu.c @@ -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)" ); diff --git a/modules/access/mtp.c b/modules/access/mtp.c index 9e35be8e2c..3a834ba0ac 100644 --- a/modules/access/mtp.c +++ b/modules/access/mtp.c @@ -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; diff --git a/modules/access/rtmp/access.c b/modules/access/rtmp/access.c index 3d4e8a8431..9d8130bf0b 100644 --- a/modules/access/rtmp/access.c +++ b/modules/access/rtmp/access.c @@ -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 ); diff --git a/modules/access/rtsp/access.c b/modules/access/rtsp/access.c index 09026d224e..b23634bbf1 100644 --- a/modules/access/rtsp/access.c +++ b/modules/access/rtsp/access.c @@ -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); diff --git a/modules/access/sftp.c b/modules/access/sftp.c index eaf355016d..787dcba43d 100644 --- a/modules/access/sftp.c +++ b/modules/access/sftp.c @@ -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; diff --git a/modules/access/smb.c b/modules/access/smb.c index 0571fceefb..f12706d26e 100644 --- a/modules/access/smb.c +++ b/modules/access/smb.c @@ -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 ); diff --git a/modules/access/vcd/vcd.c b/modules/access/vcd/vcd.c index b8742cd76f..dfe281a60a 100644 --- a/modules/access/vcd/vcd.c +++ b/modules/access/vcd/vcd.c @@ -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]; diff --git a/modules/access/vcdx/access.c b/modules/access/vcdx/access.c index 67598d0bd5..f6bb46c559 100644 --- a/modules/access/vcdx/access.c +++ b/modules/access/vcdx/access.c @@ -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) diff --git a/modules/access/zip/zipaccess.c b/modules/access/zip/zipaccess.c index 63dcd22e43..3e4689bb33 100644 --- a/modules/access/zip/zipaccess.c +++ b/modules/access/zip/zipaccess.c @@ -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 -- 2.39.2