NAKAI Yuta <[email protected]> писал(а) в своём письме Fri, 12 Sep 2014 19:28:32
+0400:
> When using -D__USE_MINGW_ANSI_STDIO=1 on MINGW, mingw doesn't use MSVCRT.
Interesting.
Currently FLAC has flac_snprintf() function in src/share/grabbag/snprintf.c
(and its exact copy local_snprintf() in src/libFLAC/metadata_iterators.c):
/*
* The _MSC_VER code below attempts to modify the return code for snprintf_s
* to something that is more compatible with the behaviour of the ISO C
version.
*/
int flac_snprintf(char *str, size_t size, const char *fmt, ...)
{
va_list va;
int rc ;
va_start (va, fmt);
#ifdef _MSC_VER
rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va);
rc = (rc > 0) ? rc : (size == 0 ? 1024 : size * 2);
#else
rc = vsnprintf (str, size, fmt, va);
#endif
va_end (va);
return rc;
}
The code implies that non-MSVC vsnprintf always has standart behavior.
But it looks like MinGW has 2 versions of vsnprintf: its own standard-conforming
and non-conforming from msvcrt.dll.
So flac_snprintf() can return unexpected value when compiled with MinGW.
_______________________________________________
flac-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/flac-dev