diff options
Diffstat (limited to 'ext/intl')
45 files changed, 327 insertions, 327 deletions
diff --git a/ext/intl/breakiterator/codepointiterator_internal.h b/ext/intl/breakiterator/codepointiterator_internal.h index 0c9b8cc9a5..d34fc0a2c2 100644 --- a/ext/intl/breakiterator/codepointiterator_internal.h +++ b/ext/intl/breakiterator/codepointiterator_internal.h @@ -26,7 +26,7 @@ namespace PHP { class CodePointBreakIterator : public BreakIterator { public: - static UClassID getStaticClassID(); + static UClassID getStaticClassID(); CodePointBreakIterator(); diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index 81f6d81546..8af48d9726 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -151,7 +151,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp) Calendar_object *co; const Calendar *cal; HashTable *debug_info; - + *is_temp = 1; ALLOC_HASHTABLE(debug_info); @@ -206,7 +206,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp) i < sizeof(debug_info_fields) / sizeof(*debug_info_fields); i++) { UErrorCode uec = U_ZERO_ERROR; - const char *name = debug_info_fields[i].name; + const char *name = debug_info_fields[i].name; int32_t res = cal->get(debug_info_fields[i].field, uec); if (U_SUCCESS(uec)) { add_assoc_long(&zfields, name, (zend_long)res); @@ -259,7 +259,7 @@ static zend_object *Calendar_object_create(zend_class_entry *ce) Calendar_object* intern; intern = (Calendar_object*)ecalloc(1, sizeof(Calendar_object) + sizeof(zval) * (ce->default_properties_count - 1)); - + zend_object_std_init(&intern->zo, ce); object_properties_init((zend_object*) intern, ce); calendar_object_init(intern); diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index da338db46b..40f1ff2f01 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -289,7 +289,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time) co->ucal->setTime((UDate)time_arg, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "Call to underlying method failed"); - + RETURN_TRUE; } @@ -305,7 +305,7 @@ U_CFUNC PHP_FUNCTION(intlcal_add) "intlcal_add: bad arguments", 0); RETURN_FALSE; } - + if (field < 0 || field >= UCAL_FIELD_COUNT) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_add: invalid field", 0); @@ -343,7 +343,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time_zone) if (zv_timezone == NULL) { RETURN_TRUE; /* the method does nothing if passed null */ } - + timeZone = timezone_process_timezone_argument(zv_timezone, CALENDAR_ERROR_P(co), "intlcal_set_time_zone"); if (timeZone == NULL) { @@ -373,7 +373,7 @@ static void _php_intlcal_before_after( } CALENDAR_METHOD_FETCH_OBJECT; - + when_co = Z_INTL_CALENDAR_P(when_object); if (when_co->ucal == NULL) { intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, @@ -429,7 +429,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) "intlcal_set: bad arguments", 0); RETURN_FALSE; } - + for (i = 0; i < variant; i++) { if (Z_LVAL(args[i]) < INT32_MIN || Z_LVAL(args[i]) > INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -456,7 +456,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) } else if (variant == 6) { co->ucal->set((int32_t)arg1, (int32_t)arg2, (int32_t)arg3, (int32_t)arg4, (int32_t)arg5, (int32_t)arg6); } - + RETURN_TRUE; } @@ -1256,7 +1256,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time) "range for a 64-bit integer", 0); RETURN_FALSE; } - + ZVAL_UNDEF(&retval); ts = (int64_t)date; diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index 8484f09629..2cb46e4a83 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -47,7 +47,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) UErrorCode status = U_ZERO_ERROR; int variant; intl_error_reset(NULL); - + // parameter number validation / variant determination if (ZEND_NUM_ARGS() > 6 || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { @@ -85,7 +85,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) Z_OBJ_P(return_value) = NULL; return; } - + // instantion of ICU object GregorianCalendar *gcal = NULL; @@ -100,7 +100,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) if (!locale) { locale = const_cast<char*>(intl_locale_get_default()); } - + gcal = new GregorianCalendar(tz, Locale::createFromName(locale), status); if (U_FAILURE(status)) { @@ -166,7 +166,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) TimeZone *tz = TimeZone::createTimeZone(tzstr); gcal->adoptTimeZone(tz); } - + Calendar_object *co = Z_INTL_CALENDAR_P(return_value); co->ucal = gcal; } @@ -216,7 +216,7 @@ U_CFUNC PHP_FUNCTION(intlgregcal_set_gregorian_change) } CALENDAR_METHOD_FETCH_OBJECT; - + fetch_greg(co)->setGregorianChange(date, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "intlgregcal_set_gregorian_change: error " "calling ICU method"); @@ -236,7 +236,7 @@ U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change) } CALENDAR_METHOD_FETCH_OBJECT; - + RETURN_DOUBLE((double)fetch_greg(co)->getGregorianChange()); } @@ -259,6 +259,6 @@ U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year) } CALENDAR_METHOD_FETCH_OBJECT; - + RETURN_BOOL((int)fetch_greg(co)->isLeapYear((int32_t)year)); } diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c index 5632dc0f76..48fc368060 100644 --- a/ext/intl/collator/collator_class.c +++ b/ext/intl/collator/collator_class.c @@ -134,10 +134,10 @@ void collator_register_Collator_class( void ) memcpy(&Collator_handlers, zend_get_std_object_handlers(), sizeof Collator_handlers); - /* Collator has no usable clone semantics - ucol_cloneBinary/ucol_openBinary require binary buffer - for which we don't have the place to keep */ + /* Collator has no usable clone semantics - ucol_cloneBinary/ucol_openBinary require binary buffer + for which we don't have the place to keep */ Collator_handlers.offset = XtOffsetOf(Collator_object, zo); - Collator_handlers.clone_obj = NULL; + Collator_handlers.clone_obj = NULL; Collator_handlers.dtor_obj = Collator_objects_dtor; Collator_handlers.free_obj = Collator_objects_free; diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index fb8530c9f9..1ee13d8b39 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -215,7 +215,7 @@ zval* collator_convert_zstr_utf8_to_utf16( zval* utf8_zval, zval *rv ) /* Set string. */ zstr = rv; ZVAL_STRINGL( zstr, (char*)ustr, UBYTES(ustr_len)); - //??? + //??? efree((char *)ustr); return zstr; @@ -400,7 +400,7 @@ zval* collator_make_printable_zval( zval* arg, zval *rv) if( Z_TYPE_P(arg) != IS_STRING ) { - + use_copy = zend_make_printable_zval(arg, &arg_copy); if( use_copy ) diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index 2d98ea9d01..dd81ebe8f7 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -55,7 +55,7 @@ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) co->ucoll = ucol_open( locale, COLLATOR_ERROR_CODE_P( co ) ); INTL_CTOR_CHECK_STATUS(co, "collator_create: unable to open ICU collator"); } -/* }}} */ +/* }}} */ /* {{{ proto Collator collator_create( string $locale ) * Create collator. diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 16f68d06ac..46571e5ead 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -93,7 +93,7 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2) if( num1_p == str1_p ) { /* str1 is string but not numeric string - * just convert it to utf8. + * just convert it to utf8. */ norm1_p = collator_convert_zstr_utf16_to_utf8( str1_p, &norm1 ); @@ -585,7 +585,7 @@ PHP_FUNCTION( collator_get_sort_key ) RETURN_FALSE; } - /* ucol_getSortKey is exception in that the key length includes the + /* ucol_getSortKey is exception in that the key length includes the * NUL terminator*/ key_len = ucol_getSortKey(co->ucoll, ustr, ustr_len, key, 0); if(!key_len) { diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index cea9dc71c5..4160c30258 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -36,12 +36,12 @@ zend_object_handlers IntlIterator_handlers; void zoi_with_current_dtor(zend_object_iterator *iter) { zoi_with_current *zoiwc = (zoi_with_current*)iter; - + if (!Z_ISUNDEF(zoiwc->wrapping_obj)) { /* we have to copy the pointer because zoiwc->wrapping_obj may be * changed midway the execution of zval_ptr_dtor() */ zval *zwo = &zoiwc->wrapping_obj; - + /* object is still here, we can rely on it to call this again and * destroy this object */ zval_ptr_dtor(zwo); @@ -193,7 +193,7 @@ static zend_object *IntlIterator_object_create(zend_class_entry *ce) IntlIterator_object *intern; intern = (IntlIterator_object*)ecalloc(1, sizeof(IntlIterator_object) + sizeof(zval) * (ce->default_properties_count - 1)); - + zend_object_std_init(&intern->zo, ce); object_properties_init(&intern->zo, ce); intl_error_init(INTLITERATOR_ERROR_P(intern)); diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index c9ad9a9409..a02edd4efe 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -842,7 +842,7 @@ static PHP_METHOD(UConverter, transcode) { } else { RETVAL_FALSE; } - + if (src_cnv) { ucnv_close(src_cnv); } @@ -864,7 +864,7 @@ static PHP_METHOD(UConverter, getErrorCode) { RETURN_FALSE; } - RETURN_LONG(intl_error_get_code(&(objval->error))); + RETURN_LONG(intl_error_get_code(&(objval->error))); } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index 60ef45b7b3..dffb1b4523 100644 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -38,7 +38,7 @@ PHP_FUNCTION( datefmt_get_datetype ) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_datetype: unable to parse input params", 0 ); RETURN_FALSE; } @@ -64,7 +64,7 @@ PHP_FUNCTION( datefmt_get_timetype ) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_timetype: unable to parse input params", 0 ); RETURN_FALSE; } @@ -95,7 +95,7 @@ PHP_FUNCTION( datefmt_get_pattern ) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_pattern: unable to parse input params", 0 ); RETURN_FALSE; } @@ -140,7 +140,7 @@ PHP_FUNCTION( datefmt_set_pattern ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os", &object, IntlDateFormatter_ce_ptr, &value, &value_len ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_set_pattern: unable to parse input params", 0); RETURN_FALSE; } @@ -200,7 +200,7 @@ PHP_FUNCTION( datefmt_get_locale ) */ PHP_FUNCTION( datefmt_is_lenient ) { - + DATE_FORMAT_METHOD_INIT_VARS; /* Parse parameters. */ diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c index ef63929a43..a10b6defc5 100644 --- a/ext/intl/dateformat/dateformat_class.c +++ b/ext/intl/dateformat/dateformat_class.c @@ -87,7 +87,7 @@ zend_object *IntlDateFormatter_object_clone(zval *object) new_obj = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object)); new_dfo = php_intl_dateformatter_fetch_object(new_obj); - /* clone standard parts */ + /* clone standard parts */ zend_objects_clone_members(&new_dfo->zo, &dfo->zo); /* clone formatter object */ if (dfo->datef_data.udatf != NULL) { @@ -105,7 +105,7 @@ zend_object *IntlDateFormatter_object_clone(zval *object) } /* }}} */ -/* +/* * 'IntlDateFormatter' class registration structures & functions */ diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 61c3627cb8..dda1dd4fd7 100644 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -29,19 +29,19 @@ #include "dateformat_format.h" #include "dateformat_data.h" -/* {{{ +/* {{{ * Internal function which calls the udat_format */ static void internal_format(IntlDateFormatter_object *dfo, UDate timestamp, zval *return_value) { UChar* formatted = NULL; int32_t resultlengthneeded =0 ; - + resultlengthneeded=udat_format( DATE_FORMAT_OBJECT(dfo), timestamp, NULL, resultlengthneeded, NULL, &INTL_DATA_ERROR_CODE(dfo)); if(INTL_DATA_ERROR_CODE(dfo)==U_BUFFER_OVERFLOW_ERROR) { INTL_DATA_ERROR_CODE(dfo)=U_ZERO_ERROR; - formatted=(UChar*)emalloc(sizeof(UChar) * resultlengthneeded); + formatted=(UChar*)emalloc(sizeof(UChar) * resultlengthneeded); udat_format( DATE_FORMAT_OBJECT(dfo), timestamp, formatted, resultlengthneeded, NULL, &INTL_DATA_ERROR_CODE(dfo)); } @@ -56,8 +56,8 @@ static void internal_format(IntlDateFormatter_object *dfo, UDate timestamp, zval /* }}} */ -/* {{{ - * Internal function which fetches an element from the passed array for the key_name passed +/* {{{ + * Internal function which fetches an element from the passed array for the key_name passed */ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo, HashTable* hash_arr, char* key_name, intl_error *err) @@ -94,7 +94,7 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo, } /* }}} */ -/* {{{ +/* {{{ * Internal function which sets UCalendar from the passed array and retrieves timestamp */ static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, @@ -149,7 +149,7 @@ static UDate internal_get_timestamp(IntlDateFormatter_object *dfo, * Format the time value as a string. }}}*/ /* {{{ proto string datefmt_format( [mixed]int $args or array $args ) * Format the time value as a string. }}}*/ -PHP_FUNCTION(datefmt_format) +PHP_FUNCTION(datefmt_format) { UDate timestamp = 0; HashTable *hash_arr = NULL; @@ -182,7 +182,7 @@ PHP_FUNCTION(datefmt_format) RETURN_FALSE; } } - + internal_format( dfo, timestamp, return_value); } diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c index 15d19485ed..378ddf641a 100644 --- a/ext/intl/dateformat/dateformat_parse.c +++ b/ext/intl/dateformat/dateformat_parse.c @@ -28,11 +28,11 @@ #include "dateformat_parse.h" #include "dateformat_data.h" -/* {{{ +/* {{{ * Internal function which calls the udat_parse - * param int store_error acts like a boolean - * if set to 1 - store any error encountered in the parameter parse_error - * if set to 0 - no need to store any error encountered in the parameter parse_error + * param int store_error acts like a boolean + * if set to 1 - store any error encountered in the parameter parse_error + * if set to 0 - no need to store any error encountered in the parameter parse_error */ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* text_to_parse, size_t text_len, int32_t *parse_pos, zval *return_value) { @@ -51,7 +51,7 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex } INTL_METHOD_CHECK_STATUS( dfo, "Date parsing failed" ); - + /* Since return is in sec. */ result = (double)timestamp / U_MILLIS_PER_SECOND; if(result > LONG_MAX || result < -LONG_MAX) { @@ -64,17 +64,17 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, zend_long calendar_field, char* key_name) { - zend_long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo)); + zend_long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" ); if( strcmp(key_name, CALENDAR_YEAR )==0 ){ /* since tm_year is years from 1900 */ - add_assoc_long( return_value, key_name,( calendar_field_val-1900) ); + add_assoc_long( return_value, key_name,( calendar_field_val-1900) ); }else if( strcmp(key_name, CALENDAR_WDAY )==0 ){ /* since tm_wday starts from 0 whereas ICU WDAY start from 1 */ - add_assoc_long( return_value, key_name,( calendar_field_val-1) ); + add_assoc_long( return_value, key_name,( calendar_field_val-1) ); }else{ - add_assoc_long( return_value, key_name, calendar_field_val ); + add_assoc_long( return_value, key_name, calendar_field_val ); } } @@ -94,7 +94,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex parsed_calendar = (UCalendar *)udat_getCalendar(DATE_FORMAT_OBJECT(dfo)); udat_parseCalendar( DATE_FORMAT_OBJECT(dfo), parsed_calendar, text_utf16, text_utf16_len, parse_pos, &INTL_DATA_ERROR_CODE(dfo)); - + if (text_utf16) { efree(text_utf16); } @@ -107,7 +107,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex add_to_localtime_arr( dfo, return_value, parsed_calendar, UCAL_SECOND, CALENDAR_SEC); add_to_localtime_arr( dfo, return_value, parsed_calendar, UCAL_MINUTE, CALENDAR_MIN); add_to_localtime_arr( dfo, return_value, parsed_calendar, UCAL_HOUR_OF_DAY, CALENDAR_HOUR); - add_to_localtime_arr( dfo, return_value, parsed_calendar, UCAL_YEAR, CALENDAR_YEAR); + add_to_localtime_arr( dfo, return_value, parsed_calendar, UCAL_YEAR, CALENDAR_YEAR); add_to_localtime_arr( dfo, return_value, parsed_calendar, UCAL_DAY_OF_MONTH, CALENDAR_MDAY); add_to_localtime_arr( dfo, return_value, parsed_calendar, UCAL_DAY_OF_WEEK, CALENDAR_WDAY); add_to_localtime_arr( dfo, return_value, parsed_calendar, UCAL_DAY_OF_YEAR, CALENDAR_YDAY); @@ -116,7 +116,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex /* Is in DST? */ isInDST = ucal_inDaylightTime(parsed_calendar , &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : while checking if currently in DST." ); - add_assoc_long( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); + add_assoc_long( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); } /* }}} */ diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c index 63664ecc03..7e0f0df68b 100644 --- a/ext/intl/formatter/formatter.c +++ b/ext/intl/formatter/formatter.c @@ -73,62 +73,62 @@ void formatter_register_constants( INIT_FUNC_ARGS ) FORMATTER_EXPOSE_CLASS_CONST( ROUND_HALFUP ); /* UNumberFormatPadPosition */ - FORMATTER_EXPOSE_CLASS_CONST( PAD_BEFORE_PREFIX ); - FORMATTER_EXPOSE_CLASS_CONST( PAD_AFTER_PREFIX ); - FORMATTER_EXPOSE_CLASS_CONST( PAD_BEFORE_SUFFIX ); + FORMATTER_EXPOSE_CLASS_CONST( PAD_BEFORE_PREFIX ); + FORMATTER_EXPOSE_CLASS_CONST( PAD_AFTER_PREFIX ); + FORMATTER_EXPOSE_CLASS_CONST( PAD_BEFORE_SUFFIX ); FORMATTER_EXPOSE_CLASS_CONST( PAD_AFTER_SUFFIX ); /* UNumberFormatAttribute */ - FORMATTER_EXPOSE_CLASS_CONST( PARSE_INT_ONLY ); - FORMATTER_EXPOSE_CLASS_CONST( GROUPING_USED ); - FORMATTER_EXPOSE_CLASS_CONST( DECIMAL_ALWAYS_SHOWN ); + FORMATTER_EXPOSE_CLASS_CONST( PARSE_INT_ONLY ); + FORMATTER_EXPOSE_CLASS_CONST( GROUPING_USED ); + FORMATTER_EXPOSE_CLASS_CONST( DECIMAL_ALWAYS_SHOWN ); FORMATTER_EXPOSE_CLASS_CONST( MAX_INTEGER_DIGITS ); - FORMATTER_EXPOSE_CLASS_CONST( MIN_INTEGER_DIGITS ); - FORMATTER_EXPOSE_CLASS_CONST( INTEGER_DIGITS ); - FORMATTER_EXPOSE_CLASS_CONST( MAX_FRACTION_DIGITS ); + FORMATTER_EXPOSE_CLASS_CONST( MIN_INTEGER_DIGITS ); + FORMATTER_EXPOSE_CLASS_CONST( INTEGER_DIGITS ); + FORMATTER_EXPOSE_CLASS_CONST( MAX_FRACTION_DIGITS ); FORMATTER_EXPOSE_CLASS_CONST( MIN_FRACTION_DIGITS ); - FORMATTER_EXPOSE_CLASS_CONST( FRACTION_DIGITS ); - FORMATTER_EXPOSE_CLASS_CONST( MULTIPLIER ); - FORMATTER_EXPOSE_CLASS_CONST( GROUPING_SIZE ); + FORMATTER_EXPOSE_CLASS_CONST( FRACTION_DIGITS ); + FORMATTER_EXPOSE_CLASS_CONST( MULTIPLIER ); + FORMATTER_EXPOSE_CLASS_CONST( GROUPING_SIZE ); FORMATTER_EXPOSE_CLASS_CONST( ROUNDING_MODE ); - FORMATTER_EXPOSE_CLASS_CONST( ROUNDING_INCREMENT ); - FORMATTER_EXPOSE_CLASS_CONST( FORMAT_WIDTH ); - FORMATTER_EXPOSE_CLASS_CONST( PADDING_POSITION ); + FORMATTER_EXPOSE_CLASS_CONST( ROUNDING_INCREMENT ); + FORMATTER_EXPOSE_CLASS_CONST( FORMAT_WIDTH ); + FORMATTER_EXPOSE_CLASS_CONST( PADDING_POSITION ); FORMATTER_EXPOSE_CLASS_CONST( SECONDARY_GROUPING_SIZE ); - FORMATTER_EXPOSE_CLASS_CONST( SIGNIFICANT_DIGITS_USED ); - FORMATTER_EXPOSE_CLASS_CONST( MIN_SIGNIFICANT_DIGITS ); - FORMATTER_EXPOSE_CLASS_CONST( MAX_SIGNIFICANT_DIGITS ); - FORMATTER_EXPOSE_CLASS_CONST( LENIENT_PARSE ); + FORMATTER_EXPOSE_CLASS_CONST( SIGNIFICANT_DIGITS_USED ); + FORMATTER_EXPOSE_CLASS_CONST( MIN_SIGNIFICANT_DIGITS ); + FORMATTER_EXPOSE_CLASS_CONST( MAX_SIGNIFICANT_DIGITS ); + FORMATTER_EXPOSE_CLASS_CONST( LENIENT_PARSE ); /* UNumberFormatTextAttribute */ - FORMATTER_EXPOSE_CLASS_CONST( POSITIVE_PREFIX ); - FORMATTER_EXPOSE_CLASS_CONST( POSITIVE_SUFFIX ); - FORMATTER_EXPOSE_CLASS_CONST( NEGATIVE_PREFIX ); + FORMATTER_EXPOSE_CLASS_CONST( POSITIVE_PREFIX ); + FORMATTER_EXPOSE_CLASS_CONST( POSITIVE_SUFFIX ); + FORMATTER_EXPOSE_CLASS_CONST( NEGATIVE_PREFIX ); FORMATTER_EXPOSE_CLASS_CONST( NEGATIVE_SUFFIX ); - FORMATTER_EXPOSE_CLASS_CONST( PADDING_CHARACTER ); - FORMATTER_EXPOSE_CLASS_CONST( CURRENCY_CODE ); - FORMATTER_EXPOSE_CLASS_CONST( DEFAULT_RULESET ); + FORMATTER_EXPOSE_CLASS_CONST( PADDING_CHARACTER ); + FORMATTER_EXPOSE_CLASS_CONST( CURRENCY_CODE ); + FORMATTER_EXPOSE_CLASS_CONST( DEFAULT_RULESET ); FORMATTER_EXPOSE_CLASS_CONST( PUBLIC_RULESETS ); /* UNumberFormatSymbol */ - FORMATTER_EXPOSE_CLASS_CONST( DECIMAL_SEPARATOR_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( GROUPING_SEPARATOR_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( PATTERN_SEPARATOR_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( DECIMAL_SEPARATOR_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( GROUPING_SEPARATOR_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( PATTERN_SEPARATOR_SYMBOL ); FORMATTER_EXPOSE_CLASS_CONST( PERCENT_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( ZERO_DIGIT_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( DIGIT_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( MINUS_SIGN_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( ZERO_DIGIT_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( DIGIT_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( MINUS_SIGN_SYMBOL ); FORMATTER_EXPOSE_CLASS_CONST( PLUS_SIGN_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( CURRENCY_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( CURRENCY_SYMBOL ); FORMATTER_EXPOSE_CLASS_CONST( INTL_CURRENCY_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( MONETARY_SEPARATOR_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( MONETARY_SEPARATOR_SYMBOL ); FORMATTER_EXPOSE_CLASS_CONST( EXPONENTIAL_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( PERMILL_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( PERMILL_SYMBOL ); FORMATTER_EXPOSE_CLASS_CONST( PAD_ESCAPE_SYMBOL ); FORMATTER_EXPOSE_CLASS_CONST( INFINITY_SYMBOL ); FORMATTER_EXPOSE_CLASS_CONST( NAN_SYMBOL ); FORMATTER_EXPOSE_CLASS_CONST( SIGNIFICANT_DIGIT_SYMBOL ); - FORMATTER_EXPOSE_CLASS_CONST( MONETARY_GROUPING_SEPARATOR_SYMBOL ); + FORMATTER_EXPOSE_CLASS_CONST( MONETARY_GROUPING_SEPARATOR_SYMBOL ); FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "TYPE_DEFAULT", FORMAT_TYPE_DEFAULT ); FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "TYPE_INT32", FORMAT_TYPE_INT32 ); diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c index f5a4cafe3c..8e4a18be41 100644 --- a/ext/intl/formatter/formatter_attr.c +++ b/ext/intl/formatter/formatter_attr.c @@ -264,7 +264,7 @@ PHP_FUNCTION( numfmt_get_symbol ) RETURN_FALSE; } - + if(symbol >= UNUM_FORMAT_SYMBOL_COUNT || symbol < 0) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "numfmt_get_symbol: invalid symbol value", 0 ); RETURN_FALSE; @@ -313,7 +313,7 @@ PHP_FUNCTION( numfmt_set_symbol ) RETURN_FALSE; } - + if (symbol >= UNUM_FORMAT_SYMBOL_COUNT || symbol < 0) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "numfmt_set_symbol: invalid symbol value", 0 ); RETURN_FALSE; diff --git a/ext/intl/formatter/formatter_attr.h b/ext/intl/formatter/formatter_attr.h index e8690ac8a4..fd8b5b0b5c 100644 --- a/ext/intl/formatter/formatter_attr.h +++ b/ext/intl/formatter/formatter_attr.h @@ -19,7 +19,7 @@ #include <php.h> -PHP_FUNCTION( numfmt_set_attribute ); +PHP_FUNCTION( numfmt_set_attribute ); PHP_FUNCTION( numfmt_get_attribute ); PHP_FUNCTION( numfmt_set_text_attribute ); PHP_FUNCTION( numfmt_get_text_attribute ); diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c index 935c51a955..df1086573f 100644 --- a/ext/intl/formatter/formatter_class.c +++ b/ext/intl/formatter/formatter_class.c @@ -76,7 +76,7 @@ zend_object *NumberFormatter_object_clone(zval *object) FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; new_obj = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object)); new_nfo = php_intl_number_format_fetch_object(new_obj); - /* clone standard parts */ + /* clone standard parts */ zend_objects_clone_members(&new_nfo->zo, &nfo->zo); /* clone formatter object. It may fail, the destruction code must handle this case */ if (FORMATTER_OBJECT(nfo) != NULL) { diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c index a46efd9660..5307e426eb 100644 --- a/ext/intl/formatter/formatter_format.c +++ b/ext/intl/formatter/formatter_format.c @@ -75,12 +75,12 @@ PHP_FUNCTION( numfmt_format ) switch(type) { case FORMAT_TYPE_INT32: convert_to_long_ex(number); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), + formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { - intl_error_reset(INTL_DATA_ERROR_P(nfo)); + intl_error_reset(INTL_DATA_ERROR_P(nfo)); formatted = eumalloc(formatted_len); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), + formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (U_FAILURE( INTL_DATA_ERROR_CODE(nfo) ) ) { efree(formatted); @@ -94,7 +94,7 @@ PHP_FUNCTION( numfmt_format ) int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_LVAL_P(number); formatted_len = unum_formatInt64(FORMATTER_OBJECT(nfo), value, formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { - intl_error_reset(INTL_DATA_ERROR_P(nfo)); + intl_error_reset(INTL_DATA_ERROR_P(nfo)); formatted = eumalloc(formatted_len); formatted_len = unum_formatInt64(FORMATTER_OBJECT(nfo), value, formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (U_FAILURE( INTL_DATA_ERROR_CODE(nfo) ) ) { @@ -109,7 +109,7 @@ PHP_FUNCTION( numfmt_format ) convert_to_double_ex(number); formatted_len = unum_formatDouble(FORMATTER_OBJECT(nfo), Z_DVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { - intl_error_reset(INTL_DATA_ERROR_P(nfo)); + intl_error_reset(INTL_DATA_ERROR_P(nfo)); formatted = eumalloc(formatted_len); unum_formatDouble(FORMATTER_OBJECT(nfo), Z_DVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (U_FAILURE( INTL_DATA_ERROR_CODE(nfo) ) ) { @@ -171,7 +171,7 @@ PHP_FUNCTION( numfmt_format_currency ) * and use it to format the number. */ if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { - intl_error_reset(INTL_DATA_ERROR_P(nfo)); + intl_error_reset(INTL_DATA_ERROR_P(nfo)); formatted = eumalloc(formatted_len); unum_formatDoubleCurrency(FORMATTER_OBJECT(nfo), number, scurrency, formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); } diff --git a/ext/intl/formatter/formatter_format.h b/ext/intl/formatter/formatter_format.h index af7b0ffe26..c4d6bfb101 100644 --- a/ext/intl/formatter/formatter_format.h +++ b/ext/intl/formatter/formatter_format.h @@ -24,7 +24,7 @@ PHP_FUNCTION( numfmt_format_currency ); #define FORMAT_TYPE_DEFAULT 0 #define FORMAT_TYPE_INT32 1 -#define FORMAT_TYPE_INT64 2 +#define FORMAT_TYPE_INT64 2 #define FORMAT_TYPE_DOUBLE 3 #define FORMAT_TYPE_CURRENCY 4 diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 91cc1802ae..70b188eedd 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -523,7 +523,7 @@ PHP_FUNCTION(grapheme_substr) efree(ustr); } ubrk_close(bi); - RETURN_EMPTY_STRING(); + RETURN_EMPTY_STRING(); } /* find the end point of the string to return */ @@ -562,7 +562,7 @@ PHP_FUNCTION(grapheme_substr) sub_str_end_pos = ustr_len; } } - + if(sub_str_start_pos > sub_str_end_pos) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: length is beyond start", 1 ); diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c index c3db4aabdf..b590631c72 100644 --- a/ext/intl/grapheme/grapheme_util.c +++ b/ext/intl/grapheme/grapheme_util.c @@ -177,10 +177,10 @@ int32_t grapheme_strpos_utf16(char *haystack, size_t haystack_len, char *needle, offset_pos = grapheme_get_haystack_offset(bi, offset); if(offset_pos == -1) { status = U_ILLEGAL_ARGUMENT_ERROR; - STRPOS_CHECK_STATUS(status, "Invalid search offset"); + STRPOS_CHECK_STATUS(status, "Invalid search offset"); } status = U_ZERO_ERROR; - usearch_setOffset(src, offset_pos, &status); + usearch_setOffset(src, offset_pos, &status); STRPOS_CHECK_STATUS(status, "Invalid search offset"); } @@ -245,17 +245,17 @@ int32_t grapheme_split_string(const UChar *text, int32_t text_length, int bounda if( U_FAILURE(status) ) { return -1; } - + ubrk_setText(bi, text, text_length, &status); pos = 0; - + for ( ret_len = 0; pos != UBRK_DONE; ) { - + pos = ubrk_next(bi); - + if ( pos != UBRK_DONE ) { - + if ( NULL != boundary_array && ret_len < boundary_array_len ) { boundary_array[ret_len] = pos; } @@ -263,9 +263,9 @@ int32_t grapheme_split_string(const UChar *text, int32_t text_length, int bounda ret_len++; } } - + ubrk_close(bi); - + return ret_len; } /* }}} */ @@ -276,19 +276,19 @@ int32_t grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t stri int ret_len = 0; int pos = 0; UErrorCode status = U_ZERO_ERROR; - + ubrk_setText(bi, string, string_len, &status); do { - + pos = ubrk_next(bi); - + if ( UBRK_DONE != pos ) { ret_len++; } - + } while ( UBRK_DONE != pos ); - + return ret_len; } /* }}} */ @@ -304,7 +304,7 @@ int32_t grapheme_get_haystack_offset(UBreakIterator* bi, int32_t offset) if ( 0 == offset ) { return 0; } - + if ( offset < 0 ) { iter_op = ubrk_previous; ubrk_last(bi); /* one past the end */ @@ -314,13 +314,13 @@ int32_t grapheme_get_haystack_offset(UBreakIterator* bi, int32_t offset) iter_op = ubrk_next; iter_incr = -1; } - + pos = 0; - + while ( pos != UBRK_DONE && offset != 0 ) { - + pos = iter_op(bi); - + if ( UBRK_DONE != pos ) { offset += iter_incr; } @@ -329,7 +329,7 @@ int32_t grapheme_get_haystack_offset(UBreakIterator* bi, int32_t offset) if ( offset != 0 ) { return -1; } - + return pos; } /* }}} */ @@ -384,7 +384,7 @@ UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *stat if ( NULL == global_break_iterator ) { - global_break_iterator = ubrk_open(UBRK_CHARACTER, + global_break_iterator = ubrk_open(UBRK_CHARACTER, NULL, /* icu default locale - locale has no effect on this iterator */ NULL, /* text not set in global iterator */ 0, /* text length = 0 */ diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index 1bd9f6d2a3..c0773e8c0c 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -143,7 +143,7 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, zend_string *buffer = zend_string_alloc(buffer_capac, 0); UIDNAInfo info = UIDNA_INFO_INITIALIZER; int buffer_used = 0; - + uts46 = uidna_openUTS46(option, &status); if (php_intl_idn_check_status(status, "failed to open UIDNA instance", mode) == FAILURE) { @@ -312,7 +312,7 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) array_init(idna_info); } } - + if (variant == INTL_IDN_VARIANT_2003) { php_intl_idn_to(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (int32_t)domain_len, (uint32_t)option, mode); diff --git a/ext/intl/intl_convertcpp.cpp b/ext/intl/intl_convertcpp.cpp index 3507737616..e33d845a72 100644 --- a/ext/intl/intl_convertcpp.cpp +++ b/ext/intl/intl_convertcpp.cpp @@ -88,7 +88,7 @@ int intl_charFromString(const UnicodeString &from, char **res, size_t *res_len, } (*res)[actual_len] = '\0'; *res_len = actual_len; - + return SUCCESS; } /* }}} */ diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h index 26814a214c..6001aa1285 100644 --- a/ext/intl/intl_data.h +++ b/ext/intl/intl_data.h @@ -24,8 +24,8 @@ #include "intl_error.h" /* Mock object to generalize error handling in sub-modules. - Sub-module data structures should always have error as first element - for this to work! + Sub-module data structures should always have error as first element + for this to work! */ typedef struct _intl_data { intl_error error; @@ -35,7 +35,7 @@ typedef struct _intl_data { #define INTL_METHOD_INIT_VARS(oclass, obj) \ zval* object = NULL; \ oclass##_object* obj = NULL; \ - intl_error_reset( NULL ); + intl_error_reset( NULL ); #define INTL_DATA_ERROR(obj) (((intl_object *)(obj))->error) #define INTL_DATA_ERROR_P(obj) (&(INTL_DATA_ERROR((obj)))) diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index 401e5b187b..28a2a244e2 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -268,7 +268,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) smart_str_appends( &ret, "at " ); smart_str_appends( &ret, "offset " ); - smart_str_append_long( &ret, (zend_long ) pe->offset ); + smart_str_append_long( &ret, (zend_long ) pe->offset ); any = 1; } @@ -315,7 +315,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) smart_str_free( &ret ); smart_str_appends( &ret, "no parse error" ); } - + smart_str_0( &ret ); return ret; } diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h index 9118bee653..fc64477c74 100644 --- a/ext/intl/locale/locale.h +++ b/ext/intl/locale/locale.h @@ -22,7 +22,7 @@ #include <php.h> void locale_register_constants( INIT_FUNC_ARGS ); - + #define OPTION_DEFAULT NULL #define LOC_LANG_TAG "language" #define LOC_SCRIPT_TAG "script" diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index a03477ca29..994cf5e96a 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -65,26 +65,26 @@ ZEND_EXTERN_MODULE_GLOBALS( intl ) */ static const char * const LOC_GRANDFATHERED[] = { "art-lojban", "i-klingon", "i-lux", "i-navajo", "no-bok", "no-nyn", - "cel-gaulish", "en-GB-oed", "i-ami", - "i-bnn", "i-default", "i-enochian", - "i-mingo", "i-pwn", "i-tao", + "cel-gaulish", "en-GB-oed", "i-ami", + "i-bnn", "i-default", "i-enochian", + "i-mingo", "i-pwn", "i-tao", "i-tay", "i-tsu", "sgn-BE-fr", "sgn-BE-nl", "sgn-CH-de", "zh-cmn", "zh-cmn-Hans", "zh-cmn-Hant", "zh-gan" , "zh-guoyu", "zh-hakka", "zh-min", - "zh-min-nan", "zh-wuu", "zh-xiang", + "zh-min-nan", "zh-wuu", "zh-xiang", "zh-yue", NULL }; /* Based on IANA registry at the time of writing this code * This array lists the preferred values for the grandfathered tags if applicable -* This is in sync with the array LOC_GRANDFATHERED +* This is in sync with the array LOC_GRANDFATHERED * e.g. the offsets of the grandfathered tags match the offset of the preferred value */ static const int LOC_PREFERRED_GRANDFATHERED_LEN = 6; static const char * const LOC_PREFERRED_GRANDFATHERED[] = { "jbo", "tlh", "lb", - "nv", "nb", "nn", + "nv", "nb", "nn", NULL }; @@ -122,7 +122,7 @@ static int16_t findOffset(const char* const* list, const char* key) /*}}}*/ static char* getPreferredTag(const char* gf_tag) -{ +{ char* result = NULL; int grOffset = 0; @@ -141,15 +141,15 @@ static char* getPreferredTag(const char* gf_tag) } /* {{{ -* returns the position of next token for lookup +* returns the position of next token for lookup * or -1 if no token -* strtokr equivalent search for token in reverse direction +* strtokr equivalent search for token in reverse direction */ static int getStrrtokenPos(char* str, int savedPos) { int result =-1; int i; - + for(i=savedPos-1; i>=0; i--) { if(isIDSeparator(*(str+i)) ){ /* delimiter found; check for singleton */ @@ -171,7 +171,7 @@ static int getStrrtokenPos(char* str, int savedPos) /* }}} */ /* {{{ -* returns the position of a singleton if present +* returns the position of a singleton if present * returns -1 if no singleton * strtok equivalent search for singleton */ @@ -180,7 +180,7 @@ static int getSingletonPos(const char* str) int result =-1; int i=0; int len = 0; - + if( str && ((len=strlen(str))>0) ){ for( i=0; i<len ; i++){ if( isIDSeparator(*(str+i)) ){ @@ -198,7 +198,7 @@ static int getSingletonPos(const char* str) } } }/* end of for */ - + } return result; } @@ -239,9 +239,9 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) default_locale = (char *)uloc_getDefault(); locale_name = zend_string_init(default_locale, strlen(default_locale), 0); } - + ini_name = zend_string_init(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0); - zend_alter_ini_entry(ini_name, locale_name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry(ini_name, locale_name, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); zend_string_release(ini_name); if (default_locale != NULL) { zend_string_release(locale_name); @@ -252,7 +252,7 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) /* }}} */ /* {{{ -* Gets the value from ICU +* Gets the value from ICU * common code shared by get_primary_language,get_script or get_region or get_variant * result = 0 if error, 1 if successful , -1 if no value */ @@ -289,7 +289,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int* } } - singletonPos = getSingletonPos( loc_name ); + singletonPos = getSingletonPos( loc_name ); if( singletonPos == 0){ /* singleton at start of script, region , variant etc. * or invalid singleton at start of language */ @@ -304,7 +304,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int* } /* end of if != LOC_CANONICAL_TAG */ if( mod_loc_name == NULL){ - mod_loc_name = estrdup(loc_name ); + mod_loc_name = estrdup(loc_name ); } /* Proceed to ICU */ @@ -371,7 +371,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int* * Gets the value from ICU , called when PHP userspace function is called * common code shared by get_primary_language,get_script or get_region or get_variant */ -static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) +static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) { const char* loc_name = NULL; @@ -430,37 +430,37 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) } /* }}} */ -/* {{{ proto static string Locale::getScript($locale) - * gets the script for the $locale +/* {{{ proto static string Locale::getScript($locale) + * gets the script for the $locale }}} */ -/* {{{ proto static string locale_get_script($locale) - * gets the script for the $locale +/* {{{ proto static string locale_get_script($locale) + * gets the script for the $locale */ -PHP_FUNCTION( locale_get_script ) +PHP_FUNCTION( locale_get_script ) { get_icu_value_src_php( LOC_SCRIPT_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } /* }}} */ -/* {{{ proto static string Locale::getRegion($locale) - * gets the region for the $locale +/* {{{ proto static string Locale::getRegion($locale) + * gets the region for the $locale }}} */ -/* {{{ proto static string locale_get_region($locale) - * gets the region for the $locale +/* {{{ proto static string locale_get_region($locale) + * gets the region for the $locale */ -PHP_FUNCTION( locale_get_region ) +PHP_FUNCTION( locale_get_region ) { get_icu_value_src_php( LOC_REGION_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } /* }}} */ -/* {{{ proto static string Locale::getPrimaryLanguage($locale) - * gets the primary language for the $locale +/* {{{ proto static string Locale::getPrimaryLanguage($locale) + * gets the primary language for the $locale }}} */ -/* {{{ proto static string locale_get_primary_language($locale) - * gets the primary language for the $locale +/* {{{ proto static string locale_get_primary_language($locale) + * gets the primary language for the $locale */ -PHP_FUNCTION(locale_get_primary_language ) +PHP_FUNCTION(locale_get_primary_language ) { get_icu_value_src_php( LOC_LANG_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } @@ -468,9 +468,9 @@ PHP_FUNCTION(locale_get_primary_language ) /* {{{ - * common code shared by display_xyz functions to get the value from ICU + * common code shared by display_xyz functions to get the value from ICU }}} */ -static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) +static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) { const char* loc_name = NULL; size_t loc_name_len = 0; @@ -496,7 +496,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME intl_error_reset( NULL ); if(zend_parse_parameters( ZEND_NUM_ARGS(), "s|s", - &loc_name, &loc_name_len , + &loc_name, &loc_name_len , &disp_loc_name ,&disp_loc_name_len ) == FAILURE) { spprintf(&msg , 0, "locale_get_display_%s : unable to parse input params", tag_name ); @@ -533,7 +533,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME if( mod_loc_name==NULL ){ mod_loc_name = estrdup( loc_name ); } - + /* Check if disp_loc_name passed , if not use default locale */ if( !disp_loc_name){ disp_loc_name = estrdup(intl_locale_get_default()); @@ -614,7 +614,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME /* {{{ proto static string get_display_name($locale[, $in_locale = null]) * gets the name for the $locale in $in_locale or default_locale */ -PHP_FUNCTION(locale_get_display_name) +PHP_FUNCTION(locale_get_display_name) { get_icu_disp_value_src_php( DISP_NAME , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } @@ -626,7 +626,7 @@ PHP_FUNCTION(locale_get_display_name) /* {{{ proto static string get_display_language($locale[, $in_locale = null]) * gets the language for the $locale in $in_locale or default_locale */ -PHP_FUNCTION(locale_get_display_language) +PHP_FUNCTION(locale_get_display_language) { get_icu_disp_value_src_php( LOC_LANG_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } @@ -638,7 +638,7 @@ PHP_FUNCTION(locale_get_display_language) /* {{{ proto static string get_display_script($locale, $in_locale = null) * gets the script for the $locale in $in_locale or default_locale */ -PHP_FUNCTION(locale_get_display_script) +PHP_FUNCTION(locale_get_display_script) { get_icu_disp_value_src_php( LOC_SCRIPT_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } @@ -650,7 +650,7 @@ PHP_FUNCTION(locale_get_display_script) /* {{{ proto static string get_display_region($locale, $in_locale = null) * gets the region for the $locale in $in_locale or default_locale */ -PHP_FUNCTION(locale_get_display_region) +PHP_FUNCTION(locale_get_display_region) { get_icu_disp_value_src_php( LOC_REGION_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } @@ -664,7 +664,7 @@ PHP_FUNCTION(locale_get_display_region) * proto static string get_display_variant($locale, $in_locale = null) * gets the variant for the $locale in $in_locale or default_locale */ -PHP_FUNCTION(locale_get_display_variant) +PHP_FUNCTION(locale_get_display_variant) { get_icu_disp_value_src_php( LOC_VARIANT_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); } @@ -677,7 +677,7 @@ PHP_FUNCTION(locale_get_display_variant) /* {{{ proto static array locale_get_keywords(string $locale) { * return an associative array containing keyword-value * pairs for this locale. The keys are keys to the array (doh!) - */ + */ PHP_FUNCTION( locale_get_keywords ) { UEnumeration* e = NULL; @@ -689,10 +689,10 @@ PHP_FUNCTION( locale_get_keywords ) const char* loc_name = NULL; size_t loc_name_len = 0; -/* - ICU expects the buffer to be allocated before calling the function - and so the buffer size has been explicitly specified - ICU uloc.h #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100 +/* + ICU expects the buffer to be allocated before calling the function + and so the buffer size has been explicitly specified + ICU uloc.h #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100 hence the kw_value buffer size is 100 */ char* kw_value = NULL; @@ -731,7 +731,7 @@ PHP_FUNCTION( locale_get_keywords ) kw_value_len=uloc_getKeywordValue( loc_name,kw_key, kw_value, kw_value_len+1 , &status ); } else if(!U_FAILURE(status)) { kw_value = erealloc( kw_value , kw_value_len+1); - } + } if (U_FAILURE(status)) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_get_keywords: Error encountered while getting the keyword value for the keyword", 0 ); if( kw_value){ @@ -752,10 +752,10 @@ PHP_FUNCTION( locale_get_keywords ) } /* }}} */ - /* {{{ proto static string Locale::canonicalize($locale) - * @return string the canonicalized locale + /* {{{ proto static string Locale::canonicalize($locale) + * @return string the canonicalized locale * }}} */ - /* {{{ proto static string locale_canonicalize(Locale $loc, string $locale) + /* {{{ proto static string locale_canonicalize(Locale $loc, string $locale) * @param string $locale The locale string to canonicalize */ PHP_FUNCTION(locale_canonicalize) @@ -764,10 +764,10 @@ PHP_FUNCTION(locale_canonicalize) } /* }}} */ -/* {{{ append_key_value +/* {{{ append_key_value * Internal function which is called from locale_compose * gets the value for the key_name and appends to the loc_name -* returns 1 if successful , -1 if not found , +* returns 1 if successful , -1 if not found , * 0 if array element is not a string , -2 if buffer-overflow */ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_name) @@ -779,7 +779,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_ /* element value is not a string */ return FAILURE; } - if(strcmp(key_name, LOC_LANG_TAG) != 0 && + if(strcmp(key_name, LOC_LANG_TAG) != 0 && strcmp(key_name, LOC_GRANDFATHERED_LANG_TAG)!=0 ) { /* not lang or grandfathered tag */ smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); @@ -804,11 +804,11 @@ static void add_prefix(smart_str* loc_name, char* key_name) } /* }}} */ -/* {{{ append_multiple_key_values +/* {{{ append_multiple_key_values * Internal function which is called from locale_compose * gets the multiple values for the key_name and appends to the loc_name -* used for 'variant','extlang','private' -* returns 1 if successful , -1 if not found , +* used for 'variant','extlang','private' +* returns 1 if successful , -1 if not found , * 0 if array element is not a string , -2 if buffer-overflow */ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, char* key_name) @@ -859,8 +859,8 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, /* Multiple variant values as variant0, variant1 ,variant2 */ isFirstSubtag = 0; - for( i=0 ; i< max_value; i++ ){ - snprintf( cur_key_name , 30, "%s%d", key_name , i); + for( i=0 ; i< max_value; i++ ){ + snprintf( cur_key_name , 30, "%s%d", key_name , i); if ((ele_value = zend_hash_str_find( hash_arr , cur_key_name , strlen(cur_key_name))) != NULL) { if( Z_TYPE_P(ele_value)!= IS_STRING ){ /* variant is not a string */ @@ -882,7 +882,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, /*{{{ * If applicable sets error message and aborts locale_compose gracefully -* returns 0 if locale_compose needs to be aborted +* returns 0 if locale_compose needs to be aborted * otherwise returns 1 */ static int handleAppendResult( int result, smart_str* loc_name) @@ -899,11 +899,11 @@ static int handleAppendResult( int result, smart_str* loc_name) /* }}} */ #define RETURN_SMART_STR(str) smart_str_0((str)); RETURN_STR((str)->s) -/* {{{ proto static string Locale::composeLocale($array) -* Creates a locale by combining the parts of locale-ID passed +/* {{{ proto static string Locale::composeLocale($array) +* Creates a locale by combining the parts of locale-ID passed * }}} */ -/* {{{ proto static string compose_locale($array) -* Creates a locale by combining the parts of locale-ID passed +/* {{{ proto static string compose_locale($array) +* Creates a locale by combining the parts of locale-ID passed * }}} */ PHP_FUNCTION(locale_compose) { @@ -929,7 +929,7 @@ PHP_FUNCTION(locale_compose) RETURN_FALSE; /* Check for grandfathered first */ - result = append_key_value(loc_name, hash_arr, LOC_GRANDFATHERED_LANG_TAG); + result = append_key_value(loc_name, hash_arr, LOC_GRANDFATHERED_LANG_TAG); if( result == SUCCESS){ RETURN_SMART_STR(loc_name); } @@ -938,7 +938,7 @@ PHP_FUNCTION(locale_compose) } /* Not grandfathered */ - result = append_key_value(loc_name, hash_arr , LOC_LANG_TAG); + result = append_key_value(loc_name, hash_arr , LOC_LANG_TAG); if( result == LOC_NOT_FOUND ){ intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_compose: parameter array does not contain 'language' tag.", 0 ); @@ -956,11 +956,11 @@ PHP_FUNCTION(locale_compose) } /* Script */ - result = append_key_value(loc_name, hash_arr , LOC_SCRIPT_TAG); + result = append_key_value(loc_name, hash_arr , LOC_SCRIPT_TAG); if( !handleAppendResult( result, loc_name)){ RETURN_FALSE; } - + /* Region */ result = append_key_value( loc_name, hash_arr , LOC_REGION_TAG); if( !handleAppendResult( result, loc_name)){ @@ -968,7 +968,7 @@ PHP_FUNCTION(locale_compose) } /* Variant */ - result = append_multiple_key_values( loc_name, hash_arr , LOC_VARIANT_TAG); + result = append_multiple_key_values( loc_name, hash_arr , LOC_VARIANT_TAG); if( !handleAppendResult( result, loc_name)){ RETURN_FALSE; } @@ -994,16 +994,16 @@ static char* get_private_subtags(const char* loc_name) { char* result =NULL; int singletonPos = 0; - int len =0; + int len =0; const char* mod_loc_name =NULL; if( loc_name && (len = strlen(loc_name)>0 ) ){ - mod_loc_name = loc_name ; + mod_loc_name = loc_name ; len = strlen(mod_loc_name); while( (singletonPos = getSingletonPos(mod_loc_name))!= -1){ - if( singletonPos!=-1){ - if( (*(mod_loc_name+singletonPos)=='x') || (*(mod_loc_name+singletonPos)=='X') ){ + if( singletonPos!=-1){ + if( (*(mod_loc_name+singletonPos)=='x') || (*(mod_loc_name+singletonPos)=='X') ){ /* private subtag start found */ if( singletonPos + 2 == len){ /* loc_name ends with '-x-' ; return NULL */ @@ -1028,7 +1028,7 @@ static char* get_private_subtags(const char* loc_name) } /* end of while */ } - + return result; } /* }}} */ @@ -1053,20 +1053,20 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name) } else { key_value = get_icu_value_internal( loc_name , key_name , &result,1 ); } - if( (strcmp(key_name , LOC_PRIVATE_TAG)==0) || + if( (strcmp(key_name , LOC_PRIVATE_TAG)==0) || ( strcmp(key_name , LOC_VARIANT_TAG)==0) ){ if( result > 0 && key_value){ /* Tokenize on the "_" or "-" */ - token = php_strtok_r( key_value , DELIMITER ,&last_ptr); + token = php_strtok_r( key_value , DELIMITER ,&last_ptr); if( cur_key_name ){ efree( cur_key_name); } cur_key_name = (char*)ecalloc( 25, 25); - sprintf( cur_key_name , "%s%d", key_name , cnt++); + sprintf( cur_key_name , "%s%d", key_name , cnt++); add_assoc_string( hash_arr, cur_key_name , token); /* tokenize on the "_" or "-" and stop at singleton if any */ while( (token = php_strtok_r(NULL , DELIMITER , &last_ptr)) && (strlen(token)>1) ){ - sprintf( cur_key_name , "%s%d", key_name , cnt++); + sprintf( cur_key_name , "%s%d", key_name , cnt++); add_assoc_string( hash_arr, cur_key_name , token); } /* @@ -1086,16 +1086,16 @@ static int add_array_entry(const char* loc_name, zval* hash_arr, char* key_name) } /*if( key_name != LOC_PRIVATE_TAG && key_value){*/ if( key_value){ - efree(key_value); + efree(key_value); } return cur_result; } /* }}} */ -/* {{{ proto static array Locale::parseLocale($locale) +/* {{{ proto static array Locale::parseLocale($locale) * parses a locale-id into an array the different parts of it }}} */ -/* {{{ proto static array parse_locale($locale) +/* {{{ proto static array parse_locale($locale) * parses a locale-id into an array the different parts of it */ PHP_FUNCTION(locale_parse) @@ -1153,7 +1153,7 @@ PHP_FUNCTION(locale_get_all_variants) char* saved_ptr = NULL; intl_error_reset( NULL ); - + if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &loc_name, &loc_name_len ) == FAILURE) { @@ -1171,15 +1171,15 @@ PHP_FUNCTION(locale_get_all_variants) array_init( return_value ); /* If the locale is grandfathered, stop, no variants */ - if( findOffset( LOC_GRANDFATHERED , loc_name ) >= 0 ){ + if( findOffset( LOC_GRANDFATHERED , loc_name ) >= 0 ){ /* ("Grandfathered Tag. No variants."); */ } - else { + else { /* Call ICU variant */ variant = get_icu_value_internal( loc_name , LOC_VARIANT_TAG , &result ,0); if( result > 0 && variant){ /* Tokenize on the "_" or "-" */ - token = php_strtok_r( variant , DELIMITER , &saved_ptr); + token = php_strtok_r( variant , DELIMITER , &saved_ptr); add_next_index_stringl( return_value, token , strlen(token)); /* tokenize on the "_" or "-" and stop at singleton if any */ while( (token = php_strtok_r(NULL , DELIMITER, &saved_ptr)) && (strlen(token)>1) ){ @@ -1190,7 +1190,7 @@ PHP_FUNCTION(locale_get_all_variants) efree( variant ); } } - + } /* }}} */ @@ -1231,11 +1231,11 @@ static int strToMatch(const char* str ,char *retstr) /* }}} */ /* {{{ proto static boolean Locale::filterMatches(string $langtag, string $locale[, bool $canonicalize]) -* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm +* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm */ /* }}} */ /* {{{ proto boolean locale_filter_matches(string $langtag, string $locale[, bool $canonicalize]) -* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm +* Checks if a $langtag filter matches with $locale according to RFC 4647's basic filtering algorithm */ PHP_FUNCTION(locale_filter_matches) { @@ -1254,13 +1254,13 @@ PHP_FUNCTION(locale_filter_matches) char* cur_lang_tag = NULL; char* cur_loc_range = NULL; - zend_bool boolCanonical = 0; + zend_bool boolCanonical = 0; UErrorCode status = U_ZERO_ERROR; intl_error_reset( NULL ); - + if(zend_parse_parameters( ZEND_NUM_ARGS(), "ss|b", - &lang_tag, &lang_tag_len , &loc_range , &loc_range_len , + &lang_tag, &lang_tag_len , &loc_range , &loc_range_len , &boolCanonical) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -1281,7 +1281,7 @@ PHP_FUNCTION(locale_filter_matches) /* canonicalize loc_range */ can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0); if( result ==0) { - intl_error_set( NULL, status, + intl_error_set( NULL, status, "locale_filter_matches : unable to canonicalize loc_range" , 0 ); RETURN_FALSE; } @@ -1289,7 +1289,7 @@ PHP_FUNCTION(locale_filter_matches) /* canonicalize lang_tag */ can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0); if( result ==0) { - intl_error_set( NULL, status, + intl_error_set( NULL, status, "locale_filter_matches : unable to canonicalize lang_tag" , 0 ); RETURN_FALSE; } @@ -1317,11 +1317,11 @@ PHP_FUNCTION(locale_filter_matches) /* check if prefix */ token = strstr( cur_lang_tag , cur_loc_range ); - + if( token && (token==cur_lang_tag) ){ /* check if the char. after match is SEPARATOR */ chrcheck = token + (strlen(cur_loc_range)); - if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ + if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ if( cur_lang_tag){ efree( cur_lang_tag ); } @@ -1357,7 +1357,7 @@ PHP_FUNCTION(locale_filter_matches) else{ /* Convert to lower case for case-insensitive comparison */ cur_lang_tag = ecalloc( 1, strlen(lang_tag ) + 1); - + result = strToMatch( lang_tag , cur_lang_tag); if( result == 0) { efree( cur_lang_tag ); @@ -1373,11 +1373,11 @@ PHP_FUNCTION(locale_filter_matches) /* check if prefix */ token = strstr( cur_lang_tag , cur_loc_range ); - + if( token && (token==cur_lang_tag) ){ /* check if the char. after match is SEPARATOR */ chrcheck = token + (strlen(cur_loc_range)); - if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ + if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ if( cur_lang_tag){ efree( cur_lang_tag ); } @@ -1404,7 +1404,7 @@ PHP_FUNCTION(locale_filter_matches) static void array_cleanup( char* arr[] , int arr_size) { int i=0; - for( i=0; i< arr_size; i++ ){ + for( i=0; i< arr_size; i++ ){ if( arr[i*2] ){ efree( arr[i*2]); } @@ -1414,7 +1414,7 @@ static void array_cleanup( char* arr[] , int arr_size) #define LOOKUP_CLEAN_RETURN(value) array_cleanup(cur_arr, cur_arr_len); return (value) /* {{{ -* returns the lookup result to lookup_loc_range_src_php +* returns the lookup result to lookup_loc_range_src_php * internal function */ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int canonicalize ) @@ -1440,7 +1440,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca /* element value is not a string */ intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: locale array element is not a string", 0); LOOKUP_CLEAN_RETURN(NULL); - } + } cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRLEN_P(ele_value)); result = strToMatch(Z_STRVAL_P(ele_value), cur_arr[cur_arr_len*2]); if(result == 0) { @@ -1448,12 +1448,12 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca LOOKUP_CLEAN_RETURN(NULL); } cur_arr[cur_arr_len*2+1] = Z_STRVAL_P(ele_value); - cur_arr_len++ ; + cur_arr_len++ ; } ZEND_HASH_FOREACH_END(); /* end of for */ /* Canonicalize array elements */ if(canonicalize) { - for(i=0; i<cur_arr_len; i++) { + for(i=0; i<cur_arr_len; i++) { lang_tag = get_icu_value_internal(cur_arr[i*2], LOC_CANONICALIZE_TAG, &result, 0); if(result != 1 || lang_tag == NULL || !lang_tag[0]) { if(lang_tag) { @@ -1463,7 +1463,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca LOOKUP_CLEAN_RETURN(NULL); } cur_arr[i*2] = erealloc(cur_arr[i*2], strlen(lang_tag)+1); - result = strToMatch(lang_tag, cur_arr[i*2]); + result = strToMatch(lang_tag, cur_arr[i*2]); efree(lang_tag); if(result == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag" , 0); @@ -1486,11 +1486,11 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca } else { loc_range = can_loc_range; } - } + } cur_loc_range = ecalloc(1, strlen(loc_range)+1); /* convert to lower and replace hyphens */ - result = strToMatch(loc_range, cur_loc_range); + result = strToMatch(loc_range, cur_loc_range); if(can_loc_range) { efree(can_loc_range); } @@ -1502,8 +1502,8 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca /* Lookup for the lang_tag match */ saved_pos = strlen(cur_loc_range); while(saved_pos > 0) { - for(i=0; i< cur_arr_len; i++){ - if(cur_arr[i*2] != NULL && strlen(cur_arr[i*2]) == saved_pos && strncmp(cur_loc_range, cur_arr[i*2], saved_pos) == 0) { + for(i=0; i< cur_arr_len; i++){ + if(cur_arr[i*2] != NULL && strlen(cur_arr[i*2]) == saved_pos && strncmp(cur_loc_range, cur_arr[i*2], saved_pos) == 0) { /* Match found */ return_value = estrdup(canonicalize?cur_arr[i*2]:cur_arr[i*2+1]); efree(cur_loc_range); @@ -1519,14 +1519,14 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca } /* }}} */ -/* {{{ proto string Locale::lookup(array $langtag, string $locale[, bool $canonicalize[, string $default = null]]) +/* {{{ proto string Locale::lookup(array $langtag, string $locale[, bool $canonicalize[, string $default = null]]) * Searchs the items in $langtag for the best match to the language -* range +* range */ /* }}} */ /* {{{ proto string locale_lookup(array $langtag, string $locale[, bool $canonicalize[, string $default = null]]) * Searchs the items in $langtag for the best match to the language -* range +* range */ PHP_FUNCTION(locale_lookup) { @@ -1556,8 +1556,8 @@ PHP_FUNCTION(locale_lookup) if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) { RETURN_EMPTY_STRING(); - } - + } + result = lookup_loc_range(loc_range, hash_arr, boolCanonical); if(result == NULL || result[0] == '\0') { if( fallback_loc ) { @@ -1596,10 +1596,10 @@ PHP_FUNCTION(locale_accept_from_http) "locale_accept_from_http: unable to parse input parameters", 0 ); RETURN_FALSE; } - + available = ures_openAvailableLocales(NULL, &status); INTL_CHECK_STATUS(status, "locale_accept_from_http: failed to retrieve locale list"); - len = uloc_acceptLanguageFromHTTP(resultLocale, INTL_MAX_LOCALE_LEN, + len = uloc_acceptLanguageFromHTTP(resultLocale, INTL_MAX_LOCALE_LEN, &outResult, http_accept, available, &status); uenum_close(available); INTL_CHECK_STATUS(status, "locale_accept_from_http: failed to find acceptable locale"); diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 4bcc047e02..bda8b573ce 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -26,7 +26,7 @@ #include "intl_convert.h" /* {{{ */ -static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) +static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) { const char* locale; char* pattern; @@ -76,7 +76,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) (mfo)->mf_data.orig_format = estrndup(pattern, pattern_len); (mfo)->mf_data.orig_format_len = pattern_len; - + /* Create an ICU message formatter. */ MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, locale, NULL, &INTL_DATA_ERROR_CODE(mfo)); diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c index 57cdbf6852..a20a7e411d 100644 --- a/ext/intl/msgformat/msgformat_attr.c +++ b/ext/intl/msgformat/msgformat_attr.c @@ -38,7 +38,7 @@ PHP_FUNCTION( msgfmt_get_pattern ) /* Parse parameters. */ if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, MessageFormatter_ce_ptr ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "msgfmt_get_pattern: unable to parse input params", 0 ); RETURN_FALSE; } @@ -71,7 +71,7 @@ PHP_FUNCTION( msgfmt_set_pattern ) if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os", &object, MessageFormatter_ce_ptr, &value, &value_len ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "msgfmt_set_pattern: unable to parse input params", 0); RETURN_FALSE; } diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c index 9fdd07e607..bb66bb4ba1 100644 --- a/ext/intl/msgformat/msgformat_class.c +++ b/ext/intl/msgformat/msgformat_class.c @@ -76,7 +76,7 @@ zend_object *MessageFormatter_object_clone(zval *object) MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; new_obj = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object)); new_mfo = php_intl_messageformatter_fetch_object(new_obj); - /* clone standard parts */ + /* clone standard parts */ zend_objects_clone_members(&new_mfo->zo, &mfo->zo); /* clone formatter object */ diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c index 697fba114a..b35c7c2281 100644 --- a/ext/intl/msgformat/msgformat_data.c +++ b/ext/intl/msgformat/msgformat_data.c @@ -80,7 +80,7 @@ msgformat_data* msgformat_data_create( void ) /* }}} */ #ifdef MSG_FORMAT_QUOTE_APOS -int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) +int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) { if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) { UChar *npattern = emalloc(sizeof(UChar)*(2*(*spattern_len)+1)); diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 76fdc3847b..d6839cbed0 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -324,13 +324,13 @@ static void umsg_set_timezone(MessageFormatter_object *mfo, * appear inside complex formats because ::getFormats() returns NULL * for all uncached formats, which is the case for complex formats * unless they were set via one of the ::setFormat() methods */ - + if (mfo->mf_data.tz_set) { return; /* already done */ } formats = mf->getFormats(count); - + if (formats == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Out of memory retrieving subformats", 0); @@ -342,7 +342,7 @@ static void umsg_set_timezone(MessageFormatter_object *mfo, if (df == NULL) { continue; } - + if (used_tz == NULL) { zval nullzv, *zvptr = &nullzv; ZVAL_NULL(zvptr); @@ -351,7 +351,7 @@ static void umsg_set_timezone(MessageFormatter_object *mfo, continue; } } - + df->setTimeZone(*used_tz); } @@ -377,7 +377,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, } types = umsg_get_types(mfo, err); - + umsg_set_timezone(mfo, err); fargs.resize(arg_count); diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index 6bcdba129c..4d63a0169a 100644 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -28,7 +28,7 @@ #include "intl_convert.h" /* {{{ */ -static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t src_len, zval *return_value) +static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t src_len, zval *return_value) { zval *fargs; int count = 0; diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c index 5b0c980d76..556cb4dee1 100644 --- a/ext/intl/normalizer/normalizer_normalize.c +++ b/ext/intl/normalizer/normalizer_normalize.c @@ -36,20 +36,20 @@ PHP_FUNCTION( normalizer_normalize ) /* form is optional, defaults to FORM_C */ zend_long form = NORMALIZER_DEFAULT; size_t input_len = 0; - + UChar* uinput = NULL; int32_t uinput_len = 0; int expansion_factor = 1; UErrorCode status = U_ZERO_ERROR; - + UChar* uret_buf = NULL; int32_t uret_len = 0; - + char* ret_buf = NULL; size_t ret_len = 0; int32_t size_needed; - + intl_error_reset( NULL ); /* Parse parameters. */ @@ -109,11 +109,11 @@ PHP_FUNCTION( normalizer_normalize ) /* normalize */ size_needed = unorm_normalize( uinput, uinput_len, form, (int32_t) 0 /* options */, uret_buf, uret_len, &status); - + /* Bail out if an unexpected error occurred. * (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough). * (U_STRING_NOT_TERMINATED_WARNING usually means that the input string is empty). - */ + */ if( U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR && status != U_STRING_NOT_TERMINATED_WARNING ) { efree( uret_buf ); efree( uinput ); @@ -180,9 +180,9 @@ PHP_FUNCTION( normalizer_is_normalized ) UChar* uinput = NULL; int uinput_len = 0; UErrorCode status = U_ZERO_ERROR; - + UBool uret = FALSE; - + intl_error_reset( NULL ); /* Parse parameters. */ @@ -233,7 +233,7 @@ PHP_FUNCTION( normalizer_is_normalized ) /* test string */ uret = unorm_isNormalizedWithOptions( uinput, uinput_len, form, (int32_t) 0 /* options */, &status); - + efree( uinput ); /* Bail out if an unexpected error occurred. */ @@ -245,7 +245,7 @@ PHP_FUNCTION( normalizer_is_normalized ) if ( uret ) RETURN_TRUE; - + RETURN_FALSE; } /* }}} */ diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 2ac1888061..3e45e48016 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -750,7 +750,7 @@ zend_function_entry intl_functions[] = { PHP_FE( resourcebundle_locales, arginfo_resourcebundle_locales_proc ) PHP_FE( resourcebundle_get_error_code, arginfo_resourcebundle_get_error_code_proc ) PHP_FE( resourcebundle_get_error_message, arginfo_resourcebundle_get_error_message_proc ) - + /* Transliterator functions */ PHP_FE( transliterator_create, arginfo_transliterator_create ) PHP_FE( transliterator_create_from_rules, arginfo_transliterator_create_from_rules ) @@ -920,7 +920,7 @@ PHP_MINIT_FUNCTION( intl ) REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS); #ifdef U_ICU_DATA_VERSION REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS); -#endif +#endif /* Register 'Collator' PHP class */ collator_register_Collator_class( ); diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c index 1a6ff1f88c..fc6ecb946c 100644 --- a/ext/intl/resourcebundle/resourcebundle.c +++ b/ext/intl/resourcebundle/resourcebundle.c @@ -24,7 +24,7 @@ #include "resourcebundle/resourcebundle_class.h" /* {{{ ResourceBundle_extract_value */ -void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *source ) +void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *source ) { UResType restype; const UChar* ufield; diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index d56544c5ae..01823d7a73 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -74,7 +74,7 @@ static zend_object *ResourceBundle_object_create( zend_class_entry *ce ) /* }}} */ /* {{{ ResourceBundle_ctor */ -static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) +static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) { const char *bundlename; size_t bundlename_len = 0; @@ -87,7 +87,7 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) intl_error_reset( NULL ); - if( zend_parse_parameters( ZEND_NUM_ARGS(), "s!s!|b", + if( zend_parse_parameters( ZEND_NUM_ARGS(), "s!s!|b", &locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -97,7 +97,7 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) } INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value); - + if (locale == NULL) { locale = intl_locale_get_default(); } @@ -155,7 +155,7 @@ PHP_METHOD( ResourceBundle, __construct ) /* {{{ proto ResourceBundle ResourceBundle::create( string $locale [, string $bundlename [, bool $fallback = true ]] ) proto ResourceBundle resourcebundle_create( string $locale [, string $bundlename [, bool $fallback = true ]] ) */ -PHP_FUNCTION( resourcebundle_create ) +PHP_FUNCTION( resourcebundle_create ) { object_init_ex( return_value, ResourceBundle_ce_ptr ); resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -166,7 +166,7 @@ PHP_FUNCTION( resourcebundle_create ) /* }}} */ /* {{{ resourcebundle_array_fetch */ -static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback) +static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback) { int32_t meindex = 0; char * mekey = NULL; @@ -174,7 +174,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ char *pbuf; ResourceBundle_object *rb; - intl_error_reset( NULL ); + intl_error_reset( NULL ); RESOURCEBUNDLE_METHOD_FETCH_OBJECT; if(Z_TYPE_P(offset) == IS_LONG) { @@ -185,12 +185,12 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ mekey = Z_STRVAL_P(offset); rb->child = ures_getByKey(rb->me, mekey, rb->child, &INTL_DATA_ERROR_CODE(rb) ); } else { - intl_errors_set(INTL_DATA_ERROR_P(rb), U_ILLEGAL_ARGUMENT_ERROR, + intl_errors_set(INTL_DATA_ERROR_P(rb), U_ILLEGAL_ARGUMENT_ERROR, "resourcebundle_get: index should be integer or string", 0); RETURN_NULL(); } - intl_error_set_code( NULL, INTL_DATA_ERROR_CODE(rb) ); + intl_error_set_code( NULL, INTL_DATA_ERROR_CODE(rb) ); if (U_FAILURE(INTL_DATA_ERROR_CODE(rb))) { if (is_numeric) { spprintf( &pbuf, 0, "Cannot load resource element %d", meindex ); @@ -220,7 +220,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ /* }}} */ /* {{{ resourcebundle_array_get */ -zval *resourcebundle_array_get(zval *object, zval *offset, int type, zval *rv) +zval *resourcebundle_array_get(zval *object, zval *offset, int type, zval *rv) { if(offset == NULL) { php_error( E_ERROR, "Cannot apply [] to ResourceBundle object" ); @@ -249,7 +249,7 @@ PHP_FUNCTION( resourcebundle_get ) zval * object; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz|b", &object, ResourceBundle_ce_ptr, &offset, &fallback ) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "resourcebundle_get: unable to parse input params", 0); RETURN_FALSE; } @@ -259,7 +259,7 @@ PHP_FUNCTION( resourcebundle_get ) /* }}} */ /* {{{ resourcebundle_array_count */ -int resourcebundle_array_count(zval *object, zend_long *count) +int resourcebundle_array_count(zval *object, zend_long *count) { ResourceBundle_object *rb; RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK; @@ -291,7 +291,7 @@ PHP_FUNCTION( resourcebundle_count ) RESOURCEBUNDLE_METHOD_INIT_VARS; if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, ResourceBundle_ce_ptr ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "resourcebundle_count: unable to parse input params", 0); RETURN_FALSE; } @@ -325,7 +325,7 @@ PHP_FUNCTION( resourcebundle_locales ) if( zend_parse_parameters(ZEND_NUM_ARGS(), "s", &bundlename, &bundlename_len ) == FAILURE ) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "resourcebundle_locales: unable to parse input params", 0); RETURN_FALSE; } @@ -336,10 +336,10 @@ PHP_FUNCTION( resourcebundle_locales ) } icuenum = ures_openAvailableLocales( bundlename, &icuerror ); - INTL_CHECK_STATUS(icuerror, "Cannot fetch locales list"); + INTL_CHECK_STATUS(icuerror, "Cannot fetch locales list"); uenum_reset( icuenum, &icuerror ); - INTL_CHECK_STATUS(icuerror, "Cannot iterate locales list"); + INTL_CHECK_STATUS(icuerror, "Cannot iterate locales list"); array_init( return_value ); while ((entry = uenum_next( icuenum, &entry_len, &icuerror ))) { diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c index 8243e69268..febf47e87d 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.c +++ b/ext/intl/resourcebundle/resourcebundle_iterator.c @@ -29,7 +29,7 @@ */ /* {{{ resourcebundle_iterator_read */ -static void resourcebundle_iterator_read( ResourceBundle_iterator *iterator ) +static void resourcebundle_iterator_read( ResourceBundle_iterator *iterator ) { UErrorCode icuerror = U_ZERO_ERROR; ResourceBundle_object *rb = iterator->subject; @@ -51,7 +51,7 @@ static void resourcebundle_iterator_read( ResourceBundle_iterator *iterator ) /* }}} */ /* {{{ resourcebundle_iterator_invalidate */ -static void resourcebundle_iterator_invalidate( zend_object_iterator *iter ) +static void resourcebundle_iterator_invalidate( zend_object_iterator *iter ) { ResourceBundle_iterator *iterator = (ResourceBundle_iterator *) iter; diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c index 84549ced83..d2f2b4c873 100644 --- a/ext/intl/spoofchecker/spoofchecker_class.c +++ b/ext/intl/spoofchecker/spoofchecker_class.c @@ -117,7 +117,7 @@ static zend_object *spoofchecker_clone_obj(zval *object) /* {{{ */ new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object)); new_sfo = php_intl_spoofchecker_fetch_object(new_obj_val); - /* clone standard parts */ + /* clone standard parts */ zend_objects_clone_members(&new_sfo->zo, &sfo->zo); /* clone internal object */ new_sfo->uspoof = uspoof_clone(sfo->uspoof, SPOOFCHECKER_ERROR_CODE_P(new_sfo)); @@ -146,7 +146,7 @@ void spoofchecker_register_Spoofchecker_class(void) memcpy(&Spoofchecker_handlers, zend_get_std_object_handlers(), sizeof Spoofchecker_handlers); Spoofchecker_handlers.offset = XtOffsetOf(Spoofchecker_object, zo); - Spoofchecker_handlers.clone_obj = spoofchecker_clone_obj; + Spoofchecker_handlers.clone_obj = spoofchecker_clone_obj; Spoofchecker_handlers.dtor_obj = Spoofchecker_objects_dtor; Spoofchecker_handlers.free_obj = Spoofchecker_objects_free; diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c index 962e31cb08..d797015cf8 100644 --- a/ext/intl/spoofchecker/spoofchecker_create.c +++ b/ext/intl/spoofchecker/spoofchecker_create.c @@ -30,13 +30,13 @@ PHP_METHOD(Spoofchecker, __construct) { int checks; SPOOFCHECKER_METHOD_INIT_VARS; - + if (zend_parse_parameters_none() == FAILURE) { return; } - + SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; - + co->uspoof = uspoof_open(SPOOFCHECKER_ERROR_CODE_P(co)); INTL_CTOR_CHECK_STATUS(co, "spoofchecker: unable to open ICU Spoof Checker"); diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c index 8a94fd0421..cb26905305 100644 --- a/ext/intl/spoofchecker/spoofchecker_main.c +++ b/ext/intl/spoofchecker/spoofchecker_main.c @@ -31,11 +31,11 @@ PHP_METHOD(Spoofchecker, isSuspicious) size_t text_len; zval *error_code = NULL; SPOOFCHECKER_METHOD_INIT_VARS; - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &text, &text_len, &error_code)) { return; } - + SPOOFCHECKER_METHOD_FETCH_OBJECT; ret = uspoof_checkUTF8(co->uspoof, text, text_len, NULL, SPOOFCHECKER_ERROR_CODE_P(co)); @@ -44,7 +44,7 @@ PHP_METHOD(Spoofchecker, isSuspicious) php_error_docref(NULL, E_WARNING, "(%d) %s", SPOOFCHECKER_ERROR_CODE(co), u_errorName(SPOOFCHECKER_ERROR_CODE(co))); RETURN_TRUE; } - + if (error_code) { zval_dtor(error_code); ZVAL_LONG(error_code, ret); @@ -63,7 +63,7 @@ PHP_METHOD(Spoofchecker, areConfusable) size_t s1_len, s2_len; zval *error_code = NULL; SPOOFCHECKER_METHOD_INIT_VARS; - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &s1, &s1_len, &s2, &s2_len, &error_code)) { return; @@ -79,7 +79,7 @@ PHP_METHOD(Spoofchecker, areConfusable) php_error_docref(NULL, E_WARNING, "(%d) %s", SPOOFCHECKER_ERROR_CODE(co), u_errorName(SPOOFCHECKER_ERROR_CODE(co))); RETURN_TRUE; } - + if (error_code) { zval_dtor(error_code); ZVAL_LONG(error_code, ret); @@ -96,7 +96,7 @@ PHP_METHOD(Spoofchecker, setAllowedLocales) char *locales; size_t locales_len; SPOOFCHECKER_METHOD_INIT_VARS; - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &locales, &locales_len)) { return; } @@ -119,7 +119,7 @@ PHP_METHOD(Spoofchecker, setChecks) { zend_long checks; SPOOFCHECKER_METHOD_INIT_VARS; - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &checks)) { return; } diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 99b95e14a8..8b4d6ef127 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -213,7 +213,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, return NULL; } } - + zval_dtor(&local_zv_tz); return timeZone; @@ -279,7 +279,7 @@ static int TimeZone_compare_objects(zval *object1, zval *object2) return 0; } } - + return 1; } /* }}} */ @@ -297,7 +297,7 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp) UErrorCode uec = U_ZERO_ERROR; *is_temp = 1; - + ALLOC_HASHTABLE(debug_info); zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0); @@ -330,11 +330,11 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp) if (U_FAILURE(uec)) { return debug_info; } - + ZVAL_LONG(&zv, (zend_long)rawOffset); - zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv); + zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv); ZVAL_LONG(&zv, (zend_long)(rawOffset + dstOffset)); - zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv); + zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv); return debug_info; } @@ -379,7 +379,7 @@ static zend_object *TimeZone_object_create(zend_class_entry *ce) TimeZone_object* intern; intern = (TimeZone_object*)ecalloc(1, sizeof(TimeZone_object) + sizeof(zval) * (ce->default_properties_count - 1)); - + zend_object_std_init(&intern->zo, ce); object_properties_init(&intern->zo, ce); TimeZone_object_init(intern); diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index 053918ad04..641727d7ed 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -304,7 +304,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id) UBool isSystemID; TimeZone::getCanonicalID(id, result, isSystemID, status); INTL_CHECK_STATUS(status, "intltz_get_canonical_id: error obtaining canonical ID"); - + char *str; size_t str_len; intl_convert_utf16_to_utf8(&str, &str_len, result.getBuffer(), result.length(), &status); @@ -313,7 +313,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id) RETVAL_STRINGL(str, str_len); //???? efree(str); - + if (is_systemid) { /* by-ref argument passed */ ZVAL_DEREF(is_systemid); zval_dtor(is_systemid); diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index 22c608c9d4..d8b030a6d1 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -63,7 +63,7 @@ static int create_transliterator( char *str_id, size_t str_id_len, zend_long dir if (ustr_id) { efree( ustr_id ); } - + if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to ) ) ) { char *buf = NULL; @@ -82,7 +82,7 @@ static int create_transliterator( char *str_id, size_t str_id_len, zend_long dir zval_dtor( object ); return FAILURE; } - + transliterator_object_construct( object, utrans, TRANSLITERATOR_ERROR_CODE_P( to ) ); /* no need to close the transliterator manually on construction error */ if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to ) ) ) @@ -109,7 +109,7 @@ PHP_FUNCTION( transliterator_create ) int res; TRANSLITERATOR_METHOD_INIT_VARS; - + (void) to; /* unused */ if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l", @@ -124,7 +124,7 @@ PHP_FUNCTION( transliterator_create ) res = create_transliterator( str_id, str_id_len, direction, object ); if( res == FAILURE ) RETURN_NULL(); - + /* success, leave return_value as it is (set by create_transliterator) */ } /* }}} */ @@ -177,7 +177,7 @@ PHP_FUNCTION( transliterator_create_from_rules ) if (ustr_rules) { efree( ustr_rules ); } - + intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( to ) ); if( U_FAILURE( INTL_DATA_ERROR_CODE( to ) ) ) { @@ -225,7 +225,7 @@ PHP_FUNCTION( transliterator_create_inverse ) object = return_value; object_init_ex( object, Transliterator_ce_ptr ); TRANSLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; /* change "to" into new object (from "object" ) */ - + utrans = utrans_openInverse( to_orig->utrans, TRANSLITERATOR_ERROR_CODE_P( to ) ); INTL_CTOR_CHECK_STATUS( to, "transliterator_create_inverse: could not create " "inverse ICU transliterator" ); @@ -245,7 +245,7 @@ PHP_FUNCTION( transliterator_list_ids ) const UChar *elem; int32_t elem_len; UErrorCode status = U_ZERO_ERROR; - + intl_error_reset( NULL ); if( zend_parse_parameters_none() == FAILURE ) @@ -327,7 +327,7 @@ PHP_FUNCTION( transliterator_transliterate ) "transliterator_transliterate: bad arguments", 0 ); RETURN_FALSE; } - + if( Z_TYPE_P( arg1 ) == IS_OBJECT && instanceof_function( Z_OBJCE_P( arg1 ), Transliterator_ce_ptr ) ) { @@ -362,7 +362,7 @@ PHP_FUNCTION( transliterator_transliterate ) "transliterator_transliterate: bad arguments", 0 ); RETURN_FALSE; } - + if( limit < -1 ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -382,7 +382,7 @@ PHP_FUNCTION( transliterator_transliterate ) /* end argument parsing/validation */ TRANSLITERATOR_METHOD_FETCH_OBJECT; - + intl_convert_utf8_to_utf16( &ustr, &ustr_len, str, str_len, TRANSLITERATOR_ERROR_CODE_P( to ) ); INTL_METHOD_CHECK_STATUS( to, "String conversion of string to UTF-16 failed" ); @@ -429,7 +429,7 @@ PHP_FUNCTION( transliterator_transliterate ) else if(TRANSLITERATOR_ERROR_CODE( to ) == U_STRING_NOT_TERMINATED_WARNING ) { uresult = safe_erealloc( uresult, uresult_len, sizeof( UChar ), 1 * sizeof( UChar ) ); - + intl_error_reset( TRANSLITERATOR_ERROR_P( to ) ); break; } @@ -445,7 +445,7 @@ PHP_FUNCTION( transliterator_transliterate ) } uresult[uresult_len] = (UChar) 0; - + success = 1; cleanup: |