From 736eb11cd53484c6768681e8d0458f1f022cf70f Mon Sep 17 00:00:00 2001 From: Christian Meissl Date: Mon, 28 Jun 2021 14:01:25 +0200 Subject: [PATCH] use platform specifc types for XlibWindow and gbm this fixes compilation on 32bit targets like armv7 --- src/backend/egl/native.rs | 5 +++-- src/wayland/dmabuf/mod.rs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backend/egl/native.rs b/src/backend/egl/native.rs index 67cf725..e7fb302 100644 --- a/src/backend/egl/native.rs +++ b/src/backend/egl/native.rs @@ -2,6 +2,7 @@ use super::{display::EGLDisplayHandle, ffi, wrap_egl_call, SwapBuffersError}; use nix::libc::{c_int, c_void}; +use std::os::raw; #[cfg(feature = "backend_gbm")] use std::os::unix::io::AsRawFd; use std::{fmt::Debug, marker::PhantomData, sync::Arc}; @@ -226,7 +227,7 @@ pub unsafe trait EGLNativeSurface: Send + Sync { #[cfg(feature = "backend_winit")] /// Typed Xlib window for the `X11` backend -pub struct XlibWindow(pub u64); +pub struct XlibWindow(pub raw::c_ulong); #[cfg(feature = "backend_winit")] unsafe impl EGLNativeSurface for XlibWindow { @@ -241,7 +242,7 @@ unsafe impl EGLNativeSurface for XlibWindow { ffi::egl::CreatePlatformWindowSurfaceEXT( display.handle, config_id, - (&mut id) as *mut u64 as *mut _, + (&mut id) as *mut raw::c_ulong as *mut _, surface_attributes.as_ptr(), ) }) diff --git a/src/wayland/dmabuf/mod.rs b/src/wayland/dmabuf/mod.rs index 18e40df..d032115 100644 --- a/src/wayland/dmabuf/mod.rs +++ b/src/wayland/dmabuf/mod.rs @@ -441,14 +441,14 @@ fn buffer_basic_checks( if let Ok(size) = ::nix::unistd::lseek(plane.fd.unwrap(), 0, ::nix::unistd::Whence::SeekEnd) { // reset the seek point let _ = ::nix::unistd::lseek(plane.fd.unwrap(), 0, ::nix::unistd::Whence::SeekSet); - if plane.offset as i64 > size { + if plane.offset as libc::off_t > size { params.as_ref().post_error( ParamError::OutOfBounds as u32, format!("Invalid offset {} for plane {}.", plane.offset, plane.plane_idx), ); return false; } - if (plane.offset + plane.stride) as i64 > size { + if (plane.offset + plane.stride) as libc::off_t > size { params.as_ref().post_error( ParamError::OutOfBounds as u32, format!("Invalid stride {} for plane {}.", plane.stride, plane.plane_idx), @@ -457,7 +457,7 @@ fn buffer_basic_checks( } // Planes > 0 can be subsampled, in which case 'size' will be smaller // than expected. - if plane.plane_idx == 0 && end as i64 > size { + if plane.plane_idx == 0 && end as libc::off_t > size { params.as_ref().post_error( ParamError::OutOfBounds as u32, format!(