Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit decdb06

Browse files
committedJul 15, 2024
Don't re-export c_int from c
1 parent a1a1c6a commit decdb06

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed
 

‎std/src/sys/pal/windows/c.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
use crate::ffi::CStr;
99
use crate::mem;
10-
pub use crate::os::raw::c_int;
11-
use crate::os::raw::{c_char, c_uint, c_ulong, c_ushort, c_void};
10+
use crate::os::raw::{c_char, c_int, c_uint, c_ulong, c_ushort, c_void};
1211
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
1312
use crate::ptr;
1413

‎std/src/sys/pal/windows/stdio.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
181181
c::CP_UTF8, // CodePage
182182
c::MB_ERR_INVALID_CHARS, // dwFlags
183183
utf8.as_ptr(), // lpMultiByteStr
184-
utf8.len() as c::c_int, // cbMultiByte
184+
utf8.len() as i32, // cbMultiByte
185185
utf16.as_mut_ptr() as *mut c::WCHAR, // lpWideCharStr
186-
utf16.len() as c::c_int, // cchWideChar
186+
utf16.len() as i32, // cchWideChar
187187
);
188188
assert!(result != 0, "Unexpected error in MultiByteToWideChar");
189189

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

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

380380
if utf16.is_empty() {
381381
return Ok(0);
@@ -386,9 +386,9 @@ fn utf16_to_utf8(utf16: &[u16], utf8: &mut [u8]) -> io::Result<usize> {
386386
c::CP_UTF8, // CodePage
387387
c::WC_ERR_INVALID_CHARS, // dwFlags
388388
utf16.as_ptr(), // lpWideCharStr
389-
utf16.len() as c::c_int, // cchWideChar
389+
utf16.len() as i32, // cchWideChar
390390
utf8.as_mut_ptr(), // lpMultiByteStr
391-
utf8.len() as c::c_int, // cbMultiByte
391+
utf8.len() as i32, // cbMultiByte
392392
ptr::null(), // lpDefaultChar
393393
ptr::null_mut(), // lpUsedDefaultChar
394394
)

0 commit comments

Comments
 (0)
Failed to load comments.