Commit adff84e6 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: avi: replace off_t (fix #19249)

AVI has 32bit limitation, but off_t file size was signed
parent 2f39c10f
......@@ -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;
......@@ -210,7 +210,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 * );
......@@ -997,7 +997,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;
......@@ -1100,7 +1100,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;
......@@ -1969,7 +1969,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];
......@@ -2346,7 +2346,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 */
......@@ -2443,7 +2443,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;
......@@ -2499,7 +2499,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 )
{
demux_sys_t *p_sys = p_demux->p_sys;
......@@ -2541,7 +2541,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;
......@@ -2611,8 +2611,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 )
......@@ -2665,7 +2665,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;
......@@ -2682,7 +2682,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 );
......
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