[FFmpeg-devel] [PATCH] avio: add avio_get_str as a replacement for get_strz
Ronald S. Bultje
rsbultje
Tue Mar 1 18:52:14 CET 2011
Hi,
On Tue, Mar 1, 2011 at 12:33 PM, Anton Khirnov <anton at khirnov.net> wrote:
> +int avio_get_str(AVIOContext *s, int maxlen, char *buf, int buflen)
> +{
> + ? ?int ret = 0;
> +
> + ? ?while (ret < maxlen) {
> + ? ? ? ?char c = avio_r8(s);
> + ? ? ? ?ret++;
> + ? ? ? ?if (!c)
> + ? ? ? ? ? ?break;
> + ? ? ? ?if (ret < buflen - 1)
> + ? ? ? ? ? ?*buf++ = c;
> + ? ?}
> + ? ?*buf = 0;
> + ? ?return ret;
> +}
That looks a little spaghetti, but I see that the obvious ways of
making it shorter don't work as intended, so fine for now. Queued,
will apply later once others have had a chance to provide input also.
Ronald
More information about the ffmpeg-devel
mailing list