summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2025-05-14 10:23:37 +0200
committerGravatar Nikias Bassen2025-05-14 10:23:37 +0200
commitcf5897a71ea412ea2aeb1e2f6b5ea74d4fabfd8c (patch)
tree4dd07870482794e7c6584a7ed9cb57aae3413572
parentb8cfac2aae312225ffb9bee944a4d84dbb73fbcd (diff)
downloadlibplist-2.7.0.tar.gz
libplist-2.7.0.tar.bz2
Silence deprecation warning by using underlying code directly2.7.0
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.
-rw-r--r--src/plist.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plist.c b/src/plist.c
index 4fc2f00..a33a6fb 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -1701,9 +1701,12 @@ int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t cmpusec)
if (!PLIST_IS_DATE(datenode)) {
return -1;
}
- int32_t sec = 0;
- int32_t usec = 0;
- plist_get_date_val(datenode, &sec, &usec);
+ plist_data_t data = plist_get_data(datenode);
+ assert(data->length == sizeof(double));
+ double val = data->realval;
+ int32_t sec = (int32_t)val;
+ val = fabs((val - (int64_t)val) * 1000000);
+ int32_t usec = (int32_t)val;
uint64_t dateval = ((int64_t)sec << 32) | usec;
uint64_t cmpval = ((int64_t)cmpsec << 32) | cmpusec;
if (dateval == cmpval) {