mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
ported ext/intl, bugfixes to go
This commit is contained in:
parent
729bce4321
commit
063079b62e
@ -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, (long)pos);
|
||||
ZVAL_INT(&zoi_iter->current, (php_int_t)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, (long)pos);
|
||||
ZVAL_INT(&zoi_iter->current, (php_int_t)pos);
|
||||
}
|
||||
|
||||
static zend_object_iterator_funcs breakiterator_iterator_funcs = {
|
||||
|
@ -208,7 +208,7 @@ static void _breakiter_no_args_ret_int32(
|
||||
|
||||
int32_t res = (bio->biter->*func)();
|
||||
|
||||
RETURN_INT((long)res);
|
||||
RETURN_INT((php_int_t)res);
|
||||
}
|
||||
|
||||
static void _breakiter_int32_ret_int32(
|
||||
@ -217,11 +217,11 @@ static void _breakiter_int32_ret_int32(
|
||||
INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
char *msg;
|
||||
long arg;
|
||||
php_int_t arg;
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &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((long)res);
|
||||
RETURN_INT((php_int_t)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((long)res);
|
||||
RETURN_INT((php_int_t)res);
|
||||
}
|
||||
|
||||
U_CFUNC PHP_FUNCTION(breakiter_following)
|
||||
@ -327,11 +327,11 @@ U_CFUNC PHP_FUNCTION(breakiter_preceding)
|
||||
|
||||
U_CFUNC PHP_FUNCTION(breakiter_is_boundary)
|
||||
{
|
||||
long offset;
|
||||
php_int_t offset;
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i",
|
||||
&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((long)res);
|
||||
RETURN_BOOL((php_int_t)res);
|
||||
}
|
||||
|
||||
U_CFUNC PHP_FUNCTION(breakiter_get_locale)
|
||||
{
|
||||
long locale_type;
|
||||
php_int_t locale_type;
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &locale_type) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &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)
|
||||
{
|
||||
long key_type = 0;
|
||||
php_int_t key_type = 0;
|
||||
BREAKITER_METHOD_INIT_VARS;
|
||||
object = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &key_type) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &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((long)BREAKITER_ERROR_CODE(bio));
|
||||
RETURN_INT((php_int_t)BREAKITER_ERROR_CODE(bio));
|
||||
}
|
||||
|
||||
U_CFUNC PHP_FUNCTION(breakiter_get_error_message)
|
||||
|
@ -18,9 +18,11 @@
|
||||
#include <unicode/uchriter.h>
|
||||
#include <typeinfo>
|
||||
|
||||
#include "php.h"
|
||||
|
||||
//copied from cmemory.h, which is not public
|
||||
typedef union {
|
||||
long t1;
|
||||
php_int_t t1;
|
||||
double t2;
|
||||
void *t3;
|
||||
} UAlignedMemory;
|
||||
|
@ -219,12 +219,12 @@ static void _php_intlcal_field_uec_ret_in32t_method(
|
||||
const char *method_name,
|
||||
INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
long field;
|
||||
php_int_t field;
|
||||
char *message;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
|
||||
"Oi", &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((long)result);
|
||||
RETURN_INT((php_int_t)result);
|
||||
}
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intlcal_get)
|
||||
@ -295,12 +295,12 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time)
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intlcal_add)
|
||||
{
|
||||
long field,
|
||||
php_int_t field,
|
||||
amount;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Oll", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) {
|
||||
"Oii", &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)
|
||||
{
|
||||
long arg1, arg2, arg3, arg4, arg5, arg6;
|
||||
php_int_t 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(),
|
||||
"Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4,
|
||||
"Oii|iiii", &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);
|
||||
@ -462,7 +462,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set)
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intlcal_roll)
|
||||
{
|
||||
long field,
|
||||
php_int_t 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(),
|
||||
"Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) {
|
||||
"Oii", &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];
|
||||
long field;
|
||||
php_int_t 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(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
|
||||
getThis(), "Oi", &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)
|
||||
{
|
||||
long field;
|
||||
php_int_t field;
|
||||
double when;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Odl", &object, Calendar_ce_ptr, &when, &field) == FAILURE) {
|
||||
"Odi", &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((long)result);
|
||||
RETURN_INT((php_int_t)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)
|
||||
{
|
||||
long dow;
|
||||
php_uint_t dow;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
|
||||
"Oi", &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((long)result);
|
||||
RETURN_INT((php_int_t)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((long)result);
|
||||
RETURN_INT((php_int_t)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)
|
||||
{
|
||||
long field;
|
||||
php_int_t field;
|
||||
char *message;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
|
||||
"Oi", &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((long)result);
|
||||
RETURN_INT((php_int_t)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)
|
||||
{
|
||||
long locale_type;
|
||||
php_int_t locale_type;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) {
|
||||
"Oi", &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((long)result);
|
||||
RETURN_INT((php_int_t)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)
|
||||
{
|
||||
long dow;
|
||||
php_int_t dow;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
|
||||
"Oi", &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((long)res);
|
||||
RETURN_INT((php_int_t)res);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -898,11 +898,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_lenient)
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intlcal_is_set)
|
||||
{
|
||||
long field;
|
||||
php_int_t field;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
|
||||
"Oi", &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)
|
||||
{
|
||||
long dow;
|
||||
php_int_t dow;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
|
||||
"Oi", &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)
|
||||
{
|
||||
long num_days;
|
||||
php_int_t num_days;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) {
|
||||
"Oi", &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;
|
||||
@ -1085,11 +1085,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option)
|
||||
|
||||
U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option)
|
||||
{
|
||||
long option;
|
||||
php_int_t option;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &option) == FAILURE) {
|
||||
"Oi", &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)
|
||||
{
|
||||
long option;
|
||||
php_int_t option;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, Calendar_ce_ptr, &option) == FAILURE) {
|
||||
"Oi", &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;
|
||||
|
@ -43,7 +43,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
|
||||
*args = &args_a[0];
|
||||
char *locale = NULL;
|
||||
int locale_len;
|
||||
long largs[6];
|
||||
php_int_t 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)
|
||||
{
|
||||
long year;
|
||||
php_int_t year;
|
||||
CALENDAR_METHOD_INIT_VARS;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
|
||||
"Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) {
|
||||
"Oi", &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;
|
||||
|
@ -33,12 +33,12 @@
|
||||
*/
|
||||
PHP_FUNCTION( collator_get_attribute )
|
||||
{
|
||||
long attribute, value;
|
||||
php_int_t attribute, value;
|
||||
|
||||
COLLATOR_METHOD_INIT_VARS
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
|
||||
&object, Collator_ce_ptr, &attribute ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
@ -64,12 +64,12 @@ PHP_FUNCTION( collator_get_attribute )
|
||||
*/
|
||||
PHP_FUNCTION( collator_set_attribute )
|
||||
{
|
||||
long attribute, value;
|
||||
php_int_t attribute, value;
|
||||
COLLATOR_METHOD_INIT_VARS
|
||||
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii",
|
||||
&object, Collator_ce_ptr, &attribute, &value ) == FAILURE)
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
@ -123,12 +123,12 @@ PHP_FUNCTION( collator_get_strength )
|
||||
*/
|
||||
PHP_FUNCTION( collator_set_strength )
|
||||
{
|
||||
long strength;
|
||||
php_int_t strength;
|
||||
|
||||
COLLATOR_METHOD_INIT_VARS
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
|
||||
&object, Collator_ce_ptr, &strength ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
@ -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, ulong hashIndex,
|
||||
HashTable* hash, zval *hashData, zend_string *hashKey, php_uint_t hashIndex,
|
||||
UErrorCode* status )
|
||||
{
|
||||
const char* old_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, ulong hashIndex,
|
||||
HashTable* hash, zval * hashData, zend_string* hashKey, php_uint_t hashIndex,
|
||||
UErrorCode* status )
|
||||
{
|
||||
const char* old_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 )
|
||||
{
|
||||
ulong hashIndex;
|
||||
php_uint_t 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 )
|
||||
{
|
||||
ulong hashIndex;
|
||||
php_uint_t hashIndex;
|
||||
zend_string *hashKey;
|
||||
zval *hashData;
|
||||
|
||||
@ -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;
|
||||
long lval = 0;
|
||||
php_int_t lval = 0;
|
||||
double dval = 0;
|
||||
|
||||
if( Z_TYPE_P( str ) != IS_STRING )
|
||||
|
@ -125,15 +125,15 @@ static double collator_u_strtod(const UChar *nptr, UChar **endptr) /* {{{ */
|
||||
*
|
||||
* Ignores `locale' stuff.
|
||||
*/
|
||||
static long collator_u_strtol(nptr, endptr, base)
|
||||
static php_int_t collator_u_strtol(nptr, endptr, base)
|
||||
const UChar *nptr;
|
||||
UChar **endptr;
|
||||
register int base;
|
||||
{
|
||||
register const UChar *s = nptr;
|
||||
register unsigned long acc;
|
||||
register php_uint_t acc;
|
||||
register UChar c;
|
||||
register unsigned long cutoff;
|
||||
register php_uint_t cutoff;
|
||||
register int neg = 0, any, cutlim;
|
||||
|
||||
if (s == NULL) {
|
||||
@ -184,9 +184,9 @@ static long collator_u_strtol(nptr, endptr, base)
|
||||
* Set any if any `digits' consumed; make it negative to indicate
|
||||
* overflow.
|
||||
*/
|
||||
cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
|
||||
cutlim = cutoff % (unsigned long)base;
|
||||
cutoff /= (unsigned long)base;
|
||||
cutoff = neg ? -(php_uint_t)PHP_INT_MIN : PHP_INT_MAX;
|
||||
cutlim = cutoff % (php_uint_t)base;
|
||||
cutoff /= (php_uint_t)base;
|
||||
for (acc = 0, any = 0;; c = *s++) {
|
||||
if (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/)
|
||||
c -= 0x30 /*'0'*/;
|
||||
@ -208,7 +208,7 @@ static long collator_u_strtol(nptr, endptr, base)
|
||||
}
|
||||
}
|
||||
if (any < 0) {
|
||||
acc = neg ? LONG_MIN : LONG_MAX;
|
||||
acc = neg ? PHP_INT_MIN : PHP_INT_MAX;
|
||||
errno = ERANGE;
|
||||
} else if (neg)
|
||||
acc = -acc;
|
||||
@ -222,9 +222,9 @@ static long collator_u_strtol(nptr, endptr, base)
|
||||
/* {{{ collator_is_numeric]
|
||||
* Taken from PHP6:is_numeric_unicode()
|
||||
*/
|
||||
zend_uchar collator_is_numeric( UChar *str, int length, long *lval, double *dval, int allow_errors )
|
||||
zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors )
|
||||
{
|
||||
long local_lval;
|
||||
php_int_t local_lval;
|
||||
double local_dval;
|
||||
UChar *end_ptr_long, *end_ptr_double;
|
||||
int conv_base=10;
|
||||
|
@ -21,6 +21,6 @@
|
||||
#include <php.h>
|
||||
#include <unicode/uchar.h>
|
||||
|
||||
zend_uchar collator_is_numeric( UChar *str, int length, long *lval, double *dval, int allow_errors );
|
||||
zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors );
|
||||
|
||||
#endif // COLLATOR_IS_NUMERIC_H
|
||||
|
@ -33,13 +33,13 @@
|
||||
*/
|
||||
PHP_FUNCTION( collator_get_locale )
|
||||
{
|
||||
long type = 0;
|
||||
php_int_t type = 0;
|
||||
char* locale_name = NULL;
|
||||
|
||||
COLLATOR_METHOD_INIT_VARS
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
|
||||
&object, Collator_ce_ptr, &type ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
@ -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 long sort_flags )
|
||||
static collator_compare_func_t collator_get_compare_function( const php_int_t 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;
|
||||
long sort_flags = COLLATOR_SORT_REGULAR;
|
||||
php_int_t sort_flags = COLLATOR_SORT_REGULAR;
|
||||
|
||||
COLLATOR_METHOD_INIT_VARS
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|l",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|i",
|
||||
&object, Collator_ce_ptr, &array, &sort_flags ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
@ -48,10 +48,10 @@ PHP_FUNCTION( intl_get_error_message )
|
||||
*/
|
||||
PHP_FUNCTION( intl_is_failure )
|
||||
{
|
||||
long err_code;
|
||||
php_int_t err_code;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l",
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i",
|
||||
&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 )
|
||||
{
|
||||
long err_code;
|
||||
php_int_t err_code;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l",
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i",
|
||||
&err_code ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
@ -62,7 +62,7 @@ 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, long reason, zval *error TSRMLS_DC) {
|
||||
static void php_converter_default_callback(zval *return_value, zval *zobj, php_int_t reason, zval *error TSRMLS_DC) {
|
||||
ZVAL_DEREF(error);
|
||||
zval_dtor(error);
|
||||
ZVAL_INT(error, U_ZERO_ERROR);
|
||||
@ -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) {
|
||||
long reason;
|
||||
php_int_t reason;
|
||||
zval *source, *codeUnits, *error;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz",
|
||||
&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) {
|
||||
long reason;
|
||||
php_int_t reason;
|
||||
zval *source, *codePoint, *error;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz",
|
||||
&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, long available, long needed TSRMLS_DC) {
|
||||
static inline zend_bool php_converter_check_limits(php_converter_object *objval, php_int_t available, php_int_t needed TSRMLS_DC) {
|
||||
if (available < needed) {
|
||||
php_converter_throw_failure(objval, U_BUFFER_OVERFLOW_ERROR TSRMLS_CC, "Buffer overrun %ld bytes needed, %ld available", needed, available);
|
||||
return 0;
|
||||
@ -171,7 +171,7 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode
|
||||
return;
|
||||
case IS_INT:
|
||||
{
|
||||
long lval = Z_IVAL_P(val);
|
||||
php_int_t lval = Z_IVAL_P(val);
|
||||
if ((lval < 0) || (lval > 0x10FFFF)) {
|
||||
php_converter_throw_failure(objval, U_ILLEGAL_ARGUMENT_ERROR TSRMLS_CC, "Invalid codepoint U+%04lx", lval);
|
||||
return;
|
||||
@ -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) {
|
||||
long reason;
|
||||
php_int_t reason;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &reason) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &reason) == FAILURE) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"UConverter::reasonText(): bad arguments", 0 TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
|
@ -170,12 +170,12 @@ PHP_FUNCTION( datefmt_set_pattern )
|
||||
PHP_FUNCTION( datefmt_get_locale )
|
||||
{
|
||||
char *loc;
|
||||
long loc_type =ULOC_ACTUAL_LOCALE;
|
||||
php_int_t loc_type =ULOC_ACTUAL_LOCALE;
|
||||
|
||||
DATE_FORMAT_METHOD_INIT_VARS;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i",
|
||||
&object, IntlDateFormatter_ce_ptr,&loc_type) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
@ -220,7 +220,7 @@ U_CFUNC PHP_FUNCTION(datefmt_set_calendar)
|
||||
DATE_FORMAT_METHOD_FETCH_OBJECT;
|
||||
|
||||
Calendar *cal;
|
||||
long cal_type;
|
||||
php_int_t cal_type;
|
||||
bool cal_owned;
|
||||
Locale locale = Locale::createFromName(dfo->requested_locale);
|
||||
// getting the actual locale from the DateFormat is not enough
|
||||
|
@ -43,11 +43,11 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
const char *locale_str;
|
||||
int locale_len = 0;
|
||||
Locale locale;
|
||||
long date_type = 0;
|
||||
long time_type = 0;
|
||||
php_int_t date_type = 0;
|
||||
php_int_t time_type = 0;
|
||||
zval *calendar_zv = NULL;
|
||||
Calendar *calendar = NULL;
|
||||
long calendar_type;
|
||||
php_int_t 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, "sll|zzs",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|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: "
|
||||
|
@ -47,9 +47,9 @@ static const DateFormat::EStyle valid_styles[] = {
|
||||
|
||||
static bool valid_format(zval *z) {
|
||||
if (Z_TYPE_P(z) == IS_INT) {
|
||||
long lval = Z_IVAL_P(z);
|
||||
php_int_t lval = Z_IVAL_P(z);
|
||||
for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) {
|
||||
if ((long)valid_styles[i] == lval) {
|
||||
if ((php_int_t)valid_styles[i] == lval) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
|
||||
const char *func_name,
|
||||
intl_error *err,
|
||||
Calendar*& cal,
|
||||
long& cal_int_type,
|
||||
php_int_t& cal_int_type,
|
||||
bool& calendar_owned TSRMLS_DC)
|
||||
{
|
||||
char *msg;
|
||||
@ -49,8 +49,8 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
|
||||
|
||||
} else if (Z_TYPE_P(calendar_zv) == IS_INT) {
|
||||
|
||||
long v = Z_IVAL_P(calendar_zv);
|
||||
if (v != (long)UCAL_TRADITIONAL && v != (long)UCAL_GREGORIAN) {
|
||||
php_int_t v = Z_IVAL_P(calendar_zv);
|
||||
if (v != (php_int_t)UCAL_TRADITIONAL && v != (php_int_t)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,7 +59,7 @@ 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 == (long)UCAL_TRADITIONAL) {
|
||||
} else if (v == (php_int_t)UCAL_TRADITIONAL) {
|
||||
cal = Calendar::createInstance(locale, status);
|
||||
} else { //UCAL_GREGORIAN
|
||||
cal = new GregorianCalendar(locale, status);
|
||||
|
@ -32,7 +32,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
|
||||
const char *func_name,
|
||||
intl_error *err,
|
||||
Calendar*& cal,
|
||||
long& cal_int_type,
|
||||
php_int_t& cal_int_type,
|
||||
bool& calendar_owned TSRMLS_DC);
|
||||
|
||||
#endif /* DATEFORMAT_HELPERS_H */
|
||||
|
@ -57,14 +57,14 @@ 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, (long)result);
|
||||
ZVAL_INT(return_value, (php_int_t)result);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, long calendar_field, char* key_name TSRMLS_DC)
|
||||
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)
|
||||
{
|
||||
long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo));
|
||||
php_int_t 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 ){
|
||||
@ -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;
|
||||
long isInDST = 0;
|
||||
php_int_t 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));
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
PHP_FUNCTION( numfmt_get_attribute )
|
||||
{
|
||||
long attribute, value;
|
||||
php_int_t attribute, value;
|
||||
FORMATTER_METHOD_INIT_VARS;
|
||||
|
||||
/* Parse parameters. */
|
||||
@ -101,7 +101,7 @@ PHP_FUNCTION( numfmt_get_attribute )
|
||||
*/
|
||||
PHP_FUNCTION( numfmt_get_text_attribute )
|
||||
{
|
||||
long attribute;
|
||||
php_int_t 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(), "Ol",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
|
||||
&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 )
|
||||
{
|
||||
long attribute;
|
||||
php_int_t attribute;
|
||||
zval *value;
|
||||
FORMATTER_METHOD_INIT_VARS;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz",
|
||||
&object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE)
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
@ -209,13 +209,13 @@ PHP_FUNCTION( numfmt_set_text_attribute )
|
||||
{
|
||||
int slength = 0;
|
||||
UChar *svalue = NULL;
|
||||
long attribute;
|
||||
php_int_t attribute;
|
||||
char *value;
|
||||
int len;
|
||||
FORMATTER_METHOD_INIT_VARS;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois",
|
||||
&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 )
|
||||
{
|
||||
long symbol;
|
||||
php_int_t 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(), "Ol",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
|
||||
&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 )
|
||||
{
|
||||
long symbol;
|
||||
php_int_t 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(), "Ols",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois",
|
||||
&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 )
|
||||
{
|
||||
long type = ULOC_ACTUAL_LOCALE;
|
||||
php_int_t type = ULOC_ACTUAL_LOCALE;
|
||||
char* loc;
|
||||
FORMATTER_METHOD_INIT_VARS;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i",
|
||||
&object, NumberFormatter_ce_ptr, &type ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
@ -33,14 +33,14 @@
|
||||
PHP_FUNCTION( numfmt_format )
|
||||
{
|
||||
zval *number;
|
||||
long type = FORMAT_TYPE_DEFAULT;
|
||||
php_int_t 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|l",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|i",
|
||||
&object, NumberFormatter_ce_ptr, &number, &type ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
@ -59,7 +59,7 @@ PHP_FUNCTION( numfmt_format )
|
||||
|
||||
if(Z_TYPE_P(number) == IS_INT) {
|
||||
/* take INT32 on 32-bit, int64 on 64-bit */
|
||||
type = (sizeof(long) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32;
|
||||
type = (sizeof(php_int_t) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32;
|
||||
} else if(Z_TYPE_P(number) == IS_DOUBLE) {
|
||||
type = FORMAT_TYPE_DOUBLE;
|
||||
} else {
|
||||
|
@ -30,13 +30,13 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
|
||||
const char* locale;
|
||||
char* pattern = NULL;
|
||||
int locale_len = 0, pattern_len = 0;
|
||||
long style;
|
||||
php_int_t style;
|
||||
UChar* spattern = NULL;
|
||||
int spattern_len = 0;
|
||||
FORMATTER_METHOD_INIT_VARS;
|
||||
|
||||
/* Parse parameters. */
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sl|s",
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "si|s",
|
||||
&locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
@ -36,7 +36,7 @@
|
||||
*/
|
||||
PHP_FUNCTION( numfmt_parse )
|
||||
{
|
||||
long type = FORMAT_TYPE_DOUBLE;
|
||||
php_int_t 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|lz/!",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|iz/!",
|
||||
&object, NumberFormatter_ce_ptr, &str, &str_len, &type, &zposition ) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
@ -86,10 +86,10 @@ PHP_FUNCTION( numfmt_parse )
|
||||
break;
|
||||
case FORMAT_TYPE_INT64:
|
||||
val64 = unum_parseInt64(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo));
|
||||
if(val64 > LONG_MAX || val64 < LONG_MIN) {
|
||||
if(val64 > ZEND_INT_MAX || val64 < ZEND_INT_MIN) {
|
||||
RETVAL_DOUBLE(val64);
|
||||
} else {
|
||||
RETVAL_INT((long)val64);
|
||||
RETVAL_INT((php_int_t)val64);
|
||||
}
|
||||
break;
|
||||
case FORMAT_TYPE_DOUBLE:
|
||||
|
@ -111,11 +111,11 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
unsigned char *haystack, *needle;
|
||||
int haystack_len, needle_len;
|
||||
unsigned char *found;
|
||||
long loffset = 0;
|
||||
php_int_t loffset = 0;
|
||||
int32_t offset = 0;
|
||||
int ret_pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (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 );
|
||||
@ -178,12 +178,12 @@ PHP_FUNCTION(grapheme_stripos)
|
||||
unsigned char *haystack, *needle, *haystack_dup, *needle_dup;
|
||||
int haystack_len, needle_len;
|
||||
unsigned char *found;
|
||||
long loffset = 0;
|
||||
php_int_t loffset = 0;
|
||||
int32_t offset = 0;
|
||||
int ret_pos;
|
||||
int is_ascii;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (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 );
|
||||
@ -252,12 +252,12 @@ PHP_FUNCTION(grapheme_strrpos)
|
||||
{
|
||||
unsigned char *haystack, *needle;
|
||||
int haystack_len, needle_len;
|
||||
long loffset = 0;
|
||||
php_int_t loffset = 0;
|
||||
int32_t offset = 0;
|
||||
int32_t ret_pos;
|
||||
int is_ascii;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (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 );
|
||||
@ -322,12 +322,12 @@ PHP_FUNCTION(grapheme_strripos)
|
||||
{
|
||||
unsigned char *haystack, *needle;
|
||||
int haystack_len, needle_len;
|
||||
long loffset = 0;
|
||||
php_int_t loffset = 0;
|
||||
int32_t offset = 0;
|
||||
int32_t ret_pos;
|
||||
int is_ascii;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (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 );
|
||||
@ -401,7 +401,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||
unsigned char *str, *sub_str;
|
||||
UChar *ustr;
|
||||
int str_len, sub_str_len, ustr_len;
|
||||
long lstart = 0, length = 0;
|
||||
php_int_t 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, "sl|l", (char **)&str, &str_len, &lstart, &length) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|i", (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;
|
||||
long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */
|
||||
long lstart = 0; /* starting position in str in bytes */
|
||||
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 */
|
||||
int32_t start = 0;
|
||||
long extract_type = GRAPHEME_EXTRACT_TYPE_COUNT;
|
||||
php_int_t 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, "sl|llz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|iiz", (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 );
|
||||
@ -898,7 +898,7 @@ PHP_FUNCTION(grapheme_extract)
|
||||
*/
|
||||
|
||||
if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : str_len ) ) {
|
||||
long nsize = ( size < str_len ? size : str_len );
|
||||
php_int_t nsize = ( size < str_len ? size : str_len );
|
||||
if ( NULL != next ) {
|
||||
ZVAL_INT(next, start+nsize);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ 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, (long)info.errors);
|
||||
add_assoc_int_ex(idna_info, "errors", sizeof("errors")-1, (php_int_t)info.errors);
|
||||
}
|
||||
|
||||
if (!buffer_used) {
|
||||
@ -265,13 +265,13 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
{
|
||||
char *domain;
|
||||
int domain_len;
|
||||
long option = 0,
|
||||
php_int_t 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|llz/",
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|iiz/",
|
||||
&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... */
|
||||
|
@ -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, (long ) pe->line );
|
||||
smart_str_append_int( &ret, (php_int_t ) 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, (long ) pe->offset );
|
||||
smart_str_append_int( &ret, (php_int_t ) pe->offset );
|
||||
any = 1;
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
|
||||
|
||||
// Key related variables
|
||||
zend_string *str_index;
|
||||
ulong num_index;
|
||||
php_uint_t num_index;
|
||||
|
||||
ZEND_HASH_FOREACH_KEY_VAL(args, num_index, str_index, elem) {
|
||||
Formattable& formattable = fargs[argNum];
|
||||
|
@ -34,7 +34,7 @@ PHP_FUNCTION( normalizer_normalize )
|
||||
{
|
||||
char* input = NULL;
|
||||
/* form is optional, defaults to FORM_C */
|
||||
long form = NORMALIZER_DEFAULT;
|
||||
php_int_t 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|l",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i",
|
||||
&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 */
|
||||
long form = NORMALIZER_DEFAULT;
|
||||
php_int_t 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|l",
|
||||
if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i",
|
||||
&input, &input_len, &form) == FAILURE )
|
||||
{
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
|
@ -50,7 +50,7 @@ ZEND_BEGIN_MODULE_GLOBALS(intl)
|
||||
collator_compare_func_t compare_func;
|
||||
UBreakIterator* grapheme_iterator;
|
||||
intl_error g_error;
|
||||
long error_level;
|
||||
php_int_t error_level;
|
||||
zend_bool use_exceptions;
|
||||
ZEND_END_MODULE_GLOBALS(intl)
|
||||
|
||||
|
@ -32,7 +32,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
|
||||
const int32_t* vfield;
|
||||
int32_t ilen;
|
||||
int i;
|
||||
long lfield;
|
||||
php_int_t lfield;
|
||||
ResourceBundle_object* newrb;
|
||||
|
||||
restype = ures_getType( source->child );
|
||||
|
@ -259,7 +259,7 @@ PHP_FUNCTION( resourcebundle_get )
|
||||
/* }}} */
|
||||
|
||||
/* {{{ resourcebundle_array_count */
|
||||
int resourcebundle_array_count(zval *object, long *count TSRMLS_DC)
|
||||
int resourcebundle_array_count(zval *object, php_int_t *count TSRMLS_DC)
|
||||
{
|
||||
ResourceBundle_object *rb;
|
||||
RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK;
|
||||
|
@ -25,10 +25,10 @@ typedef struct {
|
||||
zend_object_iterator intern;
|
||||
ResourceBundle_object *subject;
|
||||
zend_bool is_table;
|
||||
long length;
|
||||
php_int_t length;
|
||||
zval current;
|
||||
char *currentkey;
|
||||
long i;
|
||||
php_int_t i;
|
||||
} ResourceBundle_iterator;
|
||||
|
||||
zend_object_iterator *resourcebundle_get_iterator( zend_class_entry *ce, zval *object, int byref TSRMLS_DC );
|
||||
|
@ -115,10 +115,10 @@ PHP_METHOD(Spoofchecker, setAllowedLocales)
|
||||
*/
|
||||
PHP_METHOD(Spoofchecker, setChecks)
|
||||
{
|
||||
long checks;
|
||||
php_int_t checks;
|
||||
SPOOFCHECKER_METHOD_INIT_VARS;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &checks)) {
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &checks)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <zend_exceptions.h>
|
||||
|
||||
static int create_transliterator( char *str_id, int str_id_len, long direction, zval *object TSRMLS_DC )
|
||||
static int create_transliterator( char *str_id, int str_id_len, php_int_t 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;
|
||||
long direction = TRANSLITERATOR_FORWARD;
|
||||
php_int_t direction = TRANSLITERATOR_FORWARD;
|
||||
int res;
|
||||
|
||||
TRANSLITERATOR_METHOD_INIT_VARS;
|
||||
|
||||
(void) to; /* unused */
|
||||
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i",
|
||||
&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;
|
||||
long direction = TRANSLITERATOR_FORWARD;
|
||||
php_int_t 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|l",
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i",
|
||||
&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;
|
||||
long start = 0,
|
||||
php_int_t 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|ll",
|
||||
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ii",
|
||||
&arg1, &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( (long) TRANSLITERATOR_ERROR_CODE( to ) );
|
||||
RETURN_INT( (php_int_t) TRANSLITERATOR_ERROR_CODE( to ) );
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user