[vlc-commits] demux: avi: replace off_t (fix #19249)
Francois Cartegnie
git at videolan.org
Fri Dec 8 16:59:15 CET 2017
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Dec 8 11:15:17 2017 +0100| [c9b182d34005be4c002b25b61adcf3f489f0b76d] | committer: Francois Cartegnie
demux: avi: replace off_t (fix #19249)
AVI has 32bit limitation, but off_t file size was signed
(cherry picked from commit adff84e6c468b8af7aed0a47876534b9357794ba)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c9b182d34005be4c002b25b61adcf3f489f0b76d
---
modules/demux/avi/avi.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 568729c9d0..8cd11dacd8 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -106,7 +106,7 @@ static char *FromACP( const char *str )
typedef struct
{
vlc_fourcc_t i_fourcc;
- off_t i_pos;
+ uint32_t i_pos;
uint32_t i_size;
vlc_fourcc_t i_type; /* only for AVIFOURCC_LIST */
@@ -121,7 +121,7 @@ typedef struct
{
vlc_fourcc_t i_id;
uint32_t i_flags;
- off_t i_pos;
+ uint32_t i_pos;
uint32_t i_length;
int64_t i_lengthtotal;
@@ -129,14 +129,14 @@ typedef struct
typedef struct
{
- unsigned int i_size;
- unsigned int i_max;
+ uint32_t i_size;
+ uint32_t i_max;
avi_entry_t *p_entry;
} avi_index_t;
static void avi_index_Init( avi_index_t * );
static void avi_index_Clean( avi_index_t * );
-static void avi_index_Append( avi_index_t *, off_t *, avi_entry_t * );
+static void avi_index_Append( avi_index_t *, uint32_t *, avi_entry_t * );
typedef struct
{
@@ -184,8 +184,8 @@ struct demux_sys_t
bool b_odml;
- off_t i_movi_begin;
- off_t i_movi_lastchunk_pos; /* XXX position of last valid chunk */
+ uint32_t i_movi_begin;
+ uint32_t i_movi_lastchunk_pos; /* XXX position of last valid chunk */
/* number of streams and information */
unsigned int i_track;
@@ -213,7 +213,7 @@ static int AVI_StreamChunkFind( demux_t *, unsigned int i_stream );
static int AVI_StreamChunkSet ( demux_t *,
unsigned int i_stream, unsigned int i_ck );
static int AVI_StreamBytesSet ( demux_t *,
- unsigned int i_stream, off_t i_byte );
+ unsigned int i_stream, uint32_t i_byte );
vlc_fourcc_t AVI_FourccGetCodec( unsigned int i_cat, vlc_fourcc_t );
static int AVI_GetKeyFlag ( vlc_fourcc_t , uint8_t * );
@@ -1003,7 +1003,7 @@ typedef struct
int i_toread;
- off_t i_posf; /* where we will read :
+ int64_t i_posf; /* where we will read :
if i_idxposb == 0 : begining of chunk (+8 to acces data)
else : point on data directly */
} avi_track_toread_t;
@@ -1106,7 +1106,7 @@ static int Demux_Seekable( demux_t *p_demux )
avi_track_t *tk;
bool b_done;
block_t *p_frame;
- off_t i_pos;
+ int64_t i_pos;
unsigned int i;
size_t i_size;
@@ -1975,7 +1975,7 @@ static int AVI_StreamChunkSet( demux_t *p_demux, unsigned int i_stream,
/* XXX FIXME up to now, we assume that all chunk are one after one */
static int AVI_StreamBytesSet( demux_t *p_demux,
unsigned int i_stream,
- off_t i_byte )
+ uint32_t i_byte )
{
demux_sys_t *p_sys = p_demux->p_sys;
avi_track_t *p_stream = p_sys->track[i_stream];
@@ -2352,7 +2352,7 @@ static void avi_index_Clean( avi_index_t *p_index )
{
free( p_index->p_entry );
}
-static void avi_index_Append( avi_index_t *p_index, off_t *pi_last_pos,
+static void avi_index_Append( avi_index_t *p_index, uint32_t *pi_last_pos,
avi_entry_t *p_entry )
{
/* Update last chunk position */
@@ -2449,7 +2449,7 @@ static int AVI_IndexFind_idx1( demux_t *p_demux,
}
static int AVI_IndexLoad_idx1( demux_t *p_demux,
- avi_index_t p_index[], off_t *pi_last_offset )
+ avi_index_t p_index[], uint32_t *pi_last_offset )
{
demux_sys_t *p_sys = p_demux->p_sys;
@@ -2505,7 +2505,7 @@ static int AVI_IndexLoad_idx1( demux_t *p_demux,
return VLC_SUCCESS;
}
-static void __Parse_indx( demux_t *p_demux, avi_index_t *p_index, off_t *pi_max_offset,
+static void __Parse_indx( demux_t *p_demux, avi_index_t *p_index, uint32_t *pi_max_offset,
avi_chunk_indx_t *p_indx )
{
avi_entry_t index;
@@ -2546,7 +2546,7 @@ static void __Parse_indx( demux_t *p_demux, avi_index_t *p_index, off_t *pi_max_
}
static void AVI_IndexLoad_indx( demux_t *p_demux,
- avi_index_t p_index[], off_t *pi_last_offset )
+ avi_index_t p_index[], uint32_t *pi_last_offset )
{
demux_sys_t *p_sys = p_demux->p_sys;
@@ -2616,8 +2616,8 @@ static void AVI_IndexLoad( demux_t *p_demux )
avi_index_Init( &p_idx_indx[i] );
avi_index_Init( &p_idx_idx1[i] );
}
- off_t i_indx_last_pos = p_sys->i_movi_lastchunk_pos;
- off_t i_idx1_last_pos = p_sys->i_movi_lastchunk_pos;
+ uint32_t i_indx_last_pos = p_sys->i_movi_lastchunk_pos;
+ uint32_t i_idx1_last_pos = p_sys->i_movi_lastchunk_pos;
AVI_IndexLoad_indx( p_demux, p_idx_indx, &i_indx_last_pos );
if( !p_sys->b_odml )
@@ -2670,7 +2670,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
avi_chunk_list_t *p_movi;
unsigned int i_stream;
- off_t i_movi_end;
+ uint32_t i_movi_end;
mtime_t i_dialog_update;
vlc_dialog_id *p_dialog_id = NULL;
@@ -2687,7 +2687,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
for( i_stream = 0; i_stream < p_sys->i_track; i_stream++ )
avi_index_Init( &p_sys->track[i_stream]->idx );
- i_movi_end = __MIN( (off_t)(p_movi->i_chunk_pos + p_movi->i_chunk_size),
+ i_movi_end = __MIN( (uint32_t)(p_movi->i_chunk_pos + p_movi->i_chunk_size),
stream_Size( p_demux->s ) );
vlc_stream_Seek( p_demux->s, p_movi->i_chunk_pos + 12 );
More information about the vlc-commits
mailing list