1 |
fwang |
316795 |
Index: icu/trunk/source/test/intltest/strtest.cpp
|
2 |
|
|
===================================================================
|
3 |
|
|
--- icu/trunk/source/test/intltest/strtest.cpp (revision 32779)
|
4 |
|
|
+++ icu/trunk/source/test/intltest/strtest.cpp (revision 32780)
|
5 |
|
|
@@ -1,5 +1,5 @@
|
6 |
|
|
/********************************************************************
|
7 |
|
|
* COPYRIGHT:
|
8 |
|
|
- * Copyright (c) 1997-2011, International Business Machines Corporation and
|
9 |
|
|
+ * Copyright (c) 1997-2012, International Business Machines Corporation and
|
10 |
|
|
* others. All Rights Reserved.
|
11 |
|
|
********************************************************************/
|
12 |
|
|
@@ -95,5 +95,5 @@
|
13 |
|
|
StringTest::Test_U_STRING() {
|
14 |
|
|
U_STRING_INIT(ustringVar, "aZ0 -", 5);
|
15 |
|
|
- if( sizeof(ustringVar)/sizeof(*ustringVar)!=6 ||
|
16 |
|
|
+ if( u_strlen(ustringVar)!=5 ||
|
17 |
|
|
ustringVar[0]!=0x61 ||
|
18 |
|
|
ustringVar[1]!=0x5a ||
|
19 |
|
|
Index: icu/trunk/source/common/unicode/ustring.h
|
20 |
|
|
===================================================================
|
21 |
|
|
--- icu/trunk/source/common/unicode/ustring.h (revision 32779)
|
22 |
|
|
+++ icu/trunk/source/common/unicode/ustring.h (revision 32780)
|
23 |
|
|
@@ -940,5 +940,5 @@
|
24 |
|
|
*/
|
25 |
|
|
#if defined(U_DECLARE_UTF16)
|
26 |
|
|
-# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=U_DECLARE_UTF16(cs)
|
27 |
|
|
+# define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs)
|
28 |
|
|
/**@stable ICU 2.0 */
|
29 |
|
|
# define U_STRING_INIT(var, cs, length)
|
30 |
|
|
Index: icu/trunk/source/common/unicode/platform.h
|
31 |
|
|
===================================================================
|
32 |
|
|
--- icu/trunk/source/common/unicode/platform.h (revision 32779)
|
33 |
|
|
+++ icu/trunk/source/common/unicode/platform.h (revision 32780)
|
34 |
|
|
@@ -665,7 +665,7 @@
|
35 |
|
|
* gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but
|
36 |
|
|
* does not support u"abc" string literals.
|
37 |
|
|
- * C++11 requires support for UTF-16 literals
|
38 |
|
|
+ * C++11 and C11 require support for UTF-16 literals
|
39 |
|
|
*/
|
40 |
|
|
-# if (defined(__cplusplus) && __cplusplus >= 201103L)
|
41 |
|
|
+# if (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
|
42 |
|
|
# define U_HAVE_CHAR16_T 1
|
43 |
|
|
# else
|
44 |
|
|
Index: icu/trunk/source/common/unicode/umachine.h
|
45 |
|
|
===================================================================
|
46 |
|
|
--- icu/trunk/source/common/unicode/umachine.h (revision 32779)
|
47 |
|
|
+++ icu/trunk/source/common/unicode/umachine.h (revision 32780)
|
48 |
|
|
@@ -257,5 +257,5 @@
|
49 |
|
|
/**
|
50 |
|
|
* \var UChar
|
51 |
|
|
- * Define UChar to be char16_t, if available,
|
52 |
|
|
+ * Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t),
|
53 |
|
|
* or wchar_t if that is 16 bits wide; always assumed to be unsigned.
|
54 |
|
|
* If neither is available, then define UChar to be uint16_t.
|
55 |
|
|
@@ -267,8 +267,8 @@
|
56 |
|
|
* @stable ICU 4.4
|
57 |
|
|
*/
|
58 |
|
|
-
|
59 |
|
|
-/* Define UChar to be compatible with char16_t or wchar_t if possible. */
|
60 |
|
|
-#if U_HAVE_CHAR16_T
|
61 |
|
|
- typedef char16_t UChar;
|
62 |
|
|
+#if defined(UCHAR_TYPE)
|
63 |
|
|
+ typedef UCHAR_TYPE UChar;
|
64 |
|
|
+/* Not #elif U_HAVE_CHAR16_T -- because that is type-incompatible with pre-C++11 callers
|
65 |
|
|
+ typedef char16_t UChar; */
|
66 |
|
|
#elif U_SIZEOF_WCHAR_T==2
|
67 |
|
|
typedef wchar_t UChar;
|