diff options
Diffstat (limited to 'ext/intl/common/common_date.cpp')
-rw-r--r-- | ext/intl/common/common_date.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index ee998818d9..885d08cd2c 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -110,7 +110,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, intl_error *err, const char *func TSRMLS_DC) { zval retval; - zval *zfuncname; + zval zfuncname; char *message; if (err && U_FAILURE(err->code)) { @@ -125,11 +125,9 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, } if (millis) { - INIT_ZVAL(retval); - MAKE_STD_ZVAL(zfuncname); - ZVAL_STRING(zfuncname, "getTimestamp", 1); - if (call_user_function(NULL, &(z), zfuncname, &retval, 0, NULL TSRMLS_CC) - != SUCCESS || Z_TYPE(retval) != IS_LONG) { + ZVAL_STRING(&zfuncname, "getTimestamp"); + if (call_user_function(NULL, z, &zfuncname, &retval, 0, NULL TSRMLS_CC) + != SUCCESS || Z_TYPE(retval) != IS_INT) { spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the " "object", func); intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR, @@ -139,13 +137,13 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, return FAILURE; } - *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); + *millis = U_MILLIS_PER_SECOND * (double)Z_IVAL(retval); zval_ptr_dtor(&zfuncname); } if (tz) { php_date_obj *datetime; - datetime = (php_date_obj*)zend_object_store_get_object(z TSRMLS_CC); + datetime = Z_PHPDATE_P(z); if (!datetime->time) { spprintf(&message, 0, "%s: the DateTime object is not properly " "initialized", func); @@ -176,7 +174,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC) { double rv = NAN; - long lv; + php_int_t lv; int type; char *message; @@ -186,10 +184,10 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS switch (Z_TYPE_P(z)) { case IS_STRING: - type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0); + type = is_numeric_string(Z_STRVAL_P(z), Z_STRSIZE_P(z), &lv, &rv, 0); if (type == IS_DOUBLE) { rv *= U_MILLIS_PER_SECOND; - } else if (type == IS_LONG) { + } else if (type == IS_INT) { rv = U_MILLIS_PER_SECOND * (double)lv; } else { spprintf(&message, 0, "%s: string '%s' is not numeric, " @@ -200,8 +198,8 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS efree(message); } break; - case IS_LONG: - rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z); + case IS_INT: + rv = U_MILLIS_PER_SECOND * (double)Z_IVAL_P(z); break; case IS_DOUBLE: rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); @@ -210,8 +208,7 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS if (instanceof_function(Z_OBJCE_P(z), php_date_get_date_ce() TSRMLS_CC)) { intl_datetime_decompose(z, &rv, NULL, err, func TSRMLS_CC); } else if (instanceof_function(Z_OBJCE_P(z), Calendar_ce_ptr TSRMLS_CC)) { - Calendar_object *co = (Calendar_object *) - zend_object_store_get_object(z TSRMLS_CC ); + Calendar_object *co = Z_INTL_CALENDAR_P(z); if (co->ucal == NULL) { spprintf(&message, 0, "%s: IntlCalendar object is not properly " "constructed", func); |