]> git.sesse.net Git - ffmpeg/commit
avformat/aviobuf: Also return truncated buffer in avio_get_dyn_buf()
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 25 May 2020 08:14:00 +0000 (10:14 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 11 Jun 2020 02:03:38 +0000 (04:03 +0200)
commitc33e56c7a6a8bef7d95e1d36eb2f35748d475695
tree85389e26d9393c17b2dd609fb9ce5c192bf3827d
parent7be9b0bb38f415d06d06a10844d181b0a8421c47
avformat/aviobuf: Also return truncated buffer in avio_get_dyn_buf()

Two kinds of errors can happen when working with dynamic buffers:
(Re)allocation errors or truncation errors (one has to truncate the
buffer to a size of INT_MAX because avio_close_dyn_buf() and
avio_get_dyn_buf() both return an int). Right now, avio_get_dyn_buf()
returns an empty buffer in either case. But given that
avio_get_dyn_buf() does not destroy the dynamic buffer, one can return
the buffer in case of truncation and let the user check the error flags
and decide for himself instead of hardcoding a single way to proceed
in case of truncation.

(This actually restores the behaviour from before commit
163bb9ac0af495a5cb95441bdb5c02170440d28c.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/aviobuf.c