diff options
Diffstat (limited to 'ext/intl')
61 files changed, 514 insertions, 514 deletions
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 7c06af792c..ea3a305dd9 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -121,7 +121,7 @@ static zend_object *BreakIterator_clone_obj(zval *object TSRMLS_DC) "Could not clone BreakIterator", 0 TSRMLS_CC); err_msg = intl_error_get_message(BREAKITER_ERROR_P(bio_orig) TSRMLS_CC); zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC); - STR_FREE(err_msg); + zend_string_free(err_msg); } else { bio_new->biter = new_biter; ZVAL_COPY(&bio_new->text, &bio_orig->text); @@ -338,36 +338,36 @@ U_CFUNC void breakiterator_register_BreakIterator_class(TSRMLS_D) zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1, zend_ce_traversable); - zend_declare_class_constant_int(BreakIterator_ce_ptr, + zend_declare_class_constant_long(BreakIterator_ce_ptr, "DONE", sizeof("DONE") - 1, BreakIterator::DONE TSRMLS_CC ); /* Declare constants that are defined in the C header */ -#define BREAKITER_DECL_INT_CONST(name) \ - zend_declare_class_constant_int(BreakIterator_ce_ptr, #name, \ +#define BREAKITER_DECL_LONG_CONST(name) \ + zend_declare_class_constant_long(BreakIterator_ce_ptr, #name, \ sizeof(#name) - 1, UBRK_ ## name TSRMLS_CC) - BREAKITER_DECL_INT_CONST(WORD_NONE); - BREAKITER_DECL_INT_CONST(WORD_NONE_LIMIT); - BREAKITER_DECL_INT_CONST(WORD_NUMBER); - BREAKITER_DECL_INT_CONST(WORD_NUMBER_LIMIT); - BREAKITER_DECL_INT_CONST(WORD_LETTER); - BREAKITER_DECL_INT_CONST(WORD_LETTER_LIMIT); - BREAKITER_DECL_INT_CONST(WORD_KANA); - BREAKITER_DECL_INT_CONST(WORD_KANA_LIMIT); - BREAKITER_DECL_INT_CONST(WORD_IDEO); - BREAKITER_DECL_INT_CONST(WORD_IDEO_LIMIT); - - BREAKITER_DECL_INT_CONST(LINE_SOFT); - BREAKITER_DECL_INT_CONST(LINE_SOFT_LIMIT); - BREAKITER_DECL_INT_CONST(LINE_HARD); - BREAKITER_DECL_INT_CONST(LINE_HARD_LIMIT); - - BREAKITER_DECL_INT_CONST(SENTENCE_TERM); - BREAKITER_DECL_INT_CONST(SENTENCE_TERM_LIMIT); - BREAKITER_DECL_INT_CONST(SENTENCE_SEP); - BREAKITER_DECL_INT_CONST(SENTENCE_SEP_LIMIT); - -#undef BREAKITER_DECL_INT_CONST + BREAKITER_DECL_LONG_CONST(WORD_NONE); + BREAKITER_DECL_LONG_CONST(WORD_NONE_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_NUMBER); + BREAKITER_DECL_LONG_CONST(WORD_NUMBER_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_LETTER); + BREAKITER_DECL_LONG_CONST(WORD_LETTER_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_KANA); + BREAKITER_DECL_LONG_CONST(WORD_KANA_LIMIT); + BREAKITER_DECL_LONG_CONST(WORD_IDEO); + BREAKITER_DECL_LONG_CONST(WORD_IDEO_LIMIT); + + BREAKITER_DECL_LONG_CONST(LINE_SOFT); + BREAKITER_DECL_LONG_CONST(LINE_SOFT_LIMIT); + BREAKITER_DECL_LONG_CONST(LINE_HARD); + BREAKITER_DECL_LONG_CONST(LINE_HARD_LIMIT); + + BREAKITER_DECL_LONG_CONST(SENTENCE_TERM); + BREAKITER_DECL_LONG_CONST(SENTENCE_TERM_LIMIT); + BREAKITER_DECL_LONG_CONST(SENTENCE_SEP); + BREAKITER_DECL_LONG_CONST(SENTENCE_SEP_LIMIT); + +#undef BREAKITER_DECL_LONG_CONST /* Create and register 'RuleBasedBreakIterator' class. */ diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index c04e33e11b..d8f18f99f3 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -67,7 +67,7 @@ static void _breakiterator_move_forward(zend_object_iterator *iter TSRMLS_DC) int32_t pos = biter->next(); if (pos != BreakIterator::DONE) { - ZVAL_INT(&zoi_iter->current, (php_int_t)pos); + ZVAL_LONG(&zoi_iter->current, (zend_long)pos); } //else we've reached the end of the enum, nothing more is required } @@ -77,7 +77,7 @@ static void _breakiterator_rewind(zend_object_iterator *iter TSRMLS_DC) zoi_with_current *zoi_iter = (zoi_with_current*)iter; int32_t pos = biter->first(); - ZVAL_INT(&zoi_iter->current, (php_int_t)pos); + ZVAL_LONG(&zoi_iter->current, (zend_long)pos); } static zend_object_iterator_funcs breakiterator_iterator_funcs = { @@ -137,7 +137,7 @@ static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC static void _breakiterator_parts_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { /* the actual work is done in move_forward and rewind */ - ZVAL_INT(key, iter->index); + ZVAL_LONG(key, iter->index); } static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC) @@ -168,14 +168,14 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_ * No need to do anything, the engine increments ->index */ const char *s = Z_STRVAL(bio->text); - int32_t slen = Z_STRSIZE(bio->text); + int32_t slen = Z_STRLEN(bio->text); zend_string *res; if (next == BreakIterator::DONE) { next = slen; } assert(next <= slen && next >= cur); - res = STR_ALLOC(next - cur, 0); + res = zend_string_alloc(next - cur, 0); memcpy(res->val, &s[cur], res->len); res->val[res->len] = '\0'; @@ -315,7 +315,7 @@ U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D) IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method; #define PARTSITER_DECL_LONG_CONST(name) \ - zend_declare_class_constant_int(IntlPartsIterator_ce_ptr, #name, \ + zend_declare_class_constant_long(IntlPartsIterator_ce_ptr, #name, \ sizeof(#name) - 1, PARTS_ITERATOR_ ## name TSRMLS_CC) PARTSITER_DECL_LONG_CONST(KEY_SEQUENTIAL); diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index a8c32cc8d4..af380e44fd 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -208,7 +208,7 @@ static void _breakiter_no_args_ret_int32( int32_t res = (bio->biter->*func)(); - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } static void _breakiter_int32_ret_int32( @@ -217,11 +217,11 @@ static void _breakiter_int32_ret_int32( INTERNAL_FUNCTION_PARAMETERS) { char *msg; - php_int_t arg; + zend_long arg; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &arg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) { spprintf(&msg, 0, "%s: bad arguments", func_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); @@ -240,7 +240,7 @@ static void _breakiter_int32_ret_int32( int32_t res = (bio->biter->*func)((int32_t)arg); - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } U_CFUNC PHP_FUNCTION(breakiter_first) @@ -308,7 +308,7 @@ U_CFUNC PHP_FUNCTION(breakiter_current) int32_t res = bio->biter->current(); - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } U_CFUNC PHP_FUNCTION(breakiter_following) @@ -327,11 +327,11 @@ U_CFUNC PHP_FUNCTION(breakiter_preceding) U_CFUNC PHP_FUNCTION(breakiter_is_boundary) { - php_int_t offset; + zend_long offset; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &offset) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_is_boundary: bad arguments", 0 TSRMLS_CC); @@ -349,16 +349,16 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary) UBool res = bio->biter->isBoundary((int32_t)offset); - RETURN_BOOL((php_int_t)res); + RETURN_BOOL((zend_long)res); } U_CFUNC PHP_FUNCTION(breakiter_get_locale) { - php_int_t locale_type; + zend_long locale_type; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &locale_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &locale_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_locale: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -382,11 +382,11 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale) U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) { - php_int_t key_type = 0; + zend_long key_type = 0; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &key_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &key_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -422,7 +422,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_code) if (bio == NULL) RETURN_FALSE; - RETURN_INT((php_int_t)BREAKITER_ERROR_CODE(bio)); + RETURN_LONG((zend_long)BREAKITER_ERROR_CODE(bio)); } U_CFUNC PHP_FUNCTION(breakiter_get_error_message) diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp index 142cc28342..bffd1ee5cf 100644 --- a/ext/intl/breakiterator/codepointiterator_internal.cpp +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp @@ -22,7 +22,7 @@ //copied from cmemory.h, which is not public typedef union { - php_int_t t1; + zend_long t1; double t2; void *t3; } UAlignedMemory; diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp index a12924afef..a833cf1853 100644 --- a/ext/intl/breakiterator/codepointiterator_methods.cpp +++ b/ext/intl/breakiterator/codepointiterator_methods.cpp @@ -40,5 +40,5 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point) BREAKITER_METHOD_FETCH_OBJECT; - RETURN_INT(fetch_cpbi(bio)->getLastCodePoint()); + RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint()); } diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 5755b0adb8..098f8ab3cc 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -151,7 +151,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) BREAKITER_METHOD_FETCH_OBJECT; - RETURN_INT(fetch_rbbi(bio)->getRuleStatus()); + RETURN_LONG(fetch_rbbi(bio)->getRuleStatus()); } U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) @@ -189,7 +189,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) array_init_size(return_value, num_rules); for (int32_t i = 0; i < num_rules; i++) { - add_next_index_int(return_value, rules[i]); + add_next_index_long(return_value, rules[i]); } delete[] rules; } @@ -218,7 +218,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules) RETURN_FALSE; } - zend_string *ret_rules = STR_ALLOC(rules_len, 0); + zend_string *ret_rules = zend_string_alloc(rules_len, 0); memcpy(ret_rules->val, rules, rules_len); ret_rules->val[rules_len] = '\0'; diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index af4f53907f..58375f8196 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -102,7 +102,7 @@ static zend_object *Calendar_clone_obj(zval *object TSRMLS_DC) "Could not clone IntlCalendar", 0 TSRMLS_CC); err_msg = intl_error_get_message(CALENDAR_ERROR_P(co_orig) TSRMLS_CC); zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC); - STR_FREE(err_msg); + zend_string_free(err_msg); } else { co_new->ucal = newCalendar; } @@ -209,7 +209,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) 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_int(&zfields, name, (php_int_t)res); + add_assoc_long(&zfields, name, (zend_long)res); } else { add_assoc_string(&zfields, name, const_cast<char*>(u_errorName(uec))); } @@ -489,57 +489,57 @@ void calendar_register_IntlCalendar_class(TSRMLS_D) } /* Declare 'IntlCalendar' class constants */ -#define CALENDAR_DECL_INT_CONST(name, val) \ - zend_declare_class_constant_int(Calendar_ce_ptr, name, sizeof(name) - 1, \ +#define CALENDAR_DECL_LONG_CONST(name, val) \ + zend_declare_class_constant_long(Calendar_ce_ptr, name, sizeof(name) - 1, \ val TSRMLS_CC) - CALENDAR_DECL_INT_CONST("FIELD_ERA", UCAL_ERA); - CALENDAR_DECL_INT_CONST("FIELD_YEAR", UCAL_YEAR); - CALENDAR_DECL_INT_CONST("FIELD_MONTH", UCAL_MONTH); - CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR); - CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH); - CALENDAR_DECL_INT_CONST("FIELD_DATE", UCAL_DATE); - CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR); - CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK); - CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH); - CALENDAR_DECL_INT_CONST("FIELD_AM_PM", UCAL_AM_PM); - CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR); - CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); - CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR); - CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); - CALENDAR_DECL_INT_CONST("FIELD_MINUTE", UCAL_MINUTE); - CALENDAR_DECL_INT_CONST("FIELD_SECOND", UCAL_SECOND); - CALENDAR_DECL_INT_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND); - CALENDAR_DECL_INT_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET); - CALENDAR_DECL_INT_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET); - CALENDAR_DECL_INT_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY); - CALENDAR_DECL_INT_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL); - CALENDAR_DECL_INT_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR); - CALENDAR_DECL_INT_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); - CALENDAR_DECL_INT_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); - CALENDAR_DECL_INT_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); - CALENDAR_DECL_INT_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); - CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); - - CALENDAR_DECL_INT_CONST("DOW_SUNDAY", UCAL_SUNDAY); - CALENDAR_DECL_INT_CONST("DOW_MONDAY", UCAL_MONDAY); - CALENDAR_DECL_INT_CONST("DOW_TUESDAY", UCAL_TUESDAY); - CALENDAR_DECL_INT_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY); - CALENDAR_DECL_INT_CONST("DOW_THURSDAY", UCAL_THURSDAY); - CALENDAR_DECL_INT_CONST("DOW_FRIDAY", UCAL_FRIDAY); - CALENDAR_DECL_INT_CONST("DOW_SATURDAY", UCAL_SATURDAY); + CALENDAR_DECL_LONG_CONST("FIELD_ERA", UCAL_ERA); + CALENDAR_DECL_LONG_CONST("FIELD_YEAR", UCAL_YEAR); + CALENDAR_DECL_LONG_CONST("FIELD_MONTH", UCAL_MONTH); + CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR); + CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH); + CALENDAR_DECL_LONG_CONST("FIELD_DATE", UCAL_DATE); + CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR); + CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK); + CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH); + CALENDAR_DECL_LONG_CONST("FIELD_AM_PM", UCAL_AM_PM); + CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR); + CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); + CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR); + CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); + CALENDAR_DECL_LONG_CONST("FIELD_MINUTE", UCAL_MINUTE); + CALENDAR_DECL_LONG_CONST("FIELD_SECOND", UCAL_SECOND); + CALENDAR_DECL_LONG_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND); + CALENDAR_DECL_LONG_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET); + CALENDAR_DECL_LONG_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET); + CALENDAR_DECL_LONG_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY); + CALENDAR_DECL_LONG_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL); + CALENDAR_DECL_LONG_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR); + CALENDAR_DECL_LONG_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); + CALENDAR_DECL_LONG_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); + CALENDAR_DECL_LONG_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); + CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); + CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); + + CALENDAR_DECL_LONG_CONST("DOW_SUNDAY", UCAL_SUNDAY); + CALENDAR_DECL_LONG_CONST("DOW_MONDAY", UCAL_MONDAY); + CALENDAR_DECL_LONG_CONST("DOW_TUESDAY", UCAL_TUESDAY); + CALENDAR_DECL_LONG_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY); + CALENDAR_DECL_LONG_CONST("DOW_THURSDAY", UCAL_THURSDAY); + CALENDAR_DECL_LONG_CONST("DOW_FRIDAY", UCAL_FRIDAY); + CALENDAR_DECL_LONG_CONST("DOW_SATURDAY", UCAL_SATURDAY); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 - CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY); - CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND); - CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET); - CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE); + CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY); + CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND); + CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET); + CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE); #endif #if U_ICU_VERSION_MAJOR_NUM >= 49 - CALENDAR_DECL_INT_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST); - CALENDAR_DECL_INT_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST); - CALENDAR_DECL_INT_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); + CALENDAR_DECL_LONG_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST); + CALENDAR_DECL_LONG_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST); + CALENDAR_DECL_LONG_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); #endif } /* }}} */ diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 23fb376604..0d808f36fd 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -219,12 +219,12 @@ static void _php_intlcal_field_uec_ret_in32t_method( const char *method_name, INTERNAL_FUNCTION_PARAMETERS) { - php_int_t field; + zend_long field; char *message; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { spprintf(&message, 0, "%s: bad arguments", method_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); @@ -244,7 +244,7 @@ static void _php_intlcal_field_uec_ret_in32t_method( (UCalendarDateFields)field, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } U_CFUNC PHP_FUNCTION(intlcal_get) @@ -295,12 +295,12 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time) U_CFUNC PHP_FUNCTION(intlcal_add) { - php_int_t field, + zend_long field, amount; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oii", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) { + "Oll", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_add: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -399,7 +399,7 @@ U_CFUNC PHP_FUNCTION(intlcal_before) U_CFUNC PHP_FUNCTION(intlcal_set) { - php_int_t arg1, arg2, arg3, arg4, arg5, arg6; + zend_long arg1, arg2, arg3, arg4, arg5, arg6; zval args_a[7] = {0}, *args = args_a; int i; @@ -423,7 +423,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) if (variant == 4 || zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oii|iiii", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4, + "Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: bad arguments", 0 TSRMLS_CC); @@ -431,7 +431,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) } for (i = 0; i < variant; i++) { - if (Z_IVAL(args[i]) < INT32_MIN || Z_IVAL(args[i]) > INT32_MAX) { + if (Z_LVAL(args[i]) < INT32_MIN || Z_LVAL(args[i]) > INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: at least one of the arguments has an absolute " "value that is too large", 0 TSRMLS_CC); @@ -462,7 +462,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) U_CFUNC PHP_FUNCTION(intlcal_roll) { - php_int_t field, + zend_long field, value; zval args_a[3] = {0}, *args = args_a; @@ -488,7 +488,7 @@ U_CFUNC PHP_FUNCTION(intlcal_roll) } bool_variant_val = Z_TYPE(args[1]) == IS_TRUE? 1 : 0; } else if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oii", &object, Calendar_ce_ptr, &field, &value) == FAILURE) { + "Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_roll: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -524,7 +524,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) { zval args_a[2] = {0}, *args = &args_a[0]; - php_int_t field; + zend_long field; int variant; CALENDAR_METHOD_INIT_VARS; @@ -547,7 +547,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) } variant = 0; } else if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - getThis(), "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { + getThis(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_clear: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -572,12 +572,12 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) U_CFUNC PHP_FUNCTION(intlcal_field_difference) { - php_int_t field; + zend_long field; double when; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Odi", &object, Calendar_ce_ptr, &when, &field) == FAILURE) { + "Odl", &object, Calendar_ce_ptr, &when, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_field_difference: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -596,7 +596,7 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference) INTL_METHOD_CHECK_STATUS(co, "intlcal_field_difference: Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_actual_maximum) @@ -614,11 +614,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_actual_minimum) #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type) { - php_uint_t dow; + zend_ulong dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_day_of_week_type: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -637,7 +637,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_day_of_week_type: Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } #endif @@ -658,7 +658,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } static void _php_intlcal_field_ret_in32t_method( @@ -666,12 +666,12 @@ static void _php_intlcal_field_ret_in32t_method( const char *method_name, INTERNAL_FUNCTION_PARAMETERS) { - php_int_t field; + zend_long field; char *message; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { spprintf(&message, 0, "%s: bad arguments", method_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); @@ -690,7 +690,7 @@ static void _php_intlcal_field_ret_in32t_method( int32_t result = (co->ucal->*func)((UCalendarDateFields)field); INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_greatest_minimum) @@ -707,11 +707,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_least_maximum) U_CFUNC PHP_FUNCTION(intlcal_get_locale) { - php_int_t locale_type; + zend_long locale_type; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &locale_type) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_locale: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -756,7 +756,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_minimum) @@ -807,11 +807,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_type) #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition) { - php_int_t dow; + zend_long dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_weekend_transition: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -830,7 +830,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_weekend_transition: " "Error calling ICU method"); - RETURN_INT((php_int_t)res); + RETURN_LONG((zend_long)res); } #endif @@ -898,11 +898,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_lenient) U_CFUNC PHP_FUNCTION(intlcal_is_set) { - php_int_t field; + zend_long field; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_is_set: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -953,11 +953,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend) U_CFUNC PHP_FUNCTION(intlcal_set_first_day_of_week) { - php_int_t dow; + zend_long dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_first_day_of_week: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -997,11 +997,11 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient) U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week) { - php_int_t num_days; + zend_long num_days; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &num_days) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_minimal_days_in_first_week: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1064,7 +1064,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option) CALENDAR_METHOD_FETCH_OBJECT; - RETURN_INT(co->ucal->getRepeatedWallTimeOption()); + RETURN_LONG(co->ucal->getRepeatedWallTimeOption()); } U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) @@ -1080,16 +1080,16 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) CALENDAR_METHOD_FETCH_OBJECT; - RETURN_INT(co->ucal->getSkippedWallTimeOption()); + RETURN_LONG(co->ucal->getSkippedWallTimeOption()); } U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) { - php_int_t option; + zend_long option; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &option) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_repeated_wall_time_option: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1110,11 +1110,11 @@ U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option) { - php_int_t option; + zend_long option; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, Calendar_ce_ptr, &option) == FAILURE) { + "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_skipped_wall_time_option: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1179,7 +1179,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) } zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp); - if (Z_TYPE(zv_timestamp) != IS_INT) { + if (Z_TYPE(zv_timestamp) != IS_LONG) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_from_date_time: bad DateTime; call to " "DateTime::getTimestamp() failed", 0 TSRMLS_CC); @@ -1209,7 +1209,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) "error creating ICU Calendar object", 0 TSRMLS_CC); goto error; } - cal->setTime(((UDate)Z_IVAL(zv_timestamp)) * 1000., status); + cal->setTime(((UDate)Z_LVAL(zv_timestamp)) * 1000., status); if (U_FAILURE(status)) { /* time zone was adopted by cal; should not be deleted here */ delete cal; @@ -1322,7 +1322,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code) if (co == NULL) RETURN_FALSE; - RETURN_INT((php_int_t)CALENDAR_ERROR_CODE(co)); + RETURN_LONG((zend_long)CALENDAR_ERROR_CODE(co)); } U_CFUNC PHP_FUNCTION(intlcal_get_error_message) diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index 09ad390b96..9c243502fe 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -43,7 +43,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) *args = &args_a[0]; char *locale = NULL; int locale_len; - php_int_t largs[6]; + zend_long largs[6]; UErrorCode status = U_ZERO_ERROR; int variant; intl_error_reset(NULL TSRMLS_CC); @@ -242,11 +242,11 @@ U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change) U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year) { - php_int_t year; + zend_long year; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oi", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) { + "Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlgregcal_is_leap_year: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c index 08da6d3831..eff9568de1 100644 --- a/ext/intl/collator/collator.c +++ b/ext/intl/collator/collator.c @@ -38,9 +38,9 @@ void collator_register_constants( INIT_FUNC_ARGS ) return; } - #define COLLATOR_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC ); - #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define COLLATOR_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC ); + #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* UColAttributeValue constants */ COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_VALUE", UCOL_DEFAULT ); diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c index a0a4bf8df3..72446f51a7 100644 --- a/ext/intl/collator/collator_attr.c +++ b/ext/intl/collator/collator_attr.c @@ -33,12 +33,12 @@ */ PHP_FUNCTION( collator_get_attribute ) { - php_int_t attribute, value; + zend_long attribute, value; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, Collator_ce_ptr, &attribute ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -53,7 +53,7 @@ PHP_FUNCTION( collator_get_attribute ) value = ucol_getAttribute( co->ucoll, attribute, COLLATOR_ERROR_CODE_P( co ) ); COLLATOR_CHECK_STATUS( co, "Error getting attribute value" ); - RETURN_INT( value ); + RETURN_LONG( value ); } /* }}} */ @@ -64,12 +64,12 @@ PHP_FUNCTION( collator_get_attribute ) */ PHP_FUNCTION( collator_set_attribute ) { - php_int_t attribute, value; + zend_long attribute, value; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &object, Collator_ce_ptr, &attribute, &value ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -112,7 +112,7 @@ PHP_FUNCTION( collator_get_strength ) COLLATOR_METHOD_FETCH_OBJECT; /* Get current strength and return it. */ - RETURN_INT( ucol_getStrength( co->ucoll ) ); + RETURN_LONG( ucol_getStrength( co->ucoll ) ); } /* }}} */ @@ -123,12 +123,12 @@ PHP_FUNCTION( collator_get_strength ) */ PHP_FUNCTION( collator_set_strength ) { - php_int_t strength; + zend_long strength; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, Collator_ce_ptr, &strength ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c index 497061e157..4384558ac6 100644 --- a/ext/intl/collator/collator_compare.c +++ b/ext/intl/collator/collator_compare.c @@ -119,7 +119,7 @@ PHP_FUNCTION( collator_compare ) efree( ustr2 ); /* Return result of the comparison. */ - RETURN_INT( result ); + RETURN_LONG( result ); } /* }}} */ diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 89224d0341..5a572067f6 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -41,7 +41,7 @@ /* {{{ collator_convert_hash_item_from_utf8_to_utf16 */ static void collator_convert_hash_item_from_utf8_to_utf16( - HashTable* hash, zval *hashData, zend_string *hashKey, php_uint_t hashIndex, + HashTable* hash, zval *hashData, zend_string *hashKey, zend_ulong hashIndex, UErrorCode* status ) { const char* old_val; @@ -55,7 +55,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16( return; old_val = Z_STRVAL_P( hashData ); - old_val_len = Z_STRSIZE_P( hashData ); + old_val_len = Z_STRLEN_P( hashData ); /* Convert it from UTF-8 to UTF-16LE and save the result to new_val[_len]. */ intl_convert_utf8_to_utf16( &new_val, &new_val_len, old_val, old_val_len, status ); @@ -67,13 +67,13 @@ static void collator_convert_hash_item_from_utf8_to_utf16( //??? efree(new_val); /* hack to fix use of initialized value */ - Z_STRSIZE(znew_val) = Z_STRSIZE(znew_val) - UBYTES(1); + Z_STRLEN(znew_val) = Z_STRLEN(znew_val) - UBYTES(1); if( hashKey) { zend_hash_update( hash, hashKey, &znew_val); } - else /* hashKeyType == HASH_KEY_IS_INT */ + else /* hashKeyType == HASH_KEY_IS_LONG */ { zend_hash_index_update( hash, hashIndex, &znew_val); } @@ -82,7 +82,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16( /* {{{ collator_convert_hash_item_from_utf16_to_utf8 */ static void collator_convert_hash_item_from_utf16_to_utf8( - HashTable* hash, zval * hashData, zend_string* hashKey, php_uint_t hashIndex, + HashTable* hash, zval * hashData, zend_string* hashKey, zend_ulong hashIndex, UErrorCode* status ) { const char* old_val; @@ -96,7 +96,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( return; old_val = Z_STRVAL_P( hashData ); - old_val_len = Z_STRSIZE_P( hashData ); + old_val_len = Z_STRLEN_P( hashData ); /* Convert it from UTF-16LE to UTF-8 and save the result to new_val[_len]. */ intl_convert_utf16_to_utf8( &new_val, &new_val_len, @@ -113,7 +113,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( { zend_hash_update( hash, hashKey, &znew_val); } - else /* hashKeyType == HASH_KEY_IS_INT */ + else /* hashKeyType == HASH_KEY_IS_LONG */ { zend_hash_index_update( hash, hashIndex, &znew_val); } @@ -125,7 +125,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( */ void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* status ) { - php_uint_t hashIndex; + zend_ulong hashIndex; zval *hashData; zend_string *hashKey; @@ -144,7 +144,7 @@ void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* stat */ void collator_convert_hash_from_utf16_to_utf8( HashTable* hash, UErrorCode* status ) { - php_uint_t hashIndex; + zend_ulong hashIndex; zend_string *hashKey; zval *hashData; @@ -176,7 +176,7 @@ zval* collator_convert_zstr_utf16_to_utf8( zval* utf16_zval, zval *rv ) /* Convert to utf8 then. */ intl_convert_utf16_to_utf8( &str, &str_len, - (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRSIZE_P(utf16_zval) ), &status ); + (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRLEN_P(utf16_zval) ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error converting utf16 to utf8 in collator_convert_zval_utf16_to_utf8()" ); @@ -207,7 +207,7 @@ zval* collator_convert_zstr_utf8_to_utf16( zval* utf8_zval, zval *rv ) /* Convert the string to UTF-16. */ intl_convert_utf8_to_utf16( &ustr, &ustr_len, - Z_STRVAL_P( utf8_zval ), Z_STRSIZE_P( utf8_zval ), + Z_STRVAL_P( utf8_zval ), Z_STRLEN_P( utf8_zval ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error casting object to string in collator_convert_zstr_utf8_to_utf16()" ); @@ -282,7 +282,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv TSRMLS_DC ) /* Convert the string to UTF-16. */ intl_convert_utf8_to_utf16( &ustr, &ustr_len, - Z_STRVAL_P( zstr ), Z_STRSIZE_P( zstr ), + Z_STRVAL_P( zstr ), Z_STRLEN_P( zstr ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error casting object to string in collator_convert_object_to_string()" ); @@ -320,7 +320,7 @@ zval* collator_convert_string_to_number( zval* str, zval *rv ) zval_ptr_dtor( num ); num = rv; - ZVAL_INT( num, 0 ); + ZVAL_LONG( num, 0 ); } return num; @@ -338,9 +338,9 @@ zval* collator_convert_string_to_number( zval* str, zval *rv ) zval* collator_convert_string_to_double( zval* str, zval *rv ) { zval* num = collator_convert_string_to_number( str, rv ); - if( Z_TYPE_P(num) == IS_INT ) + if( Z_TYPE_P(num) == IS_LONG ) { - ZVAL_DOUBLE( num, Z_IVAL_P( num ) ); + ZVAL_DOUBLE( num, Z_LVAL_P( num ) ); } return num; @@ -359,7 +359,7 @@ zval* collator_convert_string_to_double( zval* str, zval *rv ) zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) { int is_numeric = 0; - php_int_t lval = 0; + zend_long lval = 0; double dval = 0; if( Z_TYPE_P( str ) != IS_STRING ) @@ -367,10 +367,10 @@ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) COLLATOR_CONVERT_RETURN_FAILED( str ); } - if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRSIZE_P(str) ), &lval, &dval, 1 ) ) ) + if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, 1 ) ) ) { - if( is_numeric == IS_INT ) { - ZVAL_INT(rv, lval); + if( is_numeric == IS_LONG ) { + ZVAL_LONG(rv, lval); } if( is_numeric == IS_DOUBLE ) ZVAL_DOUBLE(rv, dval); diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c index acfa43c498..91bc25d077 100644 --- a/ext/intl/collator/collator_error.c +++ b/ext/intl/collator/collator_error.c @@ -48,7 +48,7 @@ PHP_FUNCTION( collator_get_error_code ) RETURN_FALSE; /* Return collator's last error code. */ - RETURN_INT( COLLATOR_ERROR_CODE( co ) ); + RETURN_LONG( COLLATOR_ERROR_CODE( co ) ); } /* }}} */ diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index f92133e3d5..34668bb5a8 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -125,15 +125,15 @@ static double collator_u_strtod(const UChar *nptr, UChar **endptr) /* {{{ */ * * Ignores `locale' stuff. */ -static php_int_t collator_u_strtol(nptr, endptr, base) +static zend_long collator_u_strtol(nptr, endptr, base) const UChar *nptr; UChar **endptr; register int base; { register const UChar *s = nptr; - register php_uint_t acc; + register zend_ulong acc; register UChar c; - register php_uint_t cutoff; + register zend_ulong cutoff; register int neg = 0, any, cutlim; if (s == NULL) { @@ -184,9 +184,9 @@ static php_int_t collator_u_strtol(nptr, endptr, base) * Set any if any `digits' consumed; make it negative to indicate * overflow. */ - cutoff = neg ? -(php_uint_t)PHP_INT_MIN : PHP_INT_MAX; - cutlim = cutoff % (php_uint_t)base; - cutoff /= (php_uint_t)base; + cutoff = neg ? -(zend_ulong)PHP_INT_MIN : PHP_INT_MAX; + cutlim = cutoff % (zend_ulong)base; + cutoff /= (zend_ulong)base; for (acc = 0, any = 0;; c = *s++) { if (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/) c -= 0x30 /*'0'*/; @@ -222,9 +222,9 @@ static php_int_t collator_u_strtol(nptr, endptr, base) /* {{{ collator_is_numeric] * Taken from PHP6:is_numeric_unicode() */ -zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors ) +zend_uchar collator_is_numeric( UChar *str, int length, zend_long *lval, double *dval, int allow_errors ) { - php_int_t local_lval; + zend_long local_lval; double local_dval; UChar *end_ptr_long, *end_ptr_double; int conv_base=10; @@ -245,7 +245,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double if (lval) { *lval = local_lval; } - return IS_INT; + return IS_LONG; } else if (end_ptr_long == str && *end_ptr_long != '\0' && *str != '.' && *str != '-') { /* ignore partial string matches */ return 0; } @@ -288,7 +288,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double return IS_DOUBLE; } else if (end_ptr_long && lval) { *lval = local_lval; - return IS_INT; + return IS_LONG; } } return 0; diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h index bd5ccfdd26..d7aa12ce46 100644 --- a/ext/intl/collator/collator_is_numeric.h +++ b/ext/intl/collator/collator_is_numeric.h @@ -21,6 +21,6 @@ #include <php.h> #include <unicode/uchar.h> -zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors ); +zend_uchar collator_is_numeric( UChar *str, int length, zend_long *lval, double *dval, int allow_errors ); #endif // COLLATOR_IS_NUMERIC_H diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c index 786719c131..dd37cc75db 100644 --- a/ext/intl/collator/collator_locale.c +++ b/ext/intl/collator/collator_locale.c @@ -33,13 +33,13 @@ */ PHP_FUNCTION( collator_get_locale ) { - php_int_t type = 0; + zend_long type = 0; char* locale_name = NULL; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, Collator_ce_ptr, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 1d9c955fda..0856b580be 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -27,7 +27,7 @@ #include "intl_convert.h" #if !defined(HAVE_PTRDIFF_T) && !defined(_PTRDIFF_T_DEFINED) -typedef php_int_t ptrdiff_t; +typedef zend_long ptrdiff_t; #endif /** @@ -80,10 +80,10 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2 } /* Compare the strings using ICU. */ - ZVAL_INT(result, ucol_strcoll( + ZVAL_LONG(result, ucol_strcoll( co->ucoll, - INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p), - INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) )); + INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p), + INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) )); } else { @@ -190,10 +190,10 @@ static int collator_icu_compare_function(zval *result, zval *op1, zval *op2 TSRM co = Z_INTL_COLLATOR_P(&INTL_G(current_collator)); /* Compare the strings using ICU. */ - ZVAL_INT(result, ucol_strcoll( + ZVAL_LONG(result, ucol_strcoll( co->ucoll, - INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p), - INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) )); + INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p), + INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) )); zval_ptr_dtor( str1_p ); zval_ptr_dtor( str2_p ); @@ -234,9 +234,9 @@ static int collator_compare_func( const void* a, const void* b TSRMLS_DC ) convert_to_int(&result); - if( Z_IVAL(result) < 0 ) + if( Z_LVAL(result) < 0 ) return -1; - else if( Z_IVAL(result) > 0 ) + else if( Z_LVAL(result) > 0 ) return 1; return 0; @@ -258,7 +258,7 @@ static int collator_cmp_sort_keys( const void *p1, const void *p2 TSRMLS_DC ) /* {{{ collator_get_compare_function * Choose compare function according to sort flags. */ -static collator_compare_func_t collator_get_compare_function( const php_int_t sort_flags ) +static collator_compare_func_t collator_get_compare_function( const zend_long sort_flags ) { collator_compare_func_t func; @@ -290,12 +290,12 @@ static void collator_sort_internal( int renumber, INTERNAL_FUNCTION_PARAMETERS ) zval saved_collator; zval* array = NULL; HashTable* hash = NULL; - php_int_t sort_flags = COLLATOR_SORT_REGULAR; + zend_long sort_flags = COLLATOR_SORT_REGULAR; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|l", &object, Collator_ce_ptr, &array, &sort_flags ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -424,7 +424,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys ) /* Process string values only. */ if( Z_TYPE_P( hashData ) == IS_STRING ) { - intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRSIZE_P( hashData ), COLLATOR_ERROR_CODE_P( co ) ); + intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRLEN_P( hashData ), COLLATOR_ERROR_CODE_P( co ) ); if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) ) { diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index 885d08cd2c..783611e02f 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -127,7 +127,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, if (millis) { ZVAL_STRING(&zfuncname, "getTimestamp"); if (call_user_function(NULL, z, &zfuncname, &retval, 0, NULL TSRMLS_CC) - != SUCCESS || Z_TYPE(retval) != IS_INT) { + != SUCCESS || Z_TYPE(retval) != IS_LONG) { spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the " "object", func); intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR, @@ -137,7 +137,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, return FAILURE; } - *millis = U_MILLIS_PER_SECOND * (double)Z_IVAL(retval); + *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); zval_ptr_dtor(&zfuncname); } @@ -174,7 +174,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC) { double rv = NAN; - php_int_t lv; + zend_long lv; int type; char *message; @@ -184,10 +184,10 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS switch (Z_TYPE_P(z)) { case IS_STRING: - type = is_numeric_string(Z_STRVAL_P(z), Z_STRSIZE_P(z), &lv, &rv, 0); + type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0); if (type == IS_DOUBLE) { rv *= U_MILLIS_PER_SECOND; - } else if (type == IS_INT) { + } else if (type == IS_LONG) { rv = U_MILLIS_PER_SECOND * (double)lv; } else { spprintf(&message, 0, "%s: string '%s' is not numeric, " @@ -198,8 +198,8 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS efree(message); } break; - case IS_INT: - rv = U_MILLIS_PER_SECOND * (double)Z_IVAL_P(z); + case IS_LONG: + rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z); break; case IS_DOUBLE: rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index cfe46ce75a..ff28bdb456 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -238,7 +238,7 @@ static PHP_METHOD(IntlIterator, key) if (ii->iterator->funcs->get_current_key) { ii->iterator->funcs->get_current_key(ii->iterator, return_value TSRMLS_CC); } else { - RETURN_INT(ii->iterator->index); + RETURN_LONG(ii->iterator->index); } } diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c index 126c9cc35b..f7b739555e 100644 --- a/ext/intl/common/common_error.c +++ b/ext/intl/common/common_error.c @@ -28,7 +28,7 @@ */ PHP_FUNCTION( intl_get_error_code ) { - RETURN_INT( intl_error_get_code( NULL TSRMLS_CC ) ); + RETURN_LONG( intl_error_get_code( NULL TSRMLS_CC ) ); } /* }}} */ @@ -48,10 +48,10 @@ PHP_FUNCTION( intl_get_error_message ) */ PHP_FUNCTION( intl_is_failure ) { - php_int_t err_code; + zend_long err_code; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l", &err_code ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -70,10 +70,10 @@ PHP_FUNCTION( intl_is_failure ) */ PHP_FUNCTION( intl_error_name ) { - php_int_t err_code; + zend_long err_code; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l", &err_code ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -91,7 +91,7 @@ PHP_FUNCTION( intl_error_name ) */ void intl_expose_icu_error_codes( INIT_FUNC_ARGS ) { - #define INTL_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define INTL_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) /* Warnings */ INTL_EXPOSE_CONST( U_USING_FALLBACK_WARNING ); diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 868e3bc90d..aabb9c3400 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -62,10 +62,10 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr /* }}} */ /* {{{ php_converter_default_callback */ -static void php_converter_default_callback(zval *return_value, zval *zobj, php_int_t reason, zval *error TSRMLS_DC) { +static void php_converter_default_callback(zval *return_value, zval *zobj, zend_long reason, zval *error TSRMLS_DC) { ZVAL_DEREF(error); zval_dtor(error); - ZVAL_INT(error, U_ZERO_ERROR); + ZVAL_LONG(error, U_ZERO_ERROR); /* Basic functionality so children can call parent::toUCallback() */ switch (reason) { case UCNV_UNASSIGNED: @@ -81,7 +81,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, php_i chars[0] = 0x1A; chars[1] = 0; chars_len = 1; - ZVAL_INT(error, U_INVALID_STATE_ERROR); + ZVAL_LONG(error, U_INVALID_STATE_ERROR); RETVAL_STRINGL(chars, chars_len); return; } @@ -99,7 +99,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, php_i chars[0] = 0x1A; chars[1] = 0; chars_len = 1; - ZVAL_INT(error, uerror); + ZVAL_LONG(error, uerror); } RETVAL_STRINGL(chars, chars_len); } @@ -117,10 +117,10 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_toUCallback_arginfo, 0, ZEND_RETURN_VALUE, ZEND_ARG_INFO(1, error) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, toUCallback) { - php_int_t reason; + zend_long reason; zval *source, *codeUnits, *error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz", &reason, &source, &codeUnits, &error) == FAILURE) { return; } @@ -139,10 +139,10 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_fromUCallback_arginfo, 0, ZEND_RETURN_VALUE ZEND_ARG_INFO(1, error) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, fromUCallback) { - php_int_t reason; + zend_long reason; zval *source, *codePoint, *error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz", &reason, &source, &codePoint, &error) == FAILURE) { return; } @@ -152,7 +152,7 @@ static PHP_METHOD(UConverter, fromUCallback) { /* }}} */ /* {{{ php_converter_check_limits */ -static inline zend_bool php_converter_check_limits(php_converter_object *objval, php_int_t available, php_int_t needed TSRMLS_DC) { +static inline zend_bool php_converter_check_limits(php_converter_object *objval, zend_long available, zend_long needed TSRMLS_DC) { if (available < needed) { php_converter_throw_failure(objval, U_BUFFER_OVERFLOW_ERROR TSRMLS_CC, "Buffer overrun %pd bytes needed, %pd available", needed, available); return 0; @@ -169,9 +169,9 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode case IS_NULL: /* Code unit is being skipped */ return; - case IS_INT: + case IS_LONG: { - php_int_t lval = Z_IVAL_P(val); + zend_long lval = Z_LVAL_P(val); if ((lval < 0) || (lval > 0x10FFFF)) { php_converter_throw_failure(objval, U_ILLEGAL_ARGUMENT_ERROR TSRMLS_CC, "Invalid codepoint U+%04lx", lval); return; @@ -194,7 +194,7 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode case IS_STRING: { const char *strval = Z_STRVAL_P(val); - int i = 0, strlen = Z_STRSIZE_P(val); + int i = 0, strlen = Z_STRLEN_P(val); while((i != strlen) && TARGET_CHECK(args, 1)) { UChar c; @@ -233,10 +233,10 @@ static void php_converter_to_u_callback(const void *context, TSRMLS_D = objval->tsrm_ls; #endif - ZVAL_INT(&zargs[0], reason); + ZVAL_LONG(&zargs[0], reason); ZVAL_STRINGL(&zargs[1], args->source, args->sourceLimit - args->source); ZVAL_STRINGL(&zargs[2], codeUnits, length); - ZVAL_INT(&zargs[3], *pErrorCode); + ZVAL_LONG(&zargs[3], *pErrorCode); objval->to_cb.param_count = 4; objval->to_cb.params = zargs; @@ -250,10 +250,10 @@ static void php_converter_to_u_callback(const void *context, zval_ptr_dtor(&retval); } - if (Z_TYPE(zargs[3]) == IS_INT) { - *pErrorCode = Z_IVAL(zargs[3]); - } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) { - *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3])); + if (Z_TYPE(zargs[3]) == IS_LONG) { + *pErrorCode = Z_LVAL(zargs[3]); + } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) { + *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3])); } zval_ptr_dtor(&zargs[0]); @@ -269,14 +269,14 @@ static void php_converter_append_fromUnicode_target(zval *val, UConverterFromUni case IS_NULL: /* Ignore */ return; - case IS_INT: + case IS_LONG: if (TARGET_CHECK(args, 1)) { - *(args->target++) = Z_IVAL_P(val); + *(args->target++) = Z_LVAL_P(val); } return; case IS_STRING: { - int vallen = Z_STRSIZE_P(val); + int vallen = Z_STRLEN_P(val); if (TARGET_CHECK(args, vallen)) { memcpy(args->target, Z_STRVAL_P(val), vallen); args->target += vallen; @@ -312,16 +312,16 @@ static void php_converter_from_u_callback(const void *context, TSRMLS_D = objval->tsrm_ls; #endif - ZVAL_INT(&zargs[0], reason); + ZVAL_LONG(&zargs[0], reason); array_init(&zargs[1]); i = 0; while (i < length) { UChar32 c; U16_NEXT(codeUnits, i, length, c); - add_next_index_int(&zargs[1], c); + add_next_index_long(&zargs[1], c); } - ZVAL_INT(&zargs[2], codePoint); - ZVAL_INT(&zargs[3], *pErrorCode); + ZVAL_LONG(&zargs[2], codePoint); + ZVAL_LONG(&zargs[3], *pErrorCode); objval->from_cb.param_count = 4; objval->from_cb.params = zargs; @@ -335,10 +335,10 @@ static void php_converter_from_u_callback(const void *context, zval_ptr_dtor(&retval); } - if (Z_TYPE(zargs[3]) == IS_INT) { - *pErrorCode = Z_IVAL(zargs[3]); - } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) { - *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3])); + if (Z_TYPE(zargs[3]) == IS_LONG) { + *pErrorCode = Z_LVAL(zargs[3]); + } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) { + *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3])); } zval_ptr_dtor(&zargs[0]); @@ -512,7 +512,7 @@ static void php_converter_do_get_type(php_converter_object *objval, UConverter * RETURN_FALSE; } - RETURN_INT(t); + RETURN_LONG(t); } /* }}} */ @@ -731,9 +731,9 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_reasontext_arginfo, 0, ZEND_RETURN_VALUE, 0 ZEND_ARG_INFO(0, reason) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, reasonText) { - php_int_t reason; + zend_long reason; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &reason) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &reason) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "UConverter::reasonText(): bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -824,13 +824,13 @@ static PHP_METHOD(UConverter, transcode) { (tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "from_subst", sizeof("from_subst") - 1)) != NULL && Z_TYPE_P(tmpzval) == IS_STRING) { error = U_ZERO_ERROR; - ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error); + ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error); } if (U_SUCCESS(error) && (tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "to_subst", sizeof("to_subst") - 1)) != NULL && Z_TYPE_P(tmpzval) == IS_STRING) { error = U_ZERO_ERROR; - ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error); + ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error); } } @@ -871,7 +871,7 @@ static PHP_METHOD(UConverter, getErrorCode) { RETURN_FALSE; } - RETURN_INT(intl_error_get_code(&(objval->error) TSRMLS_CC)); + RETURN_LONG(intl_error_get_code(&(objval->error) TSRMLS_CC)); } /* }}} */ @@ -1081,7 +1081,7 @@ static zend_object *php_converter_clone_object(zval *object TSRMLS_DC) { err_msg = intl_error_get_message(&oldobj->error TSRMLS_CC); zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC); - STR_RELEASE(err_msg); + zend_string_release(err_msg); return retval; } @@ -1098,8 +1098,8 @@ static zend_object *php_converter_clone_object(zval *object TSRMLS_DC) { } /* }}} */ -#define CONV_REASON_CONST(v) zend_declare_class_constant_int(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC) -#define CONV_TYPE_CONST(v) zend_declare_class_constant_int(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC) +#define CONV_REASON_CONST(v) zend_declare_class_constant_long(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC) +#define CONV_TYPE_CONST(v) zend_declare_class_constant_long(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC) /* {{{ php_converter_minit */ int php_converter_minit(INIT_FUNC_ARGS) { diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c index c51b33144b..eedc60040e 100644 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -34,11 +34,11 @@ void dateformat_register_constants( INIT_FUNC_ARGS ) return; } - #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC ); - #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); - #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC ); /* UDateFormatStyle constants */ DATEFORMATTER_EXPOSE_CLASS_CONST( FULL ); @@ -85,7 +85,7 @@ PHP_FUNCTION( datefmt_get_error_code ) dfo = Z_INTL_DATEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_INT( INTL_DATA_ERROR_CODE(dfo) ); + RETURN_LONG( INTL_DATA_ERROR_CODE(dfo) ); } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index 0ee5412a90..b2f34b9c24 100644 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -48,7 +48,7 @@ PHP_FUNCTION( datefmt_get_datetype ) INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter datetype." ); - RETURN_INT(dfo->date_type ); + RETURN_LONG(dfo->date_type ); } /* }}} */ @@ -74,7 +74,7 @@ PHP_FUNCTION( datefmt_get_timetype ) INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timetype." ); - RETURN_INT(dfo->time_type ); + RETURN_LONG(dfo->time_type ); } /* }}} */ @@ -170,12 +170,12 @@ PHP_FUNCTION( datefmt_set_pattern ) PHP_FUNCTION( datefmt_get_locale ) { char *loc; - php_int_t loc_type =ULOC_ACTUAL_LOCALE; + zend_long loc_type =ULOC_ACTUAL_LOCALE; DATE_FORMAT_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &object, IntlDateFormatter_ce_ptr,&loc_type) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp index 4446922252..5f63d33143 100644 --- a/ext/intl/dateformat/dateformat_attrcpp.cpp +++ b/ext/intl/dateformat/dateformat_attrcpp.cpp @@ -160,7 +160,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar) RETURN_FALSE; } - RETURN_INT(dfo->calendar); + RETURN_LONG(dfo->calendar); } /* }}} */ @@ -220,7 +220,7 @@ U_CFUNC PHP_FUNCTION(datefmt_set_calendar) DATE_FORMAT_METHOD_FETCH_OBJECT; Calendar *cal; - php_int_t cal_type; + zend_long cal_type; bool cal_owned; Locale locale = Locale::createFromName(dfo->requested_locale); // getting the actual locale from the DateFormat is not enough diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index 5242c5f5ac..67b61bd067 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -43,11 +43,11 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) const char *locale_str; int locale_len = 0; Locale locale; - php_int_t date_type = 0; - php_int_t time_type = 0; + zend_long date_type = 0; + zend_long time_type = 0; zval *calendar_zv = NULL; Calendar *calendar = NULL; - php_int_t calendar_type; + zend_long calendar_type; bool calendar_owned; zval *timezone_zv = NULL; TimeZone *timezone = NULL; @@ -61,7 +61,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) intl_error_reset(NULL TSRMLS_CC); object = return_value; /* Parse parameters. */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|zzs", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|zzs", &locale_str, &locale_len, &date_type, &time_type, &timezone_zv, &calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: " diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 38ec4101aa..dd9b64d4ee 100644 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -71,21 +71,21 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo, } if ((ele_value = zend_hash_str_find(hash_arr, key_name, strlen(key_name))) != NULL) { - if(Z_TYPE_P(ele_value) != IS_INT) { + if(Z_TYPE_P(ele_value) != IS_LONG) { spprintf(&message, 0, "datefmt_format: parameter array contains " "a non-integer element for key '%s'", key_name); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } else { - if (Z_IVAL_P(ele_value) > INT32_MAX || - Z_IVAL_P(ele_value) < INT32_MIN) { + if (Z_LVAL_P(ele_value) > INT32_MAX || + Z_LVAL_P(ele_value) < INT32_MIN) { spprintf(&message, 0, "datefmt_format: value %pd is out of " "bounds for a 32-bit integer in key '%s'", - Z_IVAL_P(ele_value), key_name); + Z_LVAL_P(ele_value), key_name); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } else { - result = Z_IVAL_P(ele_value); + result = Z_LVAL_P(ele_value); } } } diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp index 58d9af2772..564867f017 100644 --- a/ext/intl/dateformat/dateformat_format_object.cpp +++ b/ext/intl/dateformat/dateformat_format_object.cpp @@ -46,10 +46,10 @@ static const DateFormat::EStyle valid_styles[] = { }; static bool valid_format(zval *z) { - if (Z_TYPE_P(z) == IS_INT) { - php_int_t lval = Z_IVAL_P(z); + if (Z_TYPE_P(z) == IS_LONG) { + zend_long lval = Z_LVAL_P(z); for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) { - if ((php_int_t)valid_styles[i] == lval) { + if ((zend_long)valid_styles[i] == lval) { return true; } } @@ -103,7 +103,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) "element of the array) is not valid", 0 TSRMLS_CC); RETURN_FALSE; } - dateStyle = (DateFormat::EStyle)Z_IVAL_P(z); + dateStyle = (DateFormat::EStyle)Z_LVAL_P(z); zend_hash_move_forward_ex(ht, &pos); z = zend_hash_get_current_data_ex(ht, &pos); @@ -113,18 +113,18 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) "second element of the array) is not valid", 0 TSRMLS_CC); RETURN_FALSE; } - timeStyle = (DateFormat::EStyle)Z_IVAL_P(z); - } else if (Z_TYPE_P(format) == IS_INT) { + timeStyle = (DateFormat::EStyle)Z_LVAL_P(z); + } else if (Z_TYPE_P(format) == IS_LONG) { if (!valid_format(format)) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format_object: the date/time format type is invalid", 0 TSRMLS_CC); RETURN_FALSE; } - dateStyle = timeStyle = (DateFormat::EStyle)Z_IVAL_P(format); + dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_P(format); } else { convert_to_string_ex(format); - if (Z_STRSIZE_P(format) == 0) { + if (Z_STRLEN_P(format) == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format_object: the format is empty", 0 TSRMLS_CC); RETURN_FALSE; @@ -176,7 +176,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) if (pattern) { df = new SimpleDateFormat( - UnicodeString(Z_STRVAL_P(format), Z_STRSIZE_P(format), + UnicodeString(Z_STRVAL_P(format), Z_STRLEN_P(format), UnicodeString::kInvariant), Locale::createFromName(locale_str), status); diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp index 680df46f42..92296be97a 100644 --- a/ext/intl/dateformat/dateformat_helpers.cpp +++ b/ext/intl/dateformat/dateformat_helpers.cpp @@ -33,7 +33,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv, const char *func_name, intl_error *err, Calendar*& cal, - php_int_t& cal_int_type, + zend_long& cal_int_type, bool& calendar_owned TSRMLS_DC) { char *msg; @@ -47,10 +47,10 @@ int datefmt_process_calendar_arg(zval* calendar_zv, cal_int_type = UCAL_GREGORIAN; - } else if (Z_TYPE_P(calendar_zv) == IS_INT) { + } else if (Z_TYPE_P(calendar_zv) == IS_LONG) { - php_int_t v = Z_IVAL_P(calendar_zv); - if (v != (php_int_t)UCAL_TRADITIONAL && v != (php_int_t)UCAL_GREGORIAN) { + zend_long v = Z_LVAL_P(calendar_zv); + if (v != (zend_long)UCAL_TRADITIONAL && v != (zend_long)UCAL_GREGORIAN) { spprintf(&msg, 0, "%s: invalid value for calendar type; it must be " "one of IntlDateFormatter::TRADITIONAL (locale's default " "calendar) or IntlDateFormatter::GREGORIAN. " @@ -59,14 +59,14 @@ int datefmt_process_calendar_arg(zval* calendar_zv, intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); return FAILURE; - } else if (v == (php_int_t)UCAL_TRADITIONAL) { + } else if (v == (zend_long)UCAL_TRADITIONAL) { cal = Calendar::createInstance(locale, status); } else { //UCAL_GREGORIAN cal = new GregorianCalendar(locale, status); } calendar_owned = true; - cal_int_type = Z_IVAL_P(calendar_zv); + cal_int_type = Z_LVAL_P(calendar_zv); } else if (Z_TYPE_P(calendar_zv) == IS_OBJECT && instanceof_function_ex(Z_OBJCE_P(calendar_zv), diff --git a/ext/intl/dateformat/dateformat_helpers.h b/ext/intl/dateformat/dateformat_helpers.h index 0c5647b0ab..ca88da008a 100644 --- a/ext/intl/dateformat/dateformat_helpers.h +++ b/ext/intl/dateformat/dateformat_helpers.h @@ -32,7 +32,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv, const char *func_name, intl_error *err, Calendar*& cal, - php_int_t& cal_int_type, + zend_long& cal_int_type, bool& calendar_owned TSRMLS_DC); #endif /* DATEFORMAT_HELPERS_H */ diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c index eb28a39ba2..79c2a2f7c0 100644 --- a/ext/intl/dateformat/dateformat_parse.c +++ b/ext/intl/dateformat/dateformat_parse.c @@ -57,24 +57,24 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex if(result > LONG_MAX || result < -LONG_MAX) { ZVAL_DOUBLE(return_value, result<0?ceil(result):floor(result)); } else { - ZVAL_INT(return_value, (php_int_t)result); + ZVAL_LONG(return_value, (zend_long)result); } } /* }}} */ -static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, php_int_t calendar_field, char* key_name TSRMLS_DC) +static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, zend_long calendar_field, char* key_name TSRMLS_DC) { - php_int_t 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_int( 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_int( return_value, key_name,( calendar_field_val-1) ); + add_assoc_long( return_value, key_name,( calendar_field_val-1) ); }else{ - add_assoc_int( return_value, key_name, calendar_field_val ); + add_assoc_long( return_value, key_name, calendar_field_val ); } } @@ -86,7 +86,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex UCalendar *parsed_calendar = NULL; UChar* text_utf16 = NULL; int32_t text_utf16_len = 0; - php_int_t isInDST = 0; + zend_long isInDST = 0; /* Convert timezone to UTF-16. */ intl_convert_utf8_to_utf16(&text_utf16, &text_utf16_len, text_to_parse, text_len, &INTL_DATA_ERROR_CODE(dfo)); @@ -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_int( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); + add_assoc_long( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); } /* }}} */ @@ -147,7 +147,7 @@ PHP_FUNCTION(datefmt_parse) if (z_parse_pos) { ZVAL_DEREF(z_parse_pos); convert_to_int(z_parse_pos); - parse_pos = (int32_t)Z_IVAL_P(z_parse_pos); + parse_pos = (int32_t)Z_LVAL_P(z_parse_pos); if(parse_pos > text_len) { RETURN_FALSE; } @@ -155,7 +155,7 @@ PHP_FUNCTION(datefmt_parse) internal_parse_to_timestamp( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC); if(z_parse_pos) { zval_dtor(z_parse_pos); - ZVAL_INT(z_parse_pos, parse_pos); + ZVAL_LONG(z_parse_pos, parse_pos); } } /* }}} */ @@ -186,7 +186,7 @@ PHP_FUNCTION(datefmt_localtime) if (z_parse_pos) { ZVAL_DEREF(z_parse_pos); convert_to_int(z_parse_pos); - parse_pos = (int32_t)Z_IVAL_P(z_parse_pos); + parse_pos = (int32_t)Z_LVAL_P(z_parse_pos); if(parse_pos > text_len) { RETURN_FALSE; } @@ -194,7 +194,7 @@ PHP_FUNCTION(datefmt_localtime) internal_parse_to_localtime( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC); if (z_parse_pos) { zval_dtor(z_parse_pos); - ZVAL_INT(z_parse_pos, parse_pos); + ZVAL_LONG(z_parse_pos, parse_pos); } } /* }}} */ diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c index 2c3ffaa569..12cbb6c75b 100644 --- a/ext/intl/formatter/formatter.c +++ b/ext/intl/formatter/formatter.c @@ -40,9 +40,9 @@ void formatter_register_constants( INIT_FUNC_ARGS ) zend_error(E_ERROR, "NumberFormatter class not defined"); } - #define FORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC ); - #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define FORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC ); + #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* UNumberFormatStyle constants */ FORMATTER_EXPOSE_CLASS_CONST( PATTERN_DECIMAL ); diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c index 1a1409448a..4869fdf294 100644 --- a/ext/intl/formatter/formatter_attr.c +++ b/ext/intl/formatter/formatter_attr.c @@ -32,7 +32,7 @@ */ PHP_FUNCTION( numfmt_get_attribute ) { - php_int_t attribute, value; + zend_long attribute, value; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ @@ -72,7 +72,7 @@ PHP_FUNCTION( numfmt_get_attribute ) if(value == -1) { INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR; } else { - RETVAL_INT(value); + RETVAL_LONG(value); } break; case UNUM_ROUNDING_INCREMENT: @@ -101,7 +101,7 @@ PHP_FUNCTION( numfmt_get_attribute ) */ PHP_FUNCTION( numfmt_get_text_attribute ) { - php_int_t attribute; + zend_long attribute; UChar value_buf[64]; int value_buf_size = USIZE( value_buf ); UChar* value = value_buf; @@ -109,7 +109,7 @@ PHP_FUNCTION( numfmt_get_text_attribute ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, NumberFormatter_ce_ptr, &attribute ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -145,12 +145,12 @@ PHP_FUNCTION( numfmt_get_text_attribute ) */ PHP_FUNCTION( numfmt_set_attribute ) { - php_int_t attribute; + zend_long attribute; zval *value; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -183,7 +183,7 @@ PHP_FUNCTION( numfmt_set_attribute ) case UNUM_MAX_SIGNIFICANT_DIGITS: case UNUM_LENIENT_PARSE: convert_to_int_ex(value); - unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_IVAL_P(value)); + unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_LVAL_P(value)); break; case UNUM_ROUNDING_INCREMENT: convert_to_double_ex(value); @@ -209,13 +209,13 @@ PHP_FUNCTION( numfmt_set_text_attribute ) { int slength = 0; UChar *svalue = NULL; - php_int_t attribute; + zend_long attribute; char *value; int len; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &object, NumberFormatter_ce_ptr, &attribute, &value, &len ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -249,14 +249,14 @@ PHP_FUNCTION( numfmt_set_text_attribute ) */ PHP_FUNCTION( numfmt_get_symbol ) { - php_int_t symbol; + zend_long symbol; UChar value_buf[4]; UChar *value = value_buf; int length = USIZE(value_buf); FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, NumberFormatter_ce_ptr, &symbol ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -297,7 +297,7 @@ PHP_FUNCTION( numfmt_get_symbol ) */ PHP_FUNCTION( numfmt_set_symbol ) { - php_int_t symbol; + zend_long symbol; char* value = NULL; int value_len = 0; UChar* svalue = 0; @@ -305,7 +305,7 @@ PHP_FUNCTION( numfmt_set_symbol ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &object, NumberFormatter_ce_ptr, &symbol, &value, &value_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -426,12 +426,12 @@ PHP_FUNCTION( numfmt_set_pattern ) */ PHP_FUNCTION( numfmt_get_locale ) { - php_int_t type = ULOC_ACTUAL_LOCALE; + zend_long type = ULOC_ACTUAL_LOCALE; char* loc; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &object, NumberFormatter_ce_ptr, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c index 8a8f251dcc..abae435ca2 100644 --- a/ext/intl/formatter/formatter_format.c +++ b/ext/intl/formatter/formatter_format.c @@ -33,14 +33,14 @@ PHP_FUNCTION( numfmt_format ) { zval *number; - php_int_t type = FORMAT_TYPE_DEFAULT; + zend_long type = FORMAT_TYPE_DEFAULT; UChar format_buf[32]; UChar* formatted = format_buf; int formatted_len = USIZE(format_buf); FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|l", &object, NumberFormatter_ce_ptr, &number, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -57,9 +57,9 @@ PHP_FUNCTION( numfmt_format ) convert_scalar_to_number_ex(number); } - if(Z_TYPE_P(number) == IS_INT) { + if(Z_TYPE_P(number) == IS_LONG) { /* take INT32 on 32-bit, int64 on 64-bit */ - type = (sizeof(php_int_t) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32; + type = (sizeof(zend_long) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32; } else if(Z_TYPE_P(number) == IS_DOUBLE) { type = FORMAT_TYPE_DOUBLE; } else { @@ -67,7 +67,7 @@ PHP_FUNCTION( numfmt_format ) } } - if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_INT) { + if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_LONG) { SEPARATE_ZVAL_IF_NOT_REF(number); convert_scalar_to_number(number TSRMLS_CC ); } @@ -75,12 +75,12 @@ PHP_FUNCTION( numfmt_format ) switch(type) { case FORMAT_TYPE_INT32: convert_to_int_ex(number); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_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) TSRMLS_CC); formatted = eumalloc(formatted_len); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_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); @@ -91,7 +91,7 @@ PHP_FUNCTION( numfmt_format ) case FORMAT_TYPE_INT64: { - int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_IVAL_P(number); + 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) TSRMLS_CC); diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index f24df76f51..5e790999e4 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -30,13 +30,13 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) const char* locale; char* pattern = NULL; int locale_len = 0, pattern_len = 0; - php_int_t style; + zend_long style; UChar* spattern = NULL; int spattern_len = 0; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "si|s", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sl|s", &locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -125,7 +125,7 @@ PHP_FUNCTION( numfmt_get_error_code ) nfo = Z_INTL_NUMBERFORMATTER_P(object); /* Return formatter's last error code. */ - RETURN_INT( INTL_DATA_ERROR_CODE(nfo) ); + RETURN_LONG( INTL_DATA_ERROR_CODE(nfo) ); } /* }}} */ diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c index b7cf36945b..12c9465bc3 100644 --- a/ext/intl/formatter/formatter_parse.c +++ b/ext/intl/formatter/formatter_parse.c @@ -36,7 +36,7 @@ */ PHP_FUNCTION( numfmt_parse ) { - php_int_t type = FORMAT_TYPE_DOUBLE; + zend_long type = FORMAT_TYPE_DOUBLE; UChar* sstr = NULL; int sstr_len = 0; char* str = NULL; @@ -50,7 +50,7 @@ PHP_FUNCTION( numfmt_parse ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|iz/!", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|lz/!", &object, NumberFormatter_ce_ptr, &str, &str_len, &type, &zposition ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -69,7 +69,7 @@ PHP_FUNCTION( numfmt_parse ) if(zposition) { ZVAL_DEREF(zposition); convert_to_int(zposition); - position = (int32_t)Z_IVAL_P( zposition ); + position = (int32_t)Z_LVAL_P( zposition ); position_p = &position; } @@ -82,14 +82,14 @@ PHP_FUNCTION( numfmt_parse ) switch(type) { case FORMAT_TYPE_INT32: val32 = unum_parse(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); - RETVAL_INT(val32); + RETVAL_LONG(val32); break; case FORMAT_TYPE_INT64: val64 = unum_parseInt64(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); if(val64 > ZEND_INT_MAX || val64 < ZEND_INT_MIN) { RETVAL_DOUBLE(val64); } else { - RETVAL_INT((php_int_t)val64); + RETVAL_LONG((zend_long)val64); } break; case FORMAT_TYPE_DOUBLE: @@ -107,7 +107,7 @@ PHP_FUNCTION( numfmt_parse ) #endif if(zposition) { zval_dtor(zposition); - ZVAL_INT(zposition, position); + ZVAL_LONG(zposition, position); } if (sstr) { @@ -158,14 +158,14 @@ PHP_FUNCTION( numfmt_parse_currency ) if(zposition) { ZVAL_DEREF(zposition); convert_to_int(zposition); - position = (int32_t)Z_IVAL_P( zposition ); + position = (int32_t)Z_LVAL_P( zposition ); position_p = &position; } number = unum_parseDoubleCurrency(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, currency, &INTL_DATA_ERROR_CODE(nfo)); if(zposition) { zval_dtor(zposition); - ZVAL_INT(zposition, position); + ZVAL_LONG(zposition, position); } if (sstr) { efree(sstr); diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 3968508c51..f8dc9895e5 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -44,9 +44,9 @@ */ void grapheme_register_constants( INIT_FUNC_ARGS ) { - REGISTER_INT_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT); } /* }}} */ @@ -72,7 +72,7 @@ PHP_FUNCTION(grapheme_strlen) ret_len = grapheme_ascii_check(string, string_len); if ( ret_len >= 0 ) - RETURN_INT(ret_len); + RETURN_LONG(ret_len); /* convert the string to UTF-16. */ status = U_ZERO_ERROR; @@ -97,7 +97,7 @@ PHP_FUNCTION(grapheme_strlen) } if (ret_len >= 0) { - RETVAL_INT(ret_len); + RETVAL_LONG(ret_len); } else { RETVAL_FALSE; } @@ -111,11 +111,11 @@ PHP_FUNCTION(grapheme_strpos) unsigned char *haystack, *needle; int haystack_len, needle_len; unsigned char *found; - php_int_t loffset = 0; + zend_long loffset = 0; int32_t offset = 0; int ret_pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: unable to parse input param", 0 TSRMLS_CC ); @@ -156,14 +156,14 @@ PHP_FUNCTION(grapheme_strpos) /* if it is there, and if the haystack is ascii, we are all done */ if ( grapheme_ascii_check(haystack, haystack_len) >= 0 ) { - RETURN_INT(found - haystack); + RETURN_LONG(found - haystack); } /* do utf16 part of the strpos */ ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* fIgnoreCase */, 0 /* last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -178,12 +178,12 @@ PHP_FUNCTION(grapheme_stripos) unsigned char *haystack, *needle, *haystack_dup, *needle_dup; int haystack_len, needle_len; unsigned char *found; - php_int_t loffset = 0; + zend_long loffset = 0; int32_t offset = 0; int ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_stripos: unable to parse input param", 0 TSRMLS_CC ); @@ -225,7 +225,7 @@ PHP_FUNCTION(grapheme_stripos) efree(needle_dup); if (found) { - RETURN_INT(found - haystack_dup); + RETURN_LONG(found - haystack_dup); } /* if needle was ascii too, we are all done, otherwise we need to try using Unicode to see what we get */ @@ -238,7 +238,7 @@ PHP_FUNCTION(grapheme_stripos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* fIgnoreCase */, 0 /*last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -252,12 +252,12 @@ PHP_FUNCTION(grapheme_strrpos) { unsigned char *haystack, *needle; int haystack_len, needle_len; - php_int_t loffset = 0; + zend_long loffset = 0; int32_t offset = 0; int32_t ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC ); @@ -292,7 +292,7 @@ PHP_FUNCTION(grapheme_strrpos) if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } /* if the needle was ascii too, we are done */ @@ -307,7 +307,7 @@ PHP_FUNCTION(grapheme_strrpos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* f_ignore_case */, 1/* last */ TSRMLS_CC); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -322,12 +322,12 @@ PHP_FUNCTION(grapheme_strripos) { unsigned char *haystack, *needle; int haystack_len, needle_len; - php_int_t loffset = 0; + zend_long loffset = 0; int32_t offset = 0; int32_t ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC ); @@ -370,7 +370,7 @@ PHP_FUNCTION(grapheme_strripos) efree(needle_dup); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } /* if the needle was ascii too, we are done */ @@ -385,7 +385,7 @@ PHP_FUNCTION(grapheme_strripos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* f_ignore_case */, 1 /*last */ TSRMLS_CC); if ( ret_pos >= 0 ) { - RETURN_INT(ret_pos); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -401,7 +401,7 @@ PHP_FUNCTION(grapheme_substr) unsigned char *str, *sub_str; UChar *ustr; int str_len, sub_str_len, ustr_len; - php_int_t lstart = 0, length = 0; + zend_long lstart = 0, length = 0; int32_t start = 0; int iter_val; UErrorCode status; @@ -410,7 +410,7 @@ PHP_FUNCTION(grapheme_substr) int sub_str_start_pos, sub_str_end_pos; int32_t (*iter_func)(UBreakIterator *); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|i", (char **)&str, &str_len, &lstart, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", (char **)&str, &str_len, &lstart, &length) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: unable to parse input param", 0 TSRMLS_CC ); @@ -816,17 +816,17 @@ PHP_FUNCTION(grapheme_extract) unsigned char *str, *pstr; UChar *ustr; int str_len, ustr_len; - php_int_t size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */ - php_int_t lstart = 0; /* starting position in str in bytes */ + zend_long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */ + zend_long lstart = 0; /* starting position in str in bytes */ int32_t start = 0; - php_int_t extract_type = GRAPHEME_EXTRACT_TYPE_COUNT; + zend_long extract_type = GRAPHEME_EXTRACT_TYPE_COUNT; UErrorCode status; unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE]; UBreakIterator* bi = NULL; int ret_pos; zval *next = NULL; /* return offset of next part of the string */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|iiz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|llz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_extract: unable to parse input param", 0 TSRMLS_CC ); @@ -846,7 +846,7 @@ PHP_FUNCTION(grapheme_extract) /* initialize next */ SEPARATE_ZVAL(next); zval_dtor(next); - ZVAL_INT(next, lstart); + ZVAL_LONG(next, lstart); } } @@ -898,9 +898,9 @@ PHP_FUNCTION(grapheme_extract) */ if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : str_len ) ) { - php_int_t nsize = ( size < str_len ? size : str_len ); + zend_long nsize = ( size < str_len ? size : str_len ); if ( NULL != next ) { - ZVAL_INT(next, start+nsize); + ZVAL_LONG(next, start+nsize); } RETURN_STRINGL(((char *)pstr), nsize); } @@ -943,7 +943,7 @@ PHP_FUNCTION(grapheme_extract) ubrk_close(bi); if ( NULL != next ) { - ZVAL_INT(next, start+ret_pos); + ZVAL_LONG(next, start+ret_pos); } RETURN_STRINGL(((char *)pstr), ret_pos); diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h index 576e524b16..235d043818 100644 --- a/ext/intl/grapheme/grapheme_util.h +++ b/ext/intl/grapheme/grapheme_util.h @@ -44,6 +44,6 @@ int32_t grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, un UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ); /* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */ -#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (php_int_t) max_len : offset >= (php_int_t) max_len) ) +#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (zend_long) max_len : offset >= (zend_long) max_len) ) #endif // GRAPHEME_GRAPHEME_UTIL_H diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index 96bec482a1..8075c86124 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -51,56 +51,56 @@ void idn_register_constants( INIT_FUNC_ARGS ) /* Option to prohibit processing of unassigned codepoints in the input and do not check if the input conforms to STD-3 ASCII rules. */ - REGISTER_INT_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT); /* Option to allow processing of unassigned codepoints in the input */ - REGISTER_INT_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT); /* Option to check if input conforms to STD-3 ASCII rules */ - REGISTER_INT_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_46_API /* Option to check for whether the input conforms to the BiDi rules. * Ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.) */ - REGISTER_INT_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT); /* Option to check for whether the input conforms to the CONTEXTJ rules. * Ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.) */ - REGISTER_INT_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT); /* Option for nontransitional processing in ToASCII(). * By default, ToASCII() uses transitional processing. * Ignored by the IDNA2003 implementation. */ - REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT); /* Option for nontransitional processing in ToUnicode(). * By default, ToUnicode() uses transitional processing. * Ignored by the IDNA2003 implementation. */ - REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); #endif /* VARIANTS */ - REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_46_API - REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); #endif #ifdef HAVE_46_API /* PINFO ERROR CODES */ - REGISTER_INT_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT); - REGISTER_INT_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT); #endif } /* }}} */ @@ -140,14 +140,14 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, UIDNA *uts46; int32_t len; int32_t buffer_capac = 255; /* no domain name may exceed this */ - zend_string *buffer = STR_ALLOC(buffer_capac, 0); + 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 TSRMLS_CC) == FAILURE) { - STR_FREE(buffer); + zend_string_free(buffer); RETURN_FALSE; } @@ -161,7 +161,7 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, if (php_intl_idn_check_status(status, "failed to convert name", mode TSRMLS_CC) == FAILURE) { uidna_close(uts46); - STR_FREE(buffer); + zend_string_free(buffer); RETURN_FALSE; } if (len >= 255) { @@ -190,11 +190,11 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, } add_assoc_bool_ex(idna_info, "isTransitionalDifferent", sizeof("isTransitionalDifferent")-1, info.isTransitionalDifferent); - add_assoc_int_ex(idna_info, "errors", sizeof("errors")-1, (php_int_t)info.errors); + add_assoc_long_ex(idna_info, "errors", sizeof("errors")-1, (zend_long)info.errors); } if (!buffer_used) { - STR_FREE(buffer); + zend_string_free(buffer); } uidna_close(uts46); @@ -265,13 +265,13 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) { char *domain; int domain_len; - php_int_t option = 0, + zend_long option = 0, variant = INTL_IDN_VARIANT_2003; zval *idna_info = NULL; intl_error_reset(NULL TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|iiz/", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|llz/", &domain, &domain_len, &option, &variant, &idna_info) == FAILURE) { php_intl_bad_args("bad arguments", mode TSRMLS_CC); RETURN_NULL(); /* don't set FALSE because that's not the way it was before... */ diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h index cf83e6d7ee..9424571d02 100644 --- a/ext/intl/intl_common.h +++ b/ext/intl/intl_common.h @@ -39,6 +39,6 @@ #define UCHARS(len) ((len) / sizeof(UChar)) #define INTL_Z_STRVAL_P(str) (UChar*) Z_STRVAL_P(str) -#define INTL_Z_STRSIZE_P(str) UCHARS( Z_STRSIZE_P(str) ) +#define INTL_Z_STRLEN_P(str) UCHARS( Z_STRLEN_P(str) ) #endif /* INTL_COMMON_H */ diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index a94b076511..5c082ce190 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -258,7 +258,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) if( pe->line > 0 ) { smart_str_appends( &ret, "on line " ); - smart_str_append_int( &ret, (php_int_t ) pe->line ); + smart_str_append_long( &ret, (zend_long ) pe->line ); any = 1; } if( pe->offset >= 0 ) { @@ -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_int( &ret, (php_int_t ) pe->offset ); + smart_str_append_long( &ret, (zend_long ) pe->offset ); any = 1; } diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c index fa8edddfa3..921e6e589f 100644 --- a/ext/intl/locale/locale.c +++ b/ext/intl/locale/locale.c @@ -39,8 +39,8 @@ void locale_register_constants( INIT_FUNC_ARGS ) return; } - #define LOCALE_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC ); + #define LOCALE_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC ); #define LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR(name, value) zend_declare_class_constant_string( Locale_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); LOCALE_EXPOSE_CLASS_CONST( ACTUAL_LOCALE ); diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 34e7374969..f1821a6ada 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -241,9 +241,9 @@ PHP_NAMED_FUNCTION(zif_locale_set_default) len = strlen(locale_name); } - ini_name = STR_INIT(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0); + ini_name = zend_string_init(LOCALE_INI_NAME, sizeof(LOCALE_INI_NAME) - 1, 0); zend_alter_ini_entry(ini_name, locale_name, len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); - STR_RELEASE(ini_name); + zend_string_release(ini_name); RETURN_TRUE; } @@ -782,7 +782,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_ /* not lang or grandfathered tag */ smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); } - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); return SUCCESS; } @@ -822,7 +822,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix( loc_name , key_name); smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); return SUCCESS; } else if(Z_TYPE_P(ele_value) == IS_ARRAY ) { HashTable *arr = HASH_OF(ele_value); @@ -836,7 +836,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRSIZE_P(data)); + smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRLEN_P(data)); } ZEND_HASH_FOREACH_END(); return SUCCESS; } else { @@ -869,7 +869,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , cur_key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); } } /* end of for */ } /* end of else */ @@ -1439,7 +1439,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: locale array element is not a string", 0 TSRMLS_CC); LOOKUP_CLEAN_RETURN(NULL); } - cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRSIZE_P(ele_value)); + 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) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag", 0 TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index cfe6538f0a..b9f6c7a369 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -144,7 +144,7 @@ PHP_FUNCTION( msgfmt_get_error_code ) mfo = Z_INTL_MESSAGEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_INT( INTL_DATA_ERROR_CODE(mfo) ); + RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) ); } /* }}} */ diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h index 188e6580f7..3b7bdda78e 100644 --- a/ext/intl/msgformat/msgformat_data.h +++ b/ext/intl/msgformat/msgformat_data.h @@ -30,7 +30,7 @@ typedef struct { // formatter handling UMessageFormat* umsgf; char* orig_format; - php_uint_t orig_format_len; + zend_ulong orig_format_len; HashTable* arg_types; int tz_set; /* if we've already the time zone in sub-formats */ } msgformat_data; diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 3be80791ba..50527b7f06 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -112,7 +112,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo, for (int i = 0; i < parts_count; i++) { const Formattable::Type t = types[i]; - if (zend_hash_index_update_mem(ret, (php_uint_t)i, (void*)&t, sizeof(t)) == NULL) { + if (zend_hash_index_update_mem(ret, (zend_ulong)i, (void*)&t, sizeof(t)) == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Write to argument types hash table failed", 0 TSRMLS_CC); break; @@ -200,10 +200,10 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo, "Found part with negative number", 0 TSRMLS_CC); continue; } - if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (php_uint_t)argNumber)) == NULL) { + if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (zend_ulong)argNumber)) == NULL) { /* not found already; create new entry in HT */ Formattable::Type bogusType = Formattable::kObject; - if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (php_uint_t)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) { + if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (zend_ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Write to argument types hash table failed", 0 TSRMLS_CC); continue; @@ -388,7 +388,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, // Key related variables zend_string *str_index; - php_uint_t num_index; + zend_ulong num_index; ZEND_HASH_FOREACH_KEY_VAL(args, num_index, str_index, elem) { Formattable& formattable = fargs[argNum]; @@ -401,7 +401,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, /* Process key and retrieve type */ if (str_index == NULL) { /* includes case where index < 0 because it's exposed as unsigned */ - if (num_index > (php_uint_t)INT32_MAX) { + if (num_index > (zend_ulong)INT32_MAX) { intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, "Found negative or too large array key", 0 TSRMLS_CC); continue; @@ -411,7 +411,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index); key.append(temp, len); - storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (php_uint_t)num_index); + storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (zend_ulong)num_index); } else { //string; assumed to be in UTF-8 intl_stringFromChar(key, str_index->val, str_index->len, &err.code); @@ -447,7 +447,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, UnicodeString *text = new UnicodeString(); intl_stringFromChar(*text, - Z_STRVAL_P(elem), Z_STRSIZE_P(elem), &err.code); + Z_STRVAL_P(elem), Z_STRLEN_P(elem), &err.code); if (U_FAILURE(err.code)) { char *message; @@ -466,14 +466,14 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, double d; if (Z_TYPE_P(elem) == IS_DOUBLE) { d = Z_DVAL_P(elem); - } else if (Z_TYPE_P(elem) == IS_INT) { - d = (double)Z_IVAL_P(elem); + } else if (Z_TYPE_P(elem) == IS_LONG) { + d = (double)Z_LVAL_P(elem); } else { SEPARATE_ZVAL_IF_NOT_REF(elem); convert_scalar_to_number(elem TSRMLS_CC); d = (Z_TYPE_P(elem) == IS_DOUBLE) ? Z_DVAL_P(elem) - : (double)Z_IVAL_P(elem); + : (double)Z_LVAL_P(elem); } formattable.setDouble(d); break; @@ -491,14 +491,14 @@ retry_klong: } else { tInt32 = (int32_t)Z_DVAL_P(elem); } - } else if (Z_TYPE_P(elem) == IS_INT) { - if (Z_IVAL_P(elem) > INT32_MAX || - Z_IVAL_P(elem) < INT32_MIN) { + } else if (Z_TYPE_P(elem) == IS_LONG) { + if (Z_LVAL_P(elem) > INT32_MAX || + Z_LVAL_P(elem) < INT32_MIN) { intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, "Found PHP integer with absolute value too large " "for 32 bit integer argument", 0 TSRMLS_CC); } else { - tInt32 = (int32_t)Z_IVAL_P(elem); + tInt32 = (int32_t)Z_LVAL_P(elem); } } else { SEPARATE_ZVAL_IF_NOT_REF(elem); @@ -521,9 +521,9 @@ retry_kint64: } else { tInt64 = (int64_t)Z_DVAL_P(elem); } - } else if (Z_TYPE_P(elem) == IS_INT) { + } else if (Z_TYPE_P(elem) == IS_LONG) { /* assume long is not wider than 64 bits */ - tInt64 = (int64_t)Z_IVAL_P(elem); + tInt64 = (int64_t)Z_LVAL_P(elem); } else { SEPARATE_ZVAL_IF_NOT_REF(elem); convert_scalar_to_number(elem TSRMLS_CC); @@ -569,8 +569,8 @@ retry_kint64: case IS_FALSE: convert_to_int_ex(elem); /* Intentional fallthrough */ - case IS_INT: - formattable.setInt64((int64_t)Z_IVAL_P(elem)); + case IS_LONG: + formattable.setInt64((int64_t)Z_LVAL_P(elem)); break; case IS_NULL: formattable.setInt64((int64_t)0); @@ -658,7 +658,7 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh break; case Formattable::kLong: - ZVAL_INT(&(*args)[i], fargs[i].getLong()); + ZVAL_LONG(&(*args)[i], fargs[i].getLong()); break; case Formattable::kInt64: @@ -666,7 +666,7 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh if(aInt64 > PHP_INT_MAX || aInt64 < -PHP_INT_MAX) { ZVAL_DOUBLE(&(*args)[i], (double)aInt64); } else { - ZVAL_INT(&(*args)[i], (php_int_t)aInt64); + ZVAL_LONG(&(*args)[i], (zend_long)aInt64); } break; diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c index cbc680e7aa..f06a3e685c 100644 --- a/ext/intl/normalizer/normalizer.c +++ b/ext/intl/normalizer/normalizer.c @@ -37,9 +37,9 @@ void normalizer_register_constants( INIT_FUNC_ARGS ) return; } - #define NORMALIZER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC ); - #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define NORMALIZER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC ); + #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* Normalization form constants */ NORMALIZER_EXPOSE_CLASS_CONST( NONE ); diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c index ad600c1b55..9eb8befa7f 100644 --- a/ext/intl/normalizer/normalizer_normalize.c +++ b/ext/intl/normalizer/normalizer_normalize.c @@ -34,7 +34,7 @@ PHP_FUNCTION( normalizer_normalize ) { char* input = NULL; /* form is optional, defaults to FORM_C */ - php_int_t form = NORMALIZER_DEFAULT; + zend_long form = NORMALIZER_DEFAULT; int input_len = 0; UChar* uinput = NULL; @@ -53,7 +53,7 @@ PHP_FUNCTION( normalizer_normalize ) intl_error_reset( NULL TSRMLS_CC ); /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|l", &input, &input_len, &form ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -174,7 +174,7 @@ PHP_FUNCTION( normalizer_is_normalized ) { char* input = NULL; /* form is optional, defaults to FORM_C */ - php_int_t form = NORMALIZER_DEFAULT; + zend_long form = NORMALIZER_DEFAULT; int input_len = 0; UChar* uinput = NULL; @@ -186,7 +186,7 @@ PHP_FUNCTION( normalizer_is_normalized ) intl_error_reset( NULL TSRMLS_CC ); /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|l", &input, &input_len, &form) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index f837bf9d78..9ca225ab88 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -910,7 +910,7 @@ PHP_MINIT_FUNCTION( intl ) /* For the default locale php.ini setting */ REGISTER_INI_ENTRIES(); - REGISTER_INT_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS); 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); diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h index 1ee496402f..86a75cb335 100644 --- a/ext/intl/php_intl.h +++ b/ext/intl/php_intl.h @@ -50,7 +50,7 @@ ZEND_BEGIN_MODULE_GLOBALS(intl) collator_compare_func_t compare_func; UBreakIterator* grapheme_iterator; intl_error g_error; - php_int_t error_level; + zend_long error_level; zend_bool use_exceptions; ZEND_END_MODULE_GLOBALS(intl) diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c index b13ee901f4..1232a42868 100644 --- a/ext/intl/resourcebundle/resourcebundle.c +++ b/ext/intl/resourcebundle/resourcebundle.c @@ -32,7 +32,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so const int32_t* vfield; int32_t ilen; int i; - php_int_t lfield; + zend_long lfield; ResourceBundle_object* newrb; restype = ures_getType( source->child ); @@ -53,7 +53,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so case URES_INT: lfield = ures_getInt( source->child, &INTL_DATA_ERROR_CODE(source) ); INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve integer value"); - ZVAL_INT( return_value, lfield ); + ZVAL_LONG( return_value, lfield ); break; case URES_INT_VECTOR: @@ -61,7 +61,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve vector value"); array_init( return_value ); for (i=0; i<ilen; i++) { - add_next_index_int( return_value, vfield[i] ); + add_next_index_long( return_value, vfield[i] ); } break; diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 5975c26607..e2f821ef2c 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -177,9 +177,9 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ intl_error_reset( NULL TSRMLS_CC ); RESOURCEBUNDLE_METHOD_FETCH_OBJECT; - if(Z_TYPE_P(offset) == IS_INT) { + if(Z_TYPE_P(offset) == IS_LONG) { is_numeric = 1; - meindex = Z_IVAL_P(offset); + meindex = Z_LVAL_P(offset); rb->child = ures_getByIndex( rb->me, meindex, rb->child, &INTL_DATA_ERROR_CODE(rb) ); } else if(Z_TYPE_P(offset) == IS_STRING) { mekey = Z_STRVAL_P(offset); @@ -259,7 +259,7 @@ PHP_FUNCTION( resourcebundle_get ) /* }}} */ /* {{{ resourcebundle_array_count */ -int resourcebundle_array_count(zval *object, php_int_t *count TSRMLS_DC) +int resourcebundle_array_count(zval *object, zend_long *count TSRMLS_DC) { ResourceBundle_object *rb; RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK; @@ -299,7 +299,7 @@ PHP_FUNCTION( resourcebundle_count ) RESOURCEBUNDLE_METHOD_FETCH_OBJECT; len = ures_getSize( rb->me ); - RETURN_INT( len ); + RETURN_LONG( len ); } /* {{{ arginfo_resourcebundle_getlocales */ @@ -372,7 +372,7 @@ PHP_FUNCTION( resourcebundle_get_error_code ) rb = Z_INTL_RESOURCEBUNDLE_P( object ); - RETURN_INT(INTL_DATA_ERROR_CODE(rb)); + RETURN_LONG(INTL_DATA_ERROR_CODE(rb)); } /* }}} */ diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c index 79149cb234..bdedfd15bc 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.c +++ b/ext/intl/resourcebundle/resourcebundle_iterator.c @@ -109,7 +109,7 @@ static void resourcebundle_iterator_key( zend_object_iterator *iter, zval *key T if (iterator->is_table) { ZVAL_STRING(key, iterator->currentkey); } else { - ZVAL_INT(key, iterator->i); + ZVAL_LONG(key, iterator->i); } } /* }}} */ diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.h b/ext/intl/resourcebundle/resourcebundle_iterator.h index 0c0849eddd..32818f847f 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.h +++ b/ext/intl/resourcebundle/resourcebundle_iterator.h @@ -25,10 +25,10 @@ typedef struct { zend_object_iterator intern; ResourceBundle_object *subject; zend_bool is_table; - php_int_t length; + zend_long length; zval current; char *currentkey; - php_int_t i; + zend_long i; } ResourceBundle_iterator; zend_object_iterator *resourcebundle_get_iterator( zend_class_entry *ce, zval *object, int byref TSRMLS_DC ); diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c index 747654a53b..42a014a90e 100644 --- a/ext/intl/spoofchecker/spoofchecker.c +++ b/ext/intl/spoofchecker/spoofchecker.c @@ -35,7 +35,7 @@ void spoofchecker_register_constants(INIT_FUNC_ARGS) return; } - #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC); + #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC); SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_CONFUSABLE) SPOOFCHECKER_EXPOSE_CLASS_CONST(MIXED_SCRIPT_CONFUSABLE) diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c index 57b3bdffc9..64c641ae10 100644 --- a/ext/intl/spoofchecker/spoofchecker_main.c +++ b/ext/intl/spoofchecker/spoofchecker_main.c @@ -47,7 +47,7 @@ PHP_METHOD(Spoofchecker, isSuspicious) if (error_code) { zval_dtor(error_code); - ZVAL_INT(error_code, ret); + ZVAL_LONG(error_code, ret); } RETVAL_BOOL(ret != 0); } @@ -80,7 +80,7 @@ PHP_METHOD(Spoofchecker, areConfusable) if (error_code) { zval_dtor(error_code); - ZVAL_INT(error_code, ret); + ZVAL_LONG(error_code, ret); } RETVAL_BOOL(ret != 0); } @@ -115,10 +115,10 @@ PHP_METHOD(Spoofchecker, setAllowedLocales) */ PHP_METHOD(Spoofchecker, setChecks) { - php_int_t checks; + zend_long checks; SPOOFCHECKER_METHOD_INIT_VARS; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &checks)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &checks)) { return; } diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index a0651d5352..623a643c49 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -180,7 +180,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, gottenId; UErrorCode status = U_ZERO_ERROR; /* outside_error may be NULL */ convert_to_string_ex(zv_timezone); - if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRSIZE_P(zv_timezone), + if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRLEN_P(zv_timezone), &status) == FAILURE) { spprintf(&message, 0, "%s: Time zone identifier given is not a " "valid UTF-8 string", func); @@ -249,7 +249,7 @@ static zend_object *TimeZone_clone_obj(zval *object TSRMLS_DC) "Could not clone IntlTimeZone", 0 TSRMLS_CC); err_msg = intl_error_get_message(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC); zend_throw_exception(NULL, err_msg->val, 0 TSRMLS_CC); - STR_FREE(err_msg); + zend_string_free(err_msg); } else { to_new->utimezone = newTimeZone; } @@ -331,9 +331,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC) return debug_info; } - ZVAL_INT(&zv, (php_int_t)rawOffset); + ZVAL_LONG(&zv, (zend_long)rawOffset); zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv); - ZVAL_INT(&zv, (php_int_t)(rawOffset + dstOffset)); + ZVAL_LONG(&zv, (zend_long)(rawOffset + dstOffset)); zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv); return debug_info; @@ -513,26 +513,26 @@ U_CFUNC void timezone_register_IntlTimeZone_class(TSRMLS_D) /* Declare 'IntlTimeZone' class constants */ -#define TIMEZONE_DECL_INT_CONST(name, val) \ - zend_declare_class_constant_int(TimeZone_ce_ptr, name, sizeof(name) - 1, \ +#define TIMEZONE_DECL_LONG_CONST(name, val) \ + zend_declare_class_constant_long(TimeZone_ce_ptr, name, sizeof(name) - 1, \ val TSRMLS_CC) - TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT", TimeZone::SHORT); - TIMEZONE_DECL_INT_CONST("DISPLAY_LONG", TimeZone::LONG); + TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT); + TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 - TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); - TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); - TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); - TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); - TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); - TIMEZONE_DECL_INT_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); + TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); + TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); + TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); + TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); + TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); + TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); #endif #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 - TIMEZONE_DECL_INT_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); - TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); - TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); + TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); + TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); + TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); #endif /* Declare 'IntlTimeZone' class properties */ diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index 4dbb6ddda3..9bbd182dee 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -159,34 +159,34 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration) if (arg == NULL || Z_TYPE_P(arg) == IS_NULL) { se = TimeZone::createEnumeration(); - } else if (Z_TYPE_P(arg) == IS_INT) { + } else if (Z_TYPE_P(arg) == IS_LONG) { int_offset: - if (Z_IVAL_P(arg) < (php_int_t)INT32_MIN || - Z_IVAL_P(arg) > (php_int_t)INT32_MAX) { + if (Z_LVAL_P(arg) < (zend_long)INT32_MIN || + Z_LVAL_P(arg) > (zend_long)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_enumeration: value is out of range", 0 TSRMLS_CC); RETURN_FALSE; } else { - se = TimeZone::createEnumeration((int32_t) Z_IVAL_P(arg)); + se = TimeZone::createEnumeration((int32_t) Z_LVAL_P(arg)); } } else if (Z_TYPE_P(arg) == IS_DOUBLE) { double_offset: convert_to_int_ex(arg); goto int_offset; } else if (Z_TYPE_P(arg) == IS_OBJECT || Z_TYPE_P(arg) == IS_STRING) { - php_int_t lval; + zend_long lval; double dval; convert_to_string_ex(arg); - switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, 0)) { case IS_DOUBLE: SEPARATE_ZVAL(arg); zval_dtor(arg); ZVAL_DOUBLE(arg, dval); goto double_offset; - case IS_INT: + case IS_LONG: SEPARATE_ZVAL(arg); zval_dtor(arg); - ZVAL_INT(arg, lval); + ZVAL_LONG(arg, lval); goto int_offset; } /* else call string version */ @@ -228,13 +228,13 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids) } int32_t result = TimeZone::countEquivalentIDs(id); - RETURN_INT((php_int_t)result); + RETURN_LONG((zend_long)result); } #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) { - php_int_t zoneType, + zend_long zoneType, offset_arg; char *region = NULL; int region_len = 0; @@ -250,7 +250,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) != FAILURE && Z_TYPE_P(zvoffset) == IS_NULL; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|s!i", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s!l", &zoneType, ®ion, ®ion_len, &offset_arg) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_time_zone_id_enumeration: bad arguments", 0 TSRMLS_CC); @@ -265,7 +265,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) } if (ZEND_NUM_ARGS() == 3) { - if (offset_arg < (php_int_t)INT32_MIN || offset_arg > (php_int_t)INT32_MAX) { + if (offset_arg < (zend_long)INT32_MIN || offset_arg > (zend_long)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_time_zone_id_enumeration: offset out of bounds", 0 TSRMLS_CC); RETURN_FALSE; @@ -383,12 +383,12 @@ U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id) { char *str_id; int str_id_len; - php_int_t index; + zend_long index; intl_error_reset(NULL TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &str_id, &str_id_len, &index) == FAILURE || - index < (php_int_t)INT32_MIN || index > (php_int_t)INT32_MAX) { + index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_equivalent_id: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -485,10 +485,10 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset) ZVAL_DEREF(rawOffsetArg); zval_dtor(rawOffsetArg); - ZVAL_INT(rawOffsetArg, rawOffset); + ZVAL_LONG(rawOffsetArg, rawOffset); ZVAL_DEREF(dstOffsetArg); zval_dtor(dstOffsetArg); - ZVAL_INT(dstOffsetArg, dstOffset); + ZVAL_LONG(dstOffsetArg, dstOffset); RETURN_TRUE; } @@ -506,7 +506,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset) TIMEZONE_METHOD_FETCH_OBJECT; - RETURN_INT(to->utimezone->getRawOffset()); + RETURN_LONG(to->utimezone->getRawOffset()); } U_CFUNC PHP_FUNCTION(intltz_has_same_rules) @@ -545,13 +545,13 @@ static const TimeZone::EDisplayType display_types[] = { U_CFUNC PHP_FUNCTION(intltz_get_display_name) { zend_bool daylight = 0; - php_int_t display_type = TimeZone::LONG; + zend_long display_type = TimeZone::LONG; const char *locale_str = NULL; int dummy = 0; TIMEZONE_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "O|bis!", &object, TimeZone_ce_ptr, &daylight, &display_type, + "O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type, &locale_str, &dummy) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_display_name: bad arguments", 0 TSRMLS_CC); @@ -603,7 +603,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings) TIMEZONE_METHOD_FETCH_OBJECT; - RETURN_INT((php_int_t)to->utimezone->getDSTSavings()); + RETURN_LONG((zend_long)to->utimezone->getDSTSavings()); } U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone) @@ -646,7 +646,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code) if (to == NULL) RETURN_FALSE; - RETURN_INT((php_int_t)TIMEZONE_ERROR_CODE(to)); + RETURN_LONG((zend_long)TIMEZONE_ERROR_CODE(to)); } U_CFUNC PHP_FUNCTION(intltz_get_error_message) diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c index 88e1225654..5f698e2b90 100644 --- a/ext/intl/transliterator/transliterator.c +++ b/ext/intl/transliterator/transliterator.c @@ -35,9 +35,9 @@ void transliterator_register_constants( INIT_FUNC_ARGS ) return; } - #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_INT_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS ) - #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC ); - #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/ + #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_LONG_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS ) + #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC ); + #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/ /* Normalization form constants */ TRANSLITERATOR_EXPOSE_CLASS_CONST( FORWARD ); diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index e5f26f2829..ff299a8f38 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -183,7 +183,7 @@ err: err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) TSRMLS_CC ); php_error_docref( NULL TSRMLS_CC, E_ERROR, "%s", err_msg->val ); - STR_FREE( err_msg ); /* if it's changed into a warning */ + zend_string_free( err_msg ); /* if it's changed into a warning */ /* do not destroy tempz; we need to return something */ } } @@ -223,7 +223,7 @@ static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, in TRANSLITERATOR_PROPERTY_HANDLER_PROLOG; if(zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) + Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) { retval = NULL; /* fallback to read_property */ } @@ -247,7 +247,7 @@ static zval *Transliterator_read_property( zval *object, zval *member, int type, if( ( type != BP_VAR_R && type != BP_VAR_IS ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) ) + Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) { php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" ); retval = &EG( uninitialized_zval ); @@ -272,7 +272,7 @@ static void Transliterator_write_property( zval *object, zval *member, zval *val if( ( EG( scope ) != Transliterator_ce_ptr ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) ) + Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) { php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" ); } diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index c4f620f9ca..e2b1929216 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -27,7 +27,7 @@ #include <zend_exceptions.h> -static int create_transliterator( char *str_id, int str_id_len, php_int_t direction, zval *object TSRMLS_DC ) +static int create_transliterator( char *str_id, int str_id_len, zend_long direction, zval *object TSRMLS_DC ) { Transliterator_object *to; UChar *ustr_id = NULL; @@ -105,14 +105,14 @@ PHP_FUNCTION( transliterator_create ) { char *str_id; int str_id_len; - php_int_t direction = TRANSLITERATOR_FORWARD; + zend_long direction = TRANSLITERATOR_FORWARD; int res; TRANSLITERATOR_METHOD_INIT_VARS; (void) to; /* unused */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str_id, &str_id_len, &direction ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -139,14 +139,14 @@ PHP_FUNCTION( transliterator_create_from_rules ) int str_rules_len; UChar *ustr_rules = NULL; int32_t ustr_rules_len = 0; - php_int_t direction = TRANSLITERATOR_FORWARD; + zend_long direction = TRANSLITERATOR_FORWARD; UParseError parse_error = {0, -1}; UTransliterator *utrans; UChar id[] = {0x52, 0x75, 0x6C, 0x65, 0x73, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x50, 0x48, 0x50, 0}; /* RulesTransPHP */ TRANSLITERATOR_METHOD_INIT_VARS; - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str_rules, &str_rules_len, &direction ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -307,7 +307,7 @@ PHP_FUNCTION( transliterator_transliterate ) int32_t ustr_len = 0, capacity, uresult_len; - php_int_t start = 0, + zend_long start = 0, limit = -1; int success = 0; zval tmp_object; @@ -320,7 +320,7 @@ PHP_FUNCTION( transliterator_transliterate ) { /* in non-OOP version, accept both a transliterator and a string */ zval *arg1; - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ii", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ll", &arg1, &str, &str_len, &start, &limit ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -342,20 +342,20 @@ PHP_FUNCTION( transliterator_transliterate ) convert_to_string( arg1 ); } object = &tmp_object; - res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRSIZE_P( arg1 ), + res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRLEN_P( arg1 ), TRANSLITERATOR_FORWARD, object TSRMLS_CC ); if( res == FAILURE ) { zend_string *message = intl_error_get_message( NULL TSRMLS_CC ); php_error_docref0( NULL TSRMLS_CC, E_WARNING, "Could not create " "transliterator with ID \"%s\" (%s)", Z_STRVAL_P( arg1 ), message->val ); - STR_FREE( message ); + zend_string_free( message ); /* don't set U_ILLEGAL_ARGUMENT_ERROR to allow fetching of inner error */ goto cleanup; } } } - else if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", + else if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &str, &str_len, &start, &limit ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -497,7 +497,7 @@ PHP_FUNCTION( transliterator_get_error_code ) if (to == NULL ) RETURN_FALSE; - RETURN_INT( (php_int_t) TRANSLITERATOR_ERROR_CODE( to ) ); + RETURN_LONG( (zend_long) TRANSLITERATOR_ERROR_CODE( to ) ); } /* }}} */ |
