summaryrefslogtreecommitdiff
path: root/ACE/ace/OS_NS_stdio.inl
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/ace/OS_NS_stdio.inl')
-rw-r--r--ACE/ace/OS_NS_stdio.inl51
1 files changed, 24 insertions, 27 deletions
diff --git a/ACE/ace/OS_NS_stdio.inl b/ACE/ace/OS_NS_stdio.inl
index 72a13d34b1f..ce74c3a21cb 100644
--- a/ACE/ace/OS_NS_stdio.inl
+++ b/ACE/ace/OS_NS_stdio.inl
@@ -12,9 +12,11 @@
#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_Memory.h"
-#if defined (ACE_HAS_TRIO)
-# include <trio.h>
-#endif /* ACE_HAS_TRIO */
+#if defined (ACE_HAS_CHARPTR_SPRINTF)
+# define ACE_SPRINTF_ADAPTER(X) ACE_OS::strlen (X)
+#else
+# define ACE_SPRINTF_ADAPTER(X) X
+#endif /* ACE_HAS_CHARPTR_SPRINTF */
/*****************************************************************************/
@@ -794,7 +796,7 @@ ACE_OS::rename (const char *old_name,
ACE_TEXT_CHAR_TO_TCHAR (new_name)))
ACE_FAIL_RETURN (-1);
return 0;
-# elif defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_MOVEFILEEX)
+# elif defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 == 1)
// NT4 (and up) provides a way to rename/move a file with similar semantics
// to what's usually done on UNIX - if there's an existing file with
// <new_name> it is removed before the file is renamed/moved. The
@@ -826,7 +828,7 @@ ACE_OS::rename (const wchar_t *old_name,
if (MoveFileW (old_name, new_name) != 0)
ACE_FAIL_RETURN (-1);
return 0;
-# elif defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_MOVEFILEEX)
+# elif defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 == 1)
// NT4 (and up) provides a way to rename/move a file with similar semantics
// to what's usually done on UNIX - if there's an existing file with
// <new_name> it is removed before the file is renamed/moved. The
@@ -915,47 +917,41 @@ ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx)
ACE_INLINE int
ACE_OS::vsprintf (char *buffer, const char *format, va_list argptr)
{
- return ::vsprintf (buffer, format, argptr);
+ return ACE_SPRINTF_ADAPTER (::vsprintf (buffer, format, argptr));
}
ACE_INLINE int
ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap)
{
-#if !defined (ACE_LACKS_VSNPRINTF)
- int result;
-# if !defined (ACE_WIN32)
- result = ::vsnprintf (buffer, maxlen, format, ap);
+#if defined (ACE_HAS_SNPRINTF)
+
+# if !defined (ACE_WIN32) \
+ || (defined (__BORLANDC__) && (__BORLANDC__ >= 0x600))
+ return ACE_SPRINTF_ADAPTER (::vsnprintf (buffer, maxlen, format, ap));
# else
- result = ::_vsnprintf (buffer, maxlen, format, ap);
- // Win32 doesn't regard a full buffer with no 0-terminate as an overrun.
+ int result =
+ ACE_SPRINTF_ADAPTER (::_vsnprintf (buffer, maxlen, format, ap));
+
+ // Win32 doesn't regard a full buffer with no 0-terminate as an
+ // overrun.
if (result == static_cast<int> (maxlen))
- buffer[maxlen-1] = '\0';
+ result = -1;
// Win32 doesn't 0-terminate the string if it overruns maxlen.
if (result == -1)
buffer[maxlen-1] = '\0';
-# endif
- // In out-of-range conditions, C99 defines vsnprintf() to return the number
- // of characters that would have been written if enough space was available.
- // Earlier variants of the vsnprintf() (e.g. UNIX98) defined it to return
- // -1. This method follows the C99 standard, but needs to guess at the
- // value; uses maxlen + 1.
- if (result == -1)
- {
- result = static_cast <int> (maxlen + 1);
- }
return result;
-#elif defined (ACE_HAS_TRIO)
- return trio_vsnprintf (buffer, maxlen, format, ap);
+
+# endif
#else
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (maxlen);
ACE_UNUSED_ARG (format);
ACE_UNUSED_ARG (ap);
ACE_NOTSUP_RETURN (-1);
-#endif /* ACE_LACKS_VSNPRINTF */
+#endif /* ACE_HAS_SNPRINTF */
}
#if defined (ACE_HAS_WCHAR)
@@ -1001,7 +997,8 @@ ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_lis
# elif defined (ACE_WIN32)
- int result = ::_vsnwprintf (buffer, maxlen, format, ap);
+ int result =
+ ACE_SPRINTF_ADAPTER (::_vsnwprintf (buffer, maxlen, format, ap));
// Win32 doesn't regard a full buffer with no 0-terminate as an
// overrun.