Commit 44fc4434 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix calloc usage

parent 34610e09
...@@ -792,9 +792,9 @@ static int MP4_ReadBox_stts( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -792,9 +792,9 @@ static int MP4_ReadBox_stts( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_stts->i_entry_count ); MP4_GET4BYTES( p_box->data.p_stts->i_entry_count );
p_box->data.p_stts->i_sample_count = p_box->data.p_stts->i_sample_count =
calloc( sizeof( uint32_t ), p_box->data.p_stts->i_entry_count ); calloc( p_box->data.p_stts->i_entry_count, sizeof(uint32_t) );
p_box->data.p_stts->i_sample_delta = p_box->data.p_stts->i_sample_delta =
calloc( sizeof( uint32_t ), p_box->data.p_stts->i_entry_count ); calloc( p_box->data.p_stts->i_entry_count, sizeof(uint32_t) );
for( i = 0; (i < p_box->data.p_stts->i_entry_count )&&( i_read >=8 ); i++ ) for( i = 0; (i < p_box->data.p_stts->i_entry_count )&&( i_read >=8 ); i++ )
{ {
...@@ -826,9 +826,9 @@ static int MP4_ReadBox_ctts( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -826,9 +826,9 @@ static int MP4_ReadBox_ctts( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_ctts->i_entry_count ); MP4_GET4BYTES( p_box->data.p_ctts->i_entry_count );
p_box->data.p_ctts->i_sample_count = p_box->data.p_ctts->i_sample_count =
calloc( sizeof( uint32_t ), p_box->data.p_ctts->i_entry_count ); calloc( p_box->data.p_ctts->i_entry_count, sizeof(uint32_t) );
p_box->data.p_ctts->i_sample_offset = p_box->data.p_ctts->i_sample_offset =
calloc( sizeof( uint32_t ), p_box->data.p_ctts->i_entry_count ); calloc( p_box->data.p_ctts->i_entry_count, sizeof(uint32_t) );
for( i = 0; (i < p_box->data.p_ctts->i_entry_count )&&( i_read >=8 ); i++ ) for( i = 0; (i < p_box->data.p_ctts->i_entry_count )&&( i_read >=8 ); i++ )
{ {
...@@ -1451,7 +1451,7 @@ static int MP4_ReadBox_stsz( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1451,7 +1451,7 @@ static int MP4_ReadBox_stsz( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_stsz->i_sample_count ); MP4_GET4BYTES( p_box->data.p_stsz->i_sample_count );
p_box->data.p_stsz->i_entry_size = p_box->data.p_stsz->i_entry_size =
calloc( sizeof( uint32_t ), p_box->data.p_stsz->i_sample_count ); calloc( p_box->data.p_stsz->i_sample_count, sizeof(uint32_t) );
if( !p_box->data.p_stsz->i_sample_size ) if( !p_box->data.p_stsz->i_sample_size )
{ {
...@@ -1486,11 +1486,11 @@ static int MP4_ReadBox_stsc( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1486,11 +1486,11 @@ static int MP4_ReadBox_stsc( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_stsc->i_entry_count ); MP4_GET4BYTES( p_box->data.p_stsc->i_entry_count );
p_box->data.p_stsc->i_first_chunk = p_box->data.p_stsc->i_first_chunk =
calloc( sizeof( uint32_t ), p_box->data.p_stsc->i_entry_count ); calloc( p_box->data.p_stsc->i_entry_count, sizeof(uint32_t) );
p_box->data.p_stsc->i_samples_per_chunk = p_box->data.p_stsc->i_samples_per_chunk =
calloc( sizeof( uint32_t ), p_box->data.p_stsc->i_entry_count ); calloc( p_box->data.p_stsc->i_entry_count, sizeof(uint32_t) );
p_box->data.p_stsc->i_sample_description_index = p_box->data.p_stsc->i_sample_description_index =
calloc( sizeof( uint32_t ), p_box->data.p_stsc->i_entry_count ); calloc( p_box->data.p_stsc->i_entry_count, sizeof(uint32_t) );
for( i = 0; (i < p_box->data.p_stsc->i_entry_count )&&( i_read >= 12 );i++ ) for( i = 0; (i < p_box->data.p_stsc->i_entry_count )&&( i_read >= 12 );i++ )
{ {
...@@ -1525,7 +1525,7 @@ static int MP4_ReadBox_stco_co64( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1525,7 +1525,7 @@ static int MP4_ReadBox_stco_co64( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_co64->i_entry_count ); MP4_GET4BYTES( p_box->data.p_co64->i_entry_count );
p_box->data.p_co64->i_chunk_offset = p_box->data.p_co64->i_chunk_offset =
calloc( sizeof( uint64_t ), p_box->data.p_co64->i_entry_count ); calloc( p_box->data.p_co64->i_entry_count, sizeof(uint64_t) );
for( i = 0; i < p_box->data.p_co64->i_entry_count; i++ ) for( i = 0; i < p_box->data.p_co64->i_entry_count; i++ )
{ {
...@@ -1571,7 +1571,7 @@ static int MP4_ReadBox_stss( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1571,7 +1571,7 @@ static int MP4_ReadBox_stss( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_stss->i_entry_count ); MP4_GET4BYTES( p_box->data.p_stss->i_entry_count );
p_box->data.p_stss->i_sample_number = p_box->data.p_stss->i_sample_number =
calloc( sizeof( uint32_t ), p_box->data.p_stss->i_entry_count ); calloc( p_box->data.p_stss->i_entry_count, sizeof(uint32_t) );
for( i = 0; (i < p_box->data.p_stss->i_entry_count )&&( i_read >= 4 ); i++ ) for( i = 0; (i < p_box->data.p_stss->i_entry_count )&&( i_read >= 4 ); i++ )
{ {
...@@ -1606,10 +1606,10 @@ static int MP4_ReadBox_stsh( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1606,10 +1606,10 @@ static int MP4_ReadBox_stsh( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_stsh->i_entry_count ); MP4_GET4BYTES( p_box->data.p_stsh->i_entry_count );
p_box->data.p_stsh->i_shadowed_sample_number = p_box->data.p_stsh->i_shadowed_sample_number =
calloc( sizeof( uint32_t ), p_box->data.p_stsh->i_entry_count ); calloc( p_box->data.p_stsh->i_entry_count, sizeof(uint32_t) );
p_box->data.p_stsh->i_sync_sample_number = p_box->data.p_stsh->i_sync_sample_number =
calloc( sizeof( uint32_t ), p_box->data.p_stsh->i_entry_count ); calloc( p_box->data.p_stsh->i_entry_count, sizeof(uint32_t) );
for( i = 0; (i < p_box->data.p_stss->i_entry_count )&&( i_read >= 8 ); i++ ) for( i = 0; (i < p_box->data.p_stss->i_entry_count )&&( i_read >= 8 ); i++ )
...@@ -1642,7 +1642,7 @@ static int MP4_ReadBox_stdp( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1642,7 +1642,7 @@ static int MP4_ReadBox_stdp( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GETVERSIONFLAGS( p_box->data.p_stdp ); MP4_GETVERSIONFLAGS( p_box->data.p_stdp );
p_box->data.p_stdp->i_priority = p_box->data.p_stdp->i_priority =
calloc( sizeof( uint16_t ), i_read / 2 ); calloc( i_read / 2, sizeof(uint16_t) );
for( i = 0; i < i_read / 2 ; i++ ) for( i = 0; i < i_read / 2 ; i++ )
{ {
...@@ -1675,13 +1675,17 @@ static int MP4_ReadBox_padb( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1675,13 +1675,17 @@ static int MP4_ReadBox_padb( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_padb->i_sample_count ); MP4_GET4BYTES( p_box->data.p_padb->i_sample_count );
p_box->data.p_padb->i_reserved1 = p_box->data.p_padb->i_reserved1 =
calloc( sizeof( uint16_t ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 ); calloc( ( p_box->data.p_padb->i_sample_count + 1 ) / 2,
sizeof(uint16_t) );
p_box->data.p_padb->i_pad2 = p_box->data.p_padb->i_pad2 =
calloc( sizeof( uint16_t ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 ); calloc( ( p_box->data.p_padb->i_sample_count + 1 ) / 2,
sizeof(uint16_t) );
p_box->data.p_padb->i_reserved2 = p_box->data.p_padb->i_reserved2 =
calloc( sizeof( uint16_t ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 ); calloc( ( p_box->data.p_padb->i_sample_count + 1 ) / 2,
sizeof(uint16_t) );
p_box->data.p_padb->i_pad1 = p_box->data.p_padb->i_pad1 =
calloc( sizeof( uint16_t ), ( p_box->data.p_padb->i_sample_count + 1 ) / 2 ); calloc( ( p_box->data.p_padb->i_sample_count + 1 ) / 2,
sizeof(uint16_t) );
for( i = 0; i < i_read / 2 ; i++ ) for( i = 0; i < i_read / 2 ; i++ )
...@@ -1722,13 +1726,13 @@ static int MP4_ReadBox_elst( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1722,13 +1726,13 @@ static int MP4_ReadBox_elst( stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_elst->i_entry_count ); MP4_GET4BYTES( p_box->data.p_elst->i_entry_count );
p_box->data.p_elst->i_segment_duration = p_box->data.p_elst->i_segment_duration =
calloc( sizeof( uint64_t ), p_box->data.p_elst->i_entry_count ); calloc( p_box->data.p_elst->i_entry_count, sizeof(uint64_t) );
p_box->data.p_elst->i_media_time = p_box->data.p_elst->i_media_time =
calloc( sizeof( int64_t ), p_box->data.p_elst->i_entry_count ); calloc( p_box->data.p_elst->i_entry_count, sizeof(uint64_t) );
p_box->data.p_elst->i_media_rate_integer = p_box->data.p_elst->i_media_rate_integer =
calloc( sizeof( uint16_t ), p_box->data.p_elst->i_entry_count ); calloc( p_box->data.p_elst->i_entry_count, sizeof(uint16_t) );
p_box->data.p_elst->i_media_rate_fraction= p_box->data.p_elst->i_media_rate_fraction=
calloc( sizeof( uint16_t ), p_box->data.p_elst->i_entry_count ); calloc( p_box->data.p_elst->i_entry_count, sizeof(uint16_t) );
for( i = 0; i < p_box->data.p_elst->i_entry_count; i++ ) for( i = 0; i < p_box->data.p_elst->i_entry_count; i++ )
......
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