Displaying 6 results from an estimated 6 matches for "__use_mingw_ansi_stdio".
2014 Sep 20
2
vsnprintf_s and vsnprintf
lvqcl wrote:
> I wrote a small program that fills a buffer[] with "abcdefghijklmnopqrstuvwxyz\0"
> pattern and then tries to write "0123456789" string into it.
> It calls either
> ret = vsnprintf_s(buffer, buf_size, _TRUNCATE, fmt, va);
> or
> ret = vsnprintf(buffer, buf_size, fmt, va);
<snip>
> vsnprintf (MSVC, MinGW):
>
> buf_size =
2014 Sep 20
0
vsnprintf_s and vsnprintf
...nough.
What about this version --
int flac_snprintf(char *str, size_t size, const char *fmt, ...)
{
va_list va;
int rc;
va_start (va, fmt);
#if defined _MSC_VER
rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va);
if (rc < 0)
rc = size - 1;
#elif defined __MINGW32__ && (!defined __USE_MINGW_ANSI_STDIO || __USE_MINGW_ANSI_STDIO == 0)
rc = vsnprintf (str, size, fmt, va);
if (rc < 0 || rc == size) {
rc = size - 1;
str [rc] = '\0'; /* assert(size > 0) */
}
#else
rc = vsnprintf (str, size, fmt, va);
#endif
va_end (va);
return rc;
}
Of course it is also possible to get rid of...
2014 Sep 20
3
vsnprintf_s and vsnprintf
...char *str, size_t size, const char *fmt, ...)
> {
> va_list va;
> int rc;
>
> va_start (va, fmt);
>
> #if defined _MSC_VER
> rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va);
> if (rc < 0)
> rc = size - 1;
> #elif defined __MINGW32__ && (!defined __USE_MINGW_ANSI_STDIO || __USE_MINGW_ANSI_STDIO == 0)
> rc = vsnprintf (str, size, fmt, va);
> if (rc < 0 || rc == size) {
> rc = size - 1;
> str [rc] = '\0'; /* assert(size > 0) */
> }
> #else
> rc = vsnprintf (str, size, fmt, va);
> #endif
> va_end (va);
>
> re...
2014 Sep 19
0
vsnprintf_s and vsnprintf
..."0123456789klmnopqrstuvwxyz"
buf_size = 11; ret = 10; buffer = "0123456789"
buf_size = 12; ret = 10; buffer = "0123456789"
---------------------------------------------------------------------------
vsnprintf (MinGW with "#define __USE_MINGW_ANSI_STDIO 1"):
buf_size = 8; ret = 10; buffer = "0123456"
buf_size = 9; ret = 10; buffer = "01234567"
buf_size = 10; ret = 10; buffer = "012345678"
buf_size = 11; ret = 10; buffer = "0123456789"
buf_...
2015 Jan 08
1
New version of Rtools for Windows
Oh, I forgot to mention that besides setting AR, RANLIB and the stack probing fix, you also need a very up to date binutils. 2.25 was out in december. Even with that , if you linker's default is not what you are compiling for (i.e. a multiarch toolchain), you need to set GNUTARGET also, i.e. -m32/-m64 is not enough. Some fix to autodetect non-default targets went in after christmas before the
2014 Sep 18
3
patch for win_utf8_io.c: vsnprintf_s vs. MinGW
lvqcl wrote:
> Oops. It seems that vsnprintf_s isn't always available on MinGW platform:
> MinGW declares this function only if MINGW_HAS_SECURE_API macro is defined.
> That's because WinXP version of msvcrt.dll doesn't contain secure functions
> like vsnprintf_s.
>
> Maybe it's better to revert vsnprintf_s to vsprintf or to use vnsprintf?
Ok, we need to drop