Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-10 15:52:14 +0400
committerMichael Niedermayer <michaelni@gmx.at>2013-08-10 19:01:42 +0400
commit112c970ca62de2f43019a4cc787d12a0b88d2fbc (patch)
treed8d13a7e695f4cb0ca476112f2b7647a0fcb4274 /libavutil/bprint.c
parentb37ff488b8aab2fe1245f1ba3130b1d881559794 (diff)
avutil/bprint: add av_vbprintf()
Reviewed-by: Nicolas George <nicolas.george@normalesup.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/bprint.c')
-rw-r--r--libavutil/bprint.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index fd7611aaed..e7799563ec 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -113,6 +113,29 @@ void av_bprintf(AVBPrint *buf, const char *fmt, ...)
av_bprint_grow(buf, extra_len);
}
+void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg)
+{
+ unsigned room;
+ char *dst;
+ int extra_len;
+ va_list vl;
+
+ while (1) {
+ room = av_bprint_room(buf);
+ dst = room ? buf->str + buf->len : NULL;
+ va_copy(vl, vl_arg);
+ extra_len = vsnprintf(dst, room, fmt, vl);
+ va_end(vl);
+ if (extra_len <= 0)
+ return;
+ if (extra_len < room)
+ break;
+ if (av_bprint_alloc(buf, extra_len))
+ break;
+ }
+ av_bprint_grow(buf, extra_len);
+}
+
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
{
unsigned room, real_n;