[FFmpeg-devel] [PATCH 1/2] lavu/bprint: add append buffer function
Nicolas George
nicolas.george at normalesup.org
Fri Aug 30 20:45:18 CEST 2013
Sorry, with all the discussion on the other patch, I forgot to review this
one.
Le sextidi 6 fructidor, an CCXXI, Lukasz Marek a écrit :
> Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
> ---
> libavutil/bprint.c | 18 ++++++++++++++++++
> libavutil/bprint.h | 5 +++++
> libavutil/version.h | 2 +-
> 3 files changed, 24 insertions(+), 1 deletions(-)
>
> diff --git a/libavutil/bprint.c b/libavutil/bprint.c
> index cd91bc4..ca6f9b6 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)
Dubious space before a comma, here and in the prototype.
> +{
> + 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;
> diff --git a/libavutil/bprint.h b/libavutil/bprint.h
> index bb1de25..0b005be 100644
> --- a/libavutil/bprint.h
> +++ b/libavutil/bprint.h
> @@ -133,6 +133,11 @@ void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg);
> */
> void av_bprint_chars(AVBPrint *buf, char c, unsigned n);
>
> +/**
> + * Append data to a print buffer.
> + */
> +void av_bprint_append_data(AVBPrint *buf, const char *data , unsigned size);
> +
> struct tm;
> /**
> * Append a formatted date and time to a print buffer.
> diff --git a/libavutil/version.h b/libavutil/version.h
> index e522b79..0409411 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -76,7 +76,7 @@
>
> #define LIBAVUTIL_VERSION_MAJOR 52
> #define LIBAVUTIL_VERSION_MINOR 42
> -#define LIBAVUTIL_VERSION_MICRO 100
> +#define LIBAVUTIL_VERSION_MICRO 101
>
> #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> LIBAVUTIL_VERSION_MINOR, \
Apart from the space and the minor/micro issue raised by Michael, LGTM,
thanks.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130830/b6273585/attachment.asc>
More information about the ffmpeg-devel
mailing list