1717#endif
1818
1919#include "php_intl.h"
20- #if U_ICU_VERSION_MAJOR_NUM < 56
21- #include "unicode/unorm.h"
22- #else
2320#include <unicode/unorm2.h>
24- #endif
2521#include "normalizer.h"
2622#include "normalizer_class.h"
2723#include "intl_convert.h"
2824#include <unicode/utf8.h>
2925
3026
31- #if U_ICU_VERSION_MAJOR_NUM >= 56
3227static const UNormalizer2 * intl_get_normalizer (zend_long form , UErrorCode * err )
3328{/*{{{*/
3429 switch (form )
@@ -74,7 +69,6 @@ static UBool intl_is_normalized(zend_long form, const UChar *uinput, int32_t uin
7469
7570 return unorm2_isNormalized (norm , uinput , uinput_len , err );
7671}/*}}}*/
77- #endif
7872
7973/* {{{ Normalize a string. */
8074PHP_FUNCTION ( normalizer_normalize )
@@ -116,9 +110,7 @@ PHP_FUNCTION( normalizer_normalize )
116110 break ;
117111 case NORMALIZER_FORM_C :
118112 case NORMALIZER_FORM_KC :
119- #if U_ICU_VERSION_MAJOR_NUM >= 56
120113 case NORMALIZER_FORM_KC_CF :
121- #endif
122114 break ;
123115 default :
124116 zend_argument_value_error (2 , "must be a a valid normalization form" );
@@ -151,11 +143,7 @@ PHP_FUNCTION( normalizer_normalize )
151143 uret_buf = eumalloc ( uret_len + 1 );
152144
153145 /* 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
157146 size_needed = intl_normalize (form , uinput , uinput_len , uret_buf , uret_len , & status );
158- #endif
159147
160148 /* Bail out if an unexpected error occurred.
161149 * (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough).
@@ -179,11 +167,7 @@ PHP_FUNCTION( normalizer_normalize )
179167 status = U_ZERO_ERROR ;
180168
181169 /* 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
185170 size_needed = intl_normalize (form , uinput , uinput_len , uret_buf , uret_len , & status );
186- #endif
187171
188172 /* Bail out if an unexpected error occurred. */
189173 if ( U_FAILURE (status ) ) {
@@ -243,9 +227,7 @@ PHP_FUNCTION( normalizer_is_normalized )
243227 case NORMALIZER_FORM_KD :
244228 case NORMALIZER_FORM_C :
245229 case NORMALIZER_FORM_KC :
246- #if U_ICU_VERSION_MAJOR_NUM >= 56
247230 case NORMALIZER_FORM_KC_CF :
248- #endif
249231 break ;
250232 default :
251233 zend_argument_value_error (2 , "must be a a valid normalization form" );
@@ -275,11 +257,7 @@ PHP_FUNCTION( normalizer_is_normalized )
275257
276258
277259 /* 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
281260 uret = intl_is_normalized (form , uinput , uinput_len , & status );
282- #endif
283261
284262 efree ( uinput );
285263
@@ -298,7 +276,6 @@ PHP_FUNCTION( normalizer_is_normalized )
298276/* }}} */
299277
300278/* {{{ Returns the Decomposition_Mapping property for the given UTF-8 encoded code point. */
301- #if U_ICU_VERSION_MAJOR_NUM >= 56
302279PHP_FUNCTION ( normalizer_get_raw_decomposition )
303280{
304281 char * input = NULL ;
@@ -344,5 +321,4 @@ PHP_FUNCTION( normalizer_get_raw_decomposition )
344321
345322 RETVAL_NEW_STR (intl_convert_utf16_to_utf8 (decomposition , decomposition_length , & status ));
346323}
347- #endif
348324/* }}} */
0 commit comments