mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
More zpp cleanup in ext/intl
This commit is contained in:
parent
e193d35c1e
commit
0a3c1fb4c2
@ -522,48 +522,28 @@ U_CFUNC PHP_FUNCTION(intlcal_roll)
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intlcal_clear)
|
||||
{
|
||||
zval args_a[2] = {0},
|
||||
*args = &args_a[0];
|
||||
zend_long field;
|
||||
int variant;
|
||||
zend_long field;
|
||||
zend_bool field_is_null = 1;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (ZEND_NUM_ARGS() > (getThis() ? 1 : 2) ||
|
||||
zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"intlcal_clear: too many arguments", 0);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (!getThis()) {
|
||||
args++;
|
||||
}
|
||||
if (Z_ISUNDEF(args[0]) || Z_TYPE(args[0]) == IS_NULL) {
|
||||
zval *dummy; /* we know it's null */
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(),
|
||||
getThis(), "O|z", &object, Calendar_ce_ptr, &dummy) == FAILURE) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"intlcal_clear: bad arguments", 0);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
variant = 0;
|
||||
} else if (zend_parse_method_parameters(ZEND_NUM_ARGS(),
|
||||
getThis(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(),
|
||||
getThis(), "O|l!", &object, Calendar_ce_ptr, &field, &field_is_null) == FAILURE) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"intlcal_clear: bad arguments", 0);
|
||||
RETURN_FALSE;
|
||||
} else if (field < 0 || field >= UCAL_FIELD_COUNT) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"intlcal_clear: invalid field", 0);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
variant = 1;
|
||||
}
|
||||
|
||||
CALENDAR_METHOD_FETCH_OBJECT;
|
||||
|
||||
if (variant == 0) {
|
||||
if (field_is_null) {
|
||||
co->ucal->clear();
|
||||
} else {
|
||||
if (field < 0 || field >= UCAL_FIELD_COUNT) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"intlcal_clear: invalid field", 0);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
co->ucal->clear((UCalendarDateFields)field);
|
||||
}
|
||||
|
||||
@ -614,7 +594,7 @@ 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)
|
||||
{
|
||||
zend_ulong dow;
|
||||
zend_long dow;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
|
||||
|
@ -18,8 +18,9 @@ var_dump($c->clear(-1));
|
||||
var_dump(intlcal_clear($c, -1));
|
||||
var_dump(intlcal_clear(1, 2));
|
||||
--EXPECTF--
|
||||
Warning: IntlCalendar::clear() expects at most 1 parameter, 2 given in %s on line %d
|
||||
|
||||
Warning: IntlCalendar::clear(): intlcal_clear: too many arguments in %s on line %d
|
||||
Warning: IntlCalendar::clear(): intlcal_clear: bad arguments in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: IntlCalendar::clear(): intlcal_clear: invalid field in %s on line %d
|
||||
|
@ -440,7 +440,7 @@ U_CFUNC PHP_FUNCTION(intltz_use_daylight_time)
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intltz_get_offset)
|
||||
{
|
||||
UDate date;
|
||||
double date;
|
||||
zend_bool local;
|
||||
zval *rawOffsetArg,
|
||||
*dstOffsetArg;
|
||||
@ -458,7 +458,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset)
|
||||
|
||||
TIMEZONE_METHOD_FETCH_OBJECT;
|
||||
|
||||
to->utimezone->getOffset(date, (UBool) local, rawOffset, dstOffset,
|
||||
to->utimezone->getOffset((UDate) date, (UBool) local, rawOffset, dstOffset,
|
||||
TIMEZONE_ERROR_CODE(to));
|
||||
|
||||
INTL_METHOD_CHECK_STATUS(to, "intltz_get_offset: error obtaining offset");
|
||||
|
Loading…
Reference in New Issue
Block a user