[vlc-devel] [vlc-commits] subtitles: support MicroDVD size extension

Rémi Denis-Courmont remi at remlab.net
Wed Jun 29 15:47:27 CEST 2016


Le 2016-06-29 14:00, Hugo Beauzée-Luyssen a écrit :
> On 06/29/2016 01:49 PM, Jean-Baptiste Kempf wrote:
>> On 29 Jun, Hugo Beauzée-Luyssen wrote :
>>>> +                char *value = strndup( &psz_subtitle[3], i_len );
>>>
>>> Why strdup? atoi("123garbage") will return 123
>>
>> Are you _sure_ about that?
>>
>
> That's how I interpret «The atoi, atol, and atoll functions convert
> the *initial* portion of the string pointed to by nptr to int»
> (emphasis mine)
> My local toolchain seems to agree.

Yes. To determine what was after the digits part, use strtol/strtoul, 
or sscanf("%d%n") instead.


-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list