diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-11-08 02:59:52 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-11-08 02:59:52 +0000 |
commit | f30a68993b5d63668a7df21d079320aa0782a893 (patch) | |
tree | af896c3cdfcd575174ee899f6c17753ae1c99ebc | |
parent | dabe4f96d7ff71199f068d1aad5f83c3223ee290 (diff) | |
download | ATCD-f30a68993b5d63668a7df21d079320aa0782a893.tar.gz |
ChangeLogTag:Wed Nov 7 20:54:23 2001 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r-- | ChangeLog | 31 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 31 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 31 | ||||
-rw-r--r-- | ace/Basic_Types.h | 11 | ||||
-rw-r--r-- | ace/Local_Name_Space.cpp | 2 | ||||
-rw-r--r-- | ace/Makefile | 1 | ||||
-rw-r--r-- | ace/OS_String.cpp | 54 | ||||
-rw-r--r-- | ace/OS_String.h | 76 | ||||
-rw-r--r-- | ace/OS_String.inl | 62 | ||||
-rw-r--r-- | ace/SString.h | 6 |
10 files changed, 187 insertions, 118 deletions
diff --git a/ChangeLog b/ChangeLog index e013705202d..4ad4174d7ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +Wed Nov 7 20:54:23 2001 Nanbor Wang <nanbor@cs.wustl.edu> + + * ace/Makefile: Added String_Base into the list of template + files. + + * ace/Basic_Types.h: Added definitions of ACE_WCHAR_T and + ACE_WINT_T which are defined to wchat_t and wint_t when + ACE_HAS_WCHAR are defined, and ACE_USHORT16 otherwise. They are + needed to support various "wide character" string operations + that we need to support the templatized ACE_WString, which uses + ACE_USHORT16 as the wide char type when wchar_t is not + supported. + + * ace/OS_String.h: + * ace/OS_String.inl: + * ace/OS_String.cpp: Made several wchar version string functions + available no matter ACE_HAS_WCHAR is defined or not. There are + more functions (the ones that have *_emulation helpers + available) that can be made availabe at all time, but I just + fixed the ones that ACE_WString needed for now. We can add more + later. + + * ace/SString.h: Changed the definition of ACE_WSTRING_TYPE to + ACE_WCHAR_T. ACE_WCHAR_T is defined in the same fashion as + ACE_WSTRING_TYPE was originally defined. + + * ace/Local_Name_Space.cpp: ACE_NS_WString::char_rep works just + fine. We don't need to use ACE_Wide_To_Ascii::convert + explicitly since it is not available when ACE_HAS_WCHAR isn't + defined. + Tue Oct 16 01:55:44 2001 Nanbor Wang <nanbor@cs.wustl.edu> * ace/SString.cpp (operator<<): Avoided the problem of printing diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index e013705202d..4ad4174d7ea 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,34 @@ +Wed Nov 7 20:54:23 2001 Nanbor Wang <nanbor@cs.wustl.edu> + + * ace/Makefile: Added String_Base into the list of template + files. + + * ace/Basic_Types.h: Added definitions of ACE_WCHAR_T and + ACE_WINT_T which are defined to wchat_t and wint_t when + ACE_HAS_WCHAR are defined, and ACE_USHORT16 otherwise. They are + needed to support various "wide character" string operations + that we need to support the templatized ACE_WString, which uses + ACE_USHORT16 as the wide char type when wchar_t is not + supported. + + * ace/OS_String.h: + * ace/OS_String.inl: + * ace/OS_String.cpp: Made several wchar version string functions + available no matter ACE_HAS_WCHAR is defined or not. There are + more functions (the ones that have *_emulation helpers + available) that can be made availabe at all time, but I just + fixed the ones that ACE_WString needed for now. We can add more + later. + + * ace/SString.h: Changed the definition of ACE_WSTRING_TYPE to + ACE_WCHAR_T. ACE_WCHAR_T is defined in the same fashion as + ACE_WSTRING_TYPE was originally defined. + + * ace/Local_Name_Space.cpp: ACE_NS_WString::char_rep works just + fine. We don't need to use ACE_Wide_To_Ascii::convert + explicitly since it is not available when ACE_HAS_WCHAR isn't + defined. + Tue Oct 16 01:55:44 2001 Nanbor Wang <nanbor@cs.wustl.edu> * ace/SString.cpp (operator<<): Avoided the problem of printing diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index e013705202d..4ad4174d7ea 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,34 @@ +Wed Nov 7 20:54:23 2001 Nanbor Wang <nanbor@cs.wustl.edu> + + * ace/Makefile: Added String_Base into the list of template + files. + + * ace/Basic_Types.h: Added definitions of ACE_WCHAR_T and + ACE_WINT_T which are defined to wchat_t and wint_t when + ACE_HAS_WCHAR are defined, and ACE_USHORT16 otherwise. They are + needed to support various "wide character" string operations + that we need to support the templatized ACE_WString, which uses + ACE_USHORT16 as the wide char type when wchar_t is not + supported. + + * ace/OS_String.h: + * ace/OS_String.inl: + * ace/OS_String.cpp: Made several wchar version string functions + available no matter ACE_HAS_WCHAR is defined or not. There are + more functions (the ones that have *_emulation helpers + available) that can be made availabe at all time, but I just + fixed the ones that ACE_WString needed for now. We can add more + later. + + * ace/SString.h: Changed the definition of ACE_WSTRING_TYPE to + ACE_WCHAR_T. ACE_WCHAR_T is defined in the same fashion as + ACE_WSTRING_TYPE was originally defined. + + * ace/Local_Name_Space.cpp: ACE_NS_WString::char_rep works just + fine. We don't need to use ACE_Wide_To_Ascii::convert + explicitly since it is not available when ACE_HAS_WCHAR isn't + defined. + Tue Oct 16 01:55:44 2001 Nanbor Wang <nanbor@cs.wustl.edu> * ace/SString.cpp (operator<<): Avoided the problem of printing diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h index ed85a9fe134..256c7013f03 100644 --- a/ace/Basic_Types.h +++ b/ace/Basic_Types.h @@ -204,6 +204,17 @@ typedef ACE_UINT16 ACE_USHORT16; +// 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) +# define ACE_WINT_T wint_t +# define ACE_WCHAR_T wchar_t +# else +# define ACE_WINT_T ACE_USHORT16 +# define ACE_WCHAR_T ACE_USHORT16 +# endif /* ACE_HAS_WCHAR */ + # if ACE_SIZEOF_INT == 4 typedef int ACE_INT32; typedef unsigned int ACE_UINT32; diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp index 9e29d4aece1..ae892b07f5b 100644 --- a/ace/Local_Name_Space.cpp +++ b/ace/Local_Name_Space.cpp @@ -43,7 +43,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_USHORT16)) - 1); - return ACE_Wide_To_Ascii::convert (w_string.fast_rep ()); + return w_string.char_rep (); } ACE_NS_String::ACE_NS_String (void) diff --git a/ace/Makefile b/ace/Makefile index 1a983aab876..e38b155aa23 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -284,6 +284,7 @@ TEMPLATE_FILES = \ Strategies_T \ Stream \ Stream_Modules \ + String_Base \ Svc_Handler \ Synch_T \ Task_T \ diff --git a/ace/OS_String.cpp b/ace/OS_String.cpp index 6bc7aaf44f5..b78b81c3334 100644 --- a/ace/OS_String.cpp +++ b/ace/OS_String.cpp @@ -45,9 +45,8 @@ ACE_OS_String::strnstr (const char *s1, const char *s2, size_t len2) return 0; } -#if defined (ACE_HAS_WCHAR) -const wchar_t * -ACE_OS_String::strnstr (const wchar_t *s1, const wchar_t *s2, size_t len2) +const ACE_WCHAR_T * +ACE_OS_String::strnstr (const ACE_WCHAR_T *s1, const ACE_WCHAR_T *s2, size_t len2) { // Substring length size_t len1 = ACE_OS_String::strlen (s1); @@ -61,14 +60,13 @@ ACE_OS_String::strnstr (const wchar_t *s1, const wchar_t *s2, size_t len2) for (size_t i = 0; i <= len; i++) { - if (ACE_OS_String::memcmp (s1 + i, s2, len2 * sizeof (wchar_t)) == 0) + if (ACE_OS_String::memcmp (s1 + i, s2, len2 * sizeof (ACE_WCHAR_T)) == 0) // Found a match! Return the index. return s1 + i; } return 0; } -#endif /* ACE_HAS_WCHAR */ char * ACE_OS_String::strdup (const char *s) @@ -155,17 +153,15 @@ ACE_OS_String::strnchr (const char *s, int c, size_t len) return 0; } -#if defined (ACE_HAS_WCHAR) -const wchar_t * -ACE_OS_String::strnchr (const wchar_t *s, wint_t c, size_t len) +const ACE_WCHAR_T * +ACE_OS_String::strnchr (const ACE_WCHAR_T *s, ACE_WINT_T c, size_t len) { for (size_t i = 0; i < len; i++) - if (s[i] == ACE_static_cast(wchar_t, c)) + if (s[i] == ACE_static_cast(ACE_WCHAR_T, c)) return s + i; return 0; } -#endif /* ACE_HAS_WCHAR */ #if defined (ACE_LACKS_STRRCHR) char * @@ -688,27 +684,27 @@ ACE_OS_String::wcsstr_emulation (const wchar_t *string, } #endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSTR */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSLEN) +#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN) size_t -ACE_OS_String::wcslen_emulation (const wchar_t *string) +ACE_OS_String::wcslen_emulation (const ACE_WCHAR_T *string) { - const wchar_t *s; + const ACE_WCHAR_T *s; for (s = string; *s; ++s); return s - string; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSLEN */ +#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCPY) -wchar_t * -ACE_OS_String::wcsncpy_emulation (wchar_t *destination, - const wchar_t *source, +#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY) +ACE_WCHAR_T * +ACE_OS_String::wcsncpy_emulation (ACE_WCHAR_T *destination, + const ACE_WCHAR_T *source, size_t len) { if (len != 0) { - wchar_t *d = destination; - const wchar_t *s = source; + ACE_WCHAR_T *d = destination; + const ACE_WCHAR_T *s = source; do { @@ -724,19 +720,19 @@ ACE_OS_String::wcsncpy_emulation (wchar_t *destination, return destination; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCPY */ +#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCMP) +#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP) int -ACE_OS_String::wcscmp_emulation (const wchar_t *string1, - const wchar_t *string2) +ACE_OS_String::wcscmp_emulation (const ACE_WCHAR_T *string1, + const ACE_WCHAR_T *string2) { while (*string1 == *string2++) if (*string1++ == 0) return (0); return (*string1 - *--string2); } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCMP */ +#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */ #if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY) wchar_t * @@ -829,10 +825,10 @@ ACE_OS_String::wcschr_emulation (const wchar_t *string, wint_t c) } #endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCMP) +#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP) int -ACE_OS_String::wcsncmp_emulation (const wchar_t *s1, - const wchar_t *s2, +ACE_OS_String::wcsncmp_emulation (const ACE_WCHAR_T *s1, + const ACE_WCHAR_T *s2, size_t len) { if (len == 0) @@ -848,7 +844,7 @@ ACE_OS_String::wcsncmp_emulation (const wchar_t *s1, return 0; } -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCMP */ +#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */ #if defined (ACE_LACKS_STRTOL) long diff --git a/ace/OS_String.h b/ace/OS_String.h index 7a4c07ad489..19a518fcf51 100644 --- a/ace/OS_String.h +++ b/ace/OS_String.h @@ -23,7 +23,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/OS_Export.h" +#include "ace/Basic_Types.h" #include /**/ <stddef.h> #if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ @@ -96,10 +96,8 @@ public: /// Compares two strings (char version). static int strcmp (const char *s, const char *t); -#if defined (ACE_HAS_WCHAR) /// Compares two strings (wchar_t version). - static int strcmp (const wchar_t *s, const wchar_t *t); -#endif /* ACE_HAS_WCHAR */ + static int strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t); /// Copies a string (char version). static char *strcpy (char *s, const char *t); @@ -125,10 +123,8 @@ public: /// Finds the length of a string (char version). static size_t strlen (const char *s); -#if defined (ACE_HAS_WCHAR) - /// Finds the length of a string (wchar_t version). - static size_t strlen (const wchar_t *s); -#endif /* ACE_HAS_WCHAR */ + /// Finds the length of a string (ACE_WCHAR_T version). + static size_t strlen (const ACE_WCHAR_T *s); /// Appends part of a string to another string (char version). static char *strncat (char *s, const char *t, size_t len); @@ -141,18 +137,14 @@ public: /// Compares two arrays (char version). static int strncmp (const char *s, const char *t, size_t len); -#if defined (ACE_HAS_WCHAR) /// Compares two arrays (wchar_t version). - static int strncmp (const wchar_t *s, const wchar_t *t, size_t len); -#endif /* ACE_HAS_WCHAR */ + static int strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len); /// Copies an array (char version) static char *strncpy (char *s, const char *t, size_t len); -#if defined (ACE_HAS_WCHAR) - /// Copies an array (wchar_t version) - static wchar_t *strncpy (wchar_t *s, const wchar_t *t, size_t len); -#endif /* ACE_HAS_WCHAR */ + /// Copies an array (ACE_WCHAR_T version) + static ACE_WCHAR_T *strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len); /// Searches for characters in a string (const char version). static const char *strpbrk (const char *s1, const char *s2); @@ -283,19 +275,15 @@ public: /// version). static const char *strnchr (const char *s, int c, size_t len); -#if defined (ACE_HAS_WCHAR) - /// Finds the first occurance of a character in an array (const wchar_t + /// Finds the first occurance of a character in an array (const ACE_WCHAR_T /// version). - static const wchar_t *strnchr (const wchar_t *s, wint_t c, size_t len); -#endif /* ACE_HAS_WCHAR */ + static const ACE_WCHAR_T *strnchr (const ACE_WCHAR_T *s, ACE_WINT_T c, size_t len); /// Finds the first occurance of a character in an array (char version). static char *strnchr (char *s, int c, size_t len); -#if defined (ACE_HAS_WCHAR) - /// Finds the first occurance of a character in an array (wchar_t version). - static wchar_t *strnchr (wchar_t *s, wint_t c, size_t len); -#endif /* ACE_HAS_WCHAR */ + /// Finds the first occurance of a character in an array (ACE_WCHAR_T version). + static ACE_WCHAR_T *strnchr (ACE_WCHAR_T *s, ACE_WINT_T c, size_t len); /// Compares two arrays (case insensitive const char version). static int strncasecmp (const char *s, const char *t, size_t len); @@ -319,21 +307,17 @@ public: /// version). static const char *strnstr (const char *s, const char *t, size_t len); -#if defined (ACE_HAS_WCHAR) /// Finds the first occurance of a substring in an array (const wchar_t /// version). - static const wchar_t *strnstr (const wchar_t *s, - const wchar_t *t, - size_t len); -#endif /* ACE_HAS_WCHAR */ + static const ACE_WCHAR_T *strnstr (const ACE_WCHAR_T *s, + const ACE_WCHAR_T *t, + size_t len); /// Finds the first occurance of a substring in an array (char version). static char *strnstr (char *s, const char *t, size_t len); -#if defined (ACE_HAS_WCHAR) /// Finds the first occurance of a substring in an array (wchar_t version). - static wchar_t *strnstr (wchar_t *s, const wchar_t *t, size_t len); -#endif /* ACE_HAS_WCHAR */ + static ACE_WCHAR_T *strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len); /// Returns a malloced duplicated string (char version). static char *strdup (const char *s); @@ -474,10 +458,10 @@ private: static wchar_t *wcschr_emulation (const wchar_t *string, wint_t c); #endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCMP) +#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP) /// Emulated wcscmp - Compares strings. - static int wcscmp_emulation (const wchar_t *string1, const wchar_t *string2); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCMP */ + static int wcscmp_emulation (const ACE_WCHAR_T *string1, const ACE_WCHAR_T *string2); +#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */ #if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY) /// Emulated wcscpy - Copies a string. @@ -491,10 +475,10 @@ private: const wchar_t *string2); #endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSICMP */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSLEN) +#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN) /// Emulated wcslen - Returns the length of a string. - static size_t wcslen_emulation (const wchar_t *string); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSLEN */ + static size_t wcslen_emulation (const ACE_WCHAR_T *string); +#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */ #if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCAT) /// Emulated wcscat - Appends a string. @@ -503,19 +487,19 @@ private: size_t count); #endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCAT */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCMP) +#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP) /// Emulated wcsncmp - Compares two arrays. - static int wcsncmp_emulation (const wchar_t *string1, - const wchar_t *string2, + static int wcsncmp_emulation (const ACE_WCHAR_T *string1, + const ACE_WCHAR_T *string2, size_t len); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCMP */ +#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */ -#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNCPY) +#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY) /// Emulated wcsncpy - Copies an array. - static wchar_t *wcsncpy_emulation (wchar_t *destination, - const wchar_t *source, - size_t len); -#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNCPY */ + static ACE_WCHAR_T *wcsncpy_emulation (ACE_WCHAR_T *destination, + const ACE_WCHAR_T *source, + size_t len); +#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */ #if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNICMP) /// Emulated wcsnicmp - Performs a case insensitive comparison of two diff --git a/ace/OS_String.inl b/ace/OS_String.inl index 6f2e8e79583..fd77c417ea8 100644 --- a/ace/OS_String.inl +++ b/ace/OS_String.inl @@ -176,17 +176,15 @@ ACE_OS_String::strcmp (const char *s, const char *t) #endif /* ACE_HAS_PACE */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int -ACE_OS_String::strcmp (const wchar_t *s, const wchar_t *t) +ACE_OS_String::strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t) { -# if defined (ACE_LACKS_WCSCMP) +# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP) return ACE_OS_String::wcscmp_emulation (s, t); -# else /* ACE_LACKS_WCSCMP */ +# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */ return ::wcscmp (s, t); -# endif /* ACE_LACKS_WCSCMP */ +# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS_String::strcpy (char *s, const char *t) @@ -254,17 +252,15 @@ ACE_OS_String::strlen (const char *s) #endif /* ACE_HAS_PACE */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE size_t -ACE_OS_String::strlen (const wchar_t *s) +ACE_OS_String::strlen (const ACE_WCHAR_T *s) { -# if defined (ACE_LACKS_WCSLEN) +# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN) return ACE_OS_String::wcslen_emulation (s); -# else /* ACE_LACKS_WCSLEN */ +# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */ return ::wcslen (s); -# endif /* ACE_LACKS_WCSLEN */ +# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS_String::strncat (char *s, const char *t, size_t len) @@ -298,17 +294,15 @@ ACE_OS_String::strncmp (const char *s, const char *t, size_t len) #endif /* ACE_HAS_PACE */ } -#if defined (ACE_HAS_WCHAR) ACE_INLINE int -ACE_OS_String::strncmp (const wchar_t *s, const wchar_t *t, size_t len) +ACE_OS_String::strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len) { -# if defined (ACE_LACKS_WCSNCMP) +# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP) return ACE_OS_String::wcsncmp_emulation (s, t, len); -# else /* ACE_LACKS_WCSNCMP */ +# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */ return ::wcsncmp (s, t, len); -# endif /* ACE_LACKS_WCSNCMP */ +# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS_String::strncpy (char *s, const char *t, size_t len) @@ -320,17 +314,15 @@ ACE_OS_String::strncpy (char *s, const char *t, size_t len) #endif /* ACE_HAS_PACE */ } -#if defined (ACE_HAS_WCHAR) -ACE_INLINE wchar_t * -ACE_OS_String::strncpy (wchar_t *s, const wchar_t *t, size_t len) +ACE_INLINE ACE_WCHAR_T * +ACE_OS_String::strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len) { -# if defined (ACE_LACKS_WCSNCPY) +# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY) return ACE_OS_String::wcsncpy_emulation (s, t, len); -# else /* ACE_LACKS_WCSNCPY */ +# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */ return ::wcsncpy (s, t, len); -# endif /* ACE_LACKS_WCSNCPY */ +# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */ } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE const char * ACE_OS_String::strpbrk (const char *s1, const char *s2) @@ -619,14 +611,12 @@ ACE_OS_String::strnchr (char *s, int c, size_t len) #endif } -#if defined (ACE_HAS_WCHAR) -ACE_INLINE wchar_t * -ACE_OS_String::strnchr (wchar_t *s, wint_t c, size_t len) +ACE_INLINE ACE_WCHAR_T * +ACE_OS_String::strnchr (ACE_WCHAR_T *s, ACE_WINT_T c, size_t len) { - return ACE_const_cast (wchar_t *, - ACE_OS_String::strnchr (ACE_static_cast (const wchar_t *, s), c, len)); + return ACE_const_cast (ACE_WCHAR_T *, + ACE_OS_String::strnchr (ACE_static_cast (const ACE_WCHAR_T *, s), c, len)); } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS_String::strncasecmp (const char *s, const char *t, size_t len) @@ -663,14 +653,12 @@ ACE_OS_String::strnstr (char *s, const char *t, size_t len) #endif } -#if defined (ACE_HAS_WCHAR) -ACE_INLINE wchar_t * -ACE_OS_String::strnstr (wchar_t *s, const wchar_t *t, size_t len) +ACE_INLINE ACE_WCHAR_T * +ACE_OS_String::strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len) { - return ACE_const_cast (wchar_t *, - ACE_OS_String::strnstr (ACE_static_cast (const wchar_t *, s), t, len)); + return ACE_const_cast (ACE_WCHAR_T *, + ACE_OS_String::strnstr (ACE_static_cast (const ACE_WCHAR_T *, s), t, len)); } -#endif /* ACE_HAS_WCHAR */ ACE_INLINE char * ACE_OS_String::strtok_r (char *s, const char *tokens, char **lasts) diff --git a/ace/SString.h b/ace/SString.h index 437d97de138..f5805323d81 100644 --- a/ace/SString.h +++ b/ace/SString.h @@ -20,11 +20,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#if defined (ACE_HAS_WCHAR) -typedef wchar_t ACE_WSTRING_TYPE; -#else /* ACE_HAS_WCHAR */ -typedef ACE_USHORT16 ACE_WSTRING_TYPE; -#endif /* ACE_HAS_WCHAR */ +typedef ACE_WCHAR_T ACE_WSTRING_TYPE; #if !defined (ACE_DEFAULT_GROWSIZE) #define ACE_DEFAULT_GROWSIZE 32 |