diff options
Diffstat (limited to 'ACE/ace/OS_NS_stdio.cpp')
-rw-r--r-- | ACE/ace/OS_NS_stdio.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ACE/ace/OS_NS_stdio.cpp b/ACE/ace/OS_NS_stdio.cpp index c4b23cb1904..1d78300260b 100644 --- a/ACE/ace/OS_NS_stdio.cpp +++ b/ACE/ace/OS_NS_stdio.cpp @@ -328,11 +328,16 @@ ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...) // ACE_OS_TRACE ("ACE_OS::snprintf"); # if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) || \ (defined (sun) && !defined (_XPG4) || defined(_XPG5)) || \ - defined (ACE_WIN32) + defined (ACE_WIN32) || defined (ACE_HAS_VSWPRINTF) int result; va_list ap; va_start (ap, format); -# if defined (ACE_WIN32) +# if 0 /* defined (ACE_HAS_TR24731_2005_CRT) */ + // _vsnwprintf_s() doesn't report the length needed when it truncates. This + // info is needed for the API contract return value, so don't use this. + // There's adequate protection via the maxlen. + result = _vsnwprintf_s (buf, maxlen, _TRUNCATE, format, ap); +# elif defined (ACE_WIN32) // Microsoft's vswprintf() doesn't have the maxlen argument that // XPG4/UNIX98 define. They do, however, recommend use of _vsnwprintf() // as a substitute, which does have the same signature as the UNIX98 one. @@ -387,7 +392,9 @@ ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...) # if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) || \ (defined (sun) && !defined (_XPG4) || defined(_XPG5)) || \ - (defined ACE_HAS_DINKUM_STL) || defined (__DMC__) + defined (ACE_HAS_DINKUM_STL) || defined (__DMC__) || \ + defined (ACE_HAS_VSWPRINTF) || \ + (defined (ACE_WIN32_VC8) && !defined (ACE_HAS_WINCE)) // The XPG4/UNIX98/C99 signature of the wide-char sprintf has a // maxlen argument. Since this method doesn't supply one, pass in @@ -402,7 +409,7 @@ ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...) return result; # elif defined (ACE_WIN32) - // Windows has vswprintf, but the signature is from the older ISO C + // Pre-VC8 Windows has vswprintf, but the signature is from the older ISO C // standard. Also see ACE_OS::snprintf() for more info on this. int result; |