]>
Commit | Line | Data |
---|---|---|
9c80e862 AO |
1 | diff -ruNp icu.orig/source/common/unicode/char16ptr.h icu/source/common/unicode/char16ptr.h |
2 | --- icu.orig/source/common/unicode/char16ptr.h 2018-06-21 11:39:21.000000000 +0200 | |
3 | +++ icu/source/common/unicode/char16ptr.h 2018-08-23 19:27:23.581839560 +0200 | |
4 | @@ -59,12 +59,14 @@ public: | |
0e2868a5 JB |
5 | */ |
6 | inline Char16Ptr(wchar_t *p); | |
7 | #endif | |
8 | +#ifdef U_HAS_NULLPTR_T | |
9 | /** | |
10 | * nullptr constructor. | |
11 | * @param p nullptr | |
9c80e862 | 12 | * @stable ICU 59 |
0e2868a5 JB |
13 | */ |
14 | inline Char16Ptr(std::nullptr_t p); | |
15 | +#endif | |
16 | /** | |
17 | * Destructor. | |
9c80e862 AO |
18 | * @stable ICU 59 |
19 | @@ -112,7 +114,9 @@ Char16Ptr::Char16Ptr(uint16_t *p) : p_(c | |
0e2868a5 | 20 | #if U_SIZEOF_WCHAR_T==2 |
9c80e862 | 21 | Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {} |
0e2868a5 JB |
22 | #endif |
23 | +#ifdef U_HAS_NULLPTR_T | |
9c80e862 | 24 | Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {} |
0e2868a5 JB |
25 | +#endif |
26 | Char16Ptr::~Char16Ptr() { | |
9c80e862 | 27 | U_ALIASING_BARRIER(p_); |
0e2868a5 | 28 | } |
9c80e862 | 29 | @@ -128,7 +132,9 @@ Char16Ptr::Char16Ptr(uint16_t *p) { u_.u |
0e2868a5 | 30 | #if U_SIZEOF_WCHAR_T==2 |
9c80e862 | 31 | Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; } |
0e2868a5 JB |
32 | #endif |
33 | +#ifdef U_HAS_NULLPTR_T | |
9c80e862 | 34 | Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; } |
0e2868a5 JB |
35 | +#endif |
36 | Char16Ptr::~Char16Ptr() {} | |
37 | ||
9c80e862 AO |
38 | char16_t *Char16Ptr::get() const { return u_.cp; } |
39 | @@ -164,12 +170,14 @@ public: | |
0e2868a5 JB |
40 | */ |
41 | inline ConstChar16Ptr(const wchar_t *p); | |
42 | #endif | |
43 | +#ifdef U_HAS_NULLPTR_T | |
44 | /** | |
45 | * nullptr constructor. | |
46 | * @param p nullptr | |
9c80e862 | 47 | * @stable ICU 59 |
0e2868a5 JB |
48 | */ |
49 | inline ConstChar16Ptr(const std::nullptr_t p); | |
50 | +#endif | |
51 | ||
52 | /** | |
53 | * Destructor. | |
9c80e862 | 54 | @@ -218,7 +226,9 @@ ConstChar16Ptr::ConstChar16Ptr(const uin |
0e2868a5 | 55 | #if U_SIZEOF_WCHAR_T==2 |
9c80e862 | 56 | ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {} |
0e2868a5 JB |
57 | #endif |
58 | +#ifdef U_HAS_NULLPTR_T | |
9c80e862 | 59 | ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {} |
0e2868a5 JB |
60 | +#endif |
61 | ConstChar16Ptr::~ConstChar16Ptr() { | |
9c80e862 | 62 | U_ALIASING_BARRIER(p_); |
0e2868a5 | 63 | } |
9c80e862 | 64 | @@ -234,7 +244,9 @@ ConstChar16Ptr::ConstChar16Ptr(const uin |
0e2868a5 | 65 | #if U_SIZEOF_WCHAR_T==2 |
9c80e862 | 66 | ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; } |
0e2868a5 JB |
67 | #endif |
68 | +#ifdef U_HASH_NULLPTR_T | |
9c80e862 | 69 | ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; } |
0e2868a5 JB |
70 | +#endif |
71 | ConstChar16Ptr::~ConstChar16Ptr() {} | |
72 | ||
9c80e862 AO |
73 | const char16_t *ConstChar16Ptr::get() const { return u_.cp; } |
74 | diff -ruNp icu.orig/source/common/unicode/platform.h icu/source/common/unicode/platform.h | |
75 | --- icu.orig/source/common/unicode/platform.h 2018-06-21 11:39:21.000000000 +0200 | |
76 | +++ icu/source/common/unicode/platform.h 2018-08-23 19:28:11.562612934 +0200 | |
77 | @@ -482,6 +482,10 @@ | |
0e2868a5 JB |
78 | namespace std { |
79 | typedef decltype(nullptr) nullptr_t; | |
80 | }; | |
81 | +# define U_HAS_NULLPTR_T 1 | |
82 | +#elif defined(__cplusplus) && (U_CPLUSPLUS_VERSION >= 11) | |
83 | +# define U_HAS_NULLPTR_T 1 | |
84 | +// else no U_HAS_NULLPTR_T | |
85 | #endif | |
86 | ||
87 | /** | |
9c80e862 AO |
88 | diff -ruNp icu.orig/source/common/unicode/umachine.h icu/source/common/unicode/umachine.h |
89 | --- icu.orig/source/common/unicode/umachine.h 2018-06-21 11:39:21.000000000 +0200 | |
90 | +++ icu/source/common/unicode/umachine.h 2018-08-23 19:24:06.688770067 +0200 | |
91 | @@ -295,7 +295,7 @@ typedef int8_t UBool; | |
92 | * If 1, then char16_t is a typedef and not a real type (yet) | |
93 | * @internal | |
94 | */ | |
95 | -#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) | |
96 | +#if ((U_PLATFORM == U_PF_AIX) || defined(__GNUC__)) && defined(__cplusplus) && (U_CPLUSPLUS_VERSION < 11) | |
97 | // for AIX, uchar.h needs to be included | |
98 | # include <uchar.h> | |
99 | # define U_CHAR16_IS_TYPEDEF 1 | |
100 | diff -ruNp icu.orig/source/common/unicode/unistr.h icu/source/common/unicode/unistr.h | |
101 | --- icu.orig/source/common/unicode/unistr.h 2018-06-21 11:39:21.000000000 +0200 | |
102 | +++ icu/source/common/unicode/unistr.h 2018-08-23 19:31:55.790554495 +0200 | |
103 | @@ -3026,6 +3026,7 @@ public: | |
104 | UnicodeString(ConstChar16Ptr(text)) {} | |
105 | #endif | |
106 | ||
0e2868a5 JB |
107 | +#ifdef U_HAS_NULLPTR_T |
108 | /** | |
109 | * nullptr_t constructor. | |
110 | * Effectively the same as the default constructor, makes an empty string object. | |
9c80e862 AO |
111 | @@ -3037,6 +3038,7 @@ public: |
112 | * @stable ICU 59 | |
0e2868a5 JB |
113 | */ |
114 | UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text); | |
115 | +#endif | |
116 | ||
117 | /** | |
118 | * char16_t* constructor. | |
9c80e862 AO |
119 | @@ -3073,6 +3075,7 @@ public: |
120 | UnicodeString(ConstChar16Ptr(text), length) {} | |
121 | #endif | |
122 | ||
0e2868a5 JB |
123 | +#ifdef U_HAS_NULLPTR_T |
124 | /** | |
125 | * nullptr_t constructor. | |
126 | * Effectively the same as the default constructor, makes an empty string object. | |
9c80e862 AO |
127 | @@ -3081,6 +3084,7 @@ public: |
128 | * @stable ICU 59 | |
0e2868a5 | 129 | */ |
d4cc09ca | 130 | inline UnicodeString(const std::nullptr_t text, int32_t textLength); |
0e2868a5 JB |
131 | +#endif |
132 | ||
133 | /** | |
134 | * Readonly-aliasing char16_t* constructor. | |
9c80e862 AO |
135 | @@ -3155,6 +3159,7 @@ public: |
136 | UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} | |
137 | #endif | |
138 | ||
0e2868a5 JB |
139 | +#ifdef U_HAS_NULLPTR_T |
140 | /** | |
141 | * Writable-aliasing nullptr_t constructor. | |
142 | * Effectively the same as the default constructor, makes an empty string object. | |
9c80e862 AO |
143 | @@ -3164,6 +3169,7 @@ public: |
144 | * @stable ICU 59 | |
0e2868a5 JB |
145 | */ |
146 | inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity); | |
147 | +#endif | |
148 | ||
149 | #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION | |
150 | ||
9c80e862 | 151 | @@ -3875,6 +3881,7 @@ UnicodeString::UnicodeString() { |
0e2868a5 JB |
152 | fUnion.fStackFields.fLengthAndFlags=kShortString; |
153 | } | |
154 | ||
155 | +#ifdef U_HAS_NULLPTR_T | |
156 | inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) { | |
157 | fUnion.fStackFields.fLengthAndFlags=kShortString; | |
158 | } | |
9c80e862 | 159 | @@ -3886,6 +3893,7 @@ inline UnicodeString::UnicodeString(cons |
0e2868a5 JB |
160 | inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) { |
161 | fUnion.fStackFields.fLengthAndFlags=kShortString; | |
162 | } | |
163 | +#endif | |
164 | ||
165 | //======================================== | |
166 | // Read-only implementation methods | |
9c80e862 | 167 | @@ -3936,7 +3944,11 @@ UnicodeString::isBufferWritable() const |
0e2868a5 JB |
168 | inline const char16_t * |
169 | UnicodeString::getBuffer() const { | |
170 | if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) { | |
171 | +#ifdef U_HAS_NULLPTR_T | |
172 | return nullptr; | |
173 | +#else | |
174 | + return 0; | |
175 | +#endif | |
176 | } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) { | |
177 | return fUnion.fStackFields.fBuffer; | |
178 | } else { |