mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ported ext/intl, bugfixes to go
This commit is contained in:
parent
729bce4321
commit
063079b62e
36 changed files with 189 additions and 187 deletions
|
@ -161,8 +161,8 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration)
|
|||
se = TimeZone::createEnumeration();
|
||||
} else if (Z_TYPE_P(arg) == IS_INT) {
|
||||
int_offset:
|
||||
if (Z_IVAL_P(arg) < (long)INT32_MIN ||
|
||||
Z_IVAL_P(arg) > (long)INT32_MAX) {
|
||||
if (Z_IVAL_P(arg) < (php_int_t)INT32_MIN ||
|
||||
Z_IVAL_P(arg) > (php_int_t)INT32_MAX) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"intltz_create_enumeration: value is out of range", 0 TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
|
@ -234,7 +234,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
|
|||
#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
|
||||
U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
|
||||
{
|
||||
long zoneType,
|
||||
php_int_t 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, "l|s!l",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|s!i",
|
||||
&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 < (long)INT32_MIN || offset_arg > (long)INT32_MAX) {
|
||||
if (offset_arg < (php_int_t)INT32_MIN || offset_arg > (php_int_t)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;
|
||||
long index;
|
||||
php_int_t index;
|
||||
intl_error_reset(NULL TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si",
|
||||
&str_id, &str_id_len, &index) == FAILURE ||
|
||||
index < (long)INT32_MIN || index > (long)INT32_MAX) {
|
||||
index < (php_int_t)INT32_MIN || index > (php_int_t)INT32_MAX) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"intltz_get_equivalent_id: bad arguments", 0 TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
|
@ -545,13 +545,13 @@ static const TimeZone::EDisplayType display_types[] = {
|
|||
U_CFUNC PHP_FUNCTION(intltz_get_display_name)
|
||||
{
|
||||
zend_bool daylight = 0;
|
||||
long display_type = TimeZone::LONG;
|
||||
php_int_t 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|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type,
|
||||
"O|bis!", &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((long)to->utimezone->getDSTSavings());
|
||||
RETURN_INT((php_int_t)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((long)TIMEZONE_ERROR_CODE(to));
|
||||
RETURN_INT((php_int_t)TIMEZONE_ERROR_CODE(to));
|
||||
}
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intltz_get_error_message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue