17
17
#endif
18
18
19
19
#include "php_intl.h"
20
- #if U_ICU_VERSION_MAJOR_NUM < 56
21
- #include "unicode/unorm.h"
22
- #else
23
20
#include <unicode/unorm2.h>
24
- #endif
25
21
#include "normalizer.h"
26
22
#include "normalizer_class.h"
27
23
#include "intl_convert.h"
28
24
#include <unicode/utf8.h>
29
25
30
26
31
- #if U_ICU_VERSION_MAJOR_NUM >= 56
32
27
static const UNormalizer2 * intl_get_normalizer (zend_long form , UErrorCode * err )
33
28
{/*{{{*/
34
29
switch (form )
@@ -74,7 +69,6 @@ static UBool intl_is_normalized(zend_long form, const UChar *uinput, int32_t uin
74
69
75
70
return unorm2_isNormalized (norm , uinput , uinput_len , err );
76
71
}/*}}}*/
77
- #endif
78
72
79
73
/* {{{ Normalize a string. */
80
74
PHP_FUNCTION ( normalizer_normalize )
@@ -116,9 +110,7 @@ PHP_FUNCTION( normalizer_normalize )
116
110
break ;
117
111
case NORMALIZER_FORM_C :
118
112
case NORMALIZER_FORM_KC :
119
- #if U_ICU_VERSION_MAJOR_NUM >= 56
120
113
case NORMALIZER_FORM_KC_CF :
121
- #endif
122
114
break ;
123
115
default :
124
116
zend_argument_value_error (2 , "must be a a valid normalization form" );
@@ -151,11 +143,7 @@ PHP_FUNCTION( normalizer_normalize )
151
143
uret_buf = eumalloc ( uret_len + 1 );
152
144
153
145
/* normalize */
154
- #if U_ICU_VERSION_MAJOR_NUM < 56
155
- size_needed = unorm_normalize ( uinput , uinput_len , form , (int32_t ) 0 /* options */ , uret_buf , uret_len , & status );
156
- #else
157
146
size_needed = intl_normalize (form , uinput , uinput_len , uret_buf , uret_len , & status );
158
- #endif
159
147
160
148
/* Bail out if an unexpected error occurred.
161
149
* (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough).
@@ -179,11 +167,7 @@ PHP_FUNCTION( normalizer_normalize )
179
167
status = U_ZERO_ERROR ;
180
168
181
169
/* try normalize again */
182
- #if U_ICU_VERSION_MAJOR_NUM < 56
183
- size_needed = unorm_normalize ( uinput , uinput_len , form , (int32_t ) 0 /* options */ , uret_buf , uret_len , & status );
184
- #else
185
170
size_needed = intl_normalize (form , uinput , uinput_len , uret_buf , uret_len , & status );
186
- #endif
187
171
188
172
/* Bail out if an unexpected error occurred. */
189
173
if ( U_FAILURE (status ) ) {
@@ -243,9 +227,7 @@ PHP_FUNCTION( normalizer_is_normalized )
243
227
case NORMALIZER_FORM_KD :
244
228
case NORMALIZER_FORM_C :
245
229
case NORMALIZER_FORM_KC :
246
- #if U_ICU_VERSION_MAJOR_NUM >= 56
247
230
case NORMALIZER_FORM_KC_CF :
248
- #endif
249
231
break ;
250
232
default :
251
233
zend_argument_value_error (2 , "must be a a valid normalization form" );
@@ -275,11 +257,7 @@ PHP_FUNCTION( normalizer_is_normalized )
275
257
276
258
277
259
/* test string */
278
- #if U_ICU_VERSION_MAJOR_NUM < 56
279
- uret = unorm_isNormalizedWithOptions ( uinput , uinput_len , form , (int32_t ) 0 /* options */ , & status );
280
- #else
281
260
uret = intl_is_normalized (form , uinput , uinput_len , & status );
282
- #endif
283
261
284
262
efree ( uinput );
285
263
@@ -298,7 +276,6 @@ PHP_FUNCTION( normalizer_is_normalized )
298
276
/* }}} */
299
277
300
278
/* {{{ Returns the Decomposition_Mapping property for the given UTF-8 encoded code point. */
301
- #if U_ICU_VERSION_MAJOR_NUM >= 56
302
279
PHP_FUNCTION ( normalizer_get_raw_decomposition )
303
280
{
304
281
char * input = NULL ;
@@ -344,5 +321,4 @@ PHP_FUNCTION( normalizer_get_raw_decomposition )
344
321
345
322
RETVAL_NEW_STR (intl_convert_utf16_to_utf8 (decomposition , decomposition_length , & status ));
346
323
}
347
- #endif
348
324
/* }}} */
0 commit comments