From 722f092b7a484ef601d27daed214a2fadbb80bee Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 6 Oct 2021 20:49:21 +0100 Subject: [PATCH] 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). --- src/renderloop.cpp | 6 ++++-- src/scene.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/renderloop.cpp b/src/renderloop.cpp index caa25228dc..c583b54df1 100644 --- a/src/renderloop.cpp +++ b/src/renderloop.cpp @@ -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(timestamp.count()), + static_cast(lastPresentationTimestamp.count())); lastPresentationTimestamp = std::chrono::steady_clock::now().time_since_epoch(); } diff --git a/src/scene.cpp b/src/scene.cpp index 9f86c0b7ed..bce81cf646 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -176,8 +176,10 @@ void Scene::paintScreen(const QRegion &damage, const QRegion &repaint, std::chrono::duration_cast(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(presentTime.count()), + static_cast(m_expectedPresentTimestamp.count())); } else { m_expectedPresentTimestamp = presentTime; }