Fix a -Wformat warning on FreeBSD

On FreeBSD we get a long long result so %ld triggers a warning. Cast to
long long and use %lld to make it work on all platforms (including 32-bit).
This commit is contained in:
Alex Richardson 2021-10-06 20:49:21 +01:00 committed by Alex Richardson
parent 8ab41804f0
commit 722f092b7a
2 changed files with 8 additions and 4 deletions

View file

@ -127,8 +127,10 @@ void RenderLoopPrivate::notifyFrameCompleted(std::chrono::nanoseconds timestamp)
if (lastPresentationTimestamp <= timestamp) {
lastPresentationTimestamp = timestamp;
} else {
qCWarning(KWIN_CORE, "Got invalid presentation timestamp: %ld (current %ld)",
timestamp.count(), lastPresentationTimestamp.count());
qCWarning(KWIN_CORE,
"Got invalid presentation timestamp: %lld (current %lld)",
static_cast<long long>(timestamp.count()),
static_cast<long long>(lastPresentationTimestamp.count()));
lastPresentationTimestamp = std::chrono::steady_clock::now().time_since_epoch();
}

View file

@ -176,8 +176,10 @@ void Scene::paintScreen(const QRegion &damage, const QRegion &repaint,
std::chrono::duration_cast<std::chrono::milliseconds>(renderLoop->nextPresentationTimestamp());
if (Q_UNLIKELY(presentTime < m_expectedPresentTimestamp)) {
qCDebug(KWIN_CORE, "Provided presentation timestamp is invalid: %ld (current: %ld)",
presentTime.count(), m_expectedPresentTimestamp.count());
qCDebug(KWIN_CORE,
"Provided presentation timestamp is invalid: %lld (current: %lld)",
static_cast<long long>(presentTime.count()),
static_cast<long long>(m_expectedPresentTimestamp.count()));
} else {
m_expectedPresentTimestamp = presentTime;
}