From a92571a1856cb59c7aef2be45ccefe90b2af843b Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Fri, 7 Dec 2001 17:09:41 +0000 Subject: [PATCH] ICU-1590 fix detection of U_WCHAR_IS_UTF16/32 X-SVN-Rev: 7333 --- icu4c/source/common/unicode/umachine.h | 24 -------------------- icu4c/source/common/unicode/utf.h | 31 ++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/icu4c/source/common/unicode/umachine.h b/icu4c/source/common/unicode/umachine.h index fe1df3a5be..9c560c1807 100644 --- a/icu4c/source/common/unicode/umachine.h +++ b/icu4c/source/common/unicode/umachine.h @@ -188,30 +188,6 @@ typedef int8_t UBool; # define U_INLINE #endif -/*===========================================================================*/ -/* U_WCHAR_IS_UTF16 definition */ -/*===========================================================================*/ - -#ifndef U_WCHAR_IS_UTF16 -# ifdef __STDC_ISO_10646__ -# if (U_SIZEOF_WCHAR_T==2) -# define U_WCHAR_IS_UTF16 -# elif (U_SIZEOR_WCHAR_T==4) -# define U_WCHAR_IS_UTF32 -# endif -# elif defined __UCS2__ -# if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2) -# define U_WCHAR_IS_UTF16 -# endif -# elif defined __UCS4__ -# if (U_SIZEOR_WCHAR_T==4) -# define U_WCHAR_IS_UTF32 -# endif -# elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) -# define U_WCHAR_IS_UTF16 -# endif -#endif - #include "unicode/urename.h" #endif diff --git a/icu4c/source/common/unicode/utf.h b/icu4c/source/common/unicode/utf.h index 11fb5f539f..eba511c19c 100644 --- a/icu4c/source/common/unicode/utf.h +++ b/icu4c/source/common/unicode/utf.h @@ -106,7 +106,7 @@ /*! * \def U_SIZEOF_WCHAR_T - * Do we have wchar.h on this platform? It is there on most platforms. + * U_SIZEOF_WCHAR_T==sizeof(wchar_t). */ #ifndef U_HAVE_WCHAR_H # define U_HAVE_WCHAR_H 1 @@ -115,10 +115,37 @@ /* U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it) */ #if U_SIZEOF_WCHAR_T==0 # undef U_SIZEOF_WCHAR_T - /** U_SIZEOF_WCHAR_T==sizeof(wchar_t). */ # define U_SIZEOF_WCHAR_T 4 #endif +/*! + * \def U_WCHAR_IS_UTF16 + * Defined if wchar_t uses UTF-16. + */ +/*! + * \def U_WCHAR_IS_UTF32 + * Defined if wchar_t uses UTF-32. + */ +#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) +# ifdef __STDC_ISO_10646__ +# if (U_SIZEOF_WCHAR_T==2) +# define U_WCHAR_IS_UTF16 +# elif (U_SIZEOF_WCHAR_T==4) +# define U_WCHAR_IS_UTF32 +# endif +# elif defined __UCS2__ +# if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2) +# define U_WCHAR_IS_UTF16 +# endif +# elif defined __UCS4__ +# if (U_SIZEOF_WCHAR_T==4) +# define U_WCHAR_IS_UTF32 +# endif +# elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) +# define U_WCHAR_IS_UTF16 +# endif +#endif + /*! * \var UChar32 * Define UChar32 to be wchar_t if that is 32 bits wide; may be signed or unsigned!