Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/intl/breakiterator/breakiterator_iterators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void _breakiterator_move_forward(zend_object_iterator *iter)
return;
}

int32_t pos = biter->next();
const int32_t pos = biter->next();
if (pos != BreakIterator::DONE) {
ZVAL_LONG(&zoi_iter->current, (zend_long)pos);
} //else we've reached the end of the enum, nothing more is required
Expand All @@ -76,7 +76,7 @@ static void _breakiterator_rewind(zend_object_iterator *iter)
BreakIterator *biter = _breakiter_prolog(iter);
zoi_with_current *zoi_iter = (zoi_with_current*)iter;

int32_t pos = biter->first();
const int32_t pos = biter->first();
ZVAL_LONG(&zoi_iter->current, (zend_long)pos);
}

Expand Down
8 changes: 4 additions & 4 deletions ext/intl/breakiterator/breakiterator_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void _breakiter_no_args_ret_int32(

BREAKITER_METHOD_FETCH_OBJECT;

int32_t res = (bio->biter->*func)();
const int32_t res = (bio->biter->*func)();

RETURN_LONG((zend_long)res);
}
Expand All @@ -195,7 +195,7 @@ static void _breakiter_int32_ret_int32(
RETURN_THROWS();
}

int32_t res = (bio->biter->*func)((int32_t)arg);
const int32_t res = (bio->biter->*func)((int32_t)arg);

RETURN_LONG((zend_long)res);
}
Expand Down Expand Up @@ -246,7 +246,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, current)

BREAKITER_METHOD_FETCH_OBJECT;

int32_t res = bio->biter->current();
const int32_t res = bio->biter->current();

RETURN_LONG((zend_long)res);
}
Expand Down Expand Up @@ -282,7 +282,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, isBoundary)

BREAKITER_METHOD_FETCH_OBJECT;

UBool res = bio->biter->isBoundary((int32_t)offset);
const UBool res = bio->biter->isBoundary((int32_t)offset);

RETURN_BOOL((zend_long)res);
}
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/calendar/calendar_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp)
i++) {
UErrorCode uec = U_ZERO_ERROR;
const char *name = debug_info_fields[i].name;
int32_t res = cal->get(debug_info_fields[i].field, uec);
const int32_t res = cal->get(debug_info_fields[i].field, uec);
if (U_SUCCESS(uec)) {
add_assoc_long(&zfields, name, (zend_long)res);
} else {
Expand Down
28 changes: 14 additions & 14 deletions ext/intl/calendar/calendar_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static void _php_intlcal_field_uec_ret_in32t_method(

CALENDAR_METHOD_FETCH_OBJECT;

int32_t result = (co->ucal->*func)(
const int32_t result = (co->ucal->*func)(
(UCalendarDateFields)field, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");

Expand All @@ -250,7 +250,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_time)

CALENDAR_METHOD_FETCH_OBJECT;

UDate result = co->ucal->getTime(CALENDAR_ERROR_CODE(co));
const UDate result = co->ucal->getTime(CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "error calling ICU Calendar::getTime");

RETURN_DOUBLE((double)result);
Expand Down Expand Up @@ -377,7 +377,7 @@ static void _php_intlcal_before_after(
RETURN_THROWS();
}

UBool res = (co->ucal->*func)(*when_co->ucal, CALENDAR_ERROR_CODE(co));
const UBool res = (co->ucal->*func)(*when_co->ucal, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Error calling ICU method");

RETURN_BOOL((int)res);
Expand All @@ -401,7 +401,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set)

object = getThis();

int arg_num = ZEND_NUM_ARGS() - (object ? 0 : 1);
const int arg_num = ZEND_NUM_ARGS() - (object ? 0 : 1);

if (object && arg_num > 2) {
zend_error(E_DEPRECATED, "Calling IntlCalendar::set() with more than 2 arguments is deprecated, "
Expand Down Expand Up @@ -564,7 +564,7 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference)

CALENDAR_METHOD_FETCH_OBJECT;

int32_t result = co->ucal->fieldDifference((UDate)when,
const int32_t result = co->ucal->fieldDifference((UDate)when,
(UCalendarDateFields)field, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");

Expand Down Expand Up @@ -597,7 +597,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type)

CALENDAR_METHOD_FETCH_OBJECT;

int32_t result = co->ucal->getDayOfWeekType(
const int32_t result = co->ucal->getDayOfWeekType(
(UCalendarDaysOfWeek)dow, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");

Expand All @@ -615,7 +615,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week)

CALENDAR_METHOD_FETCH_OBJECT;

int32_t result = co->ucal->getFirstDayOfWeek(CALENDAR_ERROR_CODE(co));
const int32_t result = co->ucal->getFirstDayOfWeek(CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");

RETURN_LONG((zend_long)result);
Expand All @@ -637,7 +637,7 @@ static void _php_intlcal_field_ret_in32t_method(

CALENDAR_METHOD_FETCH_OBJECT;

int32_t result = (co->ucal->*func)((UCalendarDateFields)field);
const int32_t result = (co->ucal->*func)((UCalendarDateFields)field);
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");

RETURN_LONG((zend_long)result);
Expand Down Expand Up @@ -696,7 +696,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week)

CALENDAR_METHOD_FETCH_OBJECT;

uint8_t result = co->ucal->getMinimalDaysInFirstWeek();
const uint8_t result = co->ucal->getMinimalDaysInFirstWeek();
/* TODO Is it really a failure? */
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");

Expand Down Expand Up @@ -758,7 +758,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition)

CALENDAR_METHOD_FETCH_OBJECT;

int32_t res = co->ucal->getWeekendTransition((UCalendarDaysOfWeek)dow,
const int32_t res = co->ucal->getWeekendTransition((UCalendarDaysOfWeek)dow,
CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Error calling ICU method");

Expand All @@ -776,7 +776,7 @@ U_CFUNC PHP_FUNCTION(intlcal_in_daylight_time)

CALENDAR_METHOD_FETCH_OBJECT;

UBool ret = co->ucal->inDaylightTime(CALENDAR_ERROR_CODE(co));
const UBool ret = co->ucal->inDaylightTime(CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Error calling ICU method");

RETURN_BOOL((int)ret);
Expand Down Expand Up @@ -852,7 +852,7 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend)
if (date_is_null) {
RETURN_BOOL((int)co->ucal->isWeekend());
} else {
UBool ret = co->ucal->isWeekend((UDate)date, CALENDAR_ERROR_CODE(co));
const UBool ret = co->ucal->isWeekend((UDate)date, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Error calling ICU method");
RETURN_BOOL((int)ret);
}
Expand Down Expand Up @@ -937,7 +937,7 @@ U_CFUNC PHP_FUNCTION(intlcal_equals)
RETURN_THROWS();
}

UBool result = co->ucal->equals(*other_co->ucal, CALENDAR_ERROR_CODE(co));
const UBool result = co->ucal->equals(*other_co->ucal, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "error calling ICU Calendar::equals");

RETURN_BOOL((int)result);
Expand Down Expand Up @@ -1116,7 +1116,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)

/* There are no exported functions in ext/date to this
* in a more native fashion */
double date = co->ucal->getTime(CALENDAR_ERROR_CODE(co)) / 1000.;
const double date = co->ucal->getTime(CALENDAR_ERROR_CODE(co)) / 1000.;
int64_t ts;
char ts_str[sizeof("@-9223372036854775808")];
int ts_str_len;
Expand Down
6 changes: 3 additions & 3 deletions ext/intl/converter/converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode
return;
case IS_LONG:
{
zend_long lval = Z_LVAL_P(val);
const zend_long lval = Z_LVAL_P(val);
if ((lval < 0) || (lval > 0x10FFFF)) {
php_converter_throw_failure(objval, U_ILLEGAL_ARGUMENT_ERROR, "Invalid codepoint U+%04lx", lval);
return;
Expand Down Expand Up @@ -265,7 +265,7 @@ static void php_converter_append_fromUnicode_target(zval *val, UConverterFromUni
return;
case IS_STRING:
{
size_t vallen = Z_STRLEN_P(val);
const size_t vallen = Z_STRLEN_P(val);
if (TARGET_CHECK(args, vallen)) {
args->target = reinterpret_cast<char *>(zend_mempcpy(args->target, Z_STRVAL_P(val), vallen));
}
Expand Down Expand Up @@ -682,7 +682,7 @@ static zend_string* php_converter_do_convert(UConverter *dest_cnv,
}
/* }}} */

static void php_converter_set_subst_chars(UConverter *cnv, zend_string *subst, UErrorCode *error)
static void php_converter_set_subst_chars(UConverter *cnv, const zend_string *subst, UErrorCode *error)
{
if (ZSTR_LEN(subst) > SCHAR_MAX) {
*error = U_ILLEGAL_ARGUMENT_ERROR;
Expand Down
6 changes: 3 additions & 3 deletions ext/intl/dateformat/dateformat_format_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ static constexpr DateFormat::EStyle valid_styles[] = {
DateFormat::kShortRelative,
};

static bool valid_format(zval *z) {
static bool valid_format(const zval *z) {
if (Z_TYPE_P(z) == IS_LONG) {
zend_long lval = Z_LVAL_P(z);
const zend_long lval = Z_LVAL_P(z);
for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) {
if ((zend_long)valid_styles[i] == lval) {
return true;
Expand Down Expand Up @@ -149,7 +149,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative);
}

zend_class_entry *instance_ce = object->ce;
const zend_class_entry *instance_ce = object->ce;
if (instanceof_function(instance_ce, Calendar_ce_ptr)) {
Calendar *obj_cal = calendar_fetch_native_calendar(object);
if (obj_cal == NULL) {
Expand Down
14 changes: 7 additions & 7 deletions ext/intl/dateformat/dateformat_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern "C" {
* if set to 1 - store any error encountered in the parameter parse_error
* if set to 0 - no need to store any error encountered in the parameter parse_error
*/
static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* text_to_parse, size_t text_len, int32_t *parse_pos, bool update_calendar, zval *return_value)
static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, const char* text_to_parse, size_t text_len, int32_t *parse_pos, bool update_calendar, zval *return_value)
{
double result = 0;
UDate timestamp =0;
Expand Down Expand Up @@ -70,9 +70,9 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex
}
/* }}} */

static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, zend_long calendar_field, char* key_name)
static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, zend_long calendar_field, const char* key_name)
{
zend_long calendar_field_val = ucal_get( parsed_calendar, static_cast<UCalendarDateFields>(calendar_field), &INTL_DATA_ERROR_CODE(dfo));
const zend_long calendar_field_val = ucal_get( parsed_calendar, static_cast<UCalendarDateFields>(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 ){
Expand All @@ -87,7 +87,7 @@ static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_va
}

/* {{{ Internal function which calls the udat_parseCalendar */
static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse, size_t text_len, int32_t *parse_pos, zval *return_value)
static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, const char* text_to_parse, size_t text_len, int32_t *parse_pos, zval *return_value)
{
UCalendar *parsed_calendar = NULL;
UChar* text_utf16 = NULL;
Expand Down Expand Up @@ -149,7 +149,7 @@ U_CFUNC PHP_FUNCTION(datefmt_parse)
if (z_parse_pos) {
zval *z_parse_pos_tmp = z_parse_pos;
ZVAL_DEREF(z_parse_pos_tmp);
zend_long long_parse_pos = zval_get_long(z_parse_pos_tmp);
const zend_long long_parse_pos = zval_get_long(z_parse_pos_tmp);
if (ZEND_LONG_INT_OVFL(long_parse_pos)) {
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);
intl_error_set_custom_msg(NULL, "String index is out of valid range.");
Expand Down Expand Up @@ -188,7 +188,7 @@ U_CFUNC PHP_METHOD(IntlDateFormatter, parseToCalendar)

if (z_parse_pos) {
bool failed;
zend_long long_parse_pos = zval_try_get_long(z_parse_pos, &failed);
const zend_long long_parse_pos = zval_try_get_long(z_parse_pos, &failed);
if (failed) {
zend_argument_type_error(2, "must be of type int, %s given", zend_zval_value_name(z_parse_pos));
RETURN_THROWS();
Expand Down Expand Up @@ -231,7 +231,7 @@ U_CFUNC PHP_FUNCTION(datefmt_localtime)
if (z_parse_pos) {
zval *z_parse_pos_tmp = z_parse_pos;
ZVAL_DEREF(z_parse_pos_tmp);
zend_long long_parse_pos = zval_get_long(z_parse_pos_tmp);
const zend_long long_parse_pos = zval_get_long(z_parse_pos_tmp);
if (ZEND_LONG_INT_OVFL(long_parse_pos)) {
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);
intl_error_set_custom_msg(NULL, "String index is out of valid range.");
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/formatter/formatter_attr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ U_CFUNC PHP_FUNCTION( numfmt_get_attribute )
break;
case UNUM_ROUNDING_INCREMENT:
{
double value_double = unum_getDoubleAttribute(FORMATTER_UNUM(nfo), attribute);
const double value_double = unum_getDoubleAttribute(FORMATTER_UNUM(nfo), attribute);
if(value_double == -1) {
INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
} else {
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/formatter/formatter_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ U_CFUNC PHP_FUNCTION( numfmt_parse_currency )
ZEND_TRY_ASSIGN_REF_LONG(zposition, pp.getIndex());
}

double number = currAmt->getNumber().getDouble(INTL_DATA_ERROR_CODE(nfo));
const double number = currAmt->getNumber().getDouble(INTL_DATA_ERROR_CODE(nfo));

/* Convert parsed currency to UTF-8 and pass it back to caller. */
icu::UnicodeString ucurrency(currAmt->getISOCurrency());
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/intl_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ zend_string * intl_error_get_message( intl_error* err )
return ZSTR_EMPTY_ALLOC();

uErrorName = u_errorName( err->code );
size_t uErrorLen = strlen(uErrorName);
const size_t uErrorLen = strlen(uErrorName);

/* Format output string */
if (err->custom_error_message) {
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/listformatter/listformatter_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ PHP_METHOD(IntlListFormatter, format)

intl_errors_reset(LISTFORMATTER_ERROR_P(obj));

uint32_t count = zend_hash_num_elements(ht);
const uint32_t count = zend_hash_num_elements(ht);
if (count == 0) {
RETURN_EMPTY_STRING();
}
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/locale/locale_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ U_CFUNC PHP_FUNCTION(locale_add_likely_subtags)
locale = (char *)intl_locale_get_default();
}

int32_t maximized_locale_len = uloc_addLikelySubtags(locale, maximized_locale, sizeof(maximized_locale), &status);
const int32_t maximized_locale_len = uloc_addLikelySubtags(locale, maximized_locale, sizeof(maximized_locale), &status);
INTL_CHECK_STATUS(status, "invalid locale");
if (maximized_locale_len < 0) {
RETURN_FALSE;
Expand All @@ -1683,7 +1683,7 @@ U_CFUNC PHP_FUNCTION(locale_minimize_subtags)
locale = (char *)intl_locale_get_default();
}

int32_t minimized_locale_len = uloc_minimizeSubtags(locale, minimized_locale, sizeof(minimized_locale), &status);
const int32_t minimized_locale_len = uloc_minimizeSubtags(locale, minimized_locale, sizeof(minimized_locale), &status);
INTL_CHECK_STATUS(status, "invalid locale");
if (minimized_locale_len < 0) {
RETURN_FALSE;
Expand Down
10 changes: 5 additions & 5 deletions ext/intl/msgformat/msgformat_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
(void*)&bogusType, sizeof(bogusType));
}
} else if (name_part.getType() == UMSGPAT_PART_TYPE_ARG_NUMBER) {
int32_t argNumber = name_part.getValue();
const int32_t argNumber = name_part.getValue();
if (argNumber < 0) {
intl_errors_set(&err, U_INVALID_FORMAT_ERROR,
"Found part with negative number");
Expand Down Expand Up @@ -364,7 +364,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
UChar **formatted,
int32_t *formatted_len)
{
int arg_count = zend_hash_num_elements(args);
const int arg_count = zend_hash_num_elements(args);
std::vector<Formattable> fargs;
std::vector<UnicodeString> farg_names;
MessageFormat *mf = (MessageFormat *)mfo->mf_data.umsgf;
Expand Down Expand Up @@ -408,7 +408,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
}

UChar temp[16];
int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index);
const int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index);
key.append(temp, len);

storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, num_index);
Expand Down Expand Up @@ -467,7 +467,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
}
case Formattable::kDouble:
{
double d = zval_get_double(elem);
const double d = zval_get_double(elem);
formattable.setDouble(d);
break;
}
Expand Down Expand Up @@ -523,7 +523,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
}
case Formattable::kDate:
{
double dd = intl_zval_to_millis(elem, &err);
const double dd = intl_zval_to_millis(elem, &err);
if (U_FAILURE(err.code)) {
char *message;
zend_string *u8key;
Expand Down
Loading
Loading