[vlc-devel] [PATCH 5/5] win32: vlc_fix_format_string - various fixes
Laurent Aimar
fenrir at via.ecp.fr
Fri Mar 27 23:33:53 CET 2009
On Thu, Mar 26, 2009, davidf+nntp at woaf.net wrote:
> static inline int vlc_vsnprintf (char *str, size_t size, const char *format, va_list ap)
> {
> - char *fmt = vlc_fix_format_string (format);
> + int must_free = vlc_fix_format_string (&format);
> /* traditionally, MSVCRT has provided vsnprintf as _vsnprintf;
> * to 'aid' portability/standards compliance, mingw provides a
> * static version of vsnprintf that is buggy. Be sure to use
> * MSVCRT version, at least it behaves as expected */
> - int ret = _vsnprintf (str, size, fmt ? fmt : format, ap);
According to MSDN doc, _vsnprintf does *not* nul terminate the string if not
enought space is available, so you have to do it yourself here.
(I think all snprintf alike win32 functions behave like that.)
--
fenrir
More information about the vlc-devel
mailing list