Fix compilation error with Mingw32

Fix compilation error on Mingw32 when `_TRUNCATE` is defined. Use
`_TRUNCATE` only if `__MINGW32__` not defined. Fix suggested by
Thomas Glanzmann and Nick Wilson on issue #355
This commit is contained in:
Ron Eldor 2017-09-06 17:49:10 +03:00
parent 5273182a20
commit a1413e05e9
3 changed files with 5 additions and 2 deletions

View file

@ -62,6 +62,9 @@ Bugfix
* Fix issue in RSA key generation program programs/x509/rsa_genkey * Fix issue in RSA key generation program programs/x509/rsa_genkey
where the failure of CTR DRBG initialization lead to freeing an where the failure of CTR DRBG initialization lead to freeing an
RSA context without proper initialization beforehand. RSA context without proper initialization beforehand.
* Fix compilation error on Mingw32 when `_TRUNCATE` is defined. Use `_TRUNCATE`
only if `__MINGW32__` not defined. Fix suggested by Thomas Glanzmann and
Nick Wilson on issue #355
Changes Changes
* Extend cert_write example program by options to set the CRT version * Extend cert_write example program by options to set the CRT version

View file

@ -90,7 +90,7 @@ void mbedtls_debug_print_msg( const mbedtls_ssl_context *ssl, int level,
va_start( argp, format ); va_start( argp, format );
#if defined(_WIN32) #if defined(_WIN32)
#if defined(_TRUNCATE) #if defined(_TRUNCATE) && !defined(__MINGW32__)
ret = _vsnprintf_s( str, DEBUG_BUF_SIZE, _TRUNCATE, format, argp ); ret = _vsnprintf_s( str, DEBUG_BUF_SIZE, _TRUNCATE, format, argp );
#else #else
ret = _vsnprintf( str, DEBUG_BUF_SIZE, format, argp ); ret = _vsnprintf( str, DEBUG_BUF_SIZE, format, argp );

View file

@ -74,7 +74,7 @@ int mbedtls_platform_win32_snprintf( char *s, size_t n, const char *fmt, ... )
return( -1 ); return( -1 );
va_start( argp, fmt ); va_start( argp, fmt );
#if defined(_TRUNCATE) #if defined(_TRUNCATE) && !defined(__MINGW32__)
ret = _vsnprintf_s( s, n, _TRUNCATE, fmt, argp ); ret = _vsnprintf_s( s, n, _TRUNCATE, fmt, argp );
#else #else
ret = _vsnprintf( s, n, fmt, argp ); ret = _vsnprintf( s, n, fmt, argp );