summaryrefslogtreecommitdiff
path: root/ext/intl/dateformat
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-08-25 19:24:55 +0200
committerAnatol Belski <ab@php.net>2014-08-25 19:24:55 +0200
commitc3e3c98ec666812daaaca896cf5ef758a8a6df14 (patch)
treed82a76de5c8d117d1cf2dcca19bb30a283621870 /ext/intl/dateformat
parent0cf2dbdf58645b52cb6582b1b2571c5cd9e9e6b3 (diff)
downloadphp-git-c3e3c98ec666812daaaca896cf5ef758a8a6df14.tar.gz
master renames phase 1
Diffstat (limited to 'ext/intl/dateformat')
-rw-r--r--ext/intl/dateformat/dateformat.c10
-rw-r--r--ext/intl/dateformat/dateformat_attr.c8
-rw-r--r--ext/intl/dateformat/dateformat_attrcpp.cpp4
-rw-r--r--ext/intl/dateformat/dateformat_create.cpp8
-rw-r--r--ext/intl/dateformat/dateformat_format.c10
-rw-r--r--ext/intl/dateformat/dateformat_format_object.cpp18
-rw-r--r--ext/intl/dateformat/dateformat_helpers.cpp12
-rw-r--r--ext/intl/dateformat/dateformat_helpers.h2
-rw-r--r--ext/intl/dateformat/dateformat_parse.c24
9 files changed, 48 insertions, 48 deletions
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);
}
}
/* }}} */