[FFmpeg-devel] [PATCH 1/3] avformat/avio: add avio_print_n_strings and avio_print

Marton Balint cus at passwd.hu
Wed Aug 7 07:36:51 EEST 2019



On Tue, 6 Aug 2019, Nicolas George wrote:

> Marton Balint (12019-08-05):
>> These functions can be used to print a variable number of strings consecutively
>> to the IO context. Unlike av_bprintf, no temporery buffer is necessary.
>
> I do not like this very much: the VA design disables type checking,
> which makes it rather fragile, and the benefit is really minor.

This is only a problem if avio_print_n_strings is called directly, but the 
user should always use avio_print. And avio_print macro is casting every 
parameter to const char *, so the compiler emits a warning if the user 
passes an argument which is not const char *.

>
> Maybe add avio_print_string() to print a single string, and call it as
> many times as necessary.

That reduces readability slightly, so I'd rather not do it.

Regards,
Marton


More information about the ffmpeg-devel mailing list