[FFmpeg-devel] [PATCH 1/2] avutil/bprint: add av_vbprintf()

Michael Niedermayer michaelni at gmx.at
Sat Aug 10 16:44:15 CEST 2013


On Sat, Aug 10, 2013 at 04:34:56PM +0200, Nicolas George wrote:
> Le tridi 23 thermidor, an CCXXI, Michael Niedermayer a écrit :
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavutil/bprint.c |   23 +++++++++++++++++++++++
> >  libavutil/bprint.h |    7 +++++++
> >  2 files changed, 30 insertions(+)
> > 
> > diff --git a/libavutil/bprint.c b/libavutil/bprint.c
> > index fd7611a..e779956 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);
> > +}
> 
> Looks ok.

applied

thanks


> 
> av_bprintf() could be rewritten to call it instead of duplicating the code,
> but that can be done later.
> 
> Regards,
> 
> -- 
>   Nicolas George


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- 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/20130810/316ab3d6/attachment.asc>


More information about the ffmpeg-devel mailing list