aboutsummaryrefslogtreecommitdiff
path: root/libavutil/bprint.c
diff options
context:
space:
mode:
authorLukasz Marek2013-08-23 23:21:50 +0200
committerMichael Niedermayer2013-08-30 22:36:38 +0200
commit0b46d6f3efa7c647a42d3e77d09c274f611b752b (patch)
treee97f15bf84f810d8e79777d8ce81b9e6268e0aca /libavutil/bprint.c
parent6e1b1a27a4034c578018d5042b3c8228278c4cd6 (diff)
lavu/bprint: add append buffer function
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com> Reveiwed-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.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index cd91bc4a72..7786e3bce7 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -155,6 +155,24 @@ void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
av_bprint_grow(buf, n);
}
+void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
+{
+ unsigned room, real_n;
+
+ while (1) {
+ room = av_bprint_room(buf);
+ if (size < room)
+ break;
+ if (av_bprint_alloc(buf, size))
+ break;
+ }
+ if (room) {
+ real_n = FFMIN(size, room - 1);
+ memcpy(buf->str + buf->len, data, real_n);
+ }
+ av_bprint_grow(buf, size);
+}
+
void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm)
{
unsigned room;