a/util: Fix printf formatting on 32-bit

This commit is contained in:
Ryan Pavlik 2023-03-02 15:11:20 -06:00 committed by Jakob Bornecrantz
parent 44d6755814
commit fd2c7c6a98
2 changed files with 11 additions and 5 deletions

View file

@ -11,6 +11,7 @@
#include "util/u_trace_marker.h" #include "util/u_trace_marker.h"
#include "util/u_logging.h" #include "util/u_logging.h"
#include <inttypes.h>
/*! /*!
* An @ref xrt_imu_sink splitter. * An @ref xrt_imu_sink splitter.
@ -34,11 +35,13 @@ split_sample(struct xrt_imu_sink *xfs, struct xrt_imu_sample *sample)
struct u_imu_sink_force_monotonic *s = (struct u_imu_sink_force_monotonic *)xfs; struct u_imu_sink_force_monotonic *s = (struct u_imu_sink_force_monotonic *)xfs;
if (sample->timestamp_ns == s->last_ts) { if (sample->timestamp_ns == s->last_ts) {
U_LOG_W("Got an IMU sample with a duplicate timestamp! Old: %lu; New: %lu", s->last_ts, U_LOG_W("Got an IMU sample with a duplicate timestamp! Old: %" PRId64 "; New: %" PRId64 "", s->last_ts,
sample->timestamp_ns); sample->timestamp_ns);
return; return;
} else if (sample->timestamp_ns < s->last_ts) { }
U_LOG_W("Got an IMU sample with a non-monotonically-increasing timestamp! Old: %lu; New: %lu", if (sample->timestamp_ns < s->last_ts) {
U_LOG_W("Got an IMU sample with a non-monotonically-increasing timestamp! Old: %" PRId64
"; New: %" PRId64 "",
s->last_ts, sample->timestamp_ns); s->last_ts, sample->timestamp_ns);
return; return;
} }

View file

@ -16,6 +16,7 @@
#include <stdio.h> #include <stdio.h>
#include <pthread.h> #include <pthread.h>
#include <inttypes.h>
/*! /*!
@ -141,9 +142,11 @@ force_genlock_mainloop(void *ptr)
frames[1]->timestamp = ts; frames[1]->timestamp = ts;
if (ts == q->last_ts) { if (ts == q->last_ts) {
U_LOG_W("Got an image frame with a duplicate timestamp! Old: %lu; New: %lu", q->last_ts, ts); U_LOG_W("Got an image frame with a duplicate timestamp! Old: %" PRId64 "; New: %" PRId64,
q->last_ts, ts);
} else if (ts < q->last_ts) { } else if (ts < q->last_ts) {
U_LOG_W("Got an image frame with a non-monotonically-increasing timestamp! Old: %lu; New: %lu", U_LOG_W("Got an image frame with a non-monotonically-increasing timestamp! Old: %" PRId64
"; New: %" PRId64,
q->last_ts, ts); q->last_ts, ts);
} else { } else {
// Send to the consumer, in left-right order. // Send to the consumer, in left-right order.