com php-src: Avoid abs() type mismatch warnings: ext/date/php _date.c
| From: | Nikita Popov | Date: | Sat, 06 Jan 2018 20:51:31 +0000 |
| Subject: | com php-src: Avoid abs() type mismatch warnings: ext/date/php _date.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100806@lists.php.net to get a copy of this message | ||
Commit: 6e94f943c1943984b55de159404d480f82357f7c
Author: David Carlier <devnexen@gmail.com> Mon, 18 Dec 2017 22:34:37 +0000
Committer: Nikita Popov <nikita.ppv@gmail.com> Sat, 6 Jan 2018 21:51:31 +0100
Parents: a95e8b80db1bb41844978f70cee93691b3c7206f
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6e94f943c1943984b55de159404d480f82357f7c
Log:
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..
Changed paths:
M ext/date/php_date.c
Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 0442f52..087885c 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);
}