aboutsummaryrefslogtreecommitdiff
blob: 715adb303d6b1c7e8bb58aa57a5e9ae1aae4dc90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
Based on the following upstream commits:

https://github.com/php/php-src/commit/8d35a423838eb462cd39ee535c5d003073cc5f22
https://github.com/php/php-src/commit/d8200e48857aeaf09f7127751efc5632ef7660a7
https://github.com/php/php-src/commit/9a8e7b571896f39f83cb000fdb7c466b6d328d52

--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -38,6 +38,7 @@ extern "C" {
 }
 
 using PHP::CodePointBreakIterator;
+using icu::RuleBasedBreakIterator;
 
 /* {{{ Global variables */
 zend_class_entry *BreakIterator_ce_ptr;
--- a/ext/intl/breakiterator/breakiterator_class.h
+++ b/ext/intl/breakiterator/breakiterator_class.h
@@ -26,6 +26,8 @@
 
 #ifndef USE_BREAKITERATOR_POINTER
 typedef void BreakIterator;
+#else
+using icu::BreakIterator;
 #endif
 
 typedef struct {
--- a/ext/intl/breakiterator/breakiterator_methods.cpp
+++ b/ext/intl/breakiterator/breakiterator_methods.cpp
@@ -32,6 +32,8 @@ extern "C" {
 }
 
 using PHP::CodePointBreakIterator;
+using icu::BreakIterator;
+using icu::Locale;
 
 U_CFUNC PHP_METHOD(BreakIterator, __construct)
 {
--- a/ext/intl/breakiterator/codepointiterator_internal.cpp
+++ b/ext/intl/breakiterator/codepointiterator_internal.cpp
@@ -31,6 +31,8 @@ typedef union {
 
 using namespace PHP;
 
+using icu::UCharCharacterIterator;
+
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CodePointBreakIterator);
 
 CodePointBreakIterator::CodePointBreakIterator()
--- a/ext/intl/breakiterator/codepointiterator_internal.h
+++ b/ext/intl/breakiterator/codepointiterator_internal.h
@@ -18,8 +18,11 @@
 #define CODEPOINTITERATOR_INTERNAL_H
 
 #include <unicode/brkiter.h>
+#include <unicode/unistr.h>
 
-using U_ICU_NAMESPACE::BreakIterator;
+using icu::BreakIterator;
+using icu::CharacterIterator;
+using icu::UnicodeString;
 
 namespace PHP {
 
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
@@ -25,6 +25,9 @@ extern "C" {
 
 #include "../intl_convertcpp.h"
 
+using icu::RuleBasedBreakIterator;
+using icu::Locale;
+
 static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) {
 	return (RuleBasedBreakIterator*)bio->biter;
 }
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -34,6 +34,9 @@ extern "C" {
 #include <assert.h>
 }
 
+using icu::GregorianCalendar;
+using icu::Locale;
+
 /* {{{ Global variables */
 zend_class_entry *Calendar_ce_ptr;
 zend_class_entry *GregorianCalendar_ce_ptr;
--- a/ext/intl/calendar/calendar_class.h
+++ b/ext/intl/calendar/calendar_class.h
@@ -26,6 +26,8 @@
 
 #ifndef USE_CALENDAR_POINTER
 typedef void Calendar;
+#else
+using icu::Calendar;
 #endif
 
 typedef struct {
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -40,6 +40,8 @@ extern "C" {
 }
 #include "../common/common_enum.h"
 
+using icu::Locale;
+
 U_CFUNC PHP_METHOD(IntlCalendar, __construct)
 {
 	zend_throw_exception( NULL,
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -23,6 +23,8 @@
 #include <unicode/locid.h>
 #include <unicode/calendar.h>
 #include <unicode/gregocal.h>
+#include <unicode/ustring.h>
+
 extern "C" {
 #include "../php_intl.h"
 #define USE_TIMEZONE_POINTER 1
@@ -32,6 +34,11 @@ extern "C" {
 #include <ext/date/php_date.h>
 }
 
+using icu::GregorianCalendar;
+using icu::Locale;
+using icu::UnicodeString;
+using icu::StringPiece;
+
 static inline GregorianCalendar *fetch_greg(Calendar_object *co) {
 	return (GregorianCalendar*)co->ucal;
 }
--- a/ext/intl/common/common_date.cpp
+++ b/ext/intl/common/common_date.cpp
@@ -25,6 +25,9 @@ extern "C" {
 #include <ext/date/php_date.h>
 }
 
+using icu::TimeZone;
+using icu::UnicodeString;
+
 #ifndef INFINITY
 #define INFINITY (DBL_MAX+DBL_MAX)
 #endif
--- a/ext/intl/common/common_date.h
+++ b/ext/intl/common/common_date.h
@@ -28,6 +28,8 @@ U_CDECL_END
 
 #include <unicode/timezone.h>
 
+using icu::TimeZone;
+
 U_CFUNC TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func TSRMLS_DC);
 U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz,
 		intl_error *err, const char *func TSRMLS_DC);
--- a/ext/intl/common/common_enum.h
+++ b/ext/intl/common/common_enum.h
@@ -69,6 +69,7 @@ U_CFUNC void zoi_with_current_get_current_data(zend_object_iterator *iter, zval
 U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC);
 
 #ifdef __cplusplus
+using icu::StringEnumeration;
 U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object TSRMLS_DC);
 #endif
 
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -18,6 +18,8 @@
 #include "zend_exceptions.h"
 
 #include <unicode/utypes.h>
+#include <unicode/utf8.h>
+#include <unicode/utf16.h>
 #include <unicode/ucnv.h>
 #include <unicode/ustring.h>
 
--- a/ext/intl/dateformat/dateformat_format_object.cpp
+++ b/ext/intl/dateformat/dateformat_format_object.cpp
@@ -33,6 +33,12 @@ extern "C" {
 #include "../common/common_date.h"
 }
 
+using icu::Locale;
+using icu::DateFormat;
+using icu::GregorianCalendar;
+using icu::StringPiece;
+using icu::SimpleDateFormat;
+
 static const DateFormat::EStyle valid_styles[] = {
 		DateFormat::kNone,
 		DateFormat::kFull,
--- a/ext/intl/dateformat/dateformat_helpers.cpp
+++ b/ext/intl/dateformat/dateformat_helpers.cpp
@@ -28,6 +28,8 @@ extern "C" {
 #include "../calendar/calendar_class.h"
 }
 
+using icu::GregorianCalendar;
+
 int datefmt_process_calendar_arg(zval* calendar_zv,
 								 Locale const& locale,
 								 const char *func_name,
--- a/ext/intl/dateformat/dateformat_helpers.h
+++ b/ext/intl/dateformat/dateformat_helpers.h
@@ -22,11 +22,16 @@
 #endif
 
 #include <unicode/calendar.h>
+#include <unicode/datefmt.h>
 
 extern "C" {
 #include "../php_intl.h"
 }
 
+using icu::Locale;
+using icu::Calendar;
+using icu::DateFormat;
+
 int datefmt_process_calendar_arg(zval* calendar_zv,
 								 Locale const& locale,
 								 const char *func_name,
--- a/ext/intl/grapheme/grapheme_string.c
+++ b/ext/intl/grapheme/grapheme_string.c
@@ -24,6 +24,7 @@
 #include "grapheme_util.h"
 
 #include <unicode/utypes.h>
+#include <unicode/utf8.h>
 #include <unicode/ucol.h>
 #include <unicode/ustring.h>
 #include <unicode/ubrk.h>
@@ -860,10 +861,10 @@ PHP_FUNCTION(grapheme_extract)
 	pstr = str + start;
 
 	/* just in case pstr points in the middle of a character, move forward to the start of the next char */
-	if ( !UTF8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
+	if ( !U8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
 		unsigned char *str_end = str + str_len;
 
-		while ( !UTF8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
+		while ( !U8_IS_SINGLE(*pstr) && !U8_IS_LEAD(*pstr) ) {
 			pstr++;
 			if ( pstr >= str_end ) {
 				intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
--- a/ext/intl/intl_convertcpp.h
+++ b/ext/intl/intl_convertcpp.h
@@ -25,6 +25,8 @@
 
 #include <unicode/unistr.h>
 
+using icu::UnicodeString;
+
 int intl_stringFromChar(UnicodeString &ret, char *str, int32_t str_len, UErrorCode *status);
 
 int intl_charFromString(const UnicodeString &from, char **res, int *res_len, UErrorCode *status);
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -76,6 +76,16 @@ MessageFormatAdapter::getMessagePattern(MessageFormat* m) {
 #endif
 U_NAMESPACE_END
 
+using icu::Formattable;
+using icu::Format;
+using icu::DateFormat;
+using icu::MessageFormat;
+#ifdef HAS_MESSAGE_PATTERN
+using icu::MessagePattern;
+#endif
+using icu::MessageFormatAdapter;
+using icu::FieldPosition;
+
 U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
 {
 	int32_t fmt_count = 0;
@@ -227,15 +237,16 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
 					UnicodeString typeString = mp.getSubstring(type_part);
 					/* This is all based on the rules in the docs for MessageFormat
 					 * @see http://icu-project.org/apiref/icu4c/classMessageFormat.html */
-					if (typeString == "number") {
+#define ASCII_LITERAL(s) UNICODE_STRING(s, sizeof(s)-1)
+					if (typeString == ASCII_LITERAL("number")) {
 						MessagePattern::Part style_part = mp.getPart(i + 1); /* Not advancing i */
 						if (style_part.getType() == UMSGPAT_PART_TYPE_ARG_STYLE) {
 							UnicodeString styleString = mp.getSubstring(style_part);
-							if (styleString == "integer") {
+							if (styleString == ASCII_LITERAL("integer")) {
 								type = Formattable::kInt64;
-							} else if (styleString == "currency") {
+							} else if (styleString == ASCII_LITERAL("currency")) {
 								type = Formattable::kDouble;
-							} else if (styleString == "percent") {
+							} else if (styleString == ASCII_LITERAL("percent")) {
 								type = Formattable::kDouble;
 							} else { /* some style invalid/unknown to us */
 								type = Formattable::kDouble;
@@ -243,12 +254,13 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
 						} else { // if missing style, part, make it a double
 							type = Formattable::kDouble;
 						}
-					} else if ((typeString == "date") || (typeString == "time")) {
+					} else if ((typeString == ASCII_LITERAL("date")) || (typeString == ASCII_LITERAL("time"))) {
 						type = Formattable::kDate;
-					} else if ((typeString == "spellout") || (typeString == "ordinal")
-							|| (typeString == "duration")) {
+					} else if ((typeString == ASCII_LITERAL("spellout")) || (typeString == ASCII_LITERAL("ordinal"))
+							|| (typeString == ASCII_LITERAL("duration"))) {
 						type = Formattable::kDouble;
 					}
+#undef ASCII_LITERAL
 				} else {
 					/* If there's no UMSGPAT_PART_TYPE_ARG_TYPE right after a
 					 * UMSGPAT_ARG_TYPE_SIMPLE argument, then the pattern
--- a/ext/intl/normalizer/normalizer_normalize.c
+++ b/ext/intl/normalizer/normalizer_normalize.c
@@ -24,6 +24,7 @@
 #include "normalizer_class.h"
 #include "normalizer_normalize.h"
 #include "intl_convert.h"
+#include <unicode/utf8.h>
 
 /* {{{ proto string Normalizer::normalize( string $input [, string $form = FORM_C] )
  * Normalize a string. }}} */
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -37,6 +37,8 @@ extern "C" {
 #include <ext/date/php_date.h>
 }
 
+using icu::Calendar;
+
 /* {{{ Global variables */
 U_CDECL_BEGIN
 zend_class_entry *TimeZone_ce_ptr = NULL;
--- a/ext/intl/timezone/timezone_class.h
+++ b/ext/intl/timezone/timezone_class.h
@@ -29,6 +29,8 @@
 
 #ifndef USE_TIMEZONE_POINTER
 typedef void TimeZone;
+#else
+using icu::TimeZone;
 #endif
 
 typedef struct {
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -23,6 +23,7 @@
 #include <unicode/locid.h>
 #include <unicode/timezone.h>
 #include <unicode/ustring.h>
+#include <unicode/calendar.h>
 #include "intl_convertcpp.h"
 
 #include "../common/common_date.h"
@@ -37,6 +38,9 @@ extern "C" {
 }
 #include "common/common_enum.h"
 
+using icu::Locale;
+using icu::Calendar;
+
 U_CFUNC PHP_METHOD(IntlTimeZone, __construct)
 {
 	zend_throw_exception( NULL,