Skip to content

Commit cf5897a

Browse files
committed
Silence deprecation warning by using underlying code directly
plist_date_val_compare calls plist_get_date_val which is now marked deprecated. To avoid compiler warnings during build, we use the underlying implementation directly instead of calling the function to work around it.
1 parent b8cfac2 commit cf5897a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/plist.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,9 +1701,12 @@ int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t cmpusec)
17011701
if (!PLIST_IS_DATE(datenode)) {
17021702
return -1;
17031703
}
1704-
int32_t sec = 0;
1705-
int32_t usec = 0;
1706-
plist_get_date_val(datenode, &sec, &usec);
1704+
plist_data_t data = plist_get_data(datenode);
1705+
assert(data->length == sizeof(double));
1706+
double val = data->realval;
1707+
int32_t sec = (int32_t)val;
1708+
val = fabs((val - (int64_t)val) * 1000000);
1709+
int32_t usec = (int32_t)val;
17071710
uint64_t dateval = ((int64_t)sec << 32) | usec;
17081711
uint64_t cmpval = ((int64_t)cmpsec << 32) | cmpusec;
17091712
if (dateval == cmpval) {

0 commit comments

Comments
 (0)