mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 08:11:15 -03:00
fix: don't make assumptions about signedness of libc::c_char
This commit is contained in:
committed by
Peter Ammon
parent
0cdf801d0b
commit
4ab34f2e86
@@ -1467,10 +1467,10 @@ pub fn fish_setlocale() {
|
|||||||
|
|
||||||
/// Test if the character can be encoded using the current locale.
|
/// Test if the character can be encoded using the current locale.
|
||||||
fn can_be_encoded(wc: char) -> bool {
|
fn can_be_encoded(wc: char) -> bool {
|
||||||
let mut converted = [0_i8; AT_LEAST_MB_LEN_MAX];
|
let mut converted: [libc::c_char; AT_LEAST_MB_LEN_MAX] = [0; AT_LEAST_MB_LEN_MAX];
|
||||||
let mut state = zero_mbstate();
|
let mut state = zero_mbstate();
|
||||||
unsafe {
|
unsafe {
|
||||||
wcrtomb(&mut converted[0], wc as libc::wchar_t, &mut state) != 0_usize.wrapping_sub(1)
|
wcrtomb(converted.as_mut_ptr(), wc as libc::wchar_t, &mut state) != 0_usize.wrapping_sub(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user