[vlc-devel] [PATCH] demux: mp4: avoid -Wformat warning with intermediate variable

Rémi Denis-Courmont remi at remlab.net
Tue May 5 12:25:04 CEST 2020


Neither. The code is actually guaranteed to work as it is. The warning is due to style issue that PRIu16 should not be used for int.

Le 5 mai 2020 11:21:54 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>Is the warning because of the size or because of the sign ?
>
>On 2020-05-05 9:45, Alexandre Janniaux wrote:
>> Hi,
>> 
>> I'm not sure of the format allowed for MP4 box paths but
>> since care was taken to have a fixed size format descriptor
>> to serialize the name I preferred keeping it.
>> 
>> François can probably assert whether %u would be correct or
>> not too.
>> 
>> Regards,
>> --
>> Alexandre Janniaux
>> Videolabs
>> 
>> On Mon, May 04, 2020 at 09:36:14PM +0300, Rémi Denis-Courmont wrote:
>>> Le maanantaina 4. toukokuuta 2020, 20.39.02 EEST Alexandre Janniaux
>a écrit :
>>>> ---
>>>>   modules/demux/mp4/attachments.c | 4 ++--
>>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/modules/demux/mp4/attachments.c
>>>> b/modules/demux/mp4/attachments.c index 59db7bb22bf..8376dbad053
>100644
>>>> --- a/modules/demux/mp4/attachments.c
>>>> +++ b/modules/demux/mp4/attachments.c
>>>> @@ -315,10 +315,10 @@ int MP4_GetAttachments( const MP4_Box_t
>*p_root,
>>>> input_attachment_t ***ppp_attac if ( asprintf( &psz_location,
>"pnot[%u]",
>>>> i_index - 1 ) > -1 ) {
>>>>                   char rgz_path[14];
>>>> +                uint16_t index = p_pnot->data.p_pnot->i_index - 1;
>>>>                   snprintf( rgz_path, 14,
>>>>                            "/%4.4s[%"PRIu16"]",
>>>> -                         (const char *)
>&p_pnot->data.p_pnot->i_type,
>>>> -                         p_pnot->data.p_pnot->i_index - 1 );
>>>> +                         (const char *)
>&p_pnot->data.p_pnot->i_type, index
>>>> ); const MP4_Box_t *p_pict = MP4_BoxGet( p_root, rgz_path ); if(
>p_pict )
>>>>                   {
>>>
>>> But why? You could just use %u directly here.
>>>
>>> --
>>> Реми Дёни-Курмон
>>> http://www.remlab.net/
>>>
>>>
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>> 
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
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/20200505/1a3c587f/attachment.html>


More information about the vlc-devel mailing list