mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
Remove some dead code in windows-gnu std
This commit is contained in:
parent
f1dab244d7
commit
0c97c24a6c
@ -47,7 +47,6 @@ pub type LPWCH = *mut WCHAR;
|
|||||||
pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
|
pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
|
||||||
pub type LPWSADATA = *mut WSADATA;
|
pub type LPWSADATA = *mut WSADATA;
|
||||||
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
|
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
|
||||||
pub type LPSTR = *mut CHAR;
|
|
||||||
pub type LPWSTR = *mut WCHAR;
|
pub type LPWSTR = *mut WCHAR;
|
||||||
pub type LPFILETIME = *mut FILETIME;
|
pub type LPFILETIME = *mut FILETIME;
|
||||||
pub type LPWSABUF = *mut WSABUF;
|
pub type LPWSABUF = *mut WSABUF;
|
||||||
@ -876,16 +875,6 @@ extern "system" {
|
|||||||
pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
|
pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
|
||||||
pub fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD;
|
pub fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD;
|
||||||
pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
||||||
pub fn WideCharToMultiByte(
|
|
||||||
CodePage: UINT,
|
|
||||||
dwFlags: DWORD,
|
|
||||||
lpWideCharStr: LPCWSTR,
|
|
||||||
cchWideChar: c_int,
|
|
||||||
lpMultiByteStr: LPSTR,
|
|
||||||
cbMultiByte: c_int,
|
|
||||||
lpDefaultChar: LPCSTR,
|
|
||||||
lpUsedDefaultChar: LPBOOL,
|
|
||||||
) -> c_int;
|
|
||||||
|
|
||||||
pub fn closesocket(socket: SOCKET) -> c_int;
|
pub fn closesocket(socket: SOCKET) -> c_int;
|
||||||
pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int;
|
pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int;
|
||||||
|
@ -4,7 +4,6 @@ use crate::ffi::{OsStr, OsString};
|
|||||||
use crate::io::ErrorKind;
|
use crate::io::ErrorKind;
|
||||||
use crate::os::windows::ffi::{OsStrExt, OsStringExt};
|
use crate::os::windows::ffi::{OsStrExt, OsStringExt};
|
||||||
use crate::path::PathBuf;
|
use crate::path::PathBuf;
|
||||||
use crate::ptr;
|
|
||||||
use crate::time::Duration;
|
use crate::time::Duration;
|
||||||
|
|
||||||
pub use self::rand::hashmap_random_keys;
|
pub use self::rand::hashmap_random_keys;
|
||||||
@ -206,58 +205,6 @@ fn os2path(s: &[u16]) -> PathBuf {
|
|||||||
PathBuf::from(OsString::from_wide(s))
|
PathBuf::from(OsString::from_wide(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)] // Only used in backtrace::gnu::get_executable_filename()
|
|
||||||
fn wide_char_to_multi_byte(
|
|
||||||
code_page: u32,
|
|
||||||
flags: u32,
|
|
||||||
s: &[u16],
|
|
||||||
no_default_char: bool,
|
|
||||||
) -> crate::io::Result<Vec<i8>> {
|
|
||||||
unsafe {
|
|
||||||
let mut size = c::WideCharToMultiByte(
|
|
||||||
code_page,
|
|
||||||
flags,
|
|
||||||
s.as_ptr(),
|
|
||||||
s.len() as i32,
|
|
||||||
ptr::null_mut(),
|
|
||||||
0,
|
|
||||||
ptr::null(),
|
|
||||||
ptr::null_mut(),
|
|
||||||
);
|
|
||||||
if size == 0 {
|
|
||||||
return Err(crate::io::Error::last_os_error());
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut buf = Vec::with_capacity(size as usize);
|
|
||||||
buf.set_len(size as usize);
|
|
||||||
|
|
||||||
let mut used_default_char = c::FALSE;
|
|
||||||
size = c::WideCharToMultiByte(
|
|
||||||
code_page,
|
|
||||||
flags,
|
|
||||||
s.as_ptr(),
|
|
||||||
s.len() as i32,
|
|
||||||
buf.as_mut_ptr(),
|
|
||||||
buf.len() as i32,
|
|
||||||
ptr::null(),
|
|
||||||
if no_default_char { &mut used_default_char } else { ptr::null_mut() },
|
|
||||||
);
|
|
||||||
if size == 0 {
|
|
||||||
return Err(crate::io::Error::last_os_error());
|
|
||||||
}
|
|
||||||
if no_default_char && used_default_char == c::TRUE {
|
|
||||||
return Err(crate::io::Error::new(
|
|
||||||
crate::io::ErrorKind::InvalidData,
|
|
||||||
"string cannot be converted to requested code page",
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
buf.set_len(size as usize);
|
|
||||||
|
|
||||||
Ok(buf)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] {
|
pub fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] {
|
||||||
match unrolled_find_u16s(0, v) {
|
match unrolled_find_u16s(0, v) {
|
||||||
// don't include the 0
|
// don't include the 0
|
||||||
|
Loading…
Reference in New Issue
Block a user