Skip to content

Commit 8f6612a

Browse files
committed
ext/date: Fix some [-Wsign-compare] warnings
1 parent 86a4fa3 commit 8f6612a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ext/date/php_date.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,7 +4294,7 @@ PHP_FUNCTION(timezone_transitions_get)
42944294
{
42954295
zval *object, element;
42964296
php_timezone_obj *tzobj;
4297-
int begin = 0;
4297+
uint64_t begin = 0;
42984298
bool found;
42994299
zend_long timestamp_begin = ZEND_LONG_MIN, timestamp_end = INT32_MAX;
43004300

@@ -4383,8 +4383,7 @@ PHP_FUNCTION(timezone_transitions_get)
43834383
add_nominal();
43844384
}
43854385
} else {
4386-
unsigned int i;
4387-
for (i = begin; i < tzobj->tzi.tz->bit64.timecnt; ++i) {
4386+
for (uint64_t i = begin; i < tzobj->tzi.tz->bit64.timecnt; ++i) {
43884387
if (tzobj->tzi.tz->trans[i] < timestamp_end) {
43894388
add(i, tzobj->tzi.tz->trans[i]);
43904389
} else {
@@ -4393,7 +4392,6 @@ PHP_FUNCTION(timezone_transitions_get)
43934392
}
43944393
}
43954394
if (tzobj->tzi.tz->posix_info && tzobj->tzi.tz->posix_info->dst_end) {
4396-
int i, j;
43974395
timelib_sll start_y, end_y, dummy_m, dummy_d;
43984396
timelib_sll last_transition_ts = tzobj->tzi.tz->trans[tzobj->tzi.tz->bit64.timecnt - 1];
43994397

@@ -4403,12 +4401,12 @@ PHP_FUNCTION(timezone_transitions_get)
44034401
/* Find out year for final boundary timestamp */
44044402
timelib_unixtime2date(timestamp_end, &end_y, &dummy_m, &dummy_d);
44054403

4406-
for (i = start_y; i <= end_y; i++) {
4404+
for (timelib_sll i = start_y; i <= end_y; i++) {
44074405
timelib_posix_transitions transitions = { 0 };
44084406

44094407
timelib_get_transitions_for_year(tzobj->tzi.tz, i, &transitions);
44104408

4411-
for (j = 0; j < transitions.count; j++) {
4409+
for (size_t j = 0; j < transitions.count; j++) {
44124410
if (transitions.times[j] <= last_transition_ts) {
44134411
continue;
44144412
}

0 commit comments

Comments
 (0)