diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-16 21:19:02 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-16 21:19:02 +0000 |
commit | 40fdc8a404e75ab03b68cc62e9987cf208fd8c30 (patch) | |
tree | 37d9c4d3abe4aefd8a34ed797883dd2cd4862ca7 /ace/OS_NS_stdlib.inl | |
parent | c254b281f1b9a4ca19dd0c3ee73a0654a7718909 (diff) | |
download | ATCD-40fdc8a404e75ab03b68cc62e9987cf208fd8c30.tar.gz |
This commit was manufactured by cvs2svn to create branchtypecode-overhaul
'typecode-overhaul'.
Diffstat (limited to 'ace/OS_NS_stdlib.inl')
-rw-r--r-- | ace/OS_NS_stdlib.inl | 104 |
1 files changed, 22 insertions, 82 deletions
diff --git a/ace/OS_NS_stdlib.inl b/ace/OS_NS_stdlib.inl index 0f067ccbe5b..b0d115fbc3d 100644 --- a/ace/OS_NS_stdlib.inl +++ b/ace/OS_NS_stdlib.inl @@ -1,7 +1,6 @@ // -*- C++ -*- // $Id$ -#include "ace/config-all.h" /* Need ACE_TRACE */ #include "ace/Object_Manager_Base.h" #include "ace/OS_NS_string.h" #include "ace/Global_Macros.h" @@ -176,52 +175,24 @@ ACE_OS::itoa (int value, wchar_t *string, int radix) #if !defined (ACE_LACKS_MKSTEMP) ACE_INLINE ACE_HANDLE -ACE_OS::mkstemp (char *s) +ACE_OS::mkstemp (ACE_TCHAR *s) { return ::mkstemp (s); } - -# if defined (ACE_HAS_WCHAR) -ACE_INLINE ACE_HANDLE -ACE_OS::mkstemp (wchar_t *s) -{ - ACE_Wide_To_Ascii narrow_s (s); - return ::mkstemp (narrow_s.char_rep ()); -} -# endif /* ACE_HAS_WCHAR */ #endif /* !ACE_LACKS_MKSTEMP */ #if !defined (ACE_LACKS_MKTEMP) -ACE_INLINE char * -ACE_OS::mktemp (char *s) +ACE_INLINE ACE_TCHAR * +ACE_OS::mktemp (ACE_TCHAR *s) { -# if defined (ACE_WIN32) +# if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) + return ::_wmktemp (s); +# elif defined (ACE_WIN32) return ::_mktemp (s); # else /* ACE_WIN32 */ return ::mktemp (s); # endif /* ACE_WIN32 */ } - -# if defined (ACE_HAS_WCHAR) -ACE_INLINE wchar_t * -ACE_OS::mktemp (wchar_t *s) -{ -# if defined (ACE_WIN32) - return ::_wmktemp (s); -# else - // For narrow-char filesystems, we must convert the wide-char input to - // a narrow-char string for mktemp(), then convert the name back to - // wide-char for the caller. - ACE_Wide_To_Ascii narrow_s (s); - if (::mktemp (narrow_s.char_rep ()) == 0) - return 0; - ACE_Ascii_To_Wide wide_s (narrow_s.char_rep ()); - ACE_OS::strcpy (s, wide_s.wchar_rep ()); - return s; -# endif -} -# endif /* ACE_HAS_WCHAR */ - #endif /* !ACE_LACKS_MKTEMP */ #if defined(INTEGRITY) @@ -333,41 +304,20 @@ ACE_OS::rand_r (ACE_RANDR_TYPE& seed) #endif /* !ACE_WIN32 */ -#if !defined (ACE_HAS_WINCE) -# if !defined (ACE_LACKS_REALPATH) -ACE_INLINE char * -ACE_OS::realpath (const char *file_name, - char *resolved_name) +#if !defined (ACE_LACKS_REALPATH) +ACE_INLINE ACE_TCHAR * +ACE_OS::realpath (const ACE_TCHAR *file_name, + ACE_TCHAR *resolved_name) { -# if defined (ACE_WIN32) +# if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) + return ::_wfullpath (resolved_name, file_name, PATH_MAX); +# elif defined (ACE_WIN32) return ::_fullpath (resolved_name, file_name, PATH_MAX); -# else /* ACE_WIN32 */ +# else /* ACE_WIN32 */ return ::realpath (file_name, resolved_name); -# endif /* ! ACE_WIN32 */ +# endif /* ! ACE_WIN32 */ } -# endif /* !ACE_LACKS_REALPATH */ - -# if defined (ACE_HAS_WCHAR) -ACE_INLINE wchar_t * -ACE_OS::realpath (const wchar_t *file_name, - wchar_t *resolved_name) -{ -# if defined (ACE_WIN32) - return ::_wfullpath (resolved_name, file_name, PATH_MAX); -# else /* ACE_WIN32 */ - ACE_Wide_To_Ascii n_file_name (file_name); - char n_resolved[PATH_MAX]; - if (0 != ACE_OS::realpath (n_file_name.char_rep (), n_resolved)) - { - ACE_Ascii_To_Wide w_resolved (n_resolved); - ACE_OS::strcpy (resolved_name, w_resolved.wchar_rep ()); - return resolved_name; - } - return 0; -# endif /* ! ACE_WIN32 */ -} -# endif /* ACE_HAS_WCHAR */ -#endif /* ACE_HAS_WINCE */ +#endif /* !ACE_LACKS_REALPATH */ ACE_INLINE ACE_EXIT_HOOK ACE_OS::set_exit_hook (ACE_EXIT_HOOK exit_hook) @@ -399,21 +349,11 @@ ACE_OS::strenvdup (const ACE_TCHAR *str) ACE_UNUSED_ARG (str); ACE_NOTSUP_RETURN (0); #else - if (str[0] == ACE_LIB_TEXT ('$')) - { -# if defined (ACE_WIN32) - // Always use the ACE_TCHAR for Windows. - ACE_TCHAR *temp = 0; - if ((temp = ACE_OS::getenv (&str[1])) != 0) - return ACE_OS::strdup (temp); -# else - // Use char * for environment on non-Windows. - char *temp = 0; - if ((temp = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (&str[1]))) != 0) - return ACE_OS::strdup (ACE_TEXT_CHAR_TO_TCHAR (temp)); -# endif /* ACE_WIN32 */ - return ACE_OS::strdup (str); - } + ACE_TCHAR *temp = 0; + + if (str[0] == ACE_LIB_TEXT ('$') + && (temp = ACE_OS::getenv (&str[1])) != 0) + return ACE_OS::strdup (temp); else return ACE_OS::strdup (str); #endif /* ACE_HAS_WINCE */ @@ -483,6 +423,6 @@ ACE_OS::system (const ACE_TCHAR *s) #elif defined(ACE_TANDEM_T1248_PTHREADS) ACE_OSCALL_RETURN (::spt_system (s), int, -1); #else - ACE_OSCALL_RETURN (::system (ACE_TEXT_ALWAYS_CHAR (s)), int, -1); + ACE_OSCALL_RETURN (::system (s), int, -1); #endif /* !CHORUS */ } |