[FFmpeg-devel] [RFC] SDP Generation

Michael Niedermayer michaelni
Wed Jul 18 15:08:19 CEST 2007


Hi

On Wed, Jul 18, 2007 at 11:53:57AM +0200, Luca Abeni wrote:
> Hi,
> 
> Michael Niedermayer wrote:
> [...]
> >>I think this strlcatf() function can be useful for others too, and not 
> >>only for the SDP generator. Should I submit a patch adding av_strlcatf() 
> >>to libavutil/string.c?
> >
> >yes
> 
> Ok, here it is... I hope I got it right.
> The attached patch implements the semantic I proposed (the returned 
> value is equal to the total length of the resulting string).
> Maybe for consistency with av_strlcat() it could be more interesting to 
> return the length of the string that would have been generated if enough 
> space had been available. In such case, the implementation would have been
> 
> size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
> {
>     int len = strlen(dst);
>     va_list vl;
>     int res;
> 
>     va_start(vl, fmt);
>     res = vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
>     va_end(vl);
> 
>     return len + res;
> }

len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
...
return len;


> 
> Let me know which variant is preferred, and if it is ok for commit.

above is prefered

and ok to commit above

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070718/9be10523/attachment.pgp>



More information about the ffmpeg-devel mailing list