[FFmpeg-devel] [PATCH] lavu: add snprintf(), vsnprint() and strtod() replacements for MS runtime.
Michael Niedermayer
michaelni at gmx.at
Mon Aug 27 17:32:59 CEST 2012
On Mon, Aug 27, 2012 at 02:27:47AM -0300, jamal wrote:
> On 26/08/12 11:55 PM, Ronald S. Bultje wrote:
> > +int avpriv_vsnprintf(char *restrict s, size_t n, const char *restrict fmt,
> > + va_list ap)
> > +{
> > + int ret;
> > +
> > + if (n == 0)
> > + return 0;
> > + else if (n > INT_MAX)
> > + return AVERROR(EINVAL);
> > +
> > + /* we use n - 1 here because if the buffer is not big enough, the MS
> > + * runtime libraries don't add a terminating zero at the end. MSDN
> > + * recommends to provide _snprintf/_vsnprintf() a buffer size that
> > + * is one less than the actual buffer, and zero it before calling
> > + * _snprintf/_vsnprintf() to workaround this problem.
> > + * See http://msdn.microsoft.com/en-us/library/1kt27hek(v=vs.80).aspx */
> > + memset(s, 0, n);
> > + ret = vsnprintf(s, n - 1, fmt, ap);
>
> This should be _vsnprintf.
can you elaborate why ?
MSDN (link above) says
"vsnprintf is identical to _vsnprintf"
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.
-------------- 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/20120827/7dc57927/attachment.asc>
More information about the ffmpeg-devel
mailing list