Skip to content

Commit

Permalink
Don't re-export c_int from c
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Jul 14, 2024
1 parent 8cb170b commit 1d46193
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions library/std/src/sys/pal/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

use crate::ffi::CStr;
use crate::mem;
pub use crate::os::raw::c_int;
use crate::os::raw::{c_char, c_uint, c_ulong, c_ushort, c_void};
use crate::os::raw::{c_char, c_int, c_uint, c_ulong, c_ushort, c_void};
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
use crate::ptr;

Expand Down
12 changes: 6 additions & 6 deletions library/std/src/sys/pal/windows/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
c::CP_UTF8, // CodePage
c::MB_ERR_INVALID_CHARS, // dwFlags
utf8.as_ptr(), // lpMultiByteStr
utf8.len() as c::c_int, // cbMultiByte
utf8.len() as i32, // cbMultiByte
utf16.as_mut_ptr() as *mut c::WCHAR, // lpWideCharStr
utf16.len() as c::c_int, // cchWideChar
utf16.len() as i32, // cchWideChar
);
assert!(result != 0, "Unexpected error in MultiByteToWideChar");

Expand Down Expand Up @@ -374,8 +374,8 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [MaybeUninit<u16>]) -> io::Result<usiz
}

fn utf16_to_utf8(utf16: &[u16], utf8: &mut [u8]) -> io::Result<usize> {
debug_assert!(utf16.len() <= c::c_int::MAX as usize);
debug_assert!(utf8.len() <= c::c_int::MAX as usize);
debug_assert!(utf16.len() <= i32::MAX as usize);
debug_assert!(utf8.len() <= i32::MAX as usize);

if utf16.is_empty() {
return Ok(0);
Expand All @@ -386,9 +386,9 @@ fn utf16_to_utf8(utf16: &[u16], utf8: &mut [u8]) -> io::Result<usize> {
c::CP_UTF8, // CodePage
c::WC_ERR_INVALID_CHARS, // dwFlags
utf16.as_ptr(), // lpWideCharStr
utf16.len() as c::c_int, // cchWideChar
utf16.len() as i32, // cchWideChar
utf8.as_mut_ptr(), // lpMultiByteStr
utf8.len() as c::c_int, // cbMultiByte
utf8.len() as i32, // cbMultiByte
ptr::null(), // lpDefaultChar
ptr::null_mut(), // lpUsedDefaultChar
)
Expand Down

0 comments on commit 1d46193

Please sign in to comment.