[vlc-devel] [PATCH 06/11] demux: wav: change data_pos sign

Rémi Denis-Courmont remi at remlab.net
Fri Mar 13 15:47:05 CET 2020


1) You could and probably should use stream_GetSize().
2) The error case will be caught by the overflow comparison. I'm asking about 0, not about strictly negative values.

Le 13 mars 2020 16:13:45 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>
>
>On Thu, Mar 12, 2020, at 17:36, Remi Denis-Courmont wrote:
>> Le 2020-03-12 16:05, Thomas Guillem a écrit :
>> > Use the same type than vlc_stream_Tell().
>> > ---
>> >  modules/demux/wav.c | 5 +++--
>> >  1 file changed, 3 insertions(+), 2 deletions(-)
>> > 
>> > diff --git a/modules/demux/wav.c b/modules/demux/wav.c
>> > index c8829648730..5997a3c1865 100644
>> > --- a/modules/demux/wav.c
>> > +++ b/modules/demux/wav.c
>> > @@ -46,7 +46,7 @@ typedef struct
>> >      es_format_t     fmt;
>> >      es_out_id_t     *p_es;
>> > 
>> > -    int64_t         i_data_pos;
>> > +    uint64_t        i_data_pos;
>> >      int64_t         i_data_size;
>> > 
>> >      unsigned int    i_frame_size;
>> > @@ -594,7 +594,8 @@ static int Open( vlc_object_t * p_this )
>> >      if( !b_is_rf64 || i_size < UINT32_MAX )
>> >      {
>> >          int64_t i_stream_size = stream_Size( p_demux->s );
>> > -        if( i_stream_size > 0 && i_stream_size >= i_size + 
>> > p_sys->i_data_pos )
>> > +        if( i_stream_size > 0
>> > +         && (uint64_t) i_stream_size >= i_size + p_sys->i_data_pos
>)
>> >              p_sys->i_data_size = i_size;
>> >      }
>> 
>> Do you really still need to special case 0 ?
>
>I think it's still needed because you don't want to case to uint64_t if
>the value is negative (in case of stream_Size() error).
>
>> 
>> -- 
>> Rémi Denis-Courmont
>>

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200313/25a1f72b/attachment.html>


More information about the vlc-devel mailing list