From: David Carlier Date: Mon, 18 Dec 2017 22:34:37 +0000 (+0000) Subject: Avoid abs() type mismatch warnings X-Git-Tag: php-7.3.0alpha1~686 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e94f943c1943984b55de159404d480f82357f7c;p=php Avoid abs() type mismatch warnings timelib_time z field was mistakenly promoted to 64 bits types in one place. Otherwise silence warning with explicit cast down to int. --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 0442f52d33..087885ca60 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2286,7 +2286,7 @@ static HashTable *date_object_get_properties(zval *object) /* {{{ */ break; case TIMELIB_ZONETYPE_OFFSET: { zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0); - timelib_sll utc_offset = dateobj->time->z; + int utc_offset = dateobj->time->z; ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d", utc_offset < 0 ? '-' : '+', @@ -2373,8 +2373,8 @@ static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */ ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d", tzobj->tzi.utc_offset < 0 ? '-' : '+', - abs(tzobj->tzi.utc_offset / 3600), - abs(((tzobj->tzi.utc_offset % 3600) / 60))); + abs((int)(tzobj->tzi.utc_offset / 3600)), + abs(((int)(tzobj->tzi.utc_offset % 3600) / 60))); ZVAL_NEW_STR(&zv, tmpstr); } @@ -3899,8 +3899,8 @@ PHP_FUNCTION(timezone_name_get) ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d", utc_offset < 0 ? '-' : '+', - abs(utc_offset / 3600), - abs(((utc_offset % 3600) / 60))); + abs((int)(utc_offset / 3600)), + abs(((int)(utc_offset % 3600) / 60))); RETURN_NEW_STR(tmpstr); }