Commit 24eee2df authored by Alex Richardson's avatar Alex Richardson Committed by Alex Richardson
Browse files

Cast via uintptr_t when converting between integers and pointers

When casting from integer to pointer, promoting the integer to (u)intptr_t
will ensure that the resulting type can be converted to a pointer without
problems. These two casts changed in this commit trigger a warning when
building for CHERI-enabled architectures such as Arm Morello. This is not
just limited to CHERI, the cast from xcb_pixmap_t (uint32_t) to void*
should also be flagged by -Wint-to-void-pointer-cast when using Clang,
however, it appears that warning only handles C-style casts, and not
reinterpret_cast (
parent dd6d0b22
Pipeline #140552 passed with stage
in 23 minutes and 54 seconds
......@@ -225,7 +225,7 @@ EGLSurface EglOnXBackend::createSurface(xcb_window_t window)
// a c style cast as there are (buggy) platforms where the size of the Window
// type is not the same as the size of EGLNativeWindowType, reinterpret_cast<>()
// may not compile.
surface = eglCreateWindowSurface(eglDisplay(), config(), (EGLNativeWindowType) nativeWindow, nullptr);
surface = eglCreateWindowSurface(eglDisplay(), config(), (EGLNativeWindowType)(uintptr_t)nativeWindow, nullptr);
return surface;
......@@ -228,8 +228,11 @@ bool EglPixmapTexturePrivate::create(SurfacePixmapX11 *pixmap)
m_image = eglCreateImageKHR(m_backend->eglDisplay(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR,
reinterpret_cast<EGLClientBuffer>(nativePixmap), attribs);
m_image = eglCreateImageKHR(m_backend->eglDisplay(),
if (EGL_NO_IMAGE_KHR == m_image) {
qCDebug(KWIN_CORE) << "failed to create egl image";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment