From 98ef10716c5b0509d6bd6503737e103ffd519df6 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sat, 6 Nov 2021 10:10:04 +0100 Subject: [PATCH] fix(inject): fix wrong char type that prevented compilation on ARM. Fix #801 --- espanso-inject/src/evdev/state.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/espanso-inject/src/evdev/state.rs b/espanso-inject/src/evdev/state.rs index 5a962b1..381dd88 100644 --- a/espanso-inject/src/evdev/state.rs +++ b/espanso-inject/src/evdev/state.rs @@ -1,7 +1,7 @@ // This code is a port of the libxkbcommon "interactive-evdev.c" example // https://github.com/xkbcommon/libxkbcommon/blob/master/tools/interactive-evdev.c -use std::ffi::CStr; +use std::{ffi::CStr, os::raw::c_char}; use scopeguard::ScopeGuard; @@ -48,17 +48,17 @@ impl State { } pub fn get_string(&self, code: u32) -> Option { - let mut buffer: [u8; 16] = [0; 16]; + let mut buffer: [c_char; 16] = [0; 16]; let len = unsafe { xkb_state_key_get_utf8( self.state, code, - buffer.as_mut_ptr() as *mut i8, + buffer.as_mut_ptr(), std::mem::size_of_val(&buffer), ) }; if len > 0 { - let content_raw = unsafe { CStr::from_ptr(buffer.as_ptr() as *mut i8) }; + let content_raw = unsafe { CStr::from_ptr(buffer.as_ptr()) }; let string = content_raw.to_string_lossy().to_string(); if string.is_empty() { None