Skip to content

Commit ecd986c

Browse files
committed
Fix build warnings after timelib update
1 parent 5828d54 commit ecd986c

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

ext/date/php_date.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ PHP_MINFO_FUNCTION(date)
458458
/* }}} */
459459

460460
/* {{{ Timezone Cache functions */
461-
static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_tzdb *tzdb)
461+
static timelib_tzinfo *php_date_parse_tzfile(const char *formal_tzname, const timelib_tzdb *tzdb)
462462
{
463463
timelib_tzinfo *tzi;
464464
int dummy_error_code;
@@ -479,7 +479,7 @@ static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_
479479
return tzi;
480480
}
481481

482-
timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib_tzdb *tzdb, int *dummy_error_code)
482+
timelib_tzinfo *php_date_parse_tzfile_wrapper(const char *formal_tzname, const timelib_tzdb *tzdb, int *dummy_error_code)
483483
{
484484
return php_date_parse_tzfile(formal_tzname, tzdb);
485485
}
@@ -987,7 +987,7 @@ PHPAPI zend_long php_parse_date(const char *string, zend_long *now)
987987
int error2;
988988
zend_long retval;
989989

990-
parsed_time = timelib_strtotime((char *) string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
990+
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
991991
if (error->error_count) {
992992
timelib_time_dtor(parsed_time);
993993
timelib_error_container_dtor(error);
@@ -2197,15 +2197,13 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, const char *time_str, size
21972197
if (time_str_len == 0) {
21982198
time_str = "";
21992199
}
2200-
// TODO: drop this const casts
2201-
dateobj->time = timelib_parse_from_format((char *) format, (char *) time_str, time_str_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
2200+
dateobj->time = timelib_parse_from_format(format, time_str, time_str_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
22022201
} else {
22032202
if (time_str_len == 0) {
22042203
time_str = "now";
22052204
time_str_len = sizeof("now") - 1;
22062205
}
2207-
// TODO: drop this const casts
2208-
dateobj->time = timelib_strtotime((char *) time_str, time_str_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
2206+
dateobj->time = timelib_strtotime(time_str, time_str_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
22092207
}
22102208

22112209
/* update last errors and warnings */
@@ -3349,11 +3347,11 @@ PHP_FUNCTION(date_diff)
33493347
}
33503348
/* }}} */
33513349

3352-
static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz, size_t tz_len) /* {{{ */
3350+
static int timezone_initialize(php_timezone_obj *tzobj, const char *tz, size_t tz_len) /* {{{ */
33533351
{
33543352
timelib_time *dummy_t = ecalloc(1, sizeof(timelib_time));
33553353
int dst, not_found;
3356-
char *orig_tz = tz;
3354+
const char *orig_tz = tz;
33573355

33583356
if (strlen(tz) != tz_len) {
33593357
php_error_docref(NULL, E_WARNING, "Timezone must not contain null bytes");

0 commit comments

Comments
 (0)