diff options
112 files changed, 642 insertions, 1348 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index d4a78ad8217..d94fabfaf69 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -350,7 +350,6 @@ ACE::hash_pjw (const char *str) return ACE::hash_pjw (str, ACE_OS::strlen (str)); } -#if defined (ACE_HAS_WCHAR) u_long ACE::hash_pjw (const wchar_t *str, size_t len) { @@ -380,7 +379,6 @@ ACE::hash_pjw (const wchar_t *str) { return ACE::hash_pjw (str, ACE_OS::strlen (str)); } -#endif /* ACE_HAS_WCHAR */ #if !defined (ACE_HAS_WINCE) ACE_TCHAR * @@ -3328,7 +3326,6 @@ ACE::strndup (const char *str, size_t n) return ACE_OS::strsncpy (s, str, len + 1); } -#if defined (ACE_HAS_WCHAR) wchar_t * ACE::strndup (const wchar_t *str, size_t n) { @@ -3350,7 +3347,6 @@ ACE::strndup (const wchar_t *str, size_t n) 0); return ACE_OS::strsncpy (s, str, len + 1); } -#endif /* ACE_HAS_WCHAR */ char * ACE::strnnew (const char *str, size_t n) @@ -3373,7 +3369,6 @@ ACE::strnnew (const char *str, size_t n) return ACE_OS::strsncpy (s, str, len + 1); } -#if defined (ACE_HAS_WCHAR) wchar_t * ACE::strnnew (const wchar_t *str, size_t n) { @@ -3394,7 +3389,6 @@ ACE::strnnew (const wchar_t *str, size_t n) 0); return ACE_OS::strsncpy (s, str, len + 1); } -#endif /* ACE_HAS_WCHAR */ const char * ACE::strend (const char *s) @@ -3405,7 +3399,6 @@ ACE::strend (const char *s) return s; } -#if defined ACE_HAS_WCHAR const wchar_t * ACE::strend (const wchar_t *s) { @@ -3414,7 +3407,6 @@ ACE::strend (const wchar_t *s) return s; } -#endif char * ACE::strnew (const char *s) @@ -3431,7 +3423,6 @@ ACE::strnew (const char *s) return ACE_OS::strcpy (t, s); } -#if defined (ACE_HAS_WCHAR) wchar_t * ACE::strnew (const wchar_t *s) { @@ -3446,7 +3437,6 @@ ACE::strnew (const wchar_t *s) else return ACE_OS::strcpy (t, s); } -#endif /* ACE_HAS_WCHAR */ void ACE::strdelete (char *s) @@ -3454,13 +3444,11 @@ ACE::strdelete (char *s) delete [] s; } -#if defined (ACE_HAS_WCHAR) void ACE::strdelete (wchar_t *s) { delete [] s; } -#endif /* ACE_HAS_WCHAR */ inline static bool equal_char(char a, char b, bool case_sensitive) { diff --git a/ace/ACE.h b/ace/ACE.h index 84a2c39b86b..d215890f864 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -425,7 +425,6 @@ namespace ACE /// @c ACE_OS::malloc to allocate the new string. extern ACE_Export char *strnnew (const char *str, size_t n); -#if defined (ACE_HAS_WCHAR) extern ACE_Export const wchar_t *strend (const wchar_t *s); extern ACE_Export wchar_t *strnew (const wchar_t *s); @@ -436,8 +435,6 @@ namespace ACE extern ACE_Export wchar_t *strnnew (const wchar_t *str, size_t n); -#endif /* ACE_HAS_WCHAR */ - /** * On Windows, determines if a specified pathname ends with ".exe" * (not case sensitive). If on Windows and there is no ".exe" suffix, @@ -531,13 +528,11 @@ namespace ACE /// Computes the hash value of {str} using the "Hash PJW" routine. extern ACE_Export u_long hash_pjw (const char *str, size_t len); -#if defined (ACE_HAS_WCHAR) /// Computes the hash value of {str} using the "Hash PJW" routine. extern ACE_Export u_long hash_pjw (const wchar_t *str); /// Computes the hash value of {str} using the "Hash PJW" routine. extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len); -#endif /* ACE_HAS_WCHAR */ /// Computes CRC-CCITT for the string. extern ACE_Export ACE_UINT16 crc_ccitt(const char *str); diff --git a/ace/Argv_Type_Converter.cpp b/ace/Argv_Type_Converter.cpp index c6dead61178..9680900c0d8 100644 --- a/ace/Argv_Type_Converter.cpp +++ b/ace/Argv_Type_Converter.cpp @@ -13,53 +13,45 @@ ACE_RCSID (ace, #include "ace/OS_NS_string.h" #include "ace/OS_Errno.h" -#if defined (ACE_USES_WCHAR) ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv) - : saved_argc_ (argc) - , char_argv_ (0) - , wchar_argv_ (argv) - , before_pass_argc_ (argc) - , original_type_ (1) - , wchar_passed_ (0) - , char_passed_ (0) +: saved_argc_ (argc) +, char_argv_ (0) +, wchar_argv_ (argv) +, before_pass_argc_ (argc) +, original_type_ (1) +, wchar_passed_ (0) +, char_passed_ (0) { this->initialize (); for (int i = 0; i < argc; ++i) { this->char_argv_[i] = - ACE_OS::strdup (ACE_TEXT_ALWAYS_CHAR (argv[i])); + ACE::String_Conversion::duplicate< char >( argv[i] ); } } -#endif // ACE_USES_WCHAR ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char** argv) - : saved_argc_(argc) - , char_argv_(argv) -#if defined (ACE_USES_WCHAR) - , wchar_argv_(0) - , before_pass_argc_(argc) - , original_type_(0) - , wchar_passed_(0) - , char_passed_(0) +: saved_argc_(argc) +, char_argv_(argv) +, wchar_argv_(0) +, before_pass_argc_(argc) +, original_type_(0) +, wchar_passed_(0) +, char_passed_(0) { this->initialize(); for (int i = 0; i < argc; ++i) { this->wchar_argv_[i] = - ACE_OS::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i])); + ACE::String_Conversion::duplicate< wchar_t >( argv[i] ); } } -#else -{ -} -#endif // ACE_USES_WCHAR ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void) { -#if defined (ACE_USES_WCHAR) // selectively delete the 'copy' of argv if (this->original_type_) { @@ -70,7 +62,7 @@ ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void) } for (int i = 0; i < this->before_pass_argc_; ++i) { - ACE_OS::free (this->char_argv_[i]); + ACE::String_Conversion::free( this->char_argv_[i] ); } delete [] this->char_argv_; } @@ -82,14 +74,12 @@ ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void) } for (int i = 0; i < this->before_pass_argc_; ++i) { - ACE_OS::free (this->wchar_argv_[i]); + ACE::String_Conversion::free( this->wchar_argv_[i] ); } delete [] this->wchar_argv_; } -#endif // ACE_USES_WCHAR } -#if defined (ACE_USES_WCHAR) void ACE_Argv_Type_Converter::initialize (void) { @@ -118,14 +108,14 @@ ACE_Argv_Type_Converter::align_char_with_wchar (void) { // if n'th entries of both argv lists are different if (ACE_OS::strcmp(this->char_argv_[wchar_argv_index], - ACE_TEXT_ALWAYS_CHAR (match_argv)) != 0) + ACE_TEXT_TO_CHAR_IN (match_argv)) != 0) { // loop through the wchar argv list entries that are after // wchar_argv_index for (int i = wchar_argv_index + 1; i < before_pass_argc_; ++i) { if (ACE_OS::strcmp (this->char_argv_[i], - ACE_TEXT_ALWAYS_CHAR (match_argv)) + ACE_TEXT_TO_CHAR_IN (match_argv)) == 0) { // swap the pointers in the char argv list @@ -154,7 +144,7 @@ ACE_Argv_Type_Converter::align_wchar_with_char (void) { // if n'th entries of both argv lists are different if (ACE_OS::strcmp ( - ACE_TEXT_ALWAYS_CHAR (this->wchar_argv_[char_argv_index]), + ACE_TEXT_TO_CHAR_IN (this->wchar_argv_[char_argv_index]), match_argv) != 0) { // loop through the wchar argv list entries that are after @@ -162,7 +152,7 @@ ACE_Argv_Type_Converter::align_wchar_with_char (void) for (int i = char_argv_index + 1; i < this->before_pass_argc_; ++i) { if (ACE_OS::strcmp ( - ACE_TEXT_ALWAYS_CHAR(this->wchar_argv_[i]), + ACE_TEXT_TO_CHAR_IN(this->wchar_argv_[i]), match_argv) == 0) { // swap the pointers in the char argv list wchar_t* temp = this->wchar_argv_[char_argv_index]; @@ -188,12 +178,12 @@ ACE_Argv_Type_Converter::cleanup (void) // Check whether it's ours to delete. if (original_type_ == 1) { - ACE_OS::free (this->char_argv_[i]); + ACE::String_Conversion::free( this->char_argv_[i] ); this->char_argv_[i] = 0; } else { - ACE_OS::free (this->wchar_argv_[i]); + ACE::String_Conversion::free( this->wchar_argv_[i] ); this->wchar_argv_[i] = 0; } } @@ -203,4 +193,3 @@ ACE_Argv_Type_Converter::cleanup (void) this->wchar_passed_ = 0; this->char_passed_ = 0; } -#endif // ACE_USES_WCHAR diff --git a/ace/Argv_Type_Converter.h b/ace/Argv_Type_Converter.h index 276ca6c2845..303f26be499 100644 --- a/ace/Argv_Type_Converter.h +++ b/ace/Argv_Type_Converter.h @@ -41,15 +41,16 @@ public: ACE_Argv_Type_Converter (int &argc, char** argv); -#if defined (ACE_USES_WCHAR) ACE_Argv_Type_Converter (int &argc, wchar_t** argv); -#endif // ACE_USES_WCHAR ~ACE_Argv_Type_Converter (void); /// Returns the pointer of converted command line. ACE_TCHAR** get_TCHAR_argv (void); + /// Returns the pointer of converted command line. + wchar_t** get_Wide_argv (void); + /// Returns the pointer of ASCII (char) command line. char** get_ASCII_argv (void); @@ -64,8 +65,6 @@ private: /// Assignment '=' operator should not be used. ACE_Argv_Type_Converter operator= (const ACE_Argv_Type_Converter&); -#if defined (ACE_USES_WCHAR) - /// Perform common initialization for two Ctor's. void initialize (void); @@ -79,7 +78,6 @@ private: /// Clean up removed (comsumed) argv entries and reset the pass flags. void cleanup (void); -#endif // ACE_USES_WCHAR private: /// Original number of input paramter, same as 'argc'. @@ -88,7 +86,6 @@ private: /// Data member pointer that contains converted argv in ACE_ANTI_TCHAR. char** char_argv_; -#if defined (ACE_USES_WCHAR) /// Data member pointer that contains converted argv in ACE_TCHAR. wchar_t** wchar_argv_; @@ -104,7 +101,6 @@ private: /// TRUE indicates char type argv has been passed. int char_passed_; -#endif /* ACE_USES_WCHAR */ }; #if defined (__ACE_INLINE__) diff --git a/ace/Argv_Type_Converter.inl b/ace/Argv_Type_Converter.inl index 16c657ce864..f7c91d5ccbe 100644 --- a/ace/Argv_Type_Converter.inl +++ b/ace/Argv_Type_Converter.inl @@ -6,7 +6,16 @@ ACE_INLINE ACE_TCHAR** ACE_Argv_Type_Converter::get_TCHAR_argv (void) { -#if defined (ACE_USES_WCHAR) +#if ACE_USES_WCHAR + return get_Wide_argv (); +#else + return get_ASCII_argv (); +#endif +} + +wchar_t** +ACE_Argv_Type_Converter::get_Wide_argv (void) +{ if (this->char_passed_) { this->align_wchar_with_char (); @@ -14,22 +23,17 @@ ACE_Argv_Type_Converter::get_TCHAR_argv (void) this->wchar_passed_ = true; return this->wchar_argv_; -#else - return this->char_argv_; -#endif // ACE_USES_WCHAR } ACE_INLINE char** ACE_Argv_Type_Converter::get_ASCII_argv (void) { -#if defined (ACE_USES_WCHAR) if (this->wchar_passed_) { this->align_char_with_wchar (); } this->char_passed_ = 1; -#endif // ACE_USES_WCHAR return this->char_argv_; } diff --git a/ace/Auto_Event.cpp b/ace/Auto_Event.cpp index 2c29a7dd24e..67444d3c886 100644 --- a/ace/Auto_Event.cpp +++ b/ace/Auto_Event.cpp @@ -16,12 +16,11 @@ ACE_Auto_Event::ACE_Auto_Event (int initial_state, : ACE_Event (0, initial_state, type, - ACE_TEXT_CHAR_TO_TCHAR (name), + ACE_TEXT_TO_TCHAR_IN (name), arg) { } -#if defined (ACE_HAS_WCHAR) ACE_Auto_Event::ACE_Auto_Event (int initial_state, int type, const wchar_t *name, @@ -29,11 +28,10 @@ ACE_Auto_Event::ACE_Auto_Event (int initial_state, : ACE_Event (0, initial_state, type, - ACE_TEXT_WCHAR_TO_TCHAR (name), + ACE_TEXT_TO_TCHAR_IN (name), arg) { } -#endif /* ACE_HAS_WCHAR */ void ACE_Auto_Event::dump (void) const diff --git a/ace/Auto_Event.h b/ace/Auto_Event.h index e722ee89500..50e6aedf88c 100644 --- a/ace/Auto_Event.h +++ b/ace/Auto_Event.h @@ -43,13 +43,11 @@ public: const char *name = 0, void *arg = 0); -#if defined (ACE_HAS_WCHAR) /// constructor which will create auto event (wchar_t version) ACE_Auto_Event (int initial_state, int type, const wchar_t *name, void *arg = 0); -#endif /* ACE_HAS_WCHAR */ /// Default dtor. ~ACE_Auto_Event (void); diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h index 4e93efd5847..e19cf1dde6e 100644 --- a/ace/Basic_Types.h +++ b/ace/Basic_Types.h @@ -14,7 +14,6 @@ * * Sizes of built-in types: * - ACE_SIZEOF_CHAR - * - ACE_SIZEOF_WCHAR * - ACE_SIZEOF_SHORT * - ACE_SIZEOF_INT * - ACE_SIZEOF_LONG @@ -83,23 +82,6 @@ // A char always has 1 byte, by definition. # define ACE_SIZEOF_CHAR 1 -// Unfortunately, there isn't a portable way to determine the size of a wchar. -// So we just define them on a platform basis. If the platform doesn't -// define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code -// uses ACE_SIZEOF_WCHAR in preprocessor statements, so sizeof() isn't valid. -// If the platform config doesn't set this, and this guess is wrong, -// Basic_Types_Test should catch the inconsistency. -# if defined (ACE_HAS_WCHAR) -# if !defined (ACE_SIZEOF_WCHAR) -# if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) -# define ACE_SIZEOF_WCHAR 4 -# else -// 0 so the Basic_Types test will catch this. -# define ACE_SIZEOF_WCHAR 0 -# endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ -# endif /* !ACE_SIZEOF_WCHAR */ -# endif /* ACE_HAS_WCHAR */ - // The number of bytes in a short. # if !defined (ACE_SIZEOF_SHORT) # if (USHRT_MAX) == 255U @@ -269,17 +251,6 @@ typedef ACE_UINT16 ACE_USHORT16; // @@ Backward compatibility. // Define a generic byte for use in codecs typedef unsigned char ACE_Byte; -// Define a pseudo wide character type when wchar is not supported so we -// can support basic wide character string operations. - -# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) -# define ACE_WINT_T wint_t -# define ACE_WCHAR_T wchar_t -# else -# define ACE_WINT_T ACE_UINT16 -# define ACE_WCHAR_T ACE_UINT16 -# endif /* ACE_HAS_WCHAR */ - // The number of bytes in a void *. # ifndef ACE_SIZEOF_VOID_P # define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG @@ -769,7 +740,6 @@ typedef ptrdiff_t ptr_arith_t; #define ACE_INT16_MAX 0x7FFF #define ACE_INT16_MIN -(ACE_INT16_MAX)-1 #define ACE_UINT16_MAX 0xFFFF -#define ACE_WCHAR_MAX ACE_UINT16_MAX #define ACE_INT32_MAX 0x7FFFFFFF #define ACE_INT32_MIN -(ACE_INT32_MAX)-1 #define ACE_UINT32_MAX 0xFFFFFFFF diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h index 7f19e1aaad9..6b163161f6f 100644 --- a/ace/CDR_Base.h +++ b/ace/CDR_Base.h @@ -181,9 +181,15 @@ public: bool, unsigned char>::result_type Boolean; # endif /* _MSC_VER <= 1310 */ + +# if !defined (ACE_CDR_WCHAR_OVERRIDE) || defined(ACE_USES_WCHAR) +# undef ACE_CDR_WCHAR_OVERRIDE +# define ACE_CDR_WCHAR_OVERRIDE wchar_t +# endif + typedef unsigned char Octet; typedef char Char; - typedef ACE_WCHAR_T WChar; + typedef ACE_CDR_WCHAR_OVERRIDE WChar; typedef ACE_INT16 Short; typedef ACE_UINT16 UShort; typedef ACE_INT32 Long; diff --git a/ace/CE_Screen_Output.cpp b/ace/CE_Screen_Output.cpp index dd36a8385bb..f4d69659532 100644 --- a/ace/CE_Screen_Output.cpp +++ b/ace/CE_Screen_Output.cpp @@ -76,13 +76,13 @@ ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_TCHAR* output ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_ANTI_TCHAR* output) { - *this << ACE_TEXT_CHAR_TO_TCHAR(output); + *this << ACE_TEXT_TO_TCHAR_IN(output); return *this; } ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_ANTI_TCHAR* output) { - *this << ACE_TEXT_CHAR_TO_TCHAR(output); + *this << ACE_TEXT_TO_TCHAR_IN(output); return *this; } diff --git a/ace/Default_Constants.h b/ace/Default_Constants.h index f6bb1ea0d66..9b75b3c2acf 100644 --- a/ace/Default_Constants.h +++ b/ace/Default_Constants.h @@ -427,10 +427,8 @@ #endif /* ACE_WIN32 */ // Define the Wide character and normal versions of some of the string macros -#if defined (ACE_HAS_WCHAR) # define ACE_DIRECTORY_SEPARATOR_STR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_STR_A) # define ACE_DIRECTORY_SEPARATOR_CHAR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_CHAR_A) -#endif /* ACE_HAS_WCHAR */ #define ACE_DIRECTORY_SEPARATOR_STR ACE_LIB_TEXT (ACE_DIRECTORY_SEPARATOR_STR_A) #define ACE_DIRECTORY_SEPARATOR_CHAR ACE_LIB_TEXT (ACE_DIRECTORY_SEPARATOR_CHAR_A) @@ -463,10 +461,8 @@ #endif /* ACE_WIN32 */ // Define the Wide character and normal versions of some of the string macros -#if defined (ACE_HAS_WCHAR) # define ACE_PLATFORM_W ACE_TEXT_WIDE(ACE_PLATFORM_A) # define ACE_PLATFORM_EXE_SUFFIX_W ACE_TEXT_WIDE(ACE_PLATFORM_EXE_SUFFIX_A) -#endif /* ACE_HAS_WCHAR */ #define ACE_PLATFORM ACE_LIB_TEXT (ACE_PLATFORM_A) #define ACE_PLATFORM_EXE_SUFFIX ACE_LIB_TEXT (ACE_PLATFORM_EXE_SUFFIX_A) @@ -482,7 +478,8 @@ # endif /* __MINGW32__ */ #else /* !ACE_WIN32 */ # if !defined (ACE_LD_SEARCH_PATH) -# define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("LD_LIBRARY_PATH") +# define ACE_LD_SEARCH_PATH_A "LD_LIBRARY_PATH" +# define ACE_LD_SEARCH_PATH ACE_LIB_TEXT (ACE_LD_SEARCH_PATH_A) # endif /* ACE_LD_SEARCH_PATH */ # if !defined (ACE_LD_SEARCH_PATH_SEPARATOR_STR) # define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_LIB_TEXT (":") @@ -538,16 +535,12 @@ # else /* ACE_WIN32 */ # define ACE_DEFAULT_NAMESPACE_DIR_A "/tmp" # endif /* ACE_WIN32 */ -# if defined (ACE_HAS_WCHAR) # define ACE_DEFAULT_NAMESPACE_DIR_W ACE_TEXT_WIDE(ACE_DEFAULT_NAMESPACE_DIR_A) -# endif /* ACE_HAS_WCHAR */ # define ACE_DEFAULT_NAMESPACE_DIR ACE_LIB_TEXT(ACE_DEFAULT_NAMESPACE_DIR_A) #endif /* ACE_LEGACY_MODE */ -#if defined (ACE_HAS_WCHAR) # define ACE_DEFAULT_LOCALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_LOCALNAME_A) # define ACE_DEFAULT_GLOBALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_GLOBALNAME_A) -#endif /* ACE_HAS_WCHAR */ #define ACE_DEFAULT_LOCALNAME ACE_LIB_TEXT (ACE_DEFAULT_LOCALNAME_A) #define ACE_DEFAULT_GLOBALNAME ACE_LIB_TEXT (ACE_DEFAULT_GLOBALNAME_A) diff --git a/ace/Dynamic_Service.h b/ace/Dynamic_Service.h index e7cddce6ad8..2b678fb70f1 100644 --- a/ace/Dynamic_Service.h +++ b/ace/Dynamic_Service.h @@ -40,12 +40,10 @@ class ACE_Dynamic_Service : public ACE_Dynamic_Service_Base { public: /// Return instance using @a name to search the Service_Repository. - static TYPE* instance (const ACE_TCHAR *name); + static TYPE* instance (const char *name); -#if defined (ACE_USES_WCHAR) /// Return instance using @a name to search the Service_Repository. - static TYPE* instance (const ACE_ANTI_TCHAR *name); -#endif // ACE_USES_WCHAR + static TYPE* instance (const wchar_t *name); }; #if defined (__ACE_INLINE__) diff --git a/ace/Dynamic_Service.inl b/ace/Dynamic_Service.inl index f2ebfc81e1b..3387ca51abb 100644 --- a/ace/Dynamic_Service.inl +++ b/ace/Dynamic_Service.inl @@ -1,10 +1,8 @@ /* -*- C++ -*- */ // $Id$ -#if defined (ACE_USES_WCHAR) template <class TYPE> ACE_INLINE TYPE * ACE_Dynamic_Service<TYPE>::instance (const ACE_ANTI_TCHAR *name) { - return instance (ACE_TEXT_CHAR_TO_TCHAR (name)); + return instance (ACE_TEXT_TO_TCHAR_IN (name)); } -#endif // ACE_USES_WCHAR diff --git a/ace/Env_Value_T.inl b/ace/Env_Value_T.inl index 2a58036c2f3..6df7d7a8ce4 100644 --- a/ace/Env_Value_T.inl +++ b/ace/Env_Value_T.inl @@ -33,15 +33,9 @@ ACE_Env_Value<T>::open (const ACE_TCHAR *varname, template <class T> ACE_INLINE void ACE_Env_Value<T>::fetch_value (void) { -#if defined (ACE_WIN32) const ACE_TCHAR *env = ACE_OS::getenv (this->varname_); if (env != 0) ACE_Convert (env, value_); -#else - char *nenv = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (this->varname_)); - if (nenv != 0) - ACE_Convert (ACE_TEXT_CHAR_TO_TCHAR (nenv), value_); -#endif } template <class T> ACE_INLINE const ACE_TCHAR* diff --git a/ace/FILE_Connector.cpp b/ace/FILE_Connector.cpp index 8a8c0625a92..b1854e54b17 100644 --- a/ace/FILE_Connector.cpp +++ b/ace/FILE_Connector.cpp @@ -65,7 +65,7 @@ ACE_FILE_Connector::connect (ACE_FILE_IO &new_io, handle = ACE_OS::mkstemp (filename); // mkstemp() replaces "XXXXXX" if (handle == ACE_INVALID_HANDLE - || new_io.addr_.set (ACE_TEXT_CHAR_TO_TCHAR (filename)) != 0) + || new_io.addr_.set (ACE_TEXT_TO_TCHAR_IN (filename)) != 0) return -1; new_io.set_handle (handle); diff --git a/ace/Functor.h b/ace/Functor.h index ffe25656413..22f160adef5 100644 --- a/ace/Functor.h +++ b/ace/Functor.h @@ -366,9 +366,7 @@ public: const char *rhs) const; }; -#if defined (ACE_HAS_WCHAR) - -# if ! defined (ACE_LACKS_NATIVE_WCHAR_T) +# if ! defined (ACE_LACKS_BUILTIN_WCHAR_T) /** * @class ACE_Hash<wchar_t> * @@ -381,7 +379,7 @@ public: /// Simply returns t unsigned long operator () (wchar_t t) const; }; -# endif /* ACE_LACKS_NATIVE_WCHAR_T */ +# endif /* ACE_LACKS_BUILTIN_WCHAR_T */ /** * @class ACE_Hash<const wchar_t *> * @@ -467,8 +465,6 @@ public: const wchar_t *rhs) const; }; -#endif // ACE_HAS_WCHAR - #if defined (__ACE_INLINE__) #include "ace/Functor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Functor.inl b/ace/Functor.inl index 4d32149257b..29cd493c97d 100644 --- a/ace/Functor.inl +++ b/ace/Functor.inl @@ -53,13 +53,13 @@ ACE_Hash<char>::operator () (char t) const return t; } -#if defined (ACE_HAS_WCHAR) && ! defined (ACE_LACKS_NATIVE_WCHAR_T) +#if defined (ACE_LACKS_BUILTIN_WCHAR_T) ACE_INLINE unsigned long ACE_Hash<wchar_t>::operator () (wchar_t t) const { return t; } -#endif /* ACE_HAS_WCHAR && ! ACE_LACKS_NATIVE_WCHAR_T */ +#endif /* ACE_LACKS_BUILTIN_WCHAR_T */ ACE_INLINE unsigned long ACE_Hash<signed char>::operator () (signed char t) const @@ -182,9 +182,6 @@ ACE_Less_Than<char *>::operator () (const char *lhs, const char *rhs) const return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0; } - -#if defined (ACE_HAS_WCHAR) - ACE_INLINE unsigned long ACE_Hash<const wchar_t *>::operator () (const wchar_t *t) const { @@ -223,4 +220,3 @@ ACE_Less_Than<wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) c return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0; } -#endif // ACE_HAS_WCHAR diff --git a/ace/Functor_String.h b/ace/Functor_String.h index dc28e0dcf95..2e84295ef76 100644 --- a/ace/Functor_String.h +++ b/ace/Functor_String.h @@ -82,9 +82,6 @@ public: const ACE_CString &rhs) const; }; - -#if defined (ACE_USES_WCHAR) - /** * @class ACE_Equal_To<ACE_WString> * @@ -128,7 +125,6 @@ public: const ACE_WString &rhs) const; }; -#endif /*ACE_USES_WCHAR*/ #if defined (__ACE_INLINE__) #include "ace/Functor_String.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Functor_String.inl b/ace/Functor_String.inl index 083b2f488ec..e2fcf99a036 100644 --- a/ace/Functor_String.inl +++ b/ace/Functor_String.inl @@ -26,7 +26,6 @@ ACE_Less_Than<ACE_CString>::operator () (const ACE_CString &lhs, } -#if defined (ACE_USES_WCHAR) ACE_INLINE unsigned long ACE_Hash<ACE_WString>::operator () (const ACE_WString &t) const { @@ -48,4 +47,3 @@ ACE_Less_Than<ACE_WString>::operator () (const ACE_WString &lhs, return (lhs < rhs); } -#endif /*ACE_USES_WCHAR*/ diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp index 48365670554..a397dd01c7c 100644 --- a/ace/High_Res_Timer.cpp +++ b/ace/High_Res_Timer.cpp @@ -517,7 +517,7 @@ ACE_High_Res_Timer::get_env_global_scale_factor (const ACE_TCHAR *env) #if !defined (ACE_HAS_WINCE) if (env != 0) { - const char *env_value = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (env)); + const char *env_value = ACE_OS::getenv (env); if (env_value != 0) { int value = ACE_OS::atoi (env_value); diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index 3c72504ff95..420172707af 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -48,7 +48,7 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[], { ACE_OS::sprintf (s, ACE_LIB_TEXT ("%s:%d"), - ACE_TEXT_CHAR_TO_TCHAR (ipaddr_format == 0 + ACE_TEXT_TO_TCHAR_IN (ipaddr_format == 0 ? this->get_host_name () : this->get_host_addr ()), this->get_port_number ()); @@ -217,7 +217,6 @@ ACE_INET_Addr::ACE_INET_Addr (const char address[]) this->set (address); } -#if defined (ACE_HAS_WCHAR) ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[]) : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) { @@ -226,8 +225,6 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[]) this->set (address); } -#endif /* ACE_HAS_WCHAR */ - // Copy constructor. ACE_INET_Addr::ACE_INET_Addr (const ACE_INET_Addr &sa) @@ -408,7 +405,7 @@ ACE_INET_Addr::set (const char port_name[], int address_family = PF_UNSPEC; # if defined (ACE_HAS_IPV6) - if (ACE_OS::strcmp (ACE_TEXT_CHAR_TO_TCHAR(protocol), ACE_LIB_TEXT ("tcp6")) == 0) + if (ACE_OS::strcmp (ACE_TEXT_TO_TCHAR_IN(protocol), ACE_LIB_TEXT ("tcp6")) == 0) address_family = AF_INET6; # endif /* ACE_HAS_IPV6 */ @@ -460,12 +457,11 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number, #else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"), - ACE_TEXT_CHAR_TO_TCHAR ((host_name == 0) ? + ACE_TEXT_TO_TCHAR_IN ((host_name == 0) ? "<unknown>" : host_name))); #endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ } -#if defined (ACE_HAS_WCHAR) ACE_INET_Addr::ACE_INET_Addr (u_short port_number, const wchar_t host_name[], int address_family) @@ -486,12 +482,11 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number, #else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"), - ACE_TEXT_WCHAR_TO_TCHAR ((host_name == 0) ? + ACE_TEXT_TO_TCHAR_IN ((host_name == 0) ? ACE_TEXT_WIDE ("<unknown>") : host_name))); #endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */ } -#endif /* ACE_HAS_WCHAR */ // Creates a ACE_INET_Addr from a sockaddr_in structure. @@ -614,7 +609,6 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[], ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); } -#if defined (ACE_HAS_WCHAR) ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], const wchar_t host_name[], const wchar_t protocol[]) @@ -628,7 +622,6 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); } -#endif /* ACE_HAS_WCHAR */ // Creates a ACE_INET_Addr from a PORT_NAME and an Internet address. @@ -646,7 +639,6 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[], ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); } -#if defined (ACE_HAS_WCHAR) ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], ACE_UINT32 inet_address, const wchar_t protocol[]) @@ -660,7 +652,6 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr"))); } -#endif /* ACE_HAS_WCHAR */ ACE_INET_Addr::~ACE_INET_Addr (void) { @@ -699,7 +690,6 @@ ACE_INET_Addr::get_host_name (char hostname[], return result; } -#if defined (ACE_HAS_WCHAR) int ACE_INET_Addr::get_host_name (wchar_t hostname[], size_t len) const @@ -717,12 +707,10 @@ ACE_INET_Addr::get_host_name (wchar_t hostname[], // And copy it over, if successful if (result == 0) - ACE_OS::strcpy (hostname, - ACE_Ascii_To_Wide (char_hostname).wchar_rep ()); + ACE_OS::string_copy( hostname, char_hostname, MAXHOSTNAMELEN + 1 ); return result; } -#endif /* ACE_HAS_WCHAR */ // Return the character representation of the hostname. diff --git a/ace/INET_Addr.h b/ace/INET_Addr.h index 2b7777ade01..6cdc1ae62cb 100644 --- a/ace/INET_Addr.h +++ b/ace/INET_Addr.h @@ -88,7 +88,6 @@ public: ACE_UINT32 ip_addr, const char protocol[] = "tcp"); -#if defined (ACE_HAS_WCHAR) ACE_INET_Addr (u_short port_number, const wchar_t host_name[], int address_family = AF_UNSPEC); @@ -102,7 +101,6 @@ public: ACE_INET_Addr (const wchar_t port_name[], ACE_UINT32 ip_addr, const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); -#endif /* ACE_HAS_WCHAR */ /// Default dtor. ~ACE_INET_Addr (void); @@ -170,7 +168,6 @@ public: int set (const sockaddr_in *, int len); -#if defined (ACE_HAS_WCHAR) int set (u_short port_number, const wchar_t host_name[], int encode = 1, @@ -185,7 +182,6 @@ public: const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); int set (const wchar_t addr[]); -#endif /* ACE_HAS_WCHAR */ /// Return a pointer to the underlying network address. virtual void *get_addr (void) const; @@ -220,12 +216,6 @@ public: */ virtual int string_to_addr (const char address[]); -#if defined (ACE_HAS_WCHAR) - /* - virtual int string_to_addr (const char address[]); - */ -#endif /* ACE_HAS_WCHAR */ - /** * Sets the port number without affecting the host name. If * <encode> is enabled then <port_number> is converted into network @@ -271,10 +261,8 @@ public: int get_host_name (char hostname[], size_t hostnamelen) const; -#if defined (ACE_HAS_WCHAR) int get_host_name (wchar_t hostname[], size_t hostnamelen) const; -#endif /* ACE_HAS_WCHAR */ /** * Return the character representation of the hostname (this version diff --git a/ace/INET_Addr.inl b/ace/INET_Addr.inl index ea8dc04813b..63c8f480c4b 100644 --- a/ace/INET_Addr.inl +++ b/ace/INET_Addr.inl @@ -108,7 +108,6 @@ ACE_INET_Addr::operator < (const ACE_INET_Addr &rhs) const && this->get_port_number () < rhs.get_port_number ()); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_INET_Addr::set (u_short port_number, const wchar_t host_name[], @@ -116,7 +115,7 @@ ACE_INET_Addr::set (u_short port_number, int address_family) { return this->set (port_number, - ACE_Wide_To_Ascii (host_name).char_rep (), + ACE_TEXT_TO_CHAR_IN (host_name), encode, address_family); } @@ -126,9 +125,9 @@ ACE_INET_Addr::set (const wchar_t port_name[], const wchar_t host_name[], const wchar_t protocol[]) { - return this->set (ACE_Wide_To_Ascii (port_name).char_rep (), - ACE_Wide_To_Ascii (host_name).char_rep (), - ACE_Wide_To_Ascii (protocol).char_rep ()); + return this->set (ACE_TEXT_TO_CHAR_IN (port_name), + ACE_TEXT_TO_CHAR_IN (host_name), + ACE_TEXT_TO_CHAR_IN (protocol)); } ACE_INLINE int @@ -136,19 +135,17 @@ ACE_INET_Addr::set (const wchar_t port_name[], ACE_UINT32 ip_addr, const wchar_t protocol[]) { - return this->set (ACE_Wide_To_Ascii (port_name).char_rep (), + return this->set (ACE_TEXT_TO_CHAR_IN (port_name), ip_addr, - ACE_Wide_To_Ascii (protocol).char_rep ()); + ACE_TEXT_TO_CHAR_IN (protocol)); } ACE_INLINE int ACE_INET_Addr::set (const wchar_t addr[]) { - return this->set (ACE_Wide_To_Ascii (addr).char_rep ()); + return this->set (ACE_TEXT_TO_CHAR_IN (addr)); } -#endif /* ACE_HAS_WCHAR */ - // Return @c true if the IP address is INADDR_ANY or IN6ADDR_ANY. ACE_INLINE bool ACE_INET_Addr::is_any (void) const diff --git a/ace/Lib_Find.cpp b/ace/Lib_Find.cpp index 2a78e8cc94c..0e82b87bb5d 100644 --- a/ace/Lib_Find.cpp +++ b/ace/Lib_Find.cpp @@ -318,9 +318,8 @@ ACE::ldfind (const ACE_TCHAR* filename, # else // Wide-char, non-Windows only offers char * getenv. So capture // it, translate to wide-char, and continue. - ACE_Ascii_To_Wide wide_ldpath - (ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH))); - ld_path = wide_ldpath.wchar_rep (); + ACE::String_Conversion::Convert_In< wchar_t, char >( STRING ) wide_ldpath(ACE_OS::getenv (ACE_LD_SEARCH_PATH_A); + ld_path = wide_ldpath.c_str (); # endif /* ACE_WIN32 || !ACE_USES_WCHAR */ # endif /* ACE_DEFAULT_LD_SEARCH_PATH */ @@ -561,7 +560,7 @@ ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len) } else { - ACE_OS::strcpy (buffer, ACE_TEXT_CHAR_TO_TCHAR (tmpdir)); + ACE_OS::string_copy (buffer, tmpdir, buffer_len); // Add a trailing slash because we cannot assume there is already one // at the end. And having an extra one should not cause problems. @@ -652,7 +651,6 @@ ACE::strsplit_r (char *str, return result; } -#if defined (ACE_HAS_WCHAR) wchar_t * ACE::strsplit_r (wchar_t *str, const wchar_t *token, @@ -702,4 +700,3 @@ ACE::strrepl (wchar_t *s, wchar_t search, wchar_t replace) return replaced; } -#endif /* ACE_HAS_WCHAR */ diff --git a/ace/Lib_Find.h b/ace/Lib_Find.h index a66422a1f9d..17d28284f14 100644 --- a/ace/Lib_Find.h +++ b/ace/Lib_Find.h @@ -89,7 +89,6 @@ namespace ACE const char *token, char *&next_start); -#if defined (ACE_HAS_WCHAR) /// As strrepl, but for wide characters. extern ACE_Export size_t strrepl (wchar_t *s, wchar_t search, @@ -99,7 +98,6 @@ namespace ACE extern ACE_Export wchar_t *strsplit_r (wchar_t *s, const wchar_t *token, wchar_t *&next_start); -#endif /* ACE_HAS_WCHAR */ } #include /**/ "ace/post.h" diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp index d7382c3266c..27ee8c84ddf 100644 --- a/ace/Local_Name_Space.cpp +++ b/ace/Local_Name_Space.cpp @@ -13,7 +13,7 @@ ACE_NS_String::~ACE_NS_String (void) delete [] this->rep_; } -ACE_WCHAR_T * +wchar_t * ACE_NS_String::fast_rep (void) const { ACE_TRACE ("ACE_NS_String::fast_rep"); @@ -24,7 +24,7 @@ ACE_NS_String::operator ACE_NS_WString () const { ACE_TRACE ("ACE_NS_String::operator ACE_NS_WString"); return ACE_NS_WString (this->rep_, - (this->len_ / sizeof (ACE_WCHAR_T)) - 1); + (this->len_ / sizeof (wchar_t)) - 1); } size_t @@ -39,7 +39,7 @@ ACE_NS_String::char_rep (void) const { ACE_TRACE ("ACE_NS_String::char_rep"); ACE_NS_WString w_string (this->rep_, - (this->len_ / sizeof (ACE_WCHAR_T)) - 1); + (this->len_ / sizeof (wchar_t)) - 1); return w_string.char_rep (); } @@ -52,7 +52,7 @@ ACE_NS_String::ACE_NS_String (void) } ACE_NS_String::ACE_NS_String (const ACE_NS_WString &s) - : len_ ((s.length () + 1) * sizeof (ACE_WCHAR_T)), + : len_ ((s.length () + 1) * sizeof (wchar_t)), rep_ (s.rep ()), delete_rep_ (1) { @@ -73,8 +73,8 @@ ACE_NS_String::strstr (const ACE_NS_String &s) const else { // They're smaller than we are... - const size_t len = (this->len_ - s.len_) / sizeof (ACE_WCHAR_T); - const size_t pat_len = s.len_ / sizeof (ACE_WCHAR_T) - 1; + const size_t len = (this->len_ - s.len_) / sizeof (wchar_t); + const size_t pat_len = s.len_ / sizeof (wchar_t) - 1; for (size_t i = 0; i <= len; ++i) { @@ -109,8 +109,8 @@ ACE_NS_String::operator != (const ACE_NS_String &s) const return !this->operator == (s); } -ACE_NS_String::ACE_NS_String (ACE_WCHAR_T *dst, - const ACE_WCHAR_T *src, +ACE_NS_String::ACE_NS_String (wchar_t *dst, + const wchar_t *src, size_t bytes) : len_ (bytes), rep_ (dst), @@ -124,7 +124,7 @@ u_long ACE_NS_String::hash (void) const { return ACE::hash_pjw - (reinterpret_cast<char *> (const_cast<ACE_WCHAR_T *> (this->rep_)), + (reinterpret_cast<char *> (const_cast<wchar_t *> (this->rep_)), this->len_); } diff --git a/ace/Local_Name_Space.h b/ace/Local_Name_Space.h index e8b8b4b39ca..ae08bd37917 100644 --- a/ace/Local_Name_Space.h +++ b/ace/Local_Name_Space.h @@ -42,8 +42,8 @@ public: ACE_NS_String (void); /// Initialization method. - ACE_NS_String (ACE_WCHAR_T *dst, - const ACE_WCHAR_T *src, + ACE_NS_String (wchar_t *dst, + const wchar_t *src, size_t len); /// Converts an ACE_NS_WString to an ACE_NS_String; @@ -71,7 +71,7 @@ public: size_t len (void) const; /// Returns the underlying representation. - ACE_WCHAR_T *fast_rep (void) const; + wchar_t *fast_rep (void) const; /// Returns a hash value for this string. u_long hash (void) const; @@ -81,7 +81,7 @@ private: size_t len_; /// This actually points into shared/persistent memory. - ACE_WCHAR_T *rep_; + wchar_t *rep_; /// Should rep_ be deleted when destructed (only used /// for WString conversions) diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp index 87638b4b6f2..674c774e153 100644 --- a/ace/Local_Name_Space_T.cpp +++ b/ace/Local_Name_Space_T.cpp @@ -139,8 +139,8 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind_i ( { ACE_TRACE ("ACE_Local_Name_Space::shared_bind_i"); - const size_t name_len = (name.length () + 1) * sizeof (ACE_WCHAR_T); - const size_t value_len = (value.length () + 1) * sizeof (ACE_WCHAR_T); + const size_t name_len = (name.length () + 1) * sizeof (wchar_t); + const size_t value_len = (value.length () + 1) * sizeof (wchar_t); const size_t type_len = ACE_OS::strlen (type) + 1; const size_t total_len = name_len + value_len + type_len; char *ptr = (char *) this->allocator_->malloc (total_len); @@ -151,12 +151,12 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind_i ( { // Note that the value_rep *must* come first to make sure we can // retrieve this pointer later on in unbind(). - ACE_WCHAR_T *value_rep = (ACE_WCHAR_T *) (ptr); - ACE_WCHAR_T *name_rep = (ACE_WCHAR_T *) (ptr + value_len); + wchar_t *value_rep = (wchar_t *) (ptr); + wchar_t *name_rep = (wchar_t *) (ptr + value_len); char *new_type = (char *) (ptr + value_len + name_len); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ()); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> value_urep (value.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> value_urep (value.rep ()); ACE_NS_String new_name (name_rep, name_urep.get (), name_len); ACE_NS_String new_value (value_rep, value_urep.get (), value_len); @@ -325,7 +325,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve_i ( value = nbc_string; // Gets type and then the actual reprsentation which is a - // ACE_WCHAR_T + // wchar_t const char *temp = ns_internal.type (); size_t len = ACE_OS::strlen (ns_internal.type ()); @@ -818,7 +818,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::dump_i (void) const #endif /* ! ACE_NLOGGING */ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("key=%s\nvalue=%s\ntype=%s\n"), - ACE_TEXT_CHAR_TO_TCHAR (key), ACE_TEXT_CHAR_TO_TCHAR (value), ACE_TEXT_CHAR_TO_TCHAR (type))); + ACE_TEXT_TO_TCHAR_IN (key), ACE_TEXT_TO_TCHAR_IN (value), ACE_TEXT_TO_TCHAR_IN (type))); // We need to delete key and value since char_rep allocates // memory for them delete [] key; diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index 5eb9cfe357c..cbb5c22b008 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -896,8 +896,8 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name, * 'X': print as a hex number * 'w': print a wide character * 'W': print out a wide character string. - * 'z': print an ACE_OS::WChar character - * 'Z': print an ACE_OS::WChar character string + * 'z': print an wchar_t character + * 'Z': print an wchar_t character string * '%': format a single percent sign, '%' */ ssize_t @@ -919,7 +919,6 @@ ACE_Log_Msg::log (ACE_Log_Priority log_priority, return result; } -#if defined (ACE_HAS_WCHAR) /** * Since this is the ANTI_TCHAR version, we need to convert * the format string over. @@ -935,14 +934,13 @@ ACE_Log_Msg::log (ACE_Log_Priority log_priority, va_start (argp, format_str); - ssize_t result = this->log (ACE_TEXT_ANTI_TO_TCHAR (format_str), + ssize_t result = this->log (ACE_TEXT_TO_TCHAR_IN (format_str), log_priority, argp); va_end (argp); return result; } -#endif /* ACE_HAS_WCHAR */ ssize_t ACE_Log_Msg::log (const ACE_TCHAR *format_str, @@ -1177,12 +1175,12 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, this->file () ? - ACE_TEXT_CHAR_TO_TCHAR (this->file ()) + ACE_TEXT_TO_TCHAR_IN (this->file ()) : ACE_LIB_TEXT ("<unknown file>")); else this_len = ACE_OS::sprintf (bp, format, this->file () ? - ACE_TEXT_CHAR_TO_TCHAR (this->file ()) + ACE_TEXT_TO_TCHAR_IN (this->file ()) : ACE_LIB_TEXT ("<unknown file>")); ACE_UPDATE_COUNT (bspace, this_len); break; @@ -1238,11 +1236,11 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, va_arg (argp, ACE_TCHAR *), - ACE_TEXT_CHAR_TO_TCHAR (msg)); + ACE_TEXT_TO_TCHAR_IN (msg)); else this_len = ACE_OS::sprintf (bp, format, va_arg (argp, ACE_TCHAR *), - ACE_TEXT_CHAR_TO_TCHAR (msg)); + ACE_TEXT_TO_TCHAR_IN (msg)); #if defined (ACE_WIN32) } else @@ -1346,10 +1344,10 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, #endif if (can_check) this_len = ACE_OS::snprintf - (bp, bspace, format, ACE_TEXT_CHAR_TO_TCHAR (msg)); + (bp, bspace, format, ACE_TEXT_TO_TCHAR_IN (msg)); else this_len = ACE_OS::sprintf - (bp, format, ACE_TEXT_CHAR_TO_TCHAR (msg)); + (bp, format, ACE_TEXT_TO_TCHAR_IN (msg)); #if defined (ACE_WIN32) } else @@ -1700,7 +1698,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, else this_len = ACE_OS::sprintf (bp, format, va_arg (argp, ACE_TCHAR *)); -#elif defined (ACE_HAS_WCHAR) +#else # if defined (HPUX) ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); # else @@ -1712,7 +1710,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, else this_len = ACE_OS::sprintf (bp, format, va_arg (argp, wchar_t *)); -#endif /* ACE_WIN32 / ACE_HAS_WCHAR */ +#endif /* ACE_WIN32 */ ACE_UPDATE_COUNT (bspace, this_len); break; @@ -1753,7 +1751,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, ACE_UPDATE_COUNT (bspace, this_len); break; - case 'z': // ACE_OS::WChar character + case 'z': // wchar_t character { // On some platforms sizeof (wchar_t) can be 2 // on the others 4 ... @@ -1782,14 +1780,14 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, break; } - case 'Z': // ACE_OS::WChar character string + case 'Z': // wchar_t character string { - ACE_OS::WChar *wchar_str = va_arg (argp, ACE_OS::WChar*); + wchar_t *wchar_str = va_arg (argp, wchar_t*); if (wchar_str == 0) break; wchar_t *wchar_t_str = 0; - if (sizeof (ACE_OS::WChar) != sizeof (wchar_t)) + if (sizeof (wchar_t) != sizeof (wchar_t)) { size_t len = ACE_OS::wslen (wchar_str) + 1; ACE_NEW_NORETURN(wchar_t_str, wchar_t[len]); @@ -1812,19 +1810,19 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, # else /* ACE_USES_WCHAR */ ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); # endif /* ACE_USES_WCHAR */ -#elif defined (ACE_HAS_WCHAR) +#else # if defined (HPUX) ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); # else ACE_OS::strcpy (fp, ACE_LIB_TEXT ("ls")); # endif /* HPUX */ -#endif /* ACE_WIN32 / ACE_HAS_WCHAR */ +#endif /* ACE_WIN32 */ if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, wchar_t_str); else this_len = ACE_OS::sprintf (bp, format, wchar_t_str); - if(sizeof(ACE_OS::WChar) != sizeof(wchar_t)) + if(sizeof(wchar_t) != sizeof(wchar_t)) { delete wchar_t_str; } @@ -2556,7 +2554,6 @@ ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority, return this->log_priority_enabled (log_priority); } -#if defined (ACE_USES_WCHAR) int ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority, const wchar_t *, @@ -2564,7 +2561,6 @@ ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority, { return this->log_priority_enabled (log_priority); } -#endif /* ACE_USES_WCHAR */ // **************************************************************** diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h index 4ade1db3b4c..9d4b878d375 100644 --- a/ace/Log_Msg.h +++ b/ace/Log_Msg.h @@ -36,7 +36,7 @@ ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ ace___->set (__FILE__, __LINE__, -1, __ace_error, ace___->restart (), \ ace___->msg_ostream (), ace___->msg_callback ()); \ - ace___->log (LM_ERROR, ACE_LIB_TEXT ("ACE_ASSERT: file %N, line %l assertion failed for '%s'.%a\n"), ACE_TEXT_CHAR_TO_TCHAR (#X), -1); \ + ace___->log (LM_ERROR, ACE_LIB_TEXT ("ACE_ASSERT: file %N, line %l assertion failed for '%s'.%a\n"), ACE_TEXT_TO_TCHAR_IN (#X), -1); \ } } while (0) #endif /* ACE_NDEBUG */ @@ -434,7 +434,6 @@ public: const char *, ...); -#if defined (ACE_USES_WCHAR) // We are not using ACE_TCHAR for this since ACE_HEX_DUMP // doesn't take in a ACE_TCHAR. log_hexdump takes in a char // string, so this must be able to take in a char string even @@ -443,7 +442,6 @@ public: int log_priority_enabled (ACE_Log_Priority log_priority, const wchar_t *, ...); -#endif /* ACE_USES_WCHAR */ /// Optimize reading of the pid (avoids a system call if the value is /// cached...). @@ -513,15 +511,13 @@ public: * - 'W': print a wide character string * - 'x': print as a hex number * - 'X': print as a hex number - * - 'z': print an ACE_OS::WChar character - * - 'Z': print an ACE_OS::WChar character string + * - 'z': print an wchar_t character + * - 'Z': print an wchar_t character string * - '%': print out a single percent sign, '%' */ - ssize_t log (ACE_Log_Priority priority, const ACE_TCHAR *format, ...); + ssize_t log (ACE_Log_Priority priority, const char *format, ...); -#if defined (ACE_HAS_WCHAR) - ssize_t log (ACE_Log_Priority priority, const ACE_ANTI_TCHAR *format, ...); -#endif /* ACE_HAS_WCHAR */ + ssize_t log (ACE_Log_Priority priority, const wchar_t *format, ...); /** * An alternative logging mechanism that makes it possible to diff --git a/ace/Log_Msg_UNIX_Syslog.cpp b/ace/Log_Msg_UNIX_Syslog.cpp index 9353190f191..4a685231f32 100644 --- a/ace/Log_Msg_UNIX_Syslog.cpp +++ b/ace/Log_Msg_UNIX_Syslog.cpp @@ -41,15 +41,10 @@ ACE_Log_Msg_UNIX_Syslog::open (const ACE_TCHAR * logger_key) // options LOG_CONS and LOG_PID to be set. There really should be a // logging strategy option to control the syslog log options, // however, we'll take the easy way out for now. -#if defined (ACE_USES_WCHAR) - openlog (ACE_TEXT_ALWAYS_CHAR (logger_key), + // const_cast? + ::openlog (const_cast<char *>(ACE_TEXT_TO_CHAR_IN(logger_key)), LOG_CONS|LOG_PID, ACE_DEFAULT_SYSLOG_FACILITY); -#else - openlog (const_cast<char *> (logger_key), - LOG_CONS|LOG_PID, - ACE_DEFAULT_SYSLOG_FACILITY); -#endif /* ACE_USES_WCHAR */ // Enable logging of all syslog priorities. If logging of all // priorities is not desired, use the ACE_Log_Msg::priority_mask() @@ -115,12 +110,12 @@ ACE_Log_Msg_UNIX_Syslog::log (ACE_Log_Record &log_record) ACE_Log_Record::priority_name(ACE_Log_Priority(log_record.type())); syslog (syslog_priority, "%s: %s: %s", - ACE_TEXT_ALWAYS_CHAR (date_and_time), - ACE_TEXT_ALWAYS_CHAR (prio_name), - ACE_TEXT_ALWAYS_CHAR (line)); + ACE_TEXT_TO_CHAR_IN (date_and_time), + ACE_TEXT_TO_CHAR_IN (prio_name), + ACE_TEXT_TO_CHAR_IN (line)); } else // No formatting required. - syslog (syslog_priority, "%s", ACE_TEXT_ALWAYS_CHAR (line)); + syslog (syslog_priority, "%s", ACE_TEXT_TO_CHAR_IN (line)); } return 0; diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp index 19931a6283a..11b24b7b8d2 100644 --- a/ace/Log_Record.cpp +++ b/ace/Log_Record.cpp @@ -282,7 +282,7 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[], if (result == 0) { // Since ostream expects only chars, we cannot pass wchar_t's - s << ACE_TEXT_ALWAYS_CHAR (verbose_msg); + s << ACE_TEXT_TO_CHAR_IN (verbose_msg); s.flush (); } diff --git a/ace/Logging_Strategy.cpp b/ace/Logging_Strategy.cpp index c07d59538fa..13850dd929e 100644 --- a/ace/Logging_Strategy.cpp +++ b/ace/Logging_Strategy.cpp @@ -344,7 +344,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[]) { ACE_NEW_RETURN (output_file, - ofstream (ACE_TEXT_ALWAYS_CHAR (this->filename_)), + ofstream (ACE_TEXT_TO_CHAR_IN (this->filename_)), -1); delete_ostream = 1; } @@ -352,7 +352,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[]) { ACE_NEW_RETURN (output_file, - ofstream (ACE_TEXT_ALWAYS_CHAR (this->filename_), + ofstream (ACE_TEXT_TO_CHAR_IN (this->filename_), ios::app | ios::out), -1); delete_ostream = 1; @@ -437,7 +437,7 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &, this->log_msg_->msg_ostream (output_file); #else - output_file->open (ACE_TEXT_ALWAYS_CHAR (this->filename_), + output_file->open (ACE_TEXT_TO_CHAR_IN (this->filename_), ios::out); #endif /* ACE_LACKS_IOSTREAM_TOTALLY */ @@ -530,7 +530,7 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &, this->log_msg_->msg_ostream (output_file); #else - output_file->open (ACE_TEXT_ALWAYS_CHAR (this->filename_), + output_file->open (ACE_TEXT_TO_CHAR_IN (this->filename_), ios::out); #endif /* ACE_LACKS_IOSTREAM_TOTALLY */ diff --git a/ace/MEM_Connector.cpp b/ace/MEM_Connector.cpp index 59136b02154..b2ffb2b3fc1 100644 --- a/ace/MEM_Connector.cpp +++ b/ace/MEM_Connector.cpp @@ -71,9 +71,9 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream, ACE_LIB_TEXT ("(%P|%t) MEM_Connector can't connect ") ACE_LIB_TEXT ("to %s:%d which is not a local endpoint ") ACE_LIB_TEXT ("(local address is %s:%d)\n"), - ACE_TEXT_CHAR_TO_TCHAR (remote_sap.get_host_name ()), + ACE_TEXT_TO_TCHAR_IN (remote_sap.get_host_name ()), remote_sap.get_port_number (), - ACE_TEXT_CHAR_TO_TCHAR (this->address_.get_host_name ()), + ACE_TEXT_TO_TCHAR_IN (this->address_.get_host_name ()), this->address_.get_port_number ()), -1); else diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp index e228f89c6c5..599191272ed 100644 --- a/ace/Malloc_T.cpp +++ b/ace/Malloc_T.cpp @@ -290,19 +290,17 @@ ACE_Allocator_Adapter<MALLOC>::protect (void *addr, size_t len, int flags) template <class MALLOC> ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter (const char *pool_name) - : allocator_ (ACE_TEXT_CHAR_TO_TCHAR (pool_name)) + : allocator_ (ACE_TEXT_TO_TCHAR_IN (pool_name)) { ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter"); } -#if defined (ACE_HAS_WCHAR) template <class MALLOC> ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter (const wchar_t *pool_name) - : allocator_ (ACE_TEXT_WCHAR_TO_TCHAR (pool_name)) + : allocator_ (ACE_TEXT_TO_TCHAR_IN (pool_name)) { ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter"); } -#endif /* ACE_HAS_WCHAR */ template <class MALLOC> ACE_Allocator_Adapter<MALLOC>::~ACE_Allocator_Adapter (void) diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h index ac95db68e89..241d1529f49 100644 --- a/ace/Malloc_T.h +++ b/ace/Malloc_T.h @@ -235,14 +235,13 @@ public: ACE_Allocator_Adapter (const char *pool_name, const char *lock_name, MEMORY_POOL_OPTIONS options = 0) - : allocator_ (ACE_TEXT_CHAR_TO_TCHAR (pool_name), - ACE_TEXT_CHAR_TO_TCHAR (lock_name), + : allocator_ (ACE_TEXT_TO_TCHAR_IN (pool_name), + ACE_TEXT_TO_TCHAR_IN (lock_name), options) { ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter"); } -#if defined (ACE_HAS_WCHAR) /** * Note that @a pool_name should be located in * a directory with the appropriate visibility and protection so @@ -258,13 +257,12 @@ public: ACE_Allocator_Adapter (const wchar_t *pool_name, const wchar_t *lock_name, MEMORY_POOL_OPTIONS options = 0) - : allocator_ (ACE_TEXT_WCHAR_TO_TCHAR (pool_name), - ACE_TEXT_WCHAR_TO_TCHAR (lock_name), + : allocator_ (ACE_TEXT_TO_TCHAR_IN (pool_name), + ACE_TEXT_TO_TCHAR_IN (lock_name), options) { ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter"); } -#endif /* ACE_HAS_WCHAR */ /// Destructor. virtual ~ACE_Allocator_Adapter (void); diff --git a/ace/Manual_Event.cpp b/ace/Manual_Event.cpp index e6eaca44ec6..3864da3e06e 100644 --- a/ace/Manual_Event.cpp +++ b/ace/Manual_Event.cpp @@ -16,12 +16,11 @@ ACE_Manual_Event::ACE_Manual_Event (int initial_state, : ACE_Event (1, initial_state, type, - ACE_TEXT_CHAR_TO_TCHAR (name), + ACE_TEXT_TO_TCHAR_IN (name), arg) { } -#if defined (ACE_HAS_WCHAR) ACE_Manual_Event::ACE_Manual_Event (int initial_state, int type, const wchar_t *name, @@ -29,11 +28,10 @@ ACE_Manual_Event::ACE_Manual_Event (int initial_state, : ACE_Event (1, initial_state, type, - ACE_TEXT_WCHAR_TO_TCHAR (name), + ACE_TEXT_TO_TCHAR_IN (name), arg) { } -#endif /* ACE_HAS_WCHAR */ void ACE_Manual_Event::dump (void) const diff --git a/ace/Manual_Event.h b/ace/Manual_Event.h index 784f5cfa6f5..888df828cc9 100644 --- a/ace/Manual_Event.h +++ b/ace/Manual_Event.h @@ -43,13 +43,11 @@ public: const char *name = 0, void *arg = 0); -#if defined (ACE_HAS_WCHAR) /// constructor which will create manual event (wchar_t version) ACE_Manual_Event (int initial_state, int type, const wchar_t *name, void *arg = 0); -#endif /* ACE_HAS_WCHAR */ /// Default dtor. ~ACE_Manual_Event (void); diff --git a/ace/Multihomed_INET_Addr.cpp b/ace/Multihomed_INET_Addr.cpp index 294f2858c37..15d985c3265 100644 --- a/ace/Multihomed_INET_Addr.cpp +++ b/ace/Multihomed_INET_Addr.cpp @@ -53,7 +53,7 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number, if (ret) { ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("Invalid INET addr (%s:%u) will be ignored\n"), - ACE_TEXT_CHAR_TO_TCHAR (secondary_host_names[i]), port_number)); + ACE_TEXT_TO_TCHAR_IN (secondary_host_names[i]), port_number)); this->secondaries_.size(this->secondaries_.size() - 1); } else @@ -64,7 +64,6 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number, return; } -#if defined (ACE_HAS_WCHAR) ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number, const wchar_t host_name[], int encode, @@ -89,7 +88,7 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number, if (ret) { ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("Invalid INET addr (%s:%u) will be ignored\n"), - ACE_TEXT_WCHAR_TO_TCHAR (secondary_host_names[i]), port_number)); + ACE_TEXT_TO_TCHAR_IN (secondary_host_names[i]), port_number)); this->secondaries_.size(this->secondaries_.size() - 1); } else @@ -99,7 +98,6 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number, return; } -#endif /* ACE_HAS_WCHAR */ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number, ACE_UINT32 primary_ip_addr, @@ -160,7 +158,6 @@ ACE_Multihomed_INET_Addr::set (u_short port_number, return ACE_INET_Addr::set(port_number, host_name, encode, address_family); } -#if defined (ACE_HAS_WCHAR) // // WCHAR version of ::set // @@ -187,7 +184,6 @@ ACE_Multihomed_INET_Addr::set (u_short port_number, return ACE_INET_Addr::set(port_number, host_name, encode, address_family); } -#endif /* ACE_HAS_WCHAR */ int ACE_Multihomed_INET_Addr::set (u_short port_number, diff --git a/ace/Multihomed_INET_Addr.h b/ace/Multihomed_INET_Addr.h index 0d9e2657709..6ff13a74c00 100644 --- a/ace/Multihomed_INET_Addr.h +++ b/ace/Multihomed_INET_Addr.h @@ -85,7 +85,6 @@ public: const ACE_UINT32 *secondary_ip_addrs = 0, size_t size = 0); -#if defined (ACE_HAS_WCHAR) /** * WCHAR versions of the methods that take char's as arguments. */ @@ -102,8 +101,6 @@ public: const wchar_t *(secondary_host_names[]) = 0, size_t size = 0); -#endif /* ACE_HAS_WCHAR */ - /// Use compiler-generated copy constructor. /// Use compiler-generated assignment operator. diff --git a/ace/Mutex.h b/ace/Mutex.h index e0a7dc7e518..bcd62c12b63 100644 --- a/ace/Mutex.h +++ b/ace/Mutex.h @@ -29,10 +29,7 @@ # define ACE_DEFAULT_MUTEX_A "ACE_MUTEX" # endif /* ACE_DEFAULT_MUTEX_A */ -# if defined (ACE_HAS_WCHAR) -# define ACE_DEFAULT_MUTEX_W ACE_TEXT_WIDE(ACE_DEFAULT_MUTEX_A) -# endif /* ACE_HAS_WCHAR */ - +# define ACE_DEFAULT_MUTEX_W ACE_TEXT_WIDE(ACE_DEFAULT_MUTEX_A) # define ACE_DEFAULT_MUTEX ACE_LIB_TEXT (ACE_DEFAULT_MUTEX_A) class ACE_Time_Value; diff --git a/ace/Name_Request_Reply.cpp b/ace/Name_Request_Reply.cpp index 0c2b29493e6..a9f4ecd3e3c 100644 --- a/ace/Name_Request_Reply.cpp +++ b/ace/Name_Request_Reply.cpp @@ -20,9 +20,9 @@ ACE_Name_Request::ACE_Name_Request (void) ACE_Name_Request::ACE_Name_Request ( ACE_INT32 t, // Type of request. - const ACE_WCHAR_T name[], // Name + const wchar_t name[], // Name const ACE_UINT32 name_length, // size in bytes - const ACE_WCHAR_T value[], // + const wchar_t value[], // const ACE_UINT32 value_length, // size in bytes const char type[], // const ACE_UINT32 type_length, // size in bytes @@ -51,8 +51,8 @@ ACE_Name_Request::ACE_Name_Request ( // Set up pointers and copy name value and type into request. this->name_ = this->transfer_.data_; - this->value_ = &this->name_[name_length / sizeof (ACE_WCHAR_T) ]; - this->type_ = (char *)(&this->value_[value_length / sizeof (ACE_WCHAR_T)]); // + this->value_ = &this->name_[name_length / sizeof (wchar_t) ]; + this->type_ = (char *)(&this->value_[value_length / sizeof (wchar_t)]); // (void) ACE_OS::memcpy (this->name_, name, @@ -198,7 +198,7 @@ ACE_Name_Request::timeout (const ACE_Time_Value timeout) // = Set/get the name -const ACE_WCHAR_T * +const wchar_t * ACE_Name_Request::name (void) const { ACE_TRACE ("ACE_Name_Request::name"); @@ -206,7 +206,7 @@ ACE_Name_Request::name (void) const } void -ACE_Name_Request::name (const ACE_WCHAR_T *t) +ACE_Name_Request::name (const wchar_t *t) { ACE_TRACE ("ACE_Name_Request::name"); (void) ACE_OS::memcpy (this->name_, @@ -216,7 +216,7 @@ ACE_Name_Request::name (const ACE_WCHAR_T *t) // = Set/get the value -const ACE_WCHAR_T * +const wchar_t * ACE_Name_Request::value (void) const { ACE_TRACE ("ACE_Name_Request::value"); @@ -224,7 +224,7 @@ ACE_Name_Request::value (void) const } void -ACE_Name_Request::value (const ACE_WCHAR_T *c) +ACE_Name_Request::value (const wchar_t *c) { ACE_TRACE ("ACE_Name_Request::value"); @@ -264,7 +264,7 @@ ACE_Name_Request::encode (void *&buf) size_t nv_data_len = (this->transfer_.name_len_ + this->transfer_.value_len_) - / sizeof (ACE_WCHAR_T); + / sizeof (wchar_t); for (size_t i = 0; i < nv_data_len; i++) this->transfer_.data_[i] = @@ -302,15 +302,15 @@ ACE_Name_Request::decode (void) size_t nv_data_len = (this->transfer_.name_len_ + this->transfer_.value_len_) - / sizeof (ACE_WCHAR_T); + / sizeof (wchar_t); for (size_t i = 0; i < nv_data_len; i++) this->transfer_.data_[i] = ntohs (this->transfer_.data_[i]); this->name_ = this->transfer_.data_; - this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (ACE_WCHAR_T)]; - this->type_ = (char *)(&this->value_[this->transfer_.value_len_ / sizeof (ACE_WCHAR_T)]); + this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (wchar_t)]; + this->type_ = (char *)(&this->value_[this->transfer_.value_len_ / sizeof (wchar_t)]); this->type_[this->transfer_.type_len_] = '\0'; // Decode the variable-sized portion. diff --git a/ace/Name_Request_Reply.h b/ace/Name_Request_Reply.h index 130099a55cc..f5704b7472b 100644 --- a/ace/Name_Request_Reply.h +++ b/ace/Name_Request_Reply.h @@ -71,9 +71,9 @@ public: /// Create a ACE_Name_Request message. ACE_Name_Request (ACE_INT32 msg_type, // Type of request. - const ACE_WCHAR_T name[], // + const wchar_t name[], // const ACE_UINT32 name_length, - const ACE_WCHAR_T value[], + const wchar_t value[], const ACE_UINT32 value_length, const char type[], const ACE_UINT32 type_length, @@ -100,12 +100,12 @@ public: void timeout (const ACE_Time_Value timeout); // = Set/get the name - const ACE_WCHAR_T *name (void) const; - void name (const ACE_WCHAR_T *); + const wchar_t *name (void) const; + void name (const wchar_t *); // = Set/get the value - const ACE_WCHAR_T *value (void) const; - void value (const ACE_WCHAR_T *); + const wchar_t *value (void) const; + void value (const wchar_t *); // = Set/get the type const char *type (void) const; @@ -167,17 +167,17 @@ private: /// The data portion contains the <name_> /// followed by the <value_> /// followed by the <type_>. - ACE_WCHAR_T data_[MAX_NAME_LENGTH + MAXPATHLEN + MAXPATHLEN + 2]; + wchar_t data_[MAX_NAME_LENGTH + MAXPATHLEN + MAXPATHLEN + 2]; }; /// Transfer buffer. Transfer transfer_; /// Pointer to the beginning of the name in this->data_. - ACE_WCHAR_T *name_; + wchar_t *name_; /// Pointer to the beginning of the value in this->data_; - ACE_WCHAR_T *value_; + wchar_t *value_; /// Pointer to the beginning of the type in this->data_; char *type_; diff --git a/ace/OS_NS_Thread.cpp b/ace/OS_NS_Thread.cpp index 140adaf7ed7..4fbb02201fe 100644 --- a/ace/OS_NS_Thread.cpp +++ b/ace/OS_NS_Thread.cpp @@ -1302,7 +1302,6 @@ ACE_OS::cond_init (ACE_cond_t *cv, ACE_OS::cond_init (cv, static_cast<short> (attributes.type), name, arg); } -# if defined (ACE_HAS_WCHAR) int ACE_OS::cond_init (ACE_cond_t *cv, ACE_condattr_t &attributes, @@ -1311,7 +1310,6 @@ ACE_OS::cond_init (ACE_cond_t *cv, return ACE_OS::cond_init (cv, static_cast<short> (attributes.type), name, arg); } -# endif /* ACE_HAS_WCHAR */ int ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg) @@ -1342,7 +1340,6 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg) # endif /* ACE_HAS_THREADS */ } -# if defined (ACE_HAS_WCHAR) int ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg) { @@ -1371,7 +1368,6 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg) ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } -# endif /* ACE_HAS_WCHAR */ int ACE_OS::cond_signal (ACE_cond_t *cv) @@ -1983,7 +1979,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m, ::CreateMutexW (ACE_OS::default_win32_security_attributes_r (sa, &sa_buffer, &sd_buffer), FALSE, - ACE_Ascii_To_Wide (name).wchar_rep ()); + ACE_TEXT_TO_WCHAR_IN (name)); # else /* ACE_HAS_WINCE */ m->proc_mutex_ = ::CreateMutexA (ACE_OS::default_win32_security_attributes_r @@ -2136,7 +2132,6 @@ ACE_OS::mutex_destroy (ACE_mutex_t *m) #endif /* ACE_HAS_THREADS */ } -#if defined (ACE_HAS_WCHAR) int ACE_OS::mutex_init (ACE_mutex_t *m, int lock_scope, @@ -2173,13 +2168,12 @@ ACE_OS::mutex_init (ACE_mutex_t *m, #else /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */ return ACE_OS::mutex_init (m, lock_scope, - ACE_Wide_To_Ascii (name).char_rep (), + ACE_TEXT_TO_CHAR_IN (name), attributes, sa, lock_type); #endif /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */ } -#endif /* ACE_HAS_WCHAR */ int ACE_OS::mutex_lock (ACE_mutex_t *m) @@ -2647,7 +2641,7 @@ ACE_OS::event_destroy (ACE_event_t *event) # endif ACE_OS::munmap (event->eventdata_, sizeof (ACE_eventdata_t)); - ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR(event->name_)); + ACE_OS::shm_unlink (ACE_TEXT_TO_TCHAR_IN(event->name_)); ACE_OS::free (event->name_); return r1 != 0 || r2 != 0 ? -1 : 0; } @@ -2736,7 +2730,7 @@ ACE_OS::event_init (ACE_event_t *event, (sa, &sa_buffer, &sd_buffer), manual_reset, initial_state, - ACE_Ascii_To_Wide (name).wchar_rep ()); + ACE_TEXT_TO_WCHAR_IN (name)); # else /* ACE_HAS_WINCE */ *event = ::CreateEventA (ACE_OS::default_win32_security_attributes_r (sa, &sa_buffer, &sd_buffer), @@ -2757,13 +2751,13 @@ ACE_OS::event_init (ACE_event_t *event, { int owner = 0; // Let's see if the shared memory entity already exists. - ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name), + ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_TO_TCHAR_IN (name), O_RDWR | O_CREAT | O_EXCL, ACE_DEFAULT_FILE_PERMS); if (fd == ACE_INVALID_HANDLE) { if (errno == EEXIST) - fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name), + fd = ACE_OS::shm_open (ACE_TEXT_TO_TCHAR_IN (name), O_RDWR | O_CREAT, ACE_DEFAULT_FILE_PERMS); if (fd == ACE_INVALID_HANDLE) // Still can't get it. @@ -2791,7 +2785,7 @@ ACE_OS::event_init (ACE_event_t *event, if (evtdata == MAP_FAILED) { if (owner) - ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name)); + ACE_OS::shm_unlink (ACE_TEXT_TO_TCHAR_IN (name)); return -1; } @@ -2800,7 +2794,7 @@ ACE_OS::event_init (ACE_event_t *event, event->name_ = ACE_OS::strdup (name); if (event->name_ == 0) { - ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name)); + ACE_OS::shm_unlink (ACE_TEXT_TO_TCHAR_IN (name)); return -1; } event->eventdata_ = evtdata; diff --git a/ace/OS_NS_Thread.h b/ace/OS_NS_Thread.h index d2a793e089e..064636d08ea 100644 --- a/ace/OS_NS_Thread.h +++ b/ace/OS_NS_Thread.h @@ -1204,7 +1204,6 @@ namespace ACE_OS { const char *name = 0, void *arg = 0); -# if defined (ACE_HAS_WCHAR) # if defined (ACE_LACKS_COND_T) && ! defined (ACE_PSOS_DIAB_MIPS) extern ACE_Export # else @@ -1224,7 +1223,6 @@ namespace ACE_OS { ACE_condattr_t &attributes, const wchar_t *name, void *arg = 0); -# endif /* ACE_HAS_WCHAR */ #if defined (ACE_LACKS_COND_T) && ! defined (ACE_PSOS_DIAB_MIPS) extern ACE_Export @@ -1283,7 +1281,6 @@ namespace ACE_OS { void *arg = 0, LPSECURITY_ATTRIBUTES sa = 0); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int event_init (ACE_event_t *event, int manual_reset, @@ -1292,7 +1289,6 @@ namespace ACE_OS { const wchar_t *name, void *arg = 0, LPSECURITY_ATTRIBUTES sa = 0); -# endif /* ACE_HAS_WCHAR */ extern ACE_Export int event_pulse (ACE_event_t *event); @@ -1333,7 +1329,6 @@ namespace ACE_OS { LPSECURITY_ATTRIBUTES sa = 0, int lock_type = 0); -#if defined (ACE_HAS_WCHAR) extern ACE_Export int mutex_init (ACE_mutex_t *m, int lock_scope, @@ -1341,7 +1336,6 @@ namespace ACE_OS { ACE_mutexattr_t *arg = 0, LPSECURITY_ATTRIBUTES sa = 0, int lock_type = 0); -#endif /* ACE_HAS_WCHAR */ /// Win32 note: Abandoned mutexes are not treated differently. 0 is /// returned since the calling thread does get the ownership. @@ -1498,7 +1492,6 @@ namespace ACE_OS { int max = 0x7fffffff, LPSECURITY_ATTRIBUTES sa = 0); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int sema_init (ACE_sema_t *s, u_int count, @@ -1507,7 +1500,6 @@ namespace ACE_OS { void *arg = 0, int max = 0x7fffffff, LPSECURITY_ATTRIBUTES sa = 0); -# endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int sema_post (ACE_sema_t *s); @@ -1786,13 +1778,11 @@ namespace ACE_OS { const char *name = 0, ACE_mutexattr_t *arg = 0); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int thread_mutex_init (ACE_thread_mutex_t *m, int lock_type, const wchar_t *name, ACE_mutexattr_t *arg = 0); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int thread_mutex_lock (ACE_thread_mutex_t *m); diff --git a/ace/OS_NS_Thread.inl b/ace/OS_NS_Thread.inl index 291a60a4ebd..bde9fa981e4 100644 --- a/ace/OS_NS_Thread.inl +++ b/ace/OS_NS_Thread.inl @@ -329,24 +329,20 @@ ACE_OS::cond_init (ACE_cond_t *cv, # endif /* ACE_HAS_THREADS */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::cond_init (ACE_cond_t *cv, ACE_condattr_t &attributes, const wchar_t *name, void *arg) { - return ACE_OS::cond_init (cv, attributes, ACE_Wide_To_Ascii (name).char_rep (), arg); + return ACE_OS::cond_init (cv, attributes, ACE_TEXT_TO_CHAR_IN (name), arg); } -#endif /* ACE_HAS_WCHAR */ -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg) { - return ACE_OS::cond_init (cv, type, ACE_Wide_To_Ascii (name).char_rep (), arg); + return ACE_OS::cond_init (cv, type, ACE_TEXT_TO_CHAR_IN (name), arg); } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::cond_signal (ACE_cond_t *cv) @@ -523,7 +519,6 @@ ACE_OS::mutex_lock (ACE_mutex_t *m, return timeout == 0 ? ACE_OS::mutex_lock (m) : ACE_OS::mutex_lock (m, *timeout); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::event_init (ACE_event_t *event, int manual_reset, @@ -552,12 +547,11 @@ ACE_OS::event_init (ACE_event_t *event, manual_reset, initial_state, type, - ACE_Wide_To_Ascii (name).char_rep (), + ACE_TEXT_TO_CHAR_IN (name), arg, sa); #endif /* ACE_WIN32 */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE long ACE_OS::priority_control (ACE_idtype_t idtype, ACE_id_t identifier, int cmd, void *arg) @@ -1423,13 +1417,13 @@ ACE_OS::sema_init (ACE_sema_t *s, if (type == USYNC_PROCESS) { // Let's see if it already exists. - ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR(name), + ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_TO_TCHAR_IN(name), O_RDWR | O_CREAT | O_EXCL, ACE_DEFAULT_FILE_PERMS); if (fd == ACE_INVALID_HANDLE) { if (errno == EEXIST) - fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR(name), + fd = ACE_OS::shm_open (ACE_TEXT_TO_TCHAR_IN(name), O_RDWR | O_CREAT, ACE_DEFAULT_FILE_PERMS); else @@ -1538,7 +1532,7 @@ ACE_OS::sema_init (ACE_sema_t *s, s->fd_[0] = s->fd_[1] = ACE_INVALID_HANDLE; bool creator = false; - if (ACE_OS::mkfifo (ACE_TEXT_CHAR_TO_TCHAR(name), mode) < 0) + if (ACE_OS::mkfifo (ACE_TEXT_TO_TCHAR_IN(name), mode) < 0) { if (errno != EEXIST) /* already exists OK else ERR */ return -1; @@ -1716,7 +1710,6 @@ ACE_OS::sema_init (ACE_sema_t *s, #endif /* ACE_HAS_POSIX_SEM */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::sema_init (ACE_sema_t *s, u_int count, @@ -1781,10 +1774,9 @@ ACE_OS::sema_init (ACE_sema_t *s, # endif /* ACE_USES_WINCE_SEMA_SIMULATION */ # else /* ACE_HAS_WTHREADS */ // Just call the normal char version. - return ACE_OS::sema_init (s, count, type, ACE_Wide_To_Ascii (name).char_rep (), arg, max, sa); + return ACE_OS::sema_init (s, count, type, ACE_TEXT_TO_CHAR_IN (name), arg, max, sa); # endif /* ACE_HAS_WTHREADS */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::sema_post (ACE_sema_t *s) @@ -3488,7 +3480,6 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m, #endif /* ACE_HAS_THREADS */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m, int lock_type, @@ -3522,7 +3513,6 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m, #endif /* ACE_HAS_THREADS */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m) diff --git a/ace/OS_NS_ctype.h b/ace/OS_NS_ctype.h index ce9fc51fd19..bd0b9edcdf4 100644 --- a/ace/OS_NS_ctype.h +++ b/ace/OS_NS_ctype.h @@ -94,21 +94,17 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int ace_tolower (int c); -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWLOWER) /// Converts a character to lower case (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wint_t ace_towlower (wint_t c); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWLOWER */ /// Converts a character to upper case (char version). ACE_NAMESPACE_INLINE_FUNCTION int ace_toupper (int c); -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWUPPER) /// Converts a character to upper case (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wint_t ace_towupper (wint_t c); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWUPPER */ //@} diff --git a/ace/OS_NS_ctype.inl b/ace/OS_NS_ctype.inl index 96d50465c4c..e8141bfaa15 100644 --- a/ace/OS_NS_ctype.inl +++ b/ace/OS_NS_ctype.inl @@ -2,9 +2,7 @@ // $Id$ #include "ace/os_include/os_ctype.h" -#if defined ACE_HAS_WCHAR # include "ace/os_include/os_wctype.h" -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::ace_isalnum (ACE_TCHAR c) @@ -122,13 +120,16 @@ ACE_OS::ace_tolower (int c) return tolower (c); } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWLOWER) ACE_INLINE wint_t ACE_OS::ace_towlower (wint_t c) { - return towlower (c); + #if !defined (ACE_LACKS_TOWLOWER) + return towlower (c); + #else + ACE_UNUSED_ARG( c ); + ACE_NOTSUP_RETURN (0); + #endif } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWLOWER */ ACE_INLINE int ACE_OS::ace_toupper (int c) @@ -136,10 +137,14 @@ ACE_OS::ace_toupper (int c) return toupper (c); } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWUPPER) ACE_INLINE wint_t ACE_OS::ace_towupper (wint_t c) { - return towupper (c); + #if !defined (ACE_LACKS_TOWUPPER) + return towupper (c); + #else + ACE_UNUSED_ARG( c ); + ACE_NOTSUP_RETURN (0); + #endif } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWUPPER */ + diff --git a/ace/OS_NS_dirent.inl b/ace/OS_NS_dirent.inl index 28ea14b7531..7d2b7bfb288 100644 --- a/ace/OS_NS_dirent.inl +++ b/ace/OS_NS_dirent.inl @@ -54,7 +54,7 @@ ACE_OS::opendir (const ACE_TCHAR *filename) # elif defined (ACE_HAS_NONCONST_OPENDIR) return ::opendir (const_cast<char *> (filename)); # else /* ! ACE_WIN32 && ACE_LACKS_OPENDIR */ - return ::opendir (ACE_TEXT_ALWAYS_CHAR (filename)); + return ::opendir (ACE_TEXT_TO_CHAR_IN (filename)); # endif /* ACE_WIN32 && ACE_LACKS_OPENDIR */ # endif /* ACE_PSOS */ #else @@ -167,7 +167,7 @@ ACE_OS::scandir (const ACE_TCHAR *dirname, const struct dirent **f2)) { #if defined (ACE_HAS_SCANDIR) - return ::scandir (ACE_TEXT_ALWAYS_CHAR (dirname), + return ::scandir (ACE_TEXT_TO_CHAR_IN (dirname), namelist, selector, # if defined (ACE_SCANDIR_CMP_USES_VOIDPTR) diff --git a/ace/OS_NS_dlfcn.inl b/ace/OS_NS_dlfcn.inl index a325fa74af6..8f3573587c8 100644 --- a/ace/OS_NS_dlfcn.inl +++ b/ace/OS_NS_dlfcn.inl @@ -86,7 +86,7 @@ ACE_OS::dlerror (void) # if defined (ACE_USES_WCHAR) const size_t BufLen = 256; static wchar_t buf[BufLen]; - ACE_OS::strncpy (buf, ACE_TEXT_CHAR_TO_TCHAR (err), BufLen); + ACE_OS::string_copy (buf, err, BufLen); return buf; # else return const_cast <char *> (err); @@ -131,13 +131,13 @@ ACE_OS::dlopen (const ACE_TCHAR *fname, void *handle; # if defined (ACE_HAS_SGIDLADD) ACE_OSCALL - (::sgidladd (ACE_TEXT_ALWAYS_CHAR (filename), mode), void *, 0, handle); + (::sgidladd (ACE_TEXT_TO_CHAR_IN (filename), mode), void *, 0, handle); # elif defined (_M_UNIX) ACE_OSCALL - (::_dlopen (ACE_TEXT_ALWAYS_CHAR (filename), mode), void *, 0, handle); + (::_dlopen (ACE_TEXT_TO_CHAR_IN (filename), mode), void *, 0, handle); # else ACE_OSCALL - (::dlopen (ACE_TEXT_ALWAYS_CHAR (filename), mode), void *, 0, handle); + (::dlopen (ACE_TEXT_TO_CHAR_IN (filename), mode), void *, 0, handle); # endif /* ACE_HAS_SGIDLADD */ # if !defined (ACE_HAS_AUTOMATIC_INIT_FINI) if (handle != 0) @@ -223,12 +223,12 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle, # if defined (ACE_USES_WCHAR) symbolname = sname; # else - ACE_Ascii_To_Wide sname_xlate (sname); + ACE_TEXT_TO_WCHAR_IN sname_xlate (sname); symbolname = sname_xlate.wchar_rep (); # endif /* ACE_USES_WCHAR */ #elif defined (ACE_USES_WCHAR) // WinCE is WCHAR always; other platforms need a char * symbol name - ACE_Wide_To_Ascii w_sname (sname); + ACE_TEXT_TO_CHAR_IN w_sname (sname); char *symbolname = w_sname.char_rep (); #elif defined (ACE_HAS_CHARPTR_DL) char *symbolname = const_cast<char *> (sname); diff --git a/ace/OS_NS_fcntl.cpp b/ace/OS_NS_fcntl.cpp index 3b6d205cb3d..8c69f8b8b51 100644 --- a/ace/OS_NS_fcntl.cpp +++ b/ace/OS_NS_fcntl.cpp @@ -80,7 +80,7 @@ ACE_OS::open (const char *filename, SECURITY_DESCRIPTOR sd_buffer; #if defined (ACE_HAS_WINCE) - ACE_HANDLE h = ::CreateFileW (ACE_Ascii_To_Wide (filename).wchar_rep (), + ACE_HANDLE h = ::CreateFileW (ACE_TEXT_TO_WCHAR_IN (filename), access, shared_mode, ACE_OS::default_win32_security_attributes_r @@ -167,7 +167,6 @@ ACE_OS::open (const char *filename, #endif /* ACE_WIN32 */ } -#if defined (ACE_HAS_WCHAR) ACE_HANDLE ACE_OS::open (const wchar_t *filename, int mode, @@ -259,10 +258,9 @@ ACE_OS::open (const wchar_t *filename, return h; #else /* ACE_WIN32 */ // Just emulate with ascii version - return ACE_OS::open (ACE_Wide_To_Ascii (filename).char_rep (), + return ACE_OS::open (ACE_TEXT_TO_CHAR_IN (filename), mode, perms, sa); #endif /* ACE_WIN32 */ } -#endif /* ACE_HAS_WCHAR */ diff --git a/ace/OS_NS_fcntl.h b/ace/OS_NS_fcntl.h index a903316cdaa..08bb4230d73 100644 --- a/ace/OS_NS_fcntl.h +++ b/ace/OS_NS_fcntl.h @@ -69,14 +69,12 @@ namespace ACE_OS { int mode, int perms = ACE_DEFAULT_OPEN_PERMS, LPSECURITY_ATTRIBUTES sa = 0); -#if defined (ACE_HAS_WCHAR) + extern ACE_Export ACE_HANDLE open (const wchar_t *filename, int mode, int perms = ACE_DEFAULT_OPEN_PERMS, LPSECURITY_ATTRIBUTES sa = 0); -#endif /* ACE_HAS_WCHAR */ - } /* namespace ACE_OS */ # if defined (ACE_HAS_INLINED_OSCALLS) diff --git a/ace/OS_NS_stdio.cpp b/ace/OS_NS_stdio.cpp index 62221f597e8..6e3a45cd926 100644 --- a/ace/OS_NS_stdio.cpp +++ b/ace/OS_NS_stdio.cpp @@ -155,7 +155,6 @@ ACE_OS::fopen (const char *filename, return 0; } -#if defined (ACE_HAS_WCHAR) FILE * ACE_OS::fopen (const wchar_t *filename, const ACE_TCHAR *mode) @@ -202,7 +201,6 @@ ACE_OS::fopen (const wchar_t *filename, } return 0; } -#endif /* ACE_HAS_WCHAR */ #endif /* ACE_WIN32 */ @@ -218,7 +216,6 @@ ACE_OS::fprintf (FILE *fp, const char *format, ...) return result; } -#if defined (ACE_HAS_WCHAR) int ACE_OS::fprintf (FILE *fp, const wchar_t *format, ...) { @@ -239,7 +236,6 @@ ACE_OS::fprintf (FILE *fp, const wchar_t *format, ...) # endif /* ACE_HAS_VFWPRINTF */ } -#endif /* ACE_HAS_WCHAR */ // The following *printf functions aren't inline because @@ -298,8 +294,6 @@ ACE_OS::snprintf (char *buf, size_t maxlen, const char *format, ...) #endif /* ACE_HAS_SNPRINTF */ } -#if defined (ACE_HAS_WCHAR) - int ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...) { @@ -343,7 +337,6 @@ ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...) ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_SNPRINTF */ } -#endif /* ACE_HAS_WCHAR */ int ACE_OS::sprintf (char *buf, const char *format, ...) @@ -358,7 +351,6 @@ ACE_OS::sprintf (char *buf, const char *format, ...) return result; } -#if defined (ACE_HAS_WCHAR) int ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...) { @@ -397,4 +389,4 @@ ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...) # endif /* XPG5 || ACE_HAS_DINKUM_STL */ } -#endif /* ACE_HAS_WCHAR */ + diff --git a/ace/OS_NS_stdio.h b/ace/OS_NS_stdio.h index 08f0311116d..45d4cc99c3c 100644 --- a/ace/OS_NS_stdio.h +++ b/ace/OS_NS_stdio.h @@ -149,11 +149,10 @@ namespace ACE_OS { char *cuserid (char *user, size_t maxlen = ACE_MAX_USERID); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *cuserid (wchar_t *user, size_t maxlen = ACE_MAX_USERID); -# endif /* ACE_HAS_WCHAR */ + # endif /* ACE_LACKS_CUSERID */ //@} @@ -179,10 +178,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION char *fgets (char *buf, int size, FILE *fp); -# if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FGETWS) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *fgets (wchar_t *buf, int size, FILE *fp); -# endif /* ACE_HAS_WCHAR && !ACE_LACKS_FGETWS */ //@{ @name A set of wrappers for file locks. @@ -243,14 +240,12 @@ namespace ACE_OS { #endif /* ACE_WIN32 */ FILE *fopen (const char *filename, const ACE_TCHAR *mode); -#if defined (ACE_HAS_WCHAR) #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) extern ACE_Export #else ACE_NAMESPACE_INLINE_FUNCTION #endif /* ACE_WIN32 */ FILE *fopen (const wchar_t *filename, const ACE_TCHAR *mode); -#endif /* ACE_HAS_WCHAR */ #if defined (ACE_WIN32) /// Default Win32 Security Attributes definition. @@ -293,20 +288,16 @@ namespace ACE_OS { extern ACE_Export int fprintf (FILE *fp, const char *format, ...); -# if defined (ACE_HAS_WCHAR) extern ACE_Export int fprintf (FILE *fp, const wchar_t *format, ...); -# endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int fputs (const char *s, FILE *stream); -# if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FPUTWS) ACE_NAMESPACE_INLINE_FUNCTION int fputs (const wchar_t *s, FILE *stream); -# endif /* ACE_HAS_WCHAR && !ACE_LACKS_FPUTWS */ ACE_NAMESPACE_INLINE_FUNCTION size_t fread (void *ptr, @@ -339,10 +330,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION void perror (const char *s); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION void perror (const wchar_t *s); -#endif /* ACE_HAS_WCHAR */ extern ACE_Export int printf (const char *format, ...); @@ -350,22 +339,18 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int puts (const char *s); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int puts (const wchar_t *s); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int rename (const char *old_name, const char *new_name, int flags = -1); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int rename (const wchar_t *old_name, const wchar_t *new_name, int flags = -1); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION void rewind (FILE *fp); @@ -373,28 +358,22 @@ namespace ACE_OS { extern ACE_Export int snprintf (char *buf, size_t maxlen, const char *format, ...); -# if defined (ACE_HAS_WCHAR) extern ACE_Export int snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format,...); -# endif /* ACE_HAS_WCHAR */ extern ACE_Export int sprintf (char *buf, const char *format, ...); -# if defined (ACE_HAS_WCHAR) extern ACE_Export int sprintf (wchar_t *buf, const wchar_t *format, ...); -# endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION char *tempnam (const char *dir = 0, const char *pfx = 0); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *tempnam (const wchar_t *dir, const wchar_t *pfx = 0); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int vsprintf (char *buffer, const char *format, va_list argptr); @@ -402,13 +381,11 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int vsnprintf (char *buffer, size_t maxlen, const char *format, va_list argptr); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr); ACE_NAMESPACE_INLINE_FUNCTION int vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_list argptr); -# endif /* ACE_HAS_WCHAR */ } /* namespace ACE_OS */ diff --git a/ace/OS_NS_stdio.inl b/ace/OS_NS_stdio.inl index aa5357e9db3..694491e1098 100644 --- a/ace/OS_NS_stdio.inl +++ b/ace/OS_NS_stdio.inl @@ -586,7 +586,6 @@ ACE_OS::cuserid (char *user, size_t maxlen) #endif /* VXWORKS */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::cuserid (wchar_t *user, size_t maxlen) { @@ -597,14 +596,14 @@ ACE_OS::cuserid (wchar_t *user, size_t maxlen) else return user; # else /* ACE_WIN32 */ - char *char_user; + char *char_user = 0; wchar_t *result = 0; ACE_NEW_RETURN (char_user, char[maxlen + 1], 0); if (ACE_OS::cuserid (char_user, maxlen)) { - ACE_OS::strcpy (user, ACE_Ascii_To_Wide (char_user).wchar_rep ()); + ACE_OS::string_copy (user, char_user, maxlen + 1); result = user; } @@ -613,7 +612,6 @@ ACE_OS::cuserid (wchar_t *user, size_t maxlen) return result; # endif /* ACE_WIN32 */ } -#endif /* ACE_HAS_WCHAR */ #endif /* ACE_LACKS_CUSERID */ ACE_INLINE int @@ -628,7 +626,7 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode) { ACE_OS_TRACE ("ACE_OS::fdopen"); # if defined (ACE_HAS_WINCE) - ACE_OSCALL_RETURN (::_wfdopen (handle, ACE_TEXT_ALWAYS_WCHAR (mode)), + ACE_OSCALL_RETURN (::_wfdopen (handle, ACE_TEXT_TO_WCHAR_IN (mode)), FILE*, 0); # elif defined (ACE_WIN32) @@ -673,7 +671,7 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode) ACE_NOTSUP_RETURN (0); # else ACE_OSCALL_RETURN - (::fdopen (handle, ACE_TEXT_ALWAYS_CHAR (mode)), FILE *, 0); + (::fdopen (handle, ACE_TEXT_TO_CHAR_IN (mode)), FILE *, 0); # endif /* ACE_HAS_WINCE */ } @@ -711,14 +709,19 @@ ACE_OS::fgets (char *buf, int size, FILE *fp) ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgets (buf, size, fp), char *, 0); } -#if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FGETWS) ACE_INLINE wchar_t * ACE_OS::fgets (wchar_t *buf, int size, FILE *fp) { +#if !defined(ACE_LACKS_FGETWS) ACE_OS_TRACE ("ACE_OS::fgets"); ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetws (buf, size, fp), wchar_t *, 0); +#else + ACE_UNUSED_ARG( buf ); + ACE_UNUSED_ARG( size ); + ACE_UNUSED_ARG( fp ); + ACE_NOTSUP_RETURN (0); +#endif } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FGETWS */ #if !(defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) // Win32 PC implementation of fopen () is in OS_NS_stdio.cpp. @@ -727,25 +730,23 @@ ACE_OS::fopen (const char *filename, const ACE_TCHAR *mode) { ACE_OS_TRACE ("ACE_OS::fopen"); ACE_OSCALL_RETURN - (::fopen (filename, ACE_TEXT_ALWAYS_CHAR (mode)), FILE *, 0); + (::fopen (filename, ACE_TEXT_TO_CHAR_IN (mode)), FILE *, 0); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE FILE * ACE_OS::fopen (const wchar_t *filename, const ACE_TCHAR *mode) { ACE_OS_TRACE ("ACE_OS::fopen"); #if defined (ACE_HAS_WINCE) ACE_OSCALL_RETURN - (::_wfopen (filename, ACE_TEXT_ALWAYS_WCHAR (mode)), FILE *, 0); + (::_wfopen (filename, ACE_TEXT_TO_WCHAR_IN (mode)), FILE *, 0); #else // Non-Windows doesn't use wchar_t file systems. - ACE_Wide_To_Ascii n_filename (filename); ACE_OSCALL_RETURN - (::fopen (n_filename.char_rep (), ACE_TEXT_ALWAYS_CHAR (mode)), FILE*, 0); + (::fopen (ACE_TEXT_TO_CHAR_IN (filename).c_str (), + ACE_TEXT_TO_CHAR_IN (mode)), FILE*, 0); #endif /* ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ #endif /* ACE_WIN32 */ @@ -756,14 +757,18 @@ ACE_OS::fputs (const char *s, FILE *stream) ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputs (s, stream), int, -1); } -#if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FPUTWS) ACE_INLINE int ACE_OS::fputs (const wchar_t *s, FILE *stream) { +#if !defined(ACE_LACKS_FPUTWS) ACE_OS_TRACE ("ACE_OS::fputs"); ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputws (s, stream), int, -1); +#else + ACE_UNUSED_ARG( s ); + ACE_UNUSED_ARG( stream ); + ACE_NOTSUP_RETURN (-1); +#endif } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FPUTWS */ ACE_INLINE size_t ACE_OS::fread (void *ptr, size_t size, size_t nelems, FILE *fp) @@ -779,14 +784,14 @@ ACE_OS::freopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode, FILE* stream) { ACE_OS_TRACE ("ACE_OS::freopen"); #if defined (ACE_WIN32) && (defined(ACE_USES_WCHAR) || defined(ACE_HAS_WINCE)) - ACE_OSCALL_RETURN (::_wfreopen (ACE_TEXT_ALWAYS_WCHAR (filename), - ACE_TEXT_ALWAYS_WCHAR (mode), + ACE_OSCALL_RETURN (::_wfreopen (ACE_TEXT_TO_WCHAR_IN (filename), + ACE_TEXT_TO_WCHAR_IN (mode), stream), FILE *, 0); #else ACE_OSCALL_RETURN - (ACE_STD_NAMESPACE::freopen (ACE_TEXT_ALWAYS_CHAR (filename), - ACE_TEXT_ALWAYS_CHAR (mode), + (ACE_STD_NAMESPACE::freopen (ACE_TEXT_TO_CHAR_IN (filename), + ACE_TEXT_TO_CHAR_IN (mode), stream), FILE *, 0); #endif /* ACE_WIN32 && ACE_USES_WCHAR */ @@ -851,7 +856,6 @@ ACE_OS::perror (const char *s) #endif /* ACE_HAS_WINCE */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE void ACE_OS::perror (const wchar_t *s) { @@ -862,11 +866,9 @@ ACE_OS::perror (const wchar_t *s) #elif defined (ACE_WIN32) ::_wperror (s); #else - ACE_Wide_To_Ascii n_s (s); - ::perror (n_s.char_rep ()); + ::perror (ACE_TEXT_TO_CHAR_IN (s)); #endif /* ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::puts (const char *s) @@ -875,7 +877,6 @@ ACE_OS::puts (const char *s) ACE_OSCALL_RETURN (::puts (s), int, -1); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::puts (const wchar_t *s) { @@ -884,11 +885,9 @@ ACE_OS::puts (const wchar_t *s) ACE_OSCALL_RETURN (::_putws (s), int, -1); #else /* ACE_WIN32 */ // There's no putws()... - ACE_Wide_To_Ascii n_s (s); - ACE_OSCALL_RETURN (::puts (n_s.char_rep ()), int, -1); + ACE_OSCALL_RETURN (::puts (ACE_TEXT_TO_CHAR_IN (s)), int, -1); #endif /* ACE_WIN32 */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::rename (const char *old_name, @@ -903,8 +902,8 @@ ACE_OS::rename (const char *old_name, # elif defined (ACE_HAS_WINCE) // Win CE is always wide-char. ACE_UNUSED_ARG (flags); - if (0 != MoveFile (ACE_TEXT_CHAR_TO_TCHAR (old_name), - ACE_TEXT_CHAR_TO_TCHAR (new_name))) + if (0 != MoveFile (ACE_TEXT_TO_TCHAR_IN (old_name), + ACE_TEXT_TO_TCHAR_IN (new_name))) ACE_FAIL_RETURN (-1); return 0; # elif defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 == 1) @@ -923,7 +922,6 @@ ACE_OS::rename (const char *old_name, # endif /* ACE_LACKS_RENAME */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::rename (const wchar_t *old_name, const wchar_t *new_name, @@ -953,12 +951,10 @@ ACE_OS::rename (const wchar_t *old_name, ACE_UNUSED_ARG (flags); ACE_OSCALL_RETURN (::_wrename (old_name, new_name), int, -1); # else /* ACE_LACKS_RENAME */ - ACE_Wide_To_Ascii nold_name (old_name); - ACE_Wide_To_Ascii nnew_name (new_name); - return ACE_OS::rename (nold_name.char_rep (), nnew_name.char_rep (), flags); + return ACE_OS::rename (ACE_TEXT_TO_CHAR_IN (old_name), + ACE_TEXT_TO_CHAR_IN (new_name), flags); # endif /* ACE_LACKS_RENAME */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE void ACE_OS::rewind (FILE *fp) @@ -991,7 +987,6 @@ ACE_OS::tempnam (const char *dir, const char *pfx) #endif /* ACE_LACKS_TEMPNAM */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx) { @@ -1008,25 +1003,18 @@ ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx) # endif /* __BORLANDC__ */ #else /* ACE_LACKS_TEMPNAM */ // No native wide-char support; convert to narrow and call the char* variant. - char *ndir = ACE_Wide_To_Ascii (dir).char_rep (); - char *npfx = ACE_Wide_To_Ascii (pfx).char_rep (); - char *name = ACE_OS::tempnam (ndir, npfx); + char *name = ACE_OS::tempnam (ACE_TEXT_TO_CHAR_IN (dir), + ACE_TEXT_TO_CHAR_IN (pfx)); // ACE_OS::tempnam returns a pointer to a malloc()-allocated space. // Convert that string to wide-char and free() the original. wchar_t *wname = 0; if (name != 0) { - size_t namelen = ACE_OS::strlen (name) + 1; - wname = reinterpret_cast<wchar_t *> - (ACE_OS::malloc (namelen * sizeof (wchar_t))); - if (wname != 0) - ACE_OS::strcpy (wname, ACE_Ascii_To_Wide (name).wchar_rep ()); - ACE_OS::free (name); + wname = ACE_TEXT_TO_WCHAR_OUT( name ); } return wname; #endif /* ACE_LACKS_TEMPNAM */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::vsprintf (char *buffer, const char *format, va_list argptr) @@ -1068,7 +1056,6 @@ ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap) #endif /* ACE_HAS_SNPRINTF */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr) { @@ -1097,9 +1084,7 @@ ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr) # endif /* XPG5 || ACE_HAS_DINKUM_STL */ } -#endif /* ACE_HAS_WCHAR */ -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_list ap) { @@ -1119,7 +1104,6 @@ ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_lis # endif /* platforms with a variant of vswprintf */ } -#endif /* ACE_HAS_WCHAR */ #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) #if defined (ACE_WIN32) diff --git a/ace/OS_NS_stdlib.cpp b/ace/OS_NS_stdlib.cpp index 936e5c47427..2bb6e1b1070 100644 --- a/ace/OS_NS_stdlib.cpp +++ b/ace/OS_NS_stdlib.cpp @@ -157,7 +157,7 @@ ACE_OS::itoa_emulation (int value, char *string, int radix) } #endif /* !ACE_HAS_ITOA */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW) +#if defined (ACE_LACKS_ITOW) wchar_t * ACE_OS::itow_emulation (int value, wchar_t *string, int radix) { @@ -207,7 +207,7 @@ ACE_OS::itow_emulation (int value, wchar_t *string, int radix) return string; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */ +#endif /* ACE_LACKS_ITOW */ void * ACE_OS::malloc (size_t nbytes) diff --git a/ace/OS_NS_stdlib.h b/ace/OS_NS_stdlib.h index 38fcd9e9187..0398a1263ed 100644 --- a/ace/OS_NS_stdlib.h +++ b/ace/OS_NS_stdlib.h @@ -72,10 +72,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int atoi (const char *s); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int atoi (const wchar_t *s); -# endif /* ACE_HAS_WCHAR */ // atop not in spec # if defined (atop) @@ -85,10 +83,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION void *atop (const char *s); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION void *atop (const wchar_t *s); -# endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION void *bsearch (const void *key, @@ -109,10 +105,10 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION char *getenv (const char *symbol); -# if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32) +# if defined (ACE_WIN32) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *getenv (const wchar_t *symbol); -# endif /* ACE_HAS_WCHAR && ACE_WIN32 */ +# endif /* ACE_WIN32 */ // not in spec extern ACE_Export @@ -123,11 +119,9 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION char *itoa (int value, char *string, int radix); -#if defined (ACE_HAS_WCHAR) /// Converts an integer to a string. ACE_NAMESPACE_INLINE_FUNCTION wchar_t *itoa (int value, wchar_t *string, int radix); -#endif /* ACE_HAS_WCHAR */ #if !defined (ACE_HAS_ITOA) /// Emulated itoa - Converts an integer to a string. @@ -135,11 +129,11 @@ namespace ACE_OS { char *itoa_emulation (int value, char *string, int radix); #endif /* !ACE_HAS_ITOA */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW) +#if defined (ACE_LACKS_ITOW) /// Emulated itow - Converts an integer to a string. extern ACE_Export wchar_t *itow_emulation (int value, wchar_t *string, int radix); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */ +#endif /* ACE_LACKS_ITOW */ extern ACE_Export void *malloc (size_t); @@ -147,40 +141,31 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION ACE_HANDLE mkstemp (char *s); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION ACE_HANDLE mkstemp (wchar_t *s); -# endif /* ACE_HAS_WCHAR */ #if defined (ACE_LACKS_MKSTEMP) extern ACE_Export ACE_HANDLE mkstemp_emulation (ACE_TCHAR * s); #endif /* ACE_LACKS_MKSTEMP */ -#if !defined (ACE_LACKS_MKTEMP) ACE_NAMESPACE_INLINE_FUNCTION char *mktemp (char *s); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *mktemp (wchar_t *s); -# endif /* ACE_HAS_WCHAR */ -#else - extern ACE_Export - ACE_TCHAR *mktemp (ACE_TCHAR *s); -#endif /* !ACE_LACKS_MSTEMP */ ACE_NAMESPACE_INLINE_FUNCTION int putenv (const char *string); -#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32) +#if defined (ACE_WIN32) // Windows is the only platform that supports a wchar_t environment. // Since other platforms make @a string part of the environment, it's // a certain memory leak to copy and transform wchar_t to char for // emulating this, so it's not attempted. ACE_NAMESPACE_INLINE_FUNCTION int putenv (const wchar_t *string); -#endif /* ACE_HAS_WCHAR && ACE_WIN32 */ +#endif /* ACE_WIN32 */ ACE_NAMESPACE_INLINE_FUNCTION void qsort (void *base, @@ -205,10 +190,8 @@ namespace ACE_OS { # endif /* !ACE_LACKS_REALPATH */ char *realpath (const char *file_name, char *resolved_name); -# if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *realpath (const wchar_t *file_name, wchar_t *resolved_name); -# endif /* ACE_HAS_WCHAR */ #endif /* ACE_HAS_WINCE */ // exit_hook and set_exit_hook not in spec @@ -232,21 +215,17 @@ namespace ACE_OS { double strtod (const char *s, char **endptr); #endif /* !ACE_LACKS_STRTOD */ -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOD) /// Converts a string to a double value (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION double strtod (const wchar_t *s, wchar_t **endptr); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOD */ /// Converts a string to a long value (char version). ACE_NAMESPACE_INLINE_FUNCTION long strtol (const char *s, char **ptr, int base); -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL) /// Converts a string to a long value (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION long strtol (const wchar_t *s, wchar_t **ptr, int base); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */ #if defined (ACE_LACKS_STRTOL) extern ACE_Export @@ -257,11 +236,11 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION unsigned long strtoul (const char *s, char **ptr, int base); -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL) +#if !defined (ACE_LACKS_WCSTOUL) /// Converts a string to an unsigned long value (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION unsigned long strtoul (const wchar_t *s, wchar_t **ptr, int base); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */ +#endif /* !ACE_LACKS_WCSTOUL */ #if defined (ACE_LACKS_STRTOUL) extern ACE_Export @@ -276,6 +255,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +#include "ace/OS_NS_stdlib_base.inl" + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_stdlib.inl b/ace/OS_NS_stdlib.inl index 3373a706c24..3efea39a4f9 100644 --- a/ace/OS_NS_stdlib.inl +++ b/ace/OS_NS_stdlib.inl @@ -7,6 +7,7 @@ #include "ace/Global_Macros.h" #include "ace/os_include/os_errno.h" #include "ace/os_include/os_search.h" +#include "ace/os_include/os_limits.h" #if defined(ACE_WCHAR_IN_STD_NAMESPACE) # define ACE_WCHAR_STD_NAMESPACE std @@ -62,17 +63,15 @@ ACE_OS::atoi (const char *s) ACE_OSCALL_RETURN (::atoi (s), int, -1); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::atoi (const wchar_t *s) { #if defined (ACE_WIN32) ACE_OSCALL_RETURN (::_wtoi (s), int, -1); #else /* ACE_WIN32 */ - return ACE_OS::atoi (ACE_Wide_To_Ascii(s).char_rep()); + return ACE_OS::atoi (ACE_TEXT_TO_CHAR_IN (s)); #endif /* ACE_WIN32 */ } -#endif /* ACE_HAS_WCHAR */ #if defined (atop) # undef atop @@ -95,7 +94,6 @@ ACE_OS::atop (const char *s) return p; } -#if defined (ACE_HAS_WCHAR) ACE_INLINE void * ACE_OS::atop (const wchar_t *s) { @@ -107,7 +105,6 @@ ACE_OS::atop (const wchar_t *s) void *p = reinterpret_cast<void *> (ip); return p; } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE void * ACE_OS::bsearch (const void *key, @@ -143,7 +140,7 @@ ACE_OS::getenv (const char *symbol) #endif /* ACE_LACKS_ENV */ } -#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32) +#if defined (ACE_WIN32) ACE_INLINE wchar_t * ACE_OS::getenv (const wchar_t *symbol) { @@ -154,7 +151,7 @@ ACE_OS::getenv (const wchar_t *symbol) ACE_OSCALL_RETURN (::_wgetenv (symbol), wchar_t *, 0); #endif /* ACE_LACKS_ENV */ } -#endif /* ACE_HAS_WCHAR && ACE_WIN32 */ +#endif /* ACE_WIN32 */ ACE_INLINE char * ACE_OS::itoa (int value, char *string, int radix) @@ -168,7 +165,6 @@ ACE_OS::itoa (int value, char *string, int radix) #endif /* !ACE_HAS_ITOA */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::itoa (int value, wchar_t *string, int radix) { @@ -178,7 +174,6 @@ ACE_OS::itoa (int value, wchar_t *string, int radix) return ::_itow (value, string, radix); #endif /* ACE_LACKS_ITOW */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE ACE_HANDLE ACE_OS::mkstemp (char *s) @@ -186,54 +181,51 @@ ACE_OS::mkstemp (char *s) #if !defined (ACE_LACKS_MKSTEMP) return ::mkstemp (s); #else - return ACE_OS::mkstemp_emulation (ACE_TEXT_CHAR_TO_TCHAR (s)); + return ACE_OS::mkstemp_emulation (ACE_TEXT_TO_TCHAR_INOUT (s) ); #endif /* !ACE_LACKS_MKSTEMP */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE ACE_HANDLE ACE_OS::mkstemp (wchar_t *s) { # if !defined (ACE_LACKS_MKSTEMP) - return ::mkstemp (ACE_TEXT_WCHAR_TO_TCHAR (ACE_TEXT_ALWAYS_CHAR (s))); + return ::mkstemp (ACE_TEXT_TO_CHAR_INOUT (s)); # else - return ACE_OS::mkstemp_emulation (ACE_TEXT_WCHAR_TO_TCHAR (s)); + return ACE_OS::mkstemp_emulation (ACE_TEXT_TO_TCHAR_INOUT (s)); # endif /* !ACE_LACKS_MKSTEMP */ } -#endif /* ACE_HAS_WCHAR */ -#if !defined (ACE_LACKS_MKTEMP) + ACE_INLINE char * ACE_OS::mktemp (char *s) { # if defined (ACE_WIN32) return ::_mktemp (s); -# else /* ACE_WIN32 */ +# elif !defined (ACE_LACKS_MKTEMP) return ::mktemp (s); -# endif /* ACE_WIN32 */ +# else + ACE_UNUSED_ARG( s ); + ACE_NOTSUP_RETURN (0); +# endif } -# if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::mktemp (wchar_t *s) { -# if defined (ACE_WIN32) +#if defined (ACE_LACKS_MKTEMP) + ACE_UNUSED_ARG( s ); + ACE_NOTSUP_RETURN (0); +#elif defined (ACE_WIN32) return ::_wmktemp (s); -# else +#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) + if (::mktemp (ACE_TEXT_TO_CHAR_INOUT (s)) == 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 } -# endif /* ACE_HAS_WCHAR */ - -#endif /* !ACE_LACKS_MKTEMP */ #if defined(INTEGRITY) extern "C" { @@ -257,7 +249,7 @@ ACE_OS::putenv (const char *string) #endif /* ACE_HAS_WINCE */ } -#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32) +#if defined (ACE_WIN32) ACE_INLINE int ACE_OS::putenv (const wchar_t *string) { @@ -270,7 +262,7 @@ ACE_OS::putenv (const wchar_t *string) ACE_OSCALL_RETURN (::_wputenv (string), int, -1); #endif /* ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR && ACE_WIN32 */ +#endif /* ACE_WIN32 */ ACE_INLINE void ACE_OS::qsort (void *base, @@ -357,7 +349,6 @@ ACE_OS::realpath (const char *file_name, } # 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) @@ -365,18 +356,15 @@ ACE_OS::realpath (const wchar_t *file_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)) + if (0 != ACE_OS::realpath ( ACE_TEXT_TO_CHAR_IN (file_name), n_resolved) { - ACE_Ascii_To_Wide w_resolved (n_resolved); - ACE_OS::strcpy (resolved_name, w_resolved.wchar_rep ()); + ACE_OS::string_copy (resolved_name, n_resolved, PATH_MAX); return resolved_name; } return 0; # endif /* ! ACE_WIN32 */ } -# endif /* ACE_HAS_WCHAR */ #endif /* ACE_HAS_WINCE */ ACE_INLINE ACE_EXIT_HOOK @@ -419,8 +407,8 @@ ACE_OS::strenvdup (const ACE_TCHAR *str) # 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)); + if ((temp = ACE_OS::getenv (ACE_TEXT_TO_CHAR_IN (&str[1]))) != 0) + return ACE_OS::strdup (ACE_TEXT_TO_TCHAR_IN (temp)); # endif /* ACE_WIN32 */ return ACE_OS::strdup (str); } @@ -437,13 +425,16 @@ ACE_OS::strtod (const char *s, char **endptr) } #endif /* !ACE_LACKS_STRTOD */ -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOD) ACE_INLINE double ACE_OS::strtod (const wchar_t *s, wchar_t **endptr) { - return ACE_WCHAR_STD_NAMESPACE::wcstod (s, endptr); + #if !defined (ACE_LACKS_WCSTOD) + return ACE_WCHAR_STD_NAMESPACE::wcstod (s, endptr); + #else + ACE_UNUSED_ARG( s ); + ACE_NOTSUP_RETURN (0); + #endif } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOD */ ACE_INLINE long ACE_OS::strtol (const char *s, char **ptr, int base) @@ -455,13 +446,18 @@ ACE_OS::strtol (const char *s, char **ptr, int base) #endif /* ACE_LACKS_STRTOL */ } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL) ACE_INLINE long ACE_OS::strtol (const wchar_t *s, wchar_t **ptr, int base) { +#if !defined (ACE_LACKS_WCSTOL) return ACE_WCHAR_STD_NAMESPACE::wcstol (s, ptr, base); +#else + ACE_UNUSED_ARG( s ); + ACE_UNUSED_ARG( ptr ); + ACE_UNUSED_ARG( base ); + ACE_NOTSUP_RETURN (0); +#endif } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */ ACE_INLINE unsigned long ACE_OS::strtoul (const char *s, char **ptr, int base) @@ -473,13 +469,18 @@ ACE_OS::strtoul (const char *s, char **ptr, int base) #endif /* ACE_LACKS_STRTOUL */ } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL) ACE_INLINE unsigned long ACE_OS::strtoul (const wchar_t *s, wchar_t **ptr, int base) { +#if !defined (ACE_LACKS_WCSTOUL) return ACE_WCHAR_STD_NAMESPACE::wcstoul (s, ptr, base); +#else + ACE_UNUSED_ARG( s ); + ACE_UNUSED_ARG( ptr ); + ACE_UNUSED_ARG( base ); + ACE_NOTSUP_RETURN (0); +#endif } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */ ACE_INLINE int ACE_OS::system (const ACE_TCHAR *s) @@ -493,6 +494,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 (ACE_TEXT_TO_CHAR_IN (s)), int, -1); #endif /* !CHORUS */ } diff --git a/ace/OS_NS_string.cpp b/ace/OS_NS_string.cpp index a40a20dee7c..15fa83612f1 100644 --- a/ace/OS_NS_string.cpp +++ b/ace/OS_NS_string.cpp @@ -12,9 +12,7 @@ ACE_RCSID (ace, # include "ace/OS_NS_string.inl" #endif /* ACE_HAS_INLINED_OS_CALLS */ -#if defined (ACE_HAS_WCHAR) # include "ace/OS_NS_stdlib.h" -#endif /* ACE_HAS_WCHAR */ #if !defined (ACE_LACKS_STRERROR) # include "ace/OS_NS_stdio.h" @@ -51,7 +49,6 @@ ACE_OS::strdup (const char *s) #endif /* ACE_HAS_STRDUP_EMULATION */ } -#if defined (ACE_HAS_WCHAR) wchar_t * ACE_OS::strdup (const wchar_t *s) { @@ -73,7 +70,6 @@ ACE_OS::strdup (const wchar_t *s) # endif /* __MINGW32__ */ # endif /* ACE_LACKS_WCSDUP */ } -#endif /* ACE_HAS_WCHAR */ char * ACE_OS::strecpy (char *s, const char *t) @@ -87,7 +83,6 @@ ACE_OS::strecpy (char *s, const char *t) return dscan; } -#if defined (ACE_HAS_WCHAR) wchar_t * ACE_OS::strecpy (wchar_t *s, const wchar_t *t) { @@ -99,7 +94,6 @@ ACE_OS::strecpy (wchar_t *s, const wchar_t *t) return dscan; } -#endif /* ACE_HAS_WCHAR */ char * ACE_OS::strerror (int errnum) @@ -109,9 +103,7 @@ ACE_OS::strerror (int errnum) if (ACE::is_sock_error (errnum)) { const ACE_TCHAR *errortext = ACE::sock_error (errnum); - ACE_OS::strncpy (ret_errortext, - ACE_TEXT_ALWAYS_CHAR (errortext), - sizeof (ret_errortext)); + ACE_OS::string_copy (ret_errortext, errortext, sizeof (ret_errortext)); return ret_errortext; } #if defined (ACE_LACKS_STRERROR) @@ -157,11 +149,11 @@ ACE_OS::strnchr (const char *s, int c, size_t len) return 0; } -const ACE_WCHAR_T * -ACE_OS::strnchr (const ACE_WCHAR_T *s, ACE_WINT_T c, size_t len) +const wchar_t * +ACE_OS::strnchr (const wchar_t *s, wint_t c, size_t len) { for (size_t i = 0; i < len; ++i) - if (s[i] == static_cast<ACE_WCHAR_T> (c)) + if (s[i] == static_cast<wchar_t> (c)) return s + i; return 0; @@ -190,8 +182,8 @@ ACE_OS::strnstr (const char *s1, const char *s2, size_t len2) return 0; } -const ACE_WCHAR_T * -ACE_OS::strnstr (const ACE_WCHAR_T *s1, const ACE_WCHAR_T *s2, size_t len2) +const wchar_t * +ACE_OS::strnstr (const wchar_t *s1, const wchar_t *s2, size_t len2) { // Substring length const size_t len1 = ACE_OS::strlen (s1); @@ -205,7 +197,7 @@ ACE_OS::strnstr (const ACE_WCHAR_T *s1, const ACE_WCHAR_T *s2, size_t len2) for (size_t i = 0; i <= len; i++) { - if (ACE_OS::memcmp (s1 + i, s2, len2 * sizeof (ACE_WCHAR_T)) == 0) + if (ACE_OS::memcmp (s1 + i, s2, len2 * sizeof (wchar_t)) == 0) // Found a match! Return the index. return s1 + i; } @@ -317,11 +309,11 @@ ACE_OS::strsncpy (char *dst, const char *src, size_t maxlen) return dst; } -ACE_WCHAR_T * -ACE_OS::strsncpy (ACE_WCHAR_T *dst, const ACE_WCHAR_T *src, size_t maxlen) +wchar_t * +ACE_OS::strsncpy (wchar_t *dst, const wchar_t *src, size_t maxlen) { - register ACE_WCHAR_T *rdst = dst; - register const ACE_WCHAR_T *rsrc = src; + register wchar_t *rdst = dst; + register const wchar_t *rsrc = src; register size_t rmaxlen = maxlen; if (rmaxlen > 0) @@ -383,11 +375,11 @@ ACE_OS::strtok_r_emulation (char *s, const char *tokens, char **lasts) } #endif /* !ACE_HAS_REENTRANT_FUNCTIONS */ -# if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSTOK) +# if defined (ACE_LACKS_WCSTOK) wchar_t* -ACE_OS::strtok_r_emulation (ACE_WCHAR_T *s, - const ACE_WCHAR_T *tokens, - ACE_WCHAR_T **lasts) +ACE_OS::strtok_r_emulation (wchar_t *s, + const wchar_t *tokens, + wchar_t **lasts) { if (s == 0) s = *lasts; @@ -406,4 +398,4 @@ ACE_OS::strtok_r_emulation (ACE_WCHAR_T *s, *lasts = s + l_sub; return s ; } -# endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSTOK */ +# endif /* ACE_LACKS_WCSTOK */ diff --git a/ace/OS_NS_string.h b/ace/OS_NS_string.h index 302411b5033..de822113f47 100644 --- a/ace/OS_NS_string.h +++ b/ace/OS_NS_string.h @@ -24,9 +24,6 @@ # if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Basic_Types.h" // to get ACE_WCHAR_T, - // should be in os_stddef.h or not used like this. #include "ace/ACE_export.h" #if defined (ACE_EXPORT_MACRO) @@ -88,85 +85,63 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION char *strcat (char *s, const char *t); -#if defined (ACE_HAS_WCHAR) /// Appends a string to another string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wchar_t *strcat (wchar_t *s, const wchar_t *t); -#endif /* ACE_HAS_WCHAR */ /// Finds the first occurance of a character in a string (const char /// version). ACE_NAMESPACE_INLINE_FUNCTION const char *strchr (const char *s, int c); -#if defined (ACE_HAS_WCHAR) /// Finds the first occurance of a character in a string (const wchar_t /// version). ACE_NAMESPACE_INLINE_FUNCTION const wchar_t *strchr (const wchar_t *s, wint_t c); -#endif /* ACE_HAS_WCHAR */ /// Finds the first occurance of a character in a string (char version). ACE_NAMESPACE_INLINE_FUNCTION char *strchr (char *s, int c); -#if defined (ACE_HAS_WCHAR) /// Finds the first occurance of a character in a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wchar_t *strchr (wchar_t *s, wint_t c); -#endif /* ACE_HAS_WCHAR */ - - /// Compares two strings (char version). - ACE_NAMESPACE_INLINE_FUNCTION - int strcmp (const char *s, const char *t); - - /// Compares two strings (wchar_t version). - ACE_NAMESPACE_INLINE_FUNCTION - int strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t); /// Copies a string (char version). ACE_NAMESPACE_INLINE_FUNCTION char *strcpy (char *s, const char *t); -#if defined (ACE_HAS_WCHAR) /// Copies a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wchar_t *strcpy (wchar_t *s, const wchar_t *t); -#endif /* ACE_HAS_WCHAR */ /// Searches for the first substring without any of the specified /// characters and returns the size of the substring (char version). ACE_NAMESPACE_INLINE_FUNCTION size_t strcspn (const char *s, const char *reject); -#if defined (ACE_HAS_WCHAR) /// Searches for the first substring without any of the specified /// characters and returns the size of the substring (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION size_t strcspn (const wchar_t *s, const wchar_t *reject); -#endif /* ACE_HAS_WCHAR */ /// Returns a malloced duplicated string (char version). extern ACE_Export char *strdup (const char *s); -#if defined (ACE_HAS_WCHAR) /// Returns a malloced duplicated string (wchar_t version). extern ACE_Export wchar_t *strdup (const wchar_t *s); -#endif /* ACE_HAS_WCHAR */ /// Copies a string, but returns a pointer to the end of the /// copied region (char version). extern ACE_Export char *strecpy (char *des, const char *src); -#if defined (ACE_HAS_WCHAR) /// Copies a string, but returns a pointer to the end of the /// copied region (wchar_t version). extern ACE_Export wchar_t *strecpy (wchar_t *s, const wchar_t *t); -#endif /* ACE_HAS_WCHAR */ /* ** Returns a system error message. If the supplied errnum is out of range, @@ -182,39 +157,31 @@ namespace ACE_OS { char *strerror_emulation (int errnum); #endif /* ACE_LACKS_STRERROR */ - /// Finds the length of a string (char version). - ACE_NAMESPACE_INLINE_FUNCTION - size_t strlen (const char *s); - - /// Finds the length of a string (ACE_WCHAR_T version). - ACE_NAMESPACE_INLINE_FUNCTION - size_t strlen (const ACE_WCHAR_T *s); - /// Appends part of a string to another string (char version). ACE_NAMESPACE_INLINE_FUNCTION char *strncat (char *s, const char *t, size_t len); /// Appends part of a string to another string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION - ACE_WCHAR_T *strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len); + wchar_t *strncat (wchar_t *s, const wchar_t *t, size_t len); /// Finds the first occurance of a character in an array (const char /// version). extern ACE_Export const char *strnchr (const char *s, int c, size_t len); - /// Finds the first occurance of a character in an array (const ACE_WCHAR_T + /// Finds the first occurance of a character in an array (const wchar_t /// version). extern ACE_Export - const ACE_WCHAR_T *strnchr (const ACE_WCHAR_T *s, ACE_WINT_T c, size_t len); + const wchar_t *strnchr (const wchar_t *s, wint_t c, size_t len); /// Finds the first occurance of a character in an array (char version). ACE_NAMESPACE_INLINE_FUNCTION char *strnchr (char *s, int c, size_t len); - /// Finds the first occurance of a character in an array (ACE_WCHAR_T version). + /// Finds the first occurance of a character in an array (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION - ACE_WCHAR_T *strnchr (ACE_WCHAR_T *s, ACE_WINT_T c, size_t len); + wchar_t *strnchr (wchar_t *s, wint_t c, size_t len); /// Compares two arrays (char version). ACE_NAMESPACE_INLINE_FUNCTION @@ -222,15 +189,7 @@ namespace ACE_OS { /// Compares two arrays (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION - int strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len); - - /// Copies an array (char version) - ACE_NAMESPACE_INLINE_FUNCTION - char *strncpy (char *s, const char *t, size_t len); - - /// Copies an array (ACE_WCHAR_T version) - ACE_NAMESPACE_INLINE_FUNCTION - ACE_WCHAR_T *strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len); + int strncmp (const wchar_t *s, const wchar_t *t, size_t len); /// Finds the length of a limited-length string (char version). /** @@ -244,7 +203,7 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION size_t strnlen (const char *s, size_t maxlen); - /// Finds the length of a limited-length string (ACE_WCHAR_T version). + /// Finds the length of a limited-length string (wchar_t version). /** * @param s The character string to find the length of. * @param maxlen The maximum number of characters that will be @@ -254,7 +213,7 @@ namespace ACE_OS { * is located, else @arg maxlen. */ ACE_NAMESPACE_INLINE_FUNCTION - size_t strnlen (const ACE_WCHAR_T *s, size_t maxlen); + size_t strnlen (const wchar_t *s, size_t maxlen); /// Finds the first occurance of a substring in an array (const char /// version). @@ -264,8 +223,8 @@ namespace ACE_OS { /// Finds the first occurance of a substring in an array (const wchar_t /// version). extern ACE_Export - const ACE_WCHAR_T *strnstr (const ACE_WCHAR_T *s, - const ACE_WCHAR_T *t, + const wchar_t *strnstr (const wchar_t *s, + const wchar_t *t, size_t len); /// Finds the first occurance of a substring in an array (char version). @@ -274,27 +233,23 @@ namespace ACE_OS { /// Finds the first occurance of a substring in an array (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION - ACE_WCHAR_T *strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len); + wchar_t *strnstr (wchar_t *s, const wchar_t *t, size_t len); /// Searches for characters in a string (const char version). ACE_NAMESPACE_INLINE_FUNCTION const char *strpbrk (const char *s1, const char *s2); -#if defined (ACE_HAS_WCHAR) /// Searches for characters in a string (const wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION const wchar_t *strpbrk (const wchar_t *s1, const wchar_t *s2); -#endif /* ACE_HAS_WCHAR */ /// Searches for characters in a string (char version). ACE_NAMESPACE_INLINE_FUNCTION char *strpbrk (char *s1, const char *s2); -#if defined (ACE_HAS_WCHAR) /// Searches for characters in a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wchar_t *strpbrk (wchar_t *s1, const wchar_t *s2); -#endif /* ACE_HAS_WCHAR */ #if defined (ACE_LACKS_STRPBRK) /// Emulated strpbrk - Searches for characters in a string. @@ -308,22 +263,18 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION const char *strrchr (const char *s, int c); -#if defined (ACE_HAS_WCHAR) /// Finds the last occurance of a character in a string (const wchar_t /// version). ACE_NAMESPACE_INLINE_FUNCTION const wchar_t *strrchr (const wchar_t *s, wint_t c); -#endif /* ACE_HAS_WCHAR */ /// Finds the last occurance of a character in a string (char version). ACE_NAMESPACE_INLINE_FUNCTION char *strrchr (char *s, int c); -#if defined (ACE_HAS_WCHAR) /// Finds the last occurance of a character in a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wchar_t *strrchr (wchar_t *s, wint_t c); -#endif /* ACE_HAS_WCHAR */ #if defined (ACE_LACKS_STRRCHR) /// Emulated strrchr (char version) - Finds the last occurance of a @@ -375,8 +326,8 @@ namespace ACE_OS { * strncpy() is needed. */ extern ACE_Export - ACE_WCHAR_T *strsncpy (ACE_WCHAR_T *dst, - const ACE_WCHAR_T *src, + wchar_t *strsncpy (wchar_t *dst, + const wchar_t *src, size_t maxlen); /// Searches for the first substring containing only the specified @@ -384,12 +335,10 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION size_t strspn (const char *s1, const char *s2); -#if defined (ACE_HAS_WCHAR) /// Searches for the first substring containing only the specified /// characters and returns the size of the substring (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION size_t strspn (const wchar_t *s1, const wchar_t *s2); -#endif /* ACE_HAS_WCHAR */ #if defined (ACE_LACKS_STRSPN) /// Emulated wcsspn. @@ -403,32 +352,26 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION const char *strstr (const char *s, const char *t); -#if defined (ACE_HAS_WCHAR) /// Finds the first occurance of a substring in a string (const wchar_t /// version). ACE_NAMESPACE_INLINE_FUNCTION const wchar_t *strstr (const wchar_t *s, const wchar_t *t); -#endif /* ACE_HAS_WCHAR */ /// Finds the first occurance of a substring in a string (char version). ACE_NAMESPACE_INLINE_FUNCTION char *strstr (char *s, const char *t); -#if defined (ACE_HAS_WCHAR) /// Finds the first occurance of a substring in a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wchar_t *strstr (wchar_t *s, const wchar_t *t); -#endif /* ACE_HAS_WCHAR */ /// Finds the next token in a string (char version). ACE_NAMESPACE_INLINE_FUNCTION char *strtok (char *s, const char *tokens); -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOK) /// Finds the next token in a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION wchar_t *strtok (wchar_t *s, const wchar_t *tokens); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOK */ //@} @@ -436,11 +379,9 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION char *strtok_r (char *s, const char *tokens, char **lasts); -#if defined (ACE_HAS_WCHAR) /// Finds the next token in a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION - wchar_t *strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts); -#endif // ACE_HAS_WCHAR + wchar_t *strtok_r (wchar_t *s, const wchar_t *tokens, wchar_t **lasts); #if !defined (ACE_HAS_REENTRANT_FUNCTIONS) /// Emulated strtok_r. @@ -448,14 +389,16 @@ namespace ACE_OS { char *strtok_r_emulation (char *s, const char *tokens, char **lasts); #endif /* !ACE_HAS_REENTRANT_FUNCTIONS */ -# if defined (ACE_HAS_WCHAR) && defined(ACE_LACKS_WCSTOK) +# if defined(ACE_LACKS_WCSTOK) /// Emulated strtok_r (wchar_t version). extern ACE_Export - wchar_t *strtok_r_emulation (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts); -# endif // ACE_HAS_WCHAR && ACE_LACKS_WCSTOK + wchar_t *strtok_r_emulation (wchar_t *s, const wchar_t *tokens, wchar_t **lasts); +# endif // ACE_LACKS_WCSTOK } /* namespace ACE_OS */ +#include "ace/OS_NS_string_base.inl" + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_string.inl b/ace/OS_NS_string.inl index 0a3a8a699a6..6b27bce3bd9 100644 --- a/ace/OS_NS_string.inl +++ b/ace/OS_NS_string.inl @@ -59,7 +59,6 @@ ACE_OS::strcat (char *s, const char *t) return ::strcat (s, t); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::strcat (wchar_t *s, const wchar_t *t) { @@ -69,7 +68,6 @@ ACE_OS::strcat (wchar_t *s, const wchar_t *t) return ::wcscat (s, t); # endif /* ACE_LACKS_WCSCAT */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE const char * ACE_OS::strchr (const char *s, int c) @@ -81,7 +79,6 @@ ACE_OS::strchr (const char *s, int c) #endif /* ACE_LACKS_STRCHR */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE const wchar_t * ACE_OS::strchr (const wchar_t *s, wint_t c) { @@ -91,7 +88,6 @@ ACE_OS::strchr (const wchar_t *s, wint_t c) return ::wcschr (s, c); # endif /* ACE_LACKS_WCSCHR */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS::strchr (char *s, int c) @@ -99,7 +95,6 @@ ACE_OS::strchr (char *s, int c) return ::strchr (s, c); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::strchr (wchar_t *s, wint_t c) { @@ -107,23 +102,6 @@ ACE_OS::strchr (wchar_t *s, wint_t c) const_cast<wchar_t *> (ACE_OS::strchr (static_cast<const wchar_t *> (s), c)); } -#endif /* ACE_HAS_WCHAR */ - -ACE_INLINE int -ACE_OS::strcmp (const char *s, const char *t) -{ - return ::strcmp (s, t); -} - -ACE_INLINE int -ACE_OS::strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t) -{ -# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP) - return ACE_OS::wcscmp_emulation (s, t); -# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */ - return ::wcscmp (s, t); -# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */ -} ACE_INLINE char * ACE_OS::strcpy (char *s, const char *t) @@ -131,7 +109,6 @@ ACE_OS::strcpy (char *s, const char *t) return ::strcpy (s, t); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::strcpy (wchar_t *s, const wchar_t *t) { @@ -141,7 +118,6 @@ ACE_OS::strcpy (wchar_t *s, const wchar_t *t) return ::wcscpy (s, t); # endif /* ACE_LACKS_WCSCPY */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE size_t ACE_OS::strcspn (const char *s, const char *reject) @@ -149,7 +125,6 @@ ACE_OS::strcspn (const char *s, const char *reject) return ::strcspn (s, reject); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE size_t ACE_OS::strcspn (const wchar_t *s, const wchar_t *reject) { @@ -159,23 +134,6 @@ ACE_OS::strcspn (const wchar_t *s, const wchar_t *reject) return ::wcscspn (s, reject); # endif /* ACE_LACKS_WCSCSPN */ } -#endif /* ACE_HAS_WCHAR */ - -ACE_INLINE size_t -ACE_OS::strlen (const char *s) -{ - return ::strlen (s); -} - -ACE_INLINE size_t -ACE_OS::strlen (const ACE_WCHAR_T *s) -{ -# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN) - return ACE_OS::wcslen_emulation (s); -# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */ - return ::wcslen (s); -# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */ -} ACE_INLINE char * ACE_OS::strncat (char *s, const char *t, size_t len) @@ -183,14 +141,14 @@ ACE_OS::strncat (char *s, const char *t, size_t len) return ::strncat (s, t, len); } -ACE_INLINE ACE_WCHAR_T * -ACE_OS::strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len) +ACE_INLINE wchar_t * +ACE_OS::strncat (wchar_t *s, const wchar_t *t, size_t len) { -# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT) +# if defined (ACE_LACKS_WCSNCAT) return ACE_OS::wcsncat_emulation (s, t, len); -# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCAT */ +# else /* ACE_LACKS_WCSNCAT */ return ::wcsncat (s, t, len); -# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCAT */ +# endif /* ACE_LACKS_WCSNCAT */ } ACE_INLINE char * @@ -206,12 +164,12 @@ ACE_OS::strnchr (char *s, int c, size_t len) #endif } -ACE_INLINE ACE_WCHAR_T * -ACE_OS::strnchr (ACE_WCHAR_T *s, ACE_WINT_T c, size_t len) +ACE_INLINE wchar_t * +ACE_OS::strnchr (wchar_t *s, wint_t c, size_t len) { return - const_cast<ACE_WCHAR_T *> (ACE_OS::strnchr ( - static_cast<const ACE_WCHAR_T *> (s), + const_cast<wchar_t *> (ACE_OS::strnchr ( + static_cast<const wchar_t *> (s), c, len)); } @@ -223,29 +181,13 @@ ACE_OS::strncmp (const char *s, const char *t, size_t len) } ACE_INLINE int -ACE_OS::strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len) +ACE_OS::strncmp (const wchar_t *s, const wchar_t *t, size_t len) { -# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP) +# if defined (ACE_LACKS_WCSNCMP) return ACE_OS::wcsncmp_emulation (s, t, len); -# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */ +# else /* ACE_LACKS_WCSNCMP */ return ::wcsncmp (s, t, len); -# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */ -} - -ACE_INLINE char * -ACE_OS::strncpy (char *s, const char *t, size_t len) -{ - return ::strncpy (s, t, len); -} - -ACE_INLINE ACE_WCHAR_T * -ACE_OS::strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len) -{ -# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY) - return ACE_OS::wcsncpy_emulation (s, t, len); -# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */ - return ::wcsncpy (s, t, len); -# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */ +# endif /* ACE_LACKS_WCSNCMP */ } ACE_INLINE size_t @@ -263,9 +205,9 @@ ACE_OS::strnlen (const char *s, size_t maxlen) } ACE_INLINE size_t -ACE_OS::strnlen (const ACE_WCHAR_T *s, size_t maxlen) +ACE_OS::strnlen (const wchar_t *s, size_t maxlen) { -#if defined (ACE_HAS_WCHAR) && defined (ACE_HAS_WCSNLEN) +#if defined (ACE_HAS_WCSNLEN) return wcsnlen (s, maxlen); #else /* ACE_HAS_WCSNLEN */ size_t i; @@ -287,12 +229,12 @@ ACE_OS::strnstr (char *s, const char *t, size_t len) #endif } -ACE_INLINE ACE_WCHAR_T * -ACE_OS::strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len) +ACE_INLINE wchar_t * +ACE_OS::strnstr (wchar_t *s, const wchar_t *t, size_t len) { return - const_cast<ACE_WCHAR_T *> (ACE_OS::strnstr ( - static_cast<const ACE_WCHAR_T *> (s), + const_cast<wchar_t *> (ACE_OS::strnstr ( + static_cast<const wchar_t *> (s), t, len)); } @@ -307,7 +249,6 @@ ACE_OS::strpbrk (const char *s1, const char *s2) #endif /* ACE_LACKS_STRPBRK */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE const wchar_t * ACE_OS::strpbrk (const wchar_t *s, const wchar_t *t) { @@ -317,7 +258,6 @@ ACE_OS::strpbrk (const wchar_t *s, const wchar_t *t) return ::wcspbrk (s, t); # endif /* ACE_LACKS_WCSPBRK */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS::strpbrk (char *s1, const char *s2) @@ -329,14 +269,12 @@ ACE_OS::strpbrk (char *s1, const char *s2) #endif /* ACE_LACKS_STRPBRK */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::strpbrk (wchar_t *s, const wchar_t *t) { return const_cast<wchar_t *> (ACE_OS::strpbrk ( static_cast<const wchar_t *> (s), t)); } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE const char * ACE_OS::strrchr (const char *s, int c) @@ -348,7 +286,6 @@ ACE_OS::strrchr (const char *s, int c) #endif /* ! ACE_LACKS_STRRCHR */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE const wchar_t * ACE_OS::strrchr (const wchar_t *s, wint_t c) { @@ -358,7 +295,6 @@ ACE_OS::strrchr (const wchar_t *s, wint_t c) return (const wchar_t *) ::wcsrchr (s, c); #endif /* ! ACE_LACKS_WCSRCHR */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS::strrchr (char *s, int c) @@ -370,14 +306,12 @@ ACE_OS::strrchr (char *s, int c) #endif /* ! ACE_LACKS_STRRCHR */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::strrchr (wchar_t *s, wint_t c) { return const_cast<wchar_t *> (ACE_OS::strrchr ( static_cast<const wchar_t *> (s), c)); } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE size_t ACE_OS::strspn (const char *s, const char *t) @@ -389,7 +323,6 @@ ACE_OS::strspn (const char *s, const char *t) #endif /* ACE_LACKS_STRSPN */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE size_t ACE_OS::strspn (const wchar_t *s, const wchar_t *t) { @@ -399,7 +332,6 @@ ACE_OS::strspn (const wchar_t *s, const wchar_t *t) return ::wcsspn (s, t); # endif /* ACE_LACKS_WCSSPN */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE const char * ACE_OS::strstr (const char *s, const char *t) @@ -407,7 +339,6 @@ ACE_OS::strstr (const char *s, const char *t) return (const char *) ::strstr (s, t); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE const wchar_t * ACE_OS::strstr (const wchar_t *s, const wchar_t *t) { @@ -419,7 +350,6 @@ ACE_OS::strstr (const wchar_t *s, const wchar_t *t) return (const wchar_t *) ::wcsstr (s, t); # endif /* ACE_LACKS_WCSSTR */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS::strstr (char *s, const char *t) @@ -427,7 +357,6 @@ ACE_OS::strstr (char *s, const char *t) return ::strstr (s, t); } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::strstr (wchar_t *s, const wchar_t *t) { @@ -439,7 +368,6 @@ ACE_OS::strstr (wchar_t *s, const wchar_t *t) return ::wcsstr (s, t); # endif /* ACE_LACKS_WCSSTR */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS::strtok (char *s, const char *tokens) @@ -447,18 +375,21 @@ ACE_OS::strtok (char *s, const char *tokens) return ::strtok (s, tokens); } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOK) ACE_INLINE wchar_t * ACE_OS::strtok (wchar_t *s, const wchar_t *tokens) { #if defined (ACE_HAS_3_PARAM_WCSTOK) static wchar_t *lasts; return ::wcstok (s, tokens, &lasts); -#else +#elif !defined (ACE_LACKS_WCSTOK) return ::wcstok (s, tokens); +#else + ACE_UNUSED_ARG( s ); + ACE_UNUSED_ARG( ptr ); + ACE_UNUSED_ARG( base ); + ACE_NOTSUP_RETURN (0); #endif /* ACE_HAS_3_PARAM_WCSTOK */ } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOK */ ACE_INLINE char * ACE_OS::strtok_r (char *s, const char *tokens, char **lasts) @@ -470,9 +401,8 @@ ACE_OS::strtok_r (char *s, const char *tokens, char **lasts) #endif /* (ACE_HAS_REENTRANT_FUNCTIONS) */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t* -ACE_OS::strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts) +ACE_OS::strtok_r (wchar_t *s, const wchar_t *tokens, wchar_t **lasts) { #if defined (ACE_LACKS_WCSTOK) return ACE_OS::strtok_r_emulation (s, tokens, lasts); @@ -485,4 +415,3 @@ ACE_OS::strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts # endif /* ACE_HAS_3_PARAM_WCSTOK */ #endif /* ACE_LACKS_WCSTOK */ } -#endif // ACE_HAS_WCHAR diff --git a/ace/OS_NS_strings.h b/ace/OS_NS_strings.h index e0def73a3d5..f52eb603661 100644 --- a/ace/OS_NS_strings.h +++ b/ace/OS_NS_strings.h @@ -41,21 +41,17 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int strcasecmp (const char *s, const char *t); -#if defined (ACE_HAS_WCHAR) /// Compares two strings (case insensitive const wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION int strcasecmp (const wchar_t *s, const wchar_t *t); -#endif /* ACE_HAS_WCHAR */ /// Compares two arrays (case insensitive const char version). ACE_NAMESPACE_INLINE_FUNCTION int strncasecmp (const char *s, const char *t, size_t len); -#if defined (ACE_HAS_WCHAR) /// Compares two arrays (case insensitive const wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION int strncasecmp (const wchar_t *s, const wchar_t *t, size_t len); -#endif /* ACE_HAS_WCHAR */ #if defined (ACE_LACKS_STRCASECMP) /// Emulated strcasecmp - Performs a case insensitive comparison of strings. diff --git a/ace/OS_NS_strings.inl b/ace/OS_NS_strings.inl index 588bf40ded3..115489ea9f5 100644 --- a/ace/OS_NS_strings.inl +++ b/ace/OS_NS_strings.inl @@ -1,9 +1,7 @@ // -*- C++ -*- // $Id$ -#if defined (ACE_HAS_WCHAR) # include "ace/OS_NS_wchar.h" -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::strcasecmp (const char *s, const char *t) @@ -17,7 +15,6 @@ ACE_OS::strcasecmp (const char *s, const char *t) #endif /* ACE_LACKS_STRCASECMP */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::strcasecmp (const wchar_t *s, const wchar_t *t) { @@ -27,7 +24,6 @@ ACE_OS::strcasecmp (const wchar_t *s, const wchar_t *t) return ::_wcsicmp (s, t); # endif /* ACE_LACKS_WCSICMP */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::strncasecmp (const char *s, const char *t, size_t len) @@ -41,7 +37,6 @@ ACE_OS::strncasecmp (const char *s, const char *t, size_t len) #endif /* ACE_LACKS_STRCASECMP */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::strncasecmp (const wchar_t *s, const wchar_t *t, size_t len) { @@ -51,5 +46,4 @@ ACE_OS::strncasecmp (const wchar_t *s, const wchar_t *t, size_t len) return ::_wcsnicmp (s, t, len); #endif /* ACE_LACKS_WCSNICMP */ } -#endif /* ACE_HAS_WCHAR */ diff --git a/ace/OS_NS_sys_mman.inl b/ace/OS_NS_sys_mman.inl index a3850c9057a..55fb8299a03 100644 --- a/ace/OS_NS_sys_mman.inl +++ b/ace/OS_NS_sys_mman.inl @@ -305,7 +305,7 @@ ACE_OS::shm_open (const ACE_TCHAR *filename, ACE_OS_TRACE ("ACE_OS::shm_open"); # if defined (ACE_HAS_SHM_OPEN) ACE_UNUSED_ARG (sa); - ACE_OSCALL_RETURN (::shm_open (ACE_TEXT_ALWAYS_CHAR(filename), mode, perms), ACE_HANDLE, ACE_INVALID_HANDLE); + ACE_OSCALL_RETURN (::shm_open (ACE_TEXT_TO_CHAR_IN(filename), mode, perms), ACE_HANDLE, ACE_INVALID_HANDLE); # elif defined (ACE_OPENVMS) ACE_OSCALL_RETURN (::open (filename, mode, perms, ACE_TEXT("shr=get,put,upd")), ACE_HANDLE, ACE_INVALID_HANDLE); # else /* ! ACE_HAS_SHM_OPEN */ @@ -319,7 +319,7 @@ ACE_OS::shm_unlink (const ACE_TCHAR *path) { ACE_OS_TRACE ("ACE_OS::shm_unlink"); # if defined (ACE_HAS_SHM_OPEN) - ACE_OSCALL_RETURN (::shm_unlink (ACE_TEXT_ALWAYS_CHAR(path)), int, -1); + ACE_OSCALL_RETURN (::shm_unlink (ACE_TEXT_TO_CHAR_IN(path)), int, -1); # else /* ! ACE_HAS_SHM_OPEN */ // Just use ::unlink. return ACE_OS::unlink (path); diff --git a/ace/OS_NS_sys_stat.h b/ace/OS_NS_sys_stat.h index f954938b816..fbb7312cb78 100644 --- a/ace/OS_NS_sys_stat.h +++ b/ace/OS_NS_sys_stat.h @@ -66,21 +66,17 @@ namespace ACE_OS { int lstat (const char *, ACE_stat *); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int lstat (const wchar_t *, ACE_stat *); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int mkdir (const char *path, mode_t mode = ACE_DEFAULT_DIR_PERMS); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int mkdir (const wchar_t *path, mode_t mode = ACE_DEFAULT_DIR_PERMS); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int mkfifo (const ACE_TCHAR *file, @@ -89,10 +85,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int stat (const char *file, ACE_stat *); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int stat (const wchar_t *file, ACE_stat *); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION mode_t umask (mode_t cmask); diff --git a/ace/OS_NS_sys_stat.inl b/ace/OS_NS_sys_stat.inl index 397f8a5b3bf..382863a2f59 100644 --- a/ace/OS_NS_sys_stat.inl +++ b/ace/OS_NS_sys_stat.inl @@ -27,7 +27,7 @@ namespace ACE_OS { ACE_UNUSED_ARG (mode); ACE_NOTSUP_RETURN (-1); #else - ACE_OSCALL_RETURN (::creat (ACE_TEXT_ALWAYS_CHAR (filename), mode), + ACE_OSCALL_RETURN (::creat (ACE_TEXT_TO_CHAR_IN (filename), mode), ACE_HANDLE, ACE_INVALID_HANDLE); #endif /* ACE_WIN32 */ } @@ -154,7 +154,6 @@ namespace ACE_OS { # endif /* ACE_LACKS_LSTAT */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int lstat (const wchar_t *file, ACE_stat *stp) { @@ -162,10 +161,9 @@ namespace ACE_OS { # if defined (ACE_LACKS_LSTAT) return ACE_OS::stat (file, stp); # else - return ACE_OS::lstat (ACE_Wide_To_Ascii (file).char_rep (), stp); + return ACE_OS::lstat (ACE_TEXT_TO_CHAR_IN (file), stp); # endif /* ACE_LACKS_LSTAT */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int mkdir (const char *path, mode_t mode) @@ -214,7 +212,7 @@ namespace ACE_OS { ACE_OSCALL_RETURN (::_mkdir ((char *) path), int, -1); #elif defined (ACE_HAS_WINCE) ACE_UNUSED_ARG (mode); - ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CreateDirectory (ACE_TEXT_CHAR_TO_TCHAR (path), 0), + ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CreateDirectory (ACE_TEXT_TO_TCHAR_IN (path), 0), ace_result_), int, -1); #elif defined (ACE_MKDIR_LACKS_MODE) @@ -225,8 +223,6 @@ namespace ACE_OS { #endif /* ACE_PSOS_LACKS_PHILE */ } -#if defined (ACE_HAS_WCHAR) - ACE_INLINE int mkdir (const wchar_t *path, mode_t mode) { @@ -239,12 +235,10 @@ namespace ACE_OS { ACE_UNUSED_ARG (mode); ACE_OSCALL_RETURN (::_wmkdir (path), int, -1); #else - return ACE_OS::mkdir (ACE_Wide_To_Ascii (path).char_rep (), mode); + return ACE_OS::mkdir (ACE_TEXT_TO_CHAR_IN (path), mode); #endif /* ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ - ACE_INLINE int mkfifo (const ACE_TCHAR *file, mode_t mode) { @@ -254,7 +248,7 @@ namespace ACE_OS { ACE_UNUSED_ARG (mode); ACE_NOTSUP_RETURN (-1); #else - ACE_OSCALL_RETURN (::mkfifo (ACE_TEXT_ALWAYS_CHAR (file), mode), int, -1); + ACE_OSCALL_RETURN (::mkfifo (ACE_TEXT_TO_CHAR_IN (file), mode), int, -1); #endif /* ACE_LACKS_MKFIFO */ } @@ -275,7 +269,7 @@ namespace ACE_OS { HANDLE fhandle; - fhandle = ::FindFirstFile (ACE_TEXT_CHAR_TO_TCHAR (file), &fdata); + fhandle = ::FindFirstFile (ACE_TEXT_TO_TCHAR_IN (file), &fdata); if (fhandle == INVALID_HANDLE_VALUE) { ACE_OS::set_errno_to_last_error (); @@ -309,7 +303,6 @@ namespace ACE_OS { #endif /* ACE_HAS_NONCONST_STAT */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int stat (const wchar_t *file, ACE_stat *stp) { @@ -343,11 +336,9 @@ namespace ACE_OS { #elif defined (ACE_WIN32) ACE_OSCALL_RETURN (::_wstat (file, (struct _stat *) stp), int, -1); #else /* ACE_HAS_WINCE */ - ACE_Wide_To_Ascii nfile (file); - return ACE_OS::stat (nfile.char_rep (), stp); + return ACE_OS::stat (ACE_TEXT_TO_CHAR_IN (file), stp); #endif /* ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE mode_t umask (mode_t cmask) diff --git a/ace/OS_NS_time.inl b/ace/OS_NS_time.inl index 3c17ea969c4..d1f747e20f7 100644 --- a/ace/OS_NS_time.inl +++ b/ace/OS_NS_time.inl @@ -117,14 +117,15 @@ ACE_OS::ctime (const time_t *t) ACE_OSCALL (::ctime (t), char *, 0, narrow_time); if (narrow_time == 0) return 0; - // ACE_Ascii_To_Wide::convert allocates (via new []) a wchar_t[]. If + // ACE_TEXT_TO_WCHAR_IN::convert allocates (via new []) a wchar_t[]. If // we've done this before, free the previous one. Yes, this leaves a // small memory leak (26 characters) but there's no way around this // that I know of. (Steve Huston, 12-Feb-2003). static wchar_t *wide_time = 0; if (wide_time != 0) delete [] wide_time; - wide_time = ACE_Ascii_To_Wide::convert (narrow_time); + wide_time = ACE_TEXT_TO_WCHAR_IN::convert (narrow_time); +// WHAT! return wide_time; # else ACE_OSCALL_RETURN (::ctime (t), char *, 0); @@ -175,8 +176,7 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen) return 0; # if defined (ACE_USES_WCHAR) - ACE_Ascii_To_Wide wide_buf (bufp); - ACE_OS_String::strcpy (buf, wide_buf.wchar_rep ()); + ACE_OS::string_copy (buf, wide_buf, buflen); return buf; # else return bufp; diff --git a/ace/OS_NS_unistd.cpp b/ace/OS_NS_unistd.cpp index 93221770440..068e35dabe2 100644 --- a/ace/OS_NS_unistd.cpp +++ b/ace/OS_NS_unistd.cpp @@ -57,7 +57,7 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv, // Account for environment variables. if (substitute_env_args && argv[i][0] == ACE_LIB_TEXT ('$')) { -# if defined (ACE_WIN32) || !defined (ACE_HAS_WCHAR) +# if defined (ACE_WIN32) ACE_TCHAR *temp = 0; // Win32 is the only platform with a wide-char ACE_OS::getenv(). if ((temp = ACE_OS::getenv (&argv[i][1])) != 0) @@ -65,17 +65,17 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv, else buf_len += ACE_OS::strlen (argv[i]); # else - // This is an ACE_HAS_WCHAR platform and not ACE_WIN32. + // This is not ACE_WIN32. // Convert the env variable name for getenv(), then add // the length of the returned char *string. Later, when we // actually use the returned env variable value, convert it // as well. - char *ctemp = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (&argv[i][1])); + char *ctemp = ACE_OS::getenv (ACE_TEXT_TO_CHAR_IN (&argv[i][1])); if (ctemp == 0) buf_len += ACE_OS::strlen (argv[i]); else buf_len += ACE_OS::strlen (ctemp); -# endif /* ACE_WIN32 || !ACE_HAS_WCHAR */ +# endif /* ACE_WIN32 */ } else #endif /* ACE_LACKS_ENV */ @@ -104,7 +104,7 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv, // Account for environment variables. if (substitute_env_args && argv[j][0] == ACE_LIB_TEXT ('$')) { -# if defined (ACE_WIN32) || !defined (ACE_HAS_WCHAR) +# if defined (ACE_WIN32) // Win32 is the only platform with a wide-char ACE_OS::getenv(). ACE_TCHAR *temp = ACE_OS::getenv (&argv[j][1]); if (temp != 0) @@ -112,15 +112,15 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv, else end = ACE_OS::strecpy (end, argv[j]); # else - // This is an ACE_HAS_WCHAR platform and not ACE_WIN32. + // This is not ACE_WIN32. // Convert the env variable name for getenv(), then convert // the returned char *string back to wchar_t. - char *ctemp = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (&argv[j][1])); + char *ctemp = ACE_OS::getenv (ACE_TEXT_TO_CHAR_IN (&argv[j][1])); if (ctemp == 0) end = ACE_OS::strecpy (end, argv[j]); else - end = ACE_OS::strecpy (end, ACE_TEXT_CHAR_TO_TCHAR (ctemp)); -# endif /* ACE_WIN32 || !ACE_HAS_WCHAR */ + end = ACE_OS::strecpy (end, ACE_TEXT_TO_TCHAR_IN (ctemp)); +# endif /* ACE_WIN32 */ } else #endif /* ACE_LACKS_ENV */ @@ -251,7 +251,7 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[]) // narrow char strings for execv(). char **cargv; int arg_count; -# endif /* ACE_HAS_WCHAR */ +# endif /* ACE_USES_WCHAR */ switch (result) { @@ -269,8 +269,9 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[]) ACE_OS::exit (errno); --arg_count; // Back to 0-indexed cargv[arg_count] = 0; +// WHAT! while (--arg_count >= 0) - cargv[arg_count] = ACE_Wide_To_Ascii::convert (argv[arg_count]); + cargv[arg_count] = ACE_TEXT_TO_CHAR_IN::convert (argv[arg_count]); // Don't worry about freeing the cargv or the strings it points to. // Either the process will be replaced, or we'll exit. if (ACE_OS::execv (cargv[0], cargv) == -1) @@ -285,7 +286,7 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[]) // If the execv fails, this child needs to exit. ACE_OS::exit (errno); } -# endif /* ACE_HAS_WCHAR */ +# endif /* ACE_USES_WCHAR */ default: // Server process. The fork succeeded. diff --git a/ace/OS_NS_unistd.h b/ace/OS_NS_unistd.h index 7b1046bb260..72e83d978bc 100644 --- a/ace/OS_NS_unistd.h +++ b/ace/OS_NS_unistd.h @@ -46,10 +46,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int access (const char *path, int amode); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int access (const wchar_t *path, int amode); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION unsigned int alarm (u_int secs); @@ -67,19 +65,15 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int chdir (const char *path); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int chdir (const wchar_t *path); -#endif /* ACE_HAS_WCHAR */ #endif /* ACE_LACKS_CHDIR */ ACE_NAMESPACE_INLINE_FUNCTION int rmdir (const char *path); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int rmdir (const wchar_t *path); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int close (ACE_HANDLE handle); @@ -141,10 +135,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION char *getcwd (char *, size_t); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wchar_t *getcwd (wchar_t *, size_t); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION gid_t getgid (void); @@ -174,11 +166,9 @@ namespace ACE_OS { int hostname (char *name, size_t maxnamelen); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int hostname (wchar_t *name, size_t maxnamelen); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION int isatty (int handle); @@ -311,10 +301,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int unlink (const char *path); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION int unlink (const wchar_t *path); -#endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION ssize_t write (ACE_HANDLE handle, diff --git a/ace/OS_NS_unistd.inl b/ace/OS_NS_unistd.inl index 1b6b9a6407d..a2d2ad35d4f 100644 --- a/ace/OS_NS_unistd.inl +++ b/ace/OS_NS_unistd.inl @@ -31,7 +31,7 @@ ACE_OS::access (const char *path, int amode) // @@ WINCE: There should be a Win32 API that can do this. // Hard coded read access here. ACE_UNUSED_ARG (amode); - FILE* handle = ACE_OS::fopen (ACE_TEXT_CHAR_TO_TCHAR(path), + FILE* handle = ACE_OS::fopen (ACE_TEXT_TO_TCHAR_IN(path), ACE_LIB_TEXT ("r")); if (handle != 0) { @@ -52,18 +52,15 @@ ACE_OS::access (const char *path, int amode) #endif /* ACE_LACKS_ACCESS */ } - -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::access (const wchar_t *path, int amode) { #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) ACE_OSCALL_RETURN (::_waccess (path, amode), int, -1); #else /* ACE_WIN32 && !ACE_HAS_WINCE */ - return ACE_OS::access (ACE_Wide_To_Ascii (path).char_rep (), amode); + return ACE_OS::access (ACE_TEXT_TO_CHAR_IN (path), amode); #endif /* ACE_WIN32 && !ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE u_int ACE_OS::alarm (u_int secs) @@ -138,17 +135,15 @@ ACE_OS::chdir (const char *path) #endif /* ACE_HAS_NONCONST_CHDIR */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::chdir (const wchar_t *path) { #if defined (ACE_WIN32) ACE_OSCALL_RETURN (::_wchdir (path), int, -1); #else /* ACE_WIN32 */ - return ACE_OS::chdir (ACE_Wide_To_Ascii (path).char_rep ()); + return ACE_OS::chdir (ACE_TEXT_TO_CHAR_IN (path)); #endif /* ACE_WIN32 */ } -#endif /* ACE_HAS_WCHAR */ #endif /* ACE_LACKS_CHDIR */ ACE_INLINE int @@ -192,7 +187,7 @@ ACE_OS::rmdir (const char *path) #elif defined (ACE_WIN32) && defined (__IBMCPP__) && (__IBMCPP__ >= 400) ACE_OSCALL_RETURN (::_rmdir ((char *) path), int, -1); #elif defined (ACE_HAS_WINCE) - ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::RemoveDirectory (ACE_TEXT_CHAR_TO_TCHAR (path)), + ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::RemoveDirectory (ACE_TEXT_TO_TCHAR_IN (path)), ace_result_), int, -1); #else @@ -200,7 +195,6 @@ ACE_OS::rmdir (const char *path) #endif /* ACE_PSOS_LACKS_PHILE */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::rmdir (const wchar_t *path) { @@ -211,11 +205,9 @@ ACE_OS::rmdir (const wchar_t *path) #elif defined (ACE_WIN32) ACE_OSCALL_RETURN (::_wrmdir (path), int, -1); #else - ACE_Wide_To_Ascii n_path (path); - return ACE_OS::rmdir (n_path.char_rep ()); + return ACE_OS::rmdir (ACE_TEXT_TO_CHAR_IN (path)); #endif /* ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ // @todo: which 4 and why??? dhinton // NOTE: The following four function definitions must appear before @@ -516,7 +508,6 @@ ACE_OS::getcwd (char *buf, size_t size) #endif /* ACE_PSOS_LACKS_PHILE */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::getcwd (wchar_t *buf, size_t size) { @@ -527,17 +518,11 @@ ACE_OS::getcwd (wchar_t *buf, size_t size) # elif defined (ACE_WIN32) return ::_wgetcwd (buf, static_cast<int> (size)); # else - char *narrow_buf = new char[size]; - char *result = 0; - result = ACE_OS::getcwd (narrow_buf, size); - ACE_Ascii_To_Wide wide_buf (result); - delete [] narrow_buf; - if (result != 0) - ACE_OS::strsncpy (buf, wide_buf.wchar_rep (), size); + ACE::String_Conversion::Convert_InOut< char, wchar_t > convert (buf, size); + result = ACE_OS::getcwd (convert.c_str(), convert.size()); return result == 0 ? 0 : buf; # endif /* ACE_WIN32 */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE gid_t ACE_OS::getgid (void) @@ -689,7 +674,6 @@ ACE_OS::hostname (char name[], size_t maxnamelen) #endif /* ACE_HAS_PHARLAP */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::hostname (wchar_t name[], size_t maxnamelen) { @@ -699,19 +683,13 @@ ACE_OS::hostname (wchar_t name[], size_t maxnamelen) ace_result_), int, -1); #else /* ACE_WIN32 && !ACE_HAS_WINCE */ // Emulate using the char version - char *char_name = 0; - int result = 0; - - ACE_NEW_RETURN (char_name, char[maxnamelen], -1); - - result = ACE_OS::hostname(char_name, maxnamelen); - ACE_OS::strcpy (name, ACE_Ascii_To_Wide (char_name).wchar_rep ()); + ACE::String_Conversion::Convert_InOut< char, wchar_t > convert (name, maxnamelen); + result = ACE_OS::hostname (convert.c_str(), convert.size()); delete [] char_name; return result; #endif /* ACE_WIN32 && !ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::isatty (int handle) @@ -1205,7 +1183,7 @@ ACE_OS::truncate (const ACE_TCHAR *filename, /* NOTREACHED */ #elif !defined (ACE_LACKS_TRUNCATE) ACE_OSCALL_RETURN - (::truncate (ACE_TEXT_ALWAYS_CHAR (filename), offset), int, -1); + (::truncate (ACE_TEXT_TO_CHAR_IN (filename), offset), int, -1); #else ACE_UNUSED_ARG (filename); ACE_UNUSED_ARG (offset); @@ -1265,7 +1243,7 @@ ACE_OS::unlink (const char *path) int, -1); # elif defined (ACE_HAS_WINCE) // @@ The problem is, DeleteFile is not actually equals to unlink. ;( - ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::DeleteFile (ACE_TEXT_CHAR_TO_TCHAR (path)), ace_result_), + ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::DeleteFile (ACE_TEXT_TO_TCHAR_IN (path)), ace_result_), int, -1); # elif defined (ACE_LACKS_UNLINK) ACE_UNUSED_ARG (path); @@ -1275,7 +1253,6 @@ ACE_OS::unlink (const char *path) # endif /* ACE_HAS_NONCONST_UNLINK */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::unlink (const wchar_t *path) { @@ -1287,11 +1264,9 @@ ACE_OS::unlink (const wchar_t *path) # elif defined (ACE_WIN32) ACE_OSCALL_RETURN (::_wunlink (path), int, -1); # else - ACE_Wide_To_Ascii npath (path); - return ACE_OS::unlink (npath.char_rep ()); + return ACE_OS::unlink (ACE_TEXT_TO_CHAR_IN (path)); # endif /* ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE ssize_t ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte) diff --git a/ace/OS_NS_wchar.cpp b/ace/OS_NS_wchar.cpp index 5e09dfc0a8d..b92b8d1f562 100644 --- a/ace/OS_NS_wchar.cpp +++ b/ace/OS_NS_wchar.cpp @@ -1,18 +1,16 @@ // -*- C++ -*- // $Id$ -#include "ace/OS_NS_wchar.h" +# include "ace/OS_NS_wchar.h" -ACE_RCSID(ace, OS_NS_wchar, "$Id$") +ACE_RCSID(ace, OS_NS_wchar_t, "$Id$") #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_wchar.inl" #endif /* ACE_HAS_INLINED_OS_CALLS */ -#if defined (ACE_HAS_WCHAR) -# include "ace/OS_NS_ctype.h" -# include "ace/OS_NS_string.h" -#endif /* ACE_HAS_WCHAR */ +#include "ace/OS_NS_ctype.h" +#include "ace/OS_NS_string.h" // The following wcs*_emulation methods were created based on BSD code: /*- @@ -51,7 +49,7 @@ ACE_RCSID(ace, OS_NS_wchar, "$Id$") * SUCH DAMAGE. */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCAT) +#if defined (ACE_LACKS_WCSCAT) wchar_t * ACE_OS::wcscat_emulation (wchar_t *destination, const wchar_t *source) @@ -62,9 +60,9 @@ ACE_OS::wcscat_emulation (wchar_t *destination, while ((*destination++ = *source++)); return save; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCAT */ +#endif /* ACE_LACKS_WCSCAT */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCHR) +#if defined (ACE_LACKS_WCSCHR) wchar_t * ACE_OS::wcschr_emulation (const wchar_t *string, wint_t c) { @@ -74,21 +72,21 @@ ACE_OS::wcschr_emulation (const wchar_t *string, wint_t c) return 0; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */ +#endif /* ACE_LACKS_WCSCHR */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP) +#if defined (ACE_LACKS_WCSCMP) int -ACE_OS::wcscmp_emulation (const ACE_WCHAR_T *string1, - const ACE_WCHAR_T *string2) +ACE_OS::wcscmp_emulation (const wchar_t *string1, + const wchar_t *string2) { while (*string1 == *string2++) if (*string1++ == 0) return (0); return (*string1 - *--string2); } -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */ +#endif /* ACE_LACKS_WCSCMP */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY) +#if defined (ACE_LACKS_WCSCPY) wchar_t * ACE_OS::wcscpy_emulation (wchar_t *destination, const wchar_t *source) @@ -98,9 +96,9 @@ ACE_OS::wcscpy_emulation (wchar_t *destination, for (; (*destination = *source); ++source, ++destination); return save; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCPY */ +#endif /* ACE_LACKS_WCSCPY */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCSPN) +#if defined (ACE_LACKS_WCSCSPN) size_t ACE_OS::wcscspn_emulation (const wchar_t *s, const wchar_t *reject) { @@ -120,9 +118,9 @@ ACE_OS::wcscspn_emulation (const wchar_t *s, const wchar_t *reject) return count; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCSPN */ +#endif /* ACE_LACKS_WCSCSPN */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSICMP) +#if defined (ACE_LACKS_WCSICMP) int ACE_OS::wcsicmp_emulation (const wchar_t *s, const wchar_t *t) { @@ -150,31 +148,31 @@ ACE_OS::wcsicmp_emulation (const wchar_t *s, const wchar_t *t) else return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_towlower (*scan2); } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSICMP */ +#endif /* ACE_LACKS_WCSICMP */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN) +#if defined (ACE_LACKS_WCSLEN) size_t -ACE_OS::wcslen_emulation (const ACE_WCHAR_T *string) +ACE_OS::wcslen_emulation (const wchar_t *string) { - const ACE_WCHAR_T *s; + const wchar_t *s; for (s = string; *s; ++s) continue; return s - string; } -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */ +#endif /* ACE_LACKS_WCSLEN */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT) -ACE_WCHAR_T * -ACE_OS::wcsncat_emulation (ACE_WCHAR_T *destination, - const ACE_WCHAR_T *source, +#if defined (ACE_LACKS_WCSNCAT) +wchar_t * +ACE_OS::wcsncat_emulation (wchar_t *destination, + const wchar_t *source, size_t count) { if (count != 0) { - ACE_WCHAR_T *d = destination; - const ACE_WCHAR_T *s = source; + wchar_t *d = destination; + const wchar_t *s = source; while (*d != 0) d++; @@ -192,12 +190,12 @@ ACE_OS::wcsncat_emulation (ACE_WCHAR_T *destination, return destination; } -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCAT */ +#endif /* ACE_LACKS_WCSCAT */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP) +#if defined (ACE_LACKS_WCSNCMP) int -ACE_OS::wcsncmp_emulation (const ACE_WCHAR_T *s1, - const ACE_WCHAR_T *s2, +ACE_OS::wcsncmp_emulation (const wchar_t *s1, + const wchar_t *s2, size_t len) { if (len == 0) @@ -213,18 +211,18 @@ ACE_OS::wcsncmp_emulation (const ACE_WCHAR_T *s1, return 0; } -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */ +#endif /* ACE_LACKS_WCSNCMP */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY) -ACE_WCHAR_T * -ACE_OS::wcsncpy_emulation (ACE_WCHAR_T *destination, - const ACE_WCHAR_T *source, +#if defined (ACE_LACKS_WCSNCPY) +wchar_t * +ACE_OS::wcsncpy_emulation (wchar_t *destination, + const wchar_t *source, size_t len) { if (len != 0) { - ACE_WCHAR_T *d = destination; - const ACE_WCHAR_T *s = source; + wchar_t *d = destination; + const wchar_t *s = source; do { @@ -240,9 +238,9 @@ ACE_OS::wcsncpy_emulation (ACE_WCHAR_T *destination, return destination; } -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */ +#endif /* ACE_LACKS_WCSNCPY */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNICMP) +#if defined (ACE_LACKS_WCSNICMP) int ACE_OS::wcsnicmp_emulation (const wchar_t *s, const wchar_t *t, @@ -277,9 +275,9 @@ ACE_OS::wcsnicmp_emulation (const wchar_t *s, else return ACE_OS::ace_towlower (*scan1) - ACE_OS::ace_towlower (*scan2); } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNICMP */ +#endif /* ACE_LACKS_WCSNICMP */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSPBRK) +#if defined (ACE_LACKS_WCSPBRK) wchar_t * ACE_OS::wcspbrk_emulation (const wchar_t *string, const wchar_t *charset) @@ -296,9 +294,9 @@ ACE_OS::wcspbrk_emulation (const wchar_t *string, return 0; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSPBRK */ +#endif /* ACE_LACKS_WCSPBRK */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSRCHR) +#if defined (ACE_LACKS_WCSRCHR) const wchar_t * ACE_OS::wcsrchr_emulation (const wchar_t *s, wint_t c) { @@ -326,9 +324,9 @@ ACE_OS::wcsrchr_emulation (wchar_t *s, wint_t c) return p; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSRCHR */ +#endif /* ACE_LACKS_WCSRCHR */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSPN) +#if defined (ACE_LACKS_WCSSPN) size_t ACE_OS::wcsspn_emulation (const wchar_t *string, const wchar_t *charset) @@ -345,9 +343,9 @@ cont: goto cont; return (p - 1 - string); } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSPN */ +#endif /* ACE_LACKS_WCSSPN */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSTR) +#if defined (ACE_LACKS_WCSSTR) wchar_t * ACE_OS::wcsstr_emulation (const wchar_t *string, const wchar_t *charset) @@ -371,5 +369,5 @@ ACE_OS::wcsstr_emulation (const wchar_t *string, return const_cast<wchar_t *> (string); } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSTR */ +#endif /* ACE_LACKS_WCSSTR */ diff --git a/ace/OS_NS_wchar.h b/ace/OS_NS_wchar.h index 3c8d5756fa1..d886dbcbdab 100644 --- a/ace/OS_NS_wchar.h +++ b/ace/OS_NS_wchar.h @@ -2,7 +2,7 @@ //============================================================================= /** - * @file OS_NS_wchar.h + * @file OS_NS_wchar_t.h * * $Id$ * @@ -14,8 +14,8 @@ */ //============================================================================= -#ifndef ACE_OS_NS_WCHAR_H -# define ACE_OS_NS_WCHAR_H +#ifndef ACE_OS_NS_wchar_t_H +# define ACE_OS_NS_wchar_t_H # include /**/ "ace/pre.h" @@ -25,10 +25,9 @@ # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/os_include/os_wchar.h" +#include "ace/ace_wchar.h" #include "ace/Basic_Types.h" #include "ace/ACE_export.h" -#include "ace/ace_wchar.h" // include for the time being, but this code needs to be moved. dhinton #include "ace/os_include/os_errno.h" @@ -39,100 +38,96 @@ namespace ACE_OS { - typedef ACE_WCHAR_T WChar; - -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wint_t fgetwc (FILE* fp); -#endif /* ACE_HAS_WCHAR */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCAT) +#if defined (ACE_LACKS_WCSCAT) /// Emulated wcscat - Appends a string. extern ACE_Export wchar_t *wcscat_emulation (wchar_t *destination, const wchar_t *source); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCAT */ +#endif /* ACE_LACKS_WCSCAT */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCHR) +#if defined (ACE_LACKS_WCSCHR) /// Emulated wcschr - Finds a character in a string. extern ACE_Export wchar_t *wcschr_emulation (const wchar_t *string, wint_t c); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */ +#endif /* ACE_LACKS_WCSCHR */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP) +#if defined (ACE_LACKS_WCSCMP) /// Emulated wcscmp - Compares strings. extern ACE_Export - int wcscmp_emulation (const ACE_WCHAR_T *string1, const ACE_WCHAR_T *string2); -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */ + int wcscmp_emulation (const wchar_t *string1, const wchar_t *string2); +#endif /* ACE_LACKS_WCSCMP */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY) +#if defined (ACE_LACKS_WCSCPY) /// Emulated wcscpy - Copies a string. extern ACE_Export wchar_t *wcscpy_emulation (wchar_t *destination, const wchar_t *source); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCPY */ +#endif /* ACE_LACKS_WCSCPY */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCSPN) +#if defined (ACE_LACKS_WCSCSPN) /// Emulated wcscspn. extern ACE_Export size_t wcscspn_emulation (const wchar_t *string, const wchar_t *reject); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCSPN */ +#endif /* ACE_LACKS_WCSCSPN */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSICMP) +#if defined (ACE_LACKS_WCSICMP) /// Emulated wcsicmp - Performs a case insensitive comparison of strings. extern ACE_Export int wcsicmp_emulation (const wchar_t *string1, const wchar_t *string2); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSICMP */ +#endif /* ACE_LACKS_WCSICMP */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN) +#if defined (ACE_LACKS_WCSLEN) /// Emulated wcslen - Returns the length of a string. extern ACE_Export - size_t wcslen_emulation (const ACE_WCHAR_T *string); -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */ + size_t wcslen_emulation (const wchar_t *string); +#endif /* ACE_LACKS_WCSLEN */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT) +#if defined (ACE_LACKS_WCSNCAT) /// Emulated wcscat - Appends a string. extern ACE_Export - ACE_WCHAR_T *wcsncat_emulation (ACE_WCHAR_T *destination, - const ACE_WCHAR_T *source, + wchar_t *wcsncat_emulation (wchar_t *destination, + const wchar_t *source, size_t count); -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCAT */ +#endif /* ACE_LACKS_WCSCAT */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP) +#if defined (ACE_LACKS_WCSNCMP) /// Emulated wcsncmp - Compares two arrays. extern ACE_Export - int wcsncmp_emulation (const ACE_WCHAR_T *string1, - const ACE_WCHAR_T *string2, + int wcsncmp_emulation (const wchar_t *string1, + const wchar_t *string2, size_t len); -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */ +#endif /* ACE_LACKS_WCSNCMP */ -#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY) +#if defined (ACE_LACKS_WCSNCPY) /// Emulated wcsncpy - Copies an array. extern ACE_Export - ACE_WCHAR_T *wcsncpy_emulation (ACE_WCHAR_T *destination, - const ACE_WCHAR_T *source, + wchar_t *wcsncpy_emulation (wchar_t *destination, + const wchar_t *source, size_t len); -#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */ +#endif /* ACE_LACKS_WCSNCPY */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNICMP) +#if defined (ACE_LACKS_WCSNICMP) /// Emulated wcsnicmp - Performs a case insensitive comparison of two /// arrays extern ACE_Export int wcsnicmp_emulation (const wchar_t *string1, const wchar_t *string2, size_t len); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNICMP */ +#endif /* ACE_LACKS_WCSNICMP */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSPBRK) +#if defined (ACE_LACKS_WCSPBRK) /// Emulated wcspbrk - Searches for characters in a string. extern ACE_Export wchar_t *wcspbrk_emulation (const wchar_t *string, const wchar_t *charset); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSPBRK */ +#endif /* ACE_LACKS_WCSPBRK */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSRCHR) +#if defined (ACE_LACKS_WCSRCHR) /// Emulated wcsrchr (wchar_t version) - Finds the last occurance of a /// character in a string. extern ACE_Export @@ -142,43 +137,41 @@ namespace ACE_OS { /// character in a string. extern ACE_Export const wchar_t *wcsrchr_emulation (const wchar_t *string, wint_t c); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSRCHR */ +#endif /* ACE_LACKS_WCSRCHR */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSPN) +#if defined (ACE_LACKS_WCSSPN) /// Emulated wcsspn. extern ACE_Export size_t wcsspn_emulation (const wchar_t *string, const wchar_t *charset); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSPN */ +#endif /* ACE_LACKS_WCSSPN */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSTR) +#if defined (ACE_LACKS_WCSSTR) /// Emulated wcsstr - Performs a case insensitive comparison of two strings. extern ACE_Export wchar_t *wcsstr_emulation (const wchar_t *string, const wchar_t *charset); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSTR */ +#endif /* ACE_LACKS_WCSSTR */ // these are named wrong. should be wcslen, etc... dhinton ACE_NAMESPACE_INLINE_FUNCTION - u_int wslen (const WChar *); + u_int wslen (const wchar_t *); ACE_NAMESPACE_INLINE_FUNCTION - WChar *wscpy (WChar *, - const WChar *); + wchar_t *wscpy (wchar_t *, + const wchar_t *); ACE_NAMESPACE_INLINE_FUNCTION - int wscmp (const WChar *, - const WChar *); + int wscmp (const wchar_t *, + const wchar_t *); ACE_NAMESPACE_INLINE_FUNCTION - int wsncmp (const WChar *, - const WChar *, + int wsncmp (const wchar_t *, + const wchar_t *, size_t len); -#if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION wint_t ungetwc (wint_t c, FILE* fp); -#endif /* ACE_HAS_WCHAR */ } /* namespace ACE_OS */ diff --git a/ace/OS_NS_wchar.inl b/ace/OS_NS_wchar.inl index c25d5159b53..e7c44bd8b8f 100644 --- a/ace/OS_NS_wchar.inl +++ b/ace/OS_NS_wchar.inl @@ -1,7 +1,6 @@ // -*- C++ -*- // $Id$ -#if defined (ACE_HAS_WCHAR) ACE_INLINE wint_t ACE_OS::fgetwc (FILE* fp) { @@ -12,10 +11,9 @@ ACE_OS::fgetwc (FILE* fp) ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetwc (fp), wint_t, WEOF); # endif /* ACE_LACKS_FGETWC */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE u_int -ACE_OS::wslen (const WChar *s) +ACE_OS::wslen (const wchar_t *s) { u_int len = 0; @@ -25,10 +23,10 @@ ACE_OS::wslen (const WChar *s) return len; } -ACE_INLINE ACE_OS::WChar * -ACE_OS::wscpy (WChar *dest, const WChar *src) +ACE_INLINE wchar_t * +ACE_OS::wscpy (wchar_t *dest, const wchar_t *src) { - WChar *original_dest = dest; + wchar_t *original_dest = dest; while ((*dest++ = *src++) != 0) continue; @@ -37,10 +35,10 @@ ACE_OS::wscpy (WChar *dest, const WChar *src) } ACE_INLINE int -ACE_OS::wscmp (const WChar *s, const WChar *t) +ACE_OS::wscmp (const wchar_t *s, const wchar_t *t) { - const WChar *scan1 = s; - const WChar *scan2 = t; + const wchar_t *scan1 = s; + const wchar_t *scan2 = t; while (*scan1 != 0 && *scan1 == *scan2) { @@ -52,10 +50,10 @@ ACE_OS::wscmp (const WChar *s, const WChar *t) } ACE_INLINE int -ACE_OS::wsncmp (const WChar *s, const WChar *t, size_t len) +ACE_OS::wsncmp (const wchar_t *s, const wchar_t *t, size_t len) { - const WChar *scan1 = s; - const WChar *scan2 = t; + const wchar_t *scan1 = s; + const wchar_t *scan2 = t; while (len != 0 && *scan1 != 0 && *scan1 == *scan2) { @@ -67,7 +65,6 @@ ACE_OS::wsncmp (const WChar *s, const WChar *t, size_t len) return len == 0 ? 0 : *scan1 - *scan2; } -#if defined (ACE_HAS_WCHAR) ACE_INLINE wint_t ACE_OS::ungetwc (wint_t c, FILE* fp) { @@ -79,5 +76,4 @@ ACE_OS::ungetwc (wint_t c, FILE* fp) ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::ungetwc (c, fp), wint_t, WEOF); # endif /* ACE_LACKS_FGETWC */ } -#endif /* ACE_HAS_WCHAR */ diff --git a/ace/OS_main.cpp b/ace/OS_main.cpp index 62cc9ff3148..5d8c43ac716 100644 --- a/ace/OS_main.cpp +++ b/ace/OS_main.cpp @@ -129,7 +129,7 @@ int ACE_Main_Base::run (HINSTANCE, { ACE_TCHAR cmdline[1024]; ACE_OS::strcpy (cmdline, ACE_LIB_TEXT ("program ")); - ACE_OS::strcat (cmdline, ACE_TEXT_WCHAR_TO_TCHAR (lpCmdLine)); + ACE_OS::strcat (cmdline, ACE_TEXT_TO_TCHAR_IN (lpCmdLine)); ACE_ARGV ce_argv (cmdline); ACE::init (); ACE_MAIN_OBJECT_MANAGER diff --git a/ace/Object_Manager_Base.cpp b/ace/Object_Manager_Base.cpp index 4a04cb16348..720e362e922 100644 --- a/ace/Object_Manager_Base.cpp +++ b/ace/Object_Manager_Base.cpp @@ -408,7 +408,7 @@ ACE_OS_Object_Manager::print_error_message (unsigned int line_number, #if !defined (ACE_HAS_WINCE) fprintf (stderr, "ace/OS.cpp, line %u: %s ", line_number, - ACE_TEXT_ALWAYS_CHAR (message)); + ACE_TEXT_TO_CHAR_IN (message)); perror ("failed"); #else // @@ Need to use the following information. diff --git a/ace/Process.cpp b/ace/Process.cpp index 07abb9de2a4..29aa109a267 100644 --- a/ace/Process.cpp +++ b/ace/Process.cpp @@ -349,8 +349,8 @@ ACE_Process::spawn (ACE_Process_Options &options) // releasing any of the converted string memory since this // process will either exec() or exit() shortly. # if defined (ACE_USES_WCHAR) - ACE_Wide_To_Ascii n_procname (options.process_name ()); - const char *procname = n_procname.char_rep (); + ACE::String_Conversion::Convert_In< char, wchar_t > n_procname (options.process_name ()); + const char *procname = n_procname.c_str (); wchar_t * const *wargv = options.command_line_argv (); size_t vcount, i; @@ -358,8 +358,9 @@ ACE_Process::spawn (ACE_Process_Options &options) ; char **procargv = new char *[vcount + 1]; // Need 0 at the end procargv[vcount] = 0; +// WHAT! for (i = 0; i < vcount; ++i) - procargv[i] = ACE_Wide_To_Ascii::convert (wargv[i]); + procargv[i] = ACE_TEXT_TO_CHAR_IN::convert (wargv[i]); wargv = options.env_argv (); for (vcount = 0; wargv[vcount] != 0; ++vcount) @@ -367,7 +368,7 @@ ACE_Process::spawn (ACE_Process_Options &options) char **procenv = new char *[vcount + 1]; // Need 0 at the end procenv[vcount] = 0; for (i = 0; i < vcount; ++i) - procenv[i] = ACE_Wide_To_Ascii::convert (wargv[i]); + procenv[i] = ACE_TEXT_TO_CHAR_IN::convert (wargv[i]); # else const char *procname = options.process_name (); char *const *procargv = options.command_line_argv (); @@ -962,7 +963,7 @@ ACE_Process_Options::command_line (const ACE_TCHAR *format, ...) return 0; } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_HAS_WINCE) +#if !defined (ACE_HAS_WINCE) /** * @note Not available on Windows CE because it doesn't have a char version of * vsprintf. @@ -988,14 +989,14 @@ ACE_Process_Options::command_line (const ACE_ANTI_TCHAR *format, ...) va_end (argp); ACE_OS::strcpy (this->command_line_buf_, - ACE_TEXT_ANTI_TO_TCHAR (anti_clb)); + ACE_TEXT_TO_TCHAR_IN (anti_clb)); delete [] anti_clb; command_line_argv_calculated_ = 0; return 0; } -#endif /* ACE_HAS_WCHAR && !ACE_HAS_WINCE */ +#endif /* !ACE_HAS_WINCE */ ACE_TCHAR * ACE_Process_Options::env_buf (void) diff --git a/ace/Process.h b/ace/Process.h index b746c0beb81..d273d6d9cb7 100644 --- a/ace/Process.h +++ b/ace/Process.h @@ -131,10 +131,8 @@ public: /// be <= MAXPATHLEN. void working_directory (const char *wd); -#if defined (ACE_HAS_WCHAR) /// wchar_t version of working_directory void working_directory (const wchar_t *wd); -#endif /* ACE_HAS_WCHAR */ /** * Set the command-line arguments. @a format can use any printf @@ -147,10 +145,10 @@ public: */ int command_line (const ACE_TCHAR *format, ...); -#if defined (ACE_HAS_WCHAR) && !defined (ACE_HAS_WINCE) +#if !defined (ACE_HAS_WINCE) /// Anti-TChar version of command_line () int command_line (const ACE_ANTI_TCHAR *format, ...); -#endif /* ACE_HAS_WCHAR && !ACE_HAS_WINCE */ +#endif /* !ACE_HAS_WINCE */ /// Same as above in argv format. @a argv must be null terminated. int command_line (const ACE_TCHAR * const argv[]); diff --git a/ace/Process.inl b/ace/Process.inl index db6f410e9b3..b8a0d721a7b 100644 --- a/ace/Process.inl +++ b/ace/Process.inl @@ -247,7 +247,7 @@ ACE_INLINE int ACE_Process_Options::setreugid (const ACE_TCHAR* user) { #if !defined (ACE_LACKS_PWD_FUNCTIONS) - struct passwd *ent = ACE_OS::getpwnam (ACE_TEXT_ALWAYS_CHAR (user)); + struct passwd *ent = ACE_OS::getpwnam (ACE_TEXT_TO_CHAR_IN (user)); if (ent != 0) { @@ -339,23 +339,21 @@ ACE_INLINE void ACE_Process_Options::working_directory (const char *wd) { #if !defined(ACE_HAS_WINCE) - ACE_OS::strcpy (working_directory_, ACE_TEXT_CHAR_TO_TCHAR (wd)); + ACE_OS::strcpy (working_directory_, ACE_TEXT_TO_TCHAR_IN (wd)); #else ACE_UNUSED_ARG (wd); #endif /* !ACE_HAS_WINCE */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE void ACE_Process_Options::working_directory (const wchar_t *wd) { #if !defined(ACE_HAS_WINCE) - ACE_OS::strcpy (working_directory_, ACE_TEXT_WCHAR_TO_TCHAR (wd)); + ACE_OS::strcpy (working_directory_, ACE_TEXT_TO_TCHAR_IN (wd)); #else ACE_UNUSED_ARG (wd); #endif /* !ACE_HAS_WINCE */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE void ACE_Process_Options::process_name (const ACE_TCHAR *p) diff --git a/ace/Process_Mutex.cpp b/ace/Process_Mutex.cpp index 1cf0aaa1902..0810ec1af50 100644 --- a/ace/Process_Mutex.cpp +++ b/ace/Process_Mutex.cpp @@ -38,7 +38,7 @@ ACE_Process_Mutex::unique_name (void) ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode) #if defined (_ACE_USE_SV_SEM) - : lock_ (name ? name : ACE_TEXT_ALWAYS_CHAR (this->unique_name ()), + : lock_ (name ? name : ACE_TEXT_TO_CHAR_IN (this->unique_name ()), ACE_SV_Semaphore_Complex::ACE_CREATE, 1, 1, @@ -46,7 +46,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode) #else : lock_ (USYNC_PROCESS, name ? - ACE_TEXT_CHAR_TO_TCHAR (name) : this->unique_name (), + ACE_TEXT_TO_TCHAR_IN (name) : this->unique_name (), (ACE_mutexattr_t *) arg, mode) #endif /* _ACE_USE_SV_SEM */ @@ -56,14 +56,13 @@ ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode) #endif /* !_ACE_USE_SV_SEM */ } -#if defined (ACE_HAS_WCHAR) ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name, void *arg, mode_t mode) #if defined (_ACE_USE_SV_SEM) : lock_ (name ? - ACE_Wide_To_Ascii (name).char_rep () : - ACE_TEXT_ALWAYS_CHAR (this->unique_name ()), + ACE_TEXT_TO_CHAR_IN (name) : + ACE_TEXT_TO_CHAR_IN (this->unique_name ()), ACE_SV_Semaphore_Complex::ACE_CREATE, 1, 1, @@ -71,7 +70,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name, #else : lock_ (USYNC_PROCESS, name ? - ACE_TEXT_WCHAR_TO_TCHAR (name) : this->unique_name (), + ACE_TEXT_TO_TCHAR_IN (name) : this->unique_name (), (ACE_mutexattr_t *) arg, mode) #endif /* _ACE_USE_SV_SEM */ @@ -80,7 +79,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name, ACE_UNUSED_ARG (arg); #endif /* _ACE_USE_SV_SEM */ } -#endif /* ACE_HAS_WCHAR */ + ACE_Process_Mutex::~ACE_Process_Mutex (void) { } diff --git a/ace/Process_Mutex.h b/ace/Process_Mutex.h index 69a295e3225..262525f7bed 100644 --- a/ace/Process_Mutex.h +++ b/ace/Process_Mutex.h @@ -87,8 +87,6 @@ public: ACE_Process_Mutex (const char *name = 0, void *arg = 0, mode_t mode = ACE_DEFAULT_FILE_PERMS); - -#if defined (ACE_HAS_WCHAR) /** * Create a Process_Mutex, passing in the optional @c name. (@c wchar_t * version) @@ -106,7 +104,6 @@ public: ACE_Process_Mutex (const wchar_t *name, void *arg = 0, mode_t mode = ACE_DEFAULT_FILE_PERMS); -#endif /* ACE_HAS_WCHAR */ ~ACE_Process_Mutex (void); diff --git a/ace/Process_Semaphore.cpp b/ace/Process_Semaphore.cpp index 5829ca5915a..7e3bdb7f90c 100644 --- a/ace/Process_Semaphore.cpp +++ b/ace/Process_Semaphore.cpp @@ -30,7 +30,7 @@ ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, #if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) : lock_ (count, USYNC_PROCESS, name, arg, max) #else - : lock_ (ACE_TEXT_ALWAYS_CHAR (name), + : lock_ (ACE_TEXT_TO_CHAR_IN (name), ACE_SV_Semaphore_Complex::ACE_CREATE, count) #endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ diff --git a/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp b/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp index a994146215b..1b6ef84a413 100644 --- a/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp +++ b/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp @@ -133,8 +133,7 @@ ACE_SOCK_Dgram_Mcast_QoS::subscribe_ifs (const ACE_INET_Addr &mcast_addr, if (this->subscribe (mcast_addr, qos_params, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr()), + ACE_TEXT_TO_TCHAR_IN (if_addrs[if_cnt].get_host_addr()), protocol_family, protocol, protocolinfo) == 0) diff --git a/ace/Registry_Name_Space.cpp b/ace/Registry_Name_Space.cpp index b00b455f3a9..a2322c29a8a 100644 --- a/ace/Registry_Name_Space.cpp +++ b/ace/Registry_Name_Space.cpp @@ -80,7 +80,7 @@ ACE_Registry_Name_Space::bind (const ACE_NS_WString &name, #else return this->context_.bind (name.char_rep(), object); -#endif /* ACE_HAS_WCHAR */ +#endif /* ACE_USES_WCHAR */ } diff --git a/ace/Remote_Name_Space.cpp b/ace/Remote_Name_Space.cpp index 55c50a275c7..12808ef2e62 100644 --- a/ace/Remote_Name_Space.cpp +++ b/ace/Remote_Name_Space.cpp @@ -44,12 +44,12 @@ ACE_Remote_Name_Space::bind (const ACE_NS_WString &name, const char *type) { ACE_TRACE ("ACE_Remote_Name_Space::bind"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ()); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> value_urep (value.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> value_urep (value.rep ()); ACE_UINT32 name_len = - static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (name.length () * sizeof (wchar_t)); ACE_UINT32 value_len = - static_cast<ACE_UINT32> (value.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (value.length () * sizeof (wchar_t)); ACE_UINT32 type_len = static_cast<ACE_UINT32> (ACE_OS::strlen (type)); ACE_Name_Request request (ACE_Name_Request::BIND, @@ -68,12 +68,12 @@ ACE_Remote_Name_Space::rebind (const ACE_NS_WString &name, const char *type) { ACE_TRACE ("ACE_Remote_Name_Space::rebind"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ()); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> value_urep (value.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> value_urep (value.rep ()); ACE_UINT32 name_len = - static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (name.length () * sizeof (wchar_t)); ACE_UINT32 value_len = - static_cast<ACE_UINT32> (value.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (value.length () * sizeof (wchar_t)); ACE_UINT32 type_len = static_cast<ACE_UINT32> (ACE_OS::strlen (type)); ACE_Name_Request request (ACE_Name_Request::REBIND, @@ -92,9 +92,9 @@ ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name, char *&type) { ACE_TRACE ("ACE_Remote_Name_Space::resolve"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ()); ACE_UINT32 name_len = - static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (name.length () * sizeof (wchar_t)); ACE_Name_Request request (ACE_Name_Request::RESOLVE, name_urep.get (), name_len, @@ -108,7 +108,7 @@ ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name, if (this->ns_proxy_.recv_reply (reply) == -1) return -1; - ACE_NS_WString temp (reply.value (), reply.value_len () / sizeof (ACE_WCHAR_T)); + ACE_NS_WString temp (reply.value (), reply.value_len () / sizeof (wchar_t)); value = temp; ACE_NEW_RETURN (type, char[reply.type_len () + 1], @@ -121,9 +121,9 @@ int ACE_Remote_Name_Space::unbind (const ACE_NS_WString &name) { ACE_TRACE ("ACE_Remote_Name_Space::unbind"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ()); ACE_UINT32 name_len = - static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (name.length () * sizeof (wchar_t)); ACE_Name_Request request (ACE_Name_Request::UNBIND, name_urep.get (), name_len, @@ -136,9 +136,9 @@ ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) { ACE_TRACE ("ACE_Remote_Name_Space::list_names"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ()); ACE_UINT32 pattern_len = - static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t)); ACE_Name_Request request (ACE_Name_Request::LIST_NAMES, pattern_urep.get (), pattern_len, @@ -158,7 +158,7 @@ ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set, if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) { ACE_NS_WString name (reply.name (), - reply.name_len () / sizeof (ACE_WCHAR_T)); + reply.name_len () / sizeof (wchar_t)); set.insert (name); } } @@ -170,9 +170,9 @@ ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) { ACE_TRACE ("ACE_Remote_Name_Space::list_values"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ()); ACE_UINT32 pattern_len = - static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t)); ACE_Name_Request request (ACE_Name_Request::LIST_VALUES, pattern_urep.get (), pattern_len, @@ -192,7 +192,7 @@ ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set, if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) { ACE_NS_WString value (reply.value (), - reply.value_len () / sizeof (ACE_WCHAR_T)); + reply.value_len () / sizeof (wchar_t)); set.insert (value); } } @@ -205,9 +205,9 @@ ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) { ACE_TRACE ("ACE_Remote_Name_Space::list_types"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ()); ACE_UINT32 pattern_len = - static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t)); ACE_Name_Request request (ACE_Name_Request::LIST_TYPES, pattern_urep.get (), pattern_len, @@ -240,9 +240,9 @@ ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) { ACE_TRACE ("ACE_Remote_Name_Space::list_name_entries"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ()); ACE_UINT32 pattern_len = - static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t)); ACE_Name_Request request (ACE_Name_Request::LIST_NAME_ENTRIES, pattern_urep.get (), pattern_len, @@ -263,9 +263,9 @@ ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set, if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) { ACE_NS_WString name (reply.name (), - reply.name_len () / sizeof (ACE_WCHAR_T)); + reply.name_len () / sizeof (wchar_t)); ACE_NS_WString value (reply.value (), - reply.value_len () / sizeof (ACE_WCHAR_T)); + reply.value_len () / sizeof (wchar_t)); ACE_Name_Binding entry (name, value, reply.type ()); @@ -281,9 +281,9 @@ ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) { ACE_TRACE ("ACE_Remote_Name_Space::list_value_entries"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ()); ACE_UINT32 pattern_len = - static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t)); ACE_Name_Request request (ACE_Name_Request::LIST_VALUE_ENTRIES, pattern_urep.get (), pattern_len, @@ -304,9 +304,9 @@ ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set, if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) { ACE_NS_WString name (reply.name (), - reply.name_len () / sizeof (ACE_WCHAR_T)); + reply.name_len () / sizeof (wchar_t)); ACE_NS_WString value (reply.value (), - reply.value_len () / sizeof (ACE_WCHAR_T)); + reply.value_len () / sizeof (wchar_t)); ACE_Name_Binding entry (name, value, reply.type()); @@ -322,9 +322,9 @@ ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) { ACE_TRACE ("ACE_Remote_Name_Space::list_type_entries"); - ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ()); + ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ()); ACE_UINT32 pattern_len = - static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T)); + static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t)); ACE_Name_Request request (ACE_Name_Request::LIST_TYPE_ENTRIES, pattern_urep.get (), pattern_len, @@ -345,9 +345,9 @@ ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set, if (reply.msg_type () != ACE_Name_Request::MAX_ENUM) { ACE_NS_WString name (reply.name (), - reply.name_len () / sizeof (ACE_WCHAR_T)); + reply.name_len () / sizeof (wchar_t)); ACE_NS_WString value (reply.value (), - reply.value_len () / sizeof (ACE_WCHAR_T)); + reply.value_len () / sizeof (wchar_t)); ACE_Name_Binding entry (name, value, reply.type ()); @@ -376,7 +376,7 @@ ACE_Remote_Name_Space::dump (void) const } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T>; +template class ACE_Auto_Basic_Array_Ptr<wchar_t>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> +#pragma instantiate ACE_Auto_Basic_Array_Ptr<wchar_t> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp index b3e2c96b2bc..64c4bd35b27 100644 --- a/ace/SOCK_Dgram.cpp +++ b/ace/SOCK_Dgram.cpp @@ -617,7 +617,7 @@ ACE_SOCK_Dgram::make_multicast_ifaddr (ip_mreq *ret_mreq, // Look up the interface by number, not name. if_address.ifr_ifno = ACE_OS::atoi (net_if); #else - ACE_OS::strcpy (if_address.ifr_name, ACE_TEXT_ALWAYS_CHAR (net_if)); + ACE_OS::string_copy (if_address.ifr_name, net_if, sizeof(if_address.ifr_name)); #endif /* defined (ACE_PSOS) */ if (ACE_OS::ioctl (this->get_handle (), @@ -660,7 +660,7 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq, #if defined(__linux__) if (net_if != 0) { - lmreq.ipv6mr_interface = ACE_OS::if_nametoindex (ACE_TEXT_ALWAYS_CHAR(net_if)); + lmreq.ipv6mr_interface = ACE_OS::if_nametoindex (ACE_TEXT_TO_CHAR_IN(net_if)); } else #elif defined (ACE_WIN32) @@ -704,10 +704,11 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq, { if ((num_if && pAddrs->Ipv6IfIndex == static_cast<unsigned int>(if_ix)) || (!num_if && - (ACE_OS::strcmp (ACE_TEXT_ALWAYS_CHAR (net_if), - pAddrs->AdapterName) == 0 - || ACE_OS::strcmp (ACE_TEXT_ALWAYS_CHAR (net_if), - ACE_Wide_To_Ascii (pAddrs->FriendlyName).char_rep()) == 0))) + // Do we need these conversions? + (ACE_OS::strcmp (ACE_TEXT_TO_CHAR_IN (net_if), + ACE_TEXT_TO_CHAR_IN (pAddrs->AdapterName)) == 0 + || ACE_OS::strcmp (ACE_TEXT_TO_CHAR_IN (net_if), + ACE_TEXT_TO_CHAR_IN (pAddrs->FriendlyName)) == 0))) { lmreq.ipv6mr_interface = pAddrs->Ipv6IfIndex; break; diff --git a/ace/SOCK_Dgram_Bcast.cpp b/ace/SOCK_Dgram_Bcast.cpp index ac8ea8f00fe..8dbac334cc5 100644 --- a/ace/SOCK_Dgram_Bcast.cpp +++ b/ace/SOCK_Dgram_Bcast.cpp @@ -144,7 +144,7 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name) // Get host ip address if (host_name) { - hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR (host_name)); + hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_TO_CHAR_IN (host_name)); if (hp == 0) return -1; diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp index 7661b8b975e..b11c5fd0ac7 100644 --- a/ace/SOCK_Dgram_Mcast.cpp +++ b/ace/SOCK_Dgram_Mcast.cpp @@ -272,7 +272,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, while (intf[index].if_index != 0 || intf[index].if_name != 0) { if (this->join (mcast_addr, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0) + ACE_TEXT_TO_TCHAR_IN(intf[index].if_name)) == 0) ++nr_subscribed; ++index; @@ -313,7 +313,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, while (pAddrs) { if (this->join (mcast_addr, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0) + ACE_TEXT_TO_TCHAR_IN(pAddrs->AdapterName)) == 0) ++nr_subscribed; pAddrs = pAddrs->Next; @@ -364,8 +364,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, continue; if (this->subscribe (mcast_addr, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr ())) == 0) + ACE_TEXT_TO_TCHAR_IN(if_addrs[if_cnt].get_host_addr ())) == 0) ++nr_subscribed; } } @@ -415,8 +414,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, continue; if (this->subscribe (mcast_addr, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr ())) == 0) + ACE_TEXT_TO_TCHAR_IN (if_addrs[if_cnt].get_host_addr ())) == 0) ++nr_subscribed; } } @@ -656,7 +654,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, int index = 0; while (intf[index].if_index != 0 || intf[index].if_name != 0) { - if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0) + if (this->leave (mcast_addr, ACE_TEXT_TO_TCHAR_IN(intf[index].if_name)) == 0) ++nr_unsubscribed; ++index; @@ -696,7 +694,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, while (pAddrs) { - if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0) + if (this->leave (mcast_addr, ACE_TEXT_TO_TCHAR_IN(pAddrs->AdapterName)) == 0) ++nr_unsubscribed; pAddrs = pAddrs->Next; @@ -749,8 +747,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, if (if_addrs[if_cnt].get_type () != AF_INET || if_addrs[if_cnt].is_loopback ()) continue; if (this->leave (mcast_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr ())) == 0) + ACE_TEXT_TO_TCHAR_IN (if_addrs[if_cnt].get_host_addr ())) == 0) ++nr_unsubscribed; } } @@ -798,8 +795,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, if (if_addrs[if_cnt].is_loopback ()) continue; if (this->leave (mcast_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr ())) == 0) + ACE_TEXT_TO_TCHAR_IN (if_addrs[if_cnt].get_host_addr ())) == 0) ++nr_unsubscribed; } } diff --git a/ace/SString.cpp b/ace/SString.cpp index 99aeb632943..0d3ba9efef0 100644 --- a/ace/SString.cpp +++ b/ace/SString.cpp @@ -38,12 +38,7 @@ operator<< (ACE_OSTREAM_TYPE &os, const ACE_WString &ws) { // @@ Need to figure out how to print the "wide" string // on platforms that don't support "wide" strings. -#if defined (ACE_HAS_WCHAR) - os << ACE_Wide_To_Ascii (ws.fast_rep ()).char_rep (); -#else - ACE_UNUSED_ARG (ws); - os << "(*non-printable string*)"; -#endif + os << ACE_TEXT_TO_CHAR_IN (ws.fast_rep ()); return os; } diff --git a/ace/SStringfwd.h b/ace/SStringfwd.h index f7bef34b86b..20e4b3011d2 100644 --- a/ace/SStringfwd.h +++ b/ace/SStringfwd.h @@ -19,7 +19,7 @@ #include /**/ "ace/pre.h" -#include "ace/Basic_Types.h" /* ACE_WCHAR_T definition */ +#include "ace/Basic_Types.h" /* wchar_t definition */ #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -28,7 +28,7 @@ template <class CHAR> class ACE_String_Base; // Forward declaration. -typedef ACE_WCHAR_T ACE_WSTRING_TYPE; +typedef wchar_t ACE_WSTRING_TYPE; typedef ACE_String_Base<char> ACE_CString; typedef ACE_String_Base<ACE_WSTRING_TYPE> ACE_WString; diff --git a/ace/SV_Semaphore_Simple.cpp b/ace/SV_Semaphore_Simple.cpp index e28ba4a923c..5fb1260144c 100644 --- a/ace/SV_Semaphore_Simple.cpp +++ b/ace/SV_Semaphore_Simple.cpp @@ -187,7 +187,6 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const char *name, ACE_LIB_TEXT ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"))); } -#if defined (ACE_HAS_WCHAR) ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name, int flags, int initial_value, @@ -195,7 +194,7 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name, int perms) { ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple(wchar_t)"); - if (this->open (ACE_Wide_To_Ascii (name).char_rep (), + if (this->open (ACE_TEXT_TO_CHAR_IN (name), flags, initial_value, nsems, @@ -204,7 +203,6 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"))); } -#endif /* ACE_HAS_WCHAR */ ACE_SV_Semaphore_Simple::~ACE_SV_Semaphore_Simple (void) { diff --git a/ace/SV_Semaphore_Simple.h b/ace/SV_Semaphore_Simple.h index 85ba4c0daa0..02d0da8ed12 100644 --- a/ace/SV_Semaphore_Simple.h +++ b/ace/SV_Semaphore_Simple.h @@ -67,13 +67,12 @@ public: int initial_value = 1, u_short nsems = 1, int perms = ACE_DEFAULT_FILE_PERMS); -#if defined (ACE_HAS_WCHAR) + ACE_SV_Semaphore_Simple (const wchar_t *name, int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, int perms = ACE_DEFAULT_FILE_PERMS); -#endif /* ACE_HAS_WCHAR */ ~ACE_SV_Semaphore_Simple (void); @@ -83,13 +82,11 @@ public: u_short nsems = 1, int perms = ACE_DEFAULT_FILE_PERMS); -#if defined (ACE_HAS_WCHAR) int open (const wchar_t *name, int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, int perms = ACE_DEFAULT_FILE_PERMS); -#endif /* ACE_HAS_WCHAR */ /// Open or create one or more SV_Semaphores. We return 0 if all is /// OK, else -1. diff --git a/ace/SV_Semaphore_Simple.inl b/ace/SV_Semaphore_Simple.inl index 85aad8d5b0c..46122d4e140 100644 --- a/ace/SV_Semaphore_Simple.inl +++ b/ace/SV_Semaphore_Simple.inl @@ -6,7 +6,6 @@ #include "ace/Global_Macros.h" #include "ace/OS_NS_Thread.h" -#if defined (ACE_HAS_WCHAR) // Semaphores don't offer wide-char names, so convert the name and forward // to the narrow-char open(). ACE_INLINE int @@ -17,13 +16,12 @@ ACE_SV_Semaphore_Simple::open (const wchar_t *name, int perms) { ACE_TRACE ("ACE_SV_Semaphore_Simple::open (wchar_t)"); - return this->open (ACE_Wide_To_Ascii (name).char_rep (), + return this->open (ACE_TEXT_TO_CHAR_IN (name), flags, initial_value, nsems, perms); } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_SV_Semaphore_Simple::control (int cmd, diff --git a/ace/Service_Config.inl b/ace/Service_Config.inl index a4ed474e8b3..23a6f81d12f 100644 --- a/ace/Service_Config.inl +++ b/ace/Service_Config.inl @@ -72,31 +72,31 @@ ACE_Service_Config::signal_handler (ACE_Sig_Adapter *signal_handler) ACE_INLINE int ACE_Service_Config::initialize (const ACE_Service_Type *sp, char parameters[]) { - return ACE_Service_Config::initialize (sp, ACE_TEXT_CHAR_TO_TCHAR (parameters)); + return ACE_Service_Config::initialize (sp, ACE_TEXT_TO_TCHAR_IN (parameters)); } ACE_INLINE int ACE_Service_Config::initialize (const char svc_name[], char parameters[]) { - return ACE_Service_Config::initialize (ACE_TEXT_CHAR_TO_TCHAR (svc_name), - ACE_TEXT_CHAR_TO_TCHAR (parameters)); + return ACE_Service_Config::initialize (ACE_TEXT_TO_TCHAR_IN (svc_name), + ACE_TEXT_TO_TCHAR_IN (parameters)); } ACE_INLINE int ACE_Service_Config::resume (const char svc_name[]) { - return ACE_Service_Config::resume (ACE_TEXT_CHAR_TO_TCHAR (svc_name)); + return ACE_Service_Config::resume (ACE_TEXT_TO_TCHAR_IN (svc_name)); } ACE_INLINE int ACE_Service_Config::suspend (const char svc_name[]) { - return ACE_Service_Config::suspend (ACE_TEXT_CHAR_TO_TCHAR (svc_name)); + return ACE_Service_Config::suspend (ACE_TEXT_TO_TCHAR_IN (svc_name)); } ACE_INLINE int ACE_Service_Config::remove (const char svc_name[]) { - return ACE_Service_Config::remove (ACE_TEXT_CHAR_TO_TCHAR (svc_name)); + return ACE_Service_Config::remove (ACE_TEXT_TO_TCHAR_IN (svc_name)); } #endif /* ACE_HAS_WINCE && !ACE_USES_WCHAR */ diff --git a/ace/Service_Manager.cpp b/ace/Service_Manager.cpp index 6e185d1940c..66b677bbcb7 100644 --- a/ace/Service_Manager.cpp +++ b/ace/Service_Manager.cpp @@ -297,7 +297,7 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("accepted from host %s at port %d\n"), - ACE_TEXT_CHAR_TO_TCHAR (sa.get_host_name ()), + ACE_TEXT_TO_TCHAR_IN (sa.get_host_name ()), sa.get_port_number ())); } diff --git a/ace/Shared_Memory_Pool.cpp b/ace/Shared_Memory_Pool.cpp index 8bed1289413..014616407da 100644 --- a/ace/Shared_Memory_Pool.cpp +++ b/ace/Shared_Memory_Pool.cpp @@ -248,7 +248,7 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (const ACE_TCHAR *backing_store_n // key. int segment_key; - int result = ::sscanf (ACE_TEXT_ALWAYS_CHAR (backing_store_name), + int result = ::sscanf (ACE_TEXT_TO_CHAR_IN (backing_store_name), "%d", &segment_key); @@ -256,7 +256,7 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (const ACE_TCHAR *backing_store_n // The conversion to a number failed so hash with crc32 // ACE::crc32 is also used in <SV_Semaphore_Simple>. this->base_shm_key_ = - (key_t) ACE::crc32 (ACE_TEXT_ALWAYS_CHAR (backing_store_name)); + (key_t) ACE::crc32 (ACE_TEXT_TO_CHAR_IN (backing_store_name)); else this->base_shm_key_ = segment_key; diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp index e2ca8640fb9..ed8e2082d25 100644 --- a/ace/Sock_Connect.cpp +++ b/ace/Sock_Connect.cpp @@ -392,7 +392,7 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr, // Get host ip address if necessary. if (host_name) { - hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR (host_name)); + hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_TO_CHAR_IN (host_name)); if (hp == 0) return -1; diff --git a/ace/UNIX_Addr.cpp b/ace/UNIX_Addr.cpp index 4732c21cb6d..043c8872217 100644 --- a/ace/UNIX_Addr.cpp +++ b/ace/UNIX_Addr.cpp @@ -48,7 +48,7 @@ int ACE_UNIX_Addr::addr_to_string (ACE_TCHAR s[], size_t len) const { ACE_OS::strsncpy (s, - ACE_TEXT_CHAR_TO_TCHAR (this->unix_addr_.sun_path), + ACE_TEXT_TO_TCHAR_IN (this->unix_addr_.sun_path), len); return 0; } diff --git a/ace/UNIX_Addr.h b/ace/UNIX_Addr.h index 36a040e4ec2..c1218888d13 100644 --- a/ace/UNIX_Addr.h +++ b/ace/UNIX_Addr.h @@ -76,13 +76,11 @@ public: /// Transform the string into the current addressing format. virtual int string_to_addr (const char addr[]); -#if defined (ACE_HAS_WCHAR) /// Creates an ACE_UNIX_Addr from a string. ACE_UNIX_Addr (const wchar_t rendezvous_point[]); /// Creates an ACE_UNIX_Addr from a string. int set (const wchar_t rendezvous_point[]); -#endif /* ACE_HAS_WCHAR */ /// Compare two addresses for equality. bool operator == (const ACE_UNIX_Addr &SAP) const; diff --git a/ace/UNIX_Addr.inl b/ace/UNIX_Addr.inl index 966fc1118ea..4a5da40940c 100644 --- a/ace/UNIX_Addr.inl +++ b/ace/UNIX_Addr.inl @@ -8,21 +8,19 @@ #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) -#if defined (ACE_HAS_WCHAR) /// Creates an ACE_UNIX_Addr from a string. ACE_INLINE ACE_UNIX_Addr::ACE_UNIX_Addr (const wchar_t rendezvous_point[]) { - this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point)); + this->set (rendezvous_point); } /// Creates an ACE_UNIX_Addr from a string. ACE_INLINE int ACE_UNIX_Addr::set (const wchar_t rendezvous_point[]) { - return this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point)); + return this->set (ACE_TEXT_TO_CHAR_IN (rendezvous_point)); } -#endif /* ACE_HAS_WCHAR */ // Compare two addresses for equality. diff --git a/ace/ace_wchar.h b/ace/ace_wchar.h index 7e56d2114bd..6b864873f7b 100644 --- a/ace/ace_wchar.h +++ b/ace/ace_wchar.h @@ -17,78 +17,43 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// These macros have been deprecated and should be replaced by their -// ACE_TEXT_* equivalents. These macros are just hacks and may not -// completely provide the old functionality. -#if defined (ACE_LEGACY_MODE) -// Convert the old unicode indicators -# if defined (ACE_HAS_MOSTLY_UNICODE_APIS) -# define ACE_USES_WCHAR -# endif /* ACE_HAS_MOSTLY_UNICODE_APIS */ -# if defined (ACE_HAS_UNICODE) -# define ACE_HAS_WCHAR -# endif /* ACE_HAS_UNICODE */ - -// These are defined to get older stuff to compile -// FUZZ: disable check_for_tchar -# define ASYS_TCHAR ACE_TCHAR -# define ASYS_TEXT ACE_TEXT -# define ASYS_ONLY_MULTIBYTE_STRING ACE_TEXT_ALWAYS_CHAR -# define ASYS_MULTIBYTE_STRING ACE_TEXT_CHAR_TO_TCHAR -# define ASYS_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR -# define ACE_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR - -# if defined (ACE_USES_WCHAR) -# define ASYS_ONLY_WIDE_STRING(STRING) STRING -# else /* ACE_USES_WCHAR */ -# define ASYS_ONLY_WIDE_STRING(STRING) \ - ACE_Ascii_To_Wide (STRING).wchar_rep () -# endif /* ACE_USES_WCHAR */ - -# define ACE_TEXT_STRING ACE_TString - -#endif /* ACE_LEGACY_MODE */ +#if !defined(ACE_SIZEOF_WCHAR) || !defined (ACE_WCHAR_MAX) + #error Must (Un)define ACE_SIZEOF_WCHAR, ACE_WCHAR_MAX, \ + and ACE_LACKS_BUILTIN_WCHAR_T in the config-<platform>.h +#endif -#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) -# if !defined (ACE_HAS_WCHAR) -# define ACE_HAS_WCHAR -# endif -# include /**/ <wchar.h> -#endif /* ACE_HAS_XPG4_MULTIBYPTE_CHAR */ +// Add includes and/or typedefs to get wchar_t, wint_t, and wctype_t. +# if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) +# include /**/ <wchar.h> +# endif /* ACE_HAS_XPG4_MULTIBYPTE_CHAR */ -#if defined (ACE_HAS_WCHAR) # if defined (VXWORKS) # include /**/ <types/vxTypes.h> /* For wchar_t */ -# include /**/ <stdlib.h> /* For mbstowcs, etc. */ -# include /**/ <string.h> /* For strlen */ -# define wint_t unsigned int /* VxWorks has wchar_t but not wint_t */ + typedef wchar_t wint_t; + typedef wchar_t wctype_t; + # elif defined (ACE_OPENVMS) # include /**/ <wchar.h> # include /**/ <wctype.h> + # elif defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ (ACE_HAS_STANDARD_CPP_LIBRARY != 0) # include /**/ <cwchar> # include /**/ <cwctype> + # elif defined (ACE_HAS_WINCE) # include /**/ <wtypes.h> + # elif !defined (__BORLANDC__) # include /**/ <wchar.h> + # endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ -#endif /* ACE_HAS_WCHAR */ #if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) using std::size_t; #endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ -// This makes the somewhat dubious assumption that if a platform lacks -// a native wchar_t type, then it will typedef it as unsigned short. -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_NATIVE_WCHAR_T) -# if !defined (ACE_WSTRING_HAS_USHORT_SUPPORT) -# define ACE_WSTRING_HAS_USHORT_SUPPORT -# endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */ -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_NATIVE_WCHAR_T */ - // Set the default behaviour for ACE_TEXT_WIDE to use the L-prefix #if !defined (ACE_USES_L_PREFIX) # define ACE_USES_L_PREFIX 1 @@ -105,26 +70,6 @@ using std::size_t; # define ACE_TEXT_WIDE(STRING) ACE_TEXT_WIDE_I (STRING) # endif /* ACE_TEXT_WIDE */ -#if defined (ACE_USES_WCHAR) -typedef wchar_t ACE_TCHAR; -typedef char ACE_ANTI_TCHAR; -# define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE (STRING) -# define ACE_TEXT_ALWAYS_CHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () -# define ACE_TEXT_ALWAYS_WCHAR(STRING) STRING -# define ACE_TEXT_CHAR_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () -# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) STRING -# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () -#else /* ACE_USES_WCHAR */ -typedef char ACE_TCHAR; -typedef wchar_t ACE_ANTI_TCHAR; -# define ACE_LIB_TEXT(STRING) STRING -# define ACE_TEXT_ALWAYS_CHAR(STRING) STRING -# define ACE_TEXT_ALWAYS_WCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () -# define ACE_TEXT_CHAR_TO_TCHAR(STRING) STRING -# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () -# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () -#endif /* ACE_USES_WCHAR */ - #if defined (ACE_LEGACY_MODE) # define ACE_TEXT TEXT #else /* ACE_LEGACY_MODE */ @@ -156,183 +101,21 @@ typedef wchar_t ACE_ANTI_TCHAR; #endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ -#if defined ACE_HAS_WCHAR -/** - * @class ACE_Wide_To_Ascii - * - * @brief A lightweight wchar* to char* string conversion class. - * - * The purpose of this class is to perform conversion from - * wchar* to char* strings. It is not intended for general - * purpose use. - */ -class ACE_Wide_To_Ascii -{ -public: - /// Ctor must take a wchar string. - ACE_Wide_To_Ascii (const wchar_t *s); - - /// Dtor will free up the memory. - ~ACE_Wide_To_Ascii (void); - - /// Return the internal char* representation. - char *char_rep (void); - - /// Converts an wchar_t string to ascii and returns a new string. - static char *convert (const wchar_t *wstr); - -private: - /// Internal pointer to the converted string. - char *s_; - - /// Disallow these operation. - ACE_Wide_To_Ascii (void); - ACE_Wide_To_Ascii (ACE_Wide_To_Ascii &); - ACE_Wide_To_Ascii& operator= (ACE_Wide_To_Ascii &); -}; - -/** - * @class ACE_Ascii_To_Wide - * - * @brief A lightweight char* to wchar* string conversion class. - * - * The purpose of this class is to perform conversion from - * char* to wchar* strings. It is not intended for general - * purpose use. - */ -class ACE_Ascii_To_Wide -{ -public: - /// Ctor must take a wchar string. - ACE_Ascii_To_Wide (const char *s); - - /// Dtor will free up the memory. - ~ACE_Ascii_To_Wide (void); - - /// Return the internal wchar* representation. - wchar_t *wchar_rep (void); - - /// Converts an char string to unicode/wide and returns a new string. - static wchar_t *convert (const char *str); - -private: - /// Internal pointer to the converted string. - wchar_t *s_; - - /// Disallow these operation. - ACE_Ascii_To_Wide (void); - ACE_Ascii_To_Wide (ACE_Ascii_To_Wide &); - ACE_Ascii_To_Wide operator= (ACE_Ascii_To_Wide &); -}; - -#if defined (ACE_LEGACY_MODE) -typedef ACE_Ascii_To_Wide ACE_OS_CString; -typedef ACE_Wide_To_Ascii ACE_OS_WString; -#endif /* ACE_LEGACY_MODE */ - -#endif /* ACE_HAS_WCHAR */ - -#if defined (ACE_WIN32) +// ACE_TCHAR Macros #if defined (ACE_USES_WCHAR) -#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYW -#define ACE_TEXT_STARTUPINFO STARTUPINFOW -#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAW - -#define ACE_TEXT_CreateEvent ::CreateEventW -#define ACE_TEXT_CreateFile ::CreateFileW -#define ACE_TEXT_CreateFileMapping ::CreateFileMappingW -#define ACE_TEXT_CreateMutex ::CreateMutexW -#define ACE_TEXT_CreateProcess ::CreateProcessW -#define ACE_TEXT_CreateSemaphore ::CreateSemaphoreW -#define ACE_TEXT_CreateService ::CreateServiceW -#define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsW -#define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationW -#define ACE_TEXT_FindFirstFile ::FindFirstFileW -#define ACE_TEXT_FindNextFile ::FindNextFileW -#define ACE_TEXT_FormatMessage ::FormatMessageW -#define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsW -#define ACE_TEXT_GetComputerName ::GetComputerNameW -#define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsW -#define ACE_TEXT_GetFileAttributes ::GetFileAttributesW -#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameW -#define ACE_TEXT_GetTempPath ::GetTempPathW -#define ACE_TEXT_GetUserName ::GetUserNameW -#define ACE_TEXT_LoadLibrary ::LoadLibraryW -#define ACE_TEXT_MoveFileEx ::MoveFileExW -#define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeW -#define ACE_TEXT_OpenFileMapping ::OpenFileMappingW -#define ACE_TEXT_OpenSCManager ::OpenSCManagerW -#define ACE_TEXT_OpenService ::OpenServiceW -#define ACE_TEXT_OutputDebugString ::OutputDebugStringW -#define ACE_TEXT_RegisterEventSource ::RegisterEventSourceW -#define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerW -#define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryW -#define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExW -#define ACE_TEXT_RegDeleteKey ::RegDeleteKeyW -#define ACE_TEXT_RegDeleteValue ::RegDeleteValueW -#define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExW -#define ACE_TEXT_RegEnumValue ::RegEnumValueW -#define ACE_TEXT_RegCreateKey ::RegCreateKeyW -#define ACE_TEXT_RegOpenKey ::RegOpenKeyW -#define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExW -#define ACE_TEXT_RegQueryValueEx ::RegQueryValueExW -#define ACE_TEXT_RegSetValueEx ::RegSetValueExW -#define ACE_TEXT_ReportEvent ::ReportEventW -#define ACE_TEXT_SearchPath ::SearchPathW -#define ACE_TEXT_StartService ::StartServiceW -#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherW - + typedef wchar_t ACE_TCHAR; + typedef char ACE_ANTI_TCHAR; + # define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE( STRING ) #else /* ACE_USES_WCHAR */ -#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYA -#define ACE_TEXT_STARTUPINFO STARTUPINFOA -#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAA - -#define ACE_TEXT_CreateEvent ::CreateEventA -#define ACE_TEXT_CreateFile ::CreateFileA -#define ACE_TEXT_CreateFileMapping ::CreateFileMappingA -#define ACE_TEXT_CreateMutex ::CreateMutexA -#define ACE_TEXT_CreateProcess ::CreateProcessA -#define ACE_TEXT_CreateSemaphore ::CreateSemaphoreA -#define ACE_TEXT_CreateService ::CreateServiceA -#define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsA -#define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationA -#define ACE_TEXT_FindFirstFile ::FindFirstFileA -#define ACE_TEXT_FindNextFile ::FindNextFileA -#define ACE_TEXT_FormatMessage ::FormatMessageA -#define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsA -#define ACE_TEXT_GetComputerName ::GetComputerNameA -#define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsA -#define ACE_TEXT_GetFileAttributes ::GetFileAttributesA -#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameA -#define ACE_TEXT_GetTempPath ::GetTempPathA -#define ACE_TEXT_GetUserName ::GetUserNameA -#define ACE_TEXT_LoadLibrary ::LoadLibraryA -#define ACE_TEXT_MoveFileEx ::MoveFileExA -#define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeA -#define ACE_TEXT_OpenFileMapping ::OpenFileMappingA -#define ACE_TEXT_OpenSCManager ::OpenSCManagerA -#define ACE_TEXT_OpenService ::OpenServiceA -#define ACE_TEXT_OutputDebugString ::OutputDebugStringA -#define ACE_TEXT_RegisterEventSource ::RegisterEventSourceA -#define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerA -#define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryA -#define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExA -#define ACE_TEXT_RegDeleteKey ::RegDeleteKeyA -#define ACE_TEXT_RegDeleteValue ::RegDeleteValueA -#define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExA -#define ACE_TEXT_RegEnumValue ::RegEnumValueA -#define ACE_TEXT_RegCreateKey ::RegCreateKeyA -#define ACE_TEXT_RegOpenKey ::RegOpenKeyA -#define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExA -#define ACE_TEXT_RegQueryValueEx ::RegQueryValueExA -#define ACE_TEXT_RegSetValueEx ::RegSetValueExA -#define ACE_TEXT_ReportEvent ::ReportEventA -#define ACE_TEXT_SearchPath ::SearchPathA -#define ACE_TEXT_StartService ::StartServiceA -#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherA + typedef char ACE_TCHAR; + typedef wchar_t ACE_ANTI_TCHAR; + # define ACE_LIB_TEXT(STRING) STRING #endif /* ACE_USES_WCHAR */ -#endif /* ACE_WIN32 */ -#include "ace/ace_wchar.inl" +// This package should only be included in the implementation files +// that use it. +#if defined (ACE_WIN32) +#include "ace/ace_wchar_win32_defs.h" +#endif #endif /* ACE_WCHAR_H */ diff --git a/ace/config-all.h b/ace/config-all.h index 2eb753b138f..dba2349c254 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -89,6 +89,9 @@ # include "ace/Trace.h" #endif /* ACE_OS_NTRACE */ +// Include the string conversion services here for backward compatibility +#include "ace/String_Conversion_T.h" + // These includes are here to avoid circular dependencies. // Keep this at the bottom of the file. It contains the main macros. #include "ace/OS_main.h" diff --git a/ace/config-doxygen.h b/ace/config-doxygen.h index 6b928396456..d60eb0d5955 100644 --- a/ace/config-doxygen.h +++ b/ace/config-doxygen.h @@ -18,9 +18,6 @@ /// Make sure that we always turn inlining on. #defind __ACE_INLINE__ -/// Make the wchar_t interfaces available. -#define ACE_HAS_WCHAR - /// Make all the emulation versions of string operations visible // #define ACE_LACKS_WCSTOK #define ACE_LACKS_ITOW diff --git a/ace/config-freebsd.h b/ace/config-freebsd.h index f0e92a55340..fd1afe17751 100644 --- a/ace/config-freebsd.h +++ b/ace/config-freebsd.h @@ -256,7 +256,6 @@ typedef union sigval sigval_t; #define ACE_LACKS_STROPTS_H -// Needed when ACE_HAS_WCHAR is defined. #define ACE_LACKS_WCSNICMP #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSDUP diff --git a/ace/config-hpux-11.00.h b/ace/config-hpux-11.00.h index 7b793dd8c16..ddc86e1ae7c 100644 --- a/ace/config-hpux-11.00.h +++ b/ace/config-hpux-11.00.h @@ -149,8 +149,6 @@ // Platform has XPG4 wide character support # define ACE_HAS_XPG4_MULTIBYTE_CHAR -# define ACE_HAS_WCHAR -# define ACE_SIZEOF_WCHAR _WCHAR_T # endif /* __cplusplus < 199707L */ diff --git a/ace/config-netbsd.h b/ace/config-netbsd.h index 17c4cbb9c9a..8d7965c9c66 100644 --- a/ace/config-netbsd.h +++ b/ace/config-netbsd.h @@ -83,7 +83,6 @@ #define ACE_HAS_USING_KEYWORD 1 #define ACE_HAS_VOIDPTR_MMAP 1 #define ACE_HAS_VOIDPTR_SOCKOPT 1 -#define ACE_HAS_WCHAR 1 #define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR 1 #define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 #define ACE_IOCTL_TYPE_ARG2 u_long diff --git a/ace/config-pharlap.h b/ace/config-pharlap.h index fa274e22383..928e3395f9c 100644 --- a/ace/config-pharlap.h +++ b/ace/config-pharlap.h @@ -54,7 +54,6 @@ // Let the config-win32.h file do its thing #undef ACE_CONFIG_H #include "ace/config-win32.h" -#undef ACE_HAS_WCHAR #include /**/ <embkern.h> #if defined (ACE_HAS_PHARLAP_RT) diff --git a/ace/config-rtems.h b/ace/config-rtems.h index 5ec4d571a4e..7917c0c6dfd 100644 --- a/ace/config-rtems.h +++ b/ace/config-rtems.h @@ -133,8 +133,6 @@ ACE_HAS_SEND_TIMEDWAIT ACE_HAS_SENDTO_TIMEDWAIT ACE_HAS_IP_MULTICAST ACE_HAS_NONCONST_SELECT_TIMEVAL -ACE_HAS_WCHAR_TYPEDEFS_CHAR -ACE_HAS_WCHAR_TYPEDEFS_USHORT ACE_HAS_SIGNAL_SAFE_OS_CALLS ACE_HAS_SIZET_SOCKET_LEN ACE_HAS_SOCKADDR_MSG_NAME diff --git a/ace/config-vxworks5.x.h b/ace/config-vxworks5.x.h index d3299b203be..c0fe9f9f473 100644 --- a/ace/config-vxworks5.x.h +++ b/ace/config-vxworks5.x.h @@ -36,6 +36,11 @@ # define ACE_LACKS_LINEBUFFERED_STREAMBUF +// ACE WChar support +#define ACE_SIZEOF_WCHAR 4 +#define ACE_WCHAR_MAX 0xFFFFFFFF +#undef ACE_LACKS_BUILTIN_WCHAR_T + // An explicit check for Tornado 2.1, which had very limited release. // See include/makeinclude/platform_vxworks5.x_g++.GNU for details // on version conventions used by ACE for VxWorks. diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index dcee76dd553..7b171b5d98d 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -278,6 +278,13 @@ #define ACE_UINT64_TYPE unsigned long long #endif +// ACE WChar support +#define ACE_SIZEOF_WCHAR 2 +#define ACE_WCHAR_MAX 0xFFFF +#if !defined(_NATIVE_WCHAR_T_DEFINED) +# define ACE_LACKS_BUILTIN_WCHAR_T +#endif + // Optimize ACE_Handle_Set for select(). #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT @@ -285,12 +292,6 @@ // is controlled in compiler configs since it's a compiler switch. // Additionally, if the user selected use of wide chars (by setting either // ACE_USES_WCHAR or UNICODE) make sure both are enabled. -#define ACE_HAS_WCHAR -#if defined (ACE_USES_WCHAR) -# ifndef UNICODE -# define UNICODE -# endif -#endif /* ACE_USES_WCHAR */ #if defined (UNICODE) && !defined (ACE_USES_WCHAR) # define ACE_USES_WCHAR #endif /* UNICODE && !ACE_USES_WCHAR */ diff --git a/ace/config-win32-ghs.h b/ace/config-win32-ghs.h index b14d90d2636..44789dc8d48 100644 --- a/ace/config-win32-ghs.h +++ b/ace/config-win32-ghs.h @@ -25,7 +25,6 @@ //Green Hills Native x86 does not support structural exceptions # undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS -# undef ACE_HAS_WCHAR # define ACE_CONFIG_INCLUDE_GHS_COMMON # include "ace/config-ghs-common.h" diff --git a/ace/config-win32-msvc.h b/ace/config-win32-msvc.h index a28d2805d17..dd280d0cfaf 100644 --- a/ace/config-win32-msvc.h +++ b/ace/config-win32-msvc.h @@ -55,7 +55,7 @@ #endif /* _CPPRTTI */ #if ! defined(_NATIVE_WCHAR_T_DEFINED) - #define ACE_LACKS_NATIVE_WCHAR_T + #define ACE_LACKS_BUILTIN_WCHAR_T #endif // Win Mobile still does thread exits differently than PC Windows. diff --git a/ace/os_include/os_stddef.h b/ace/os_include/os_stddef.h index 008a3f7ba1e..db1190d33f8 100644 --- a/ace/os_include/os_stddef.h +++ b/ace/os_include/os_stddef.h @@ -81,12 +81,6 @@ extern "C" value equal to its value when used as the lone character in an integer character constant. */ -#if defined (ACE_LACKS_WCHAR_T) -# if !defined (ACE_WCHAR_T_TYPE) -# define ACE_WCHAR_T_TYPE long; -# endif /* !ACE_WCHAR_T_TYPE */ - typedef ACE_WCHAR_T_TYPE wchar_t; -#endif /* ACE_LACKS_WCHAR_T */ // Unsigned integer type of the result of the sizeof operator. #if defined (ACE_LACKS_SIZE_T) |