Skip to content

Commit

Permalink
Remove LPWSTR
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Jul 15, 2024
1 parent 0b22ecb commit d621d21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 0 additions & 2 deletions std/src/sys/pal/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ pub type LPCVOID = *const c_void;
pub type LPOVERLAPPED = *mut OVERLAPPED;
pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
pub type LPVOID = *mut c_void;
pub type LPWCH = *mut WCHAR;
pub type LPWSTR = *mut WCHAR;

#[cfg(target_vendor = "win7")]
pub type PSRWLOCK = *mut SRWLOCK;
Expand Down
4 changes: 2 additions & 2 deletions std/src/sys/pal/windows/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn error_string(mut errnum: i32) -> String {
}

pub struct Env {
base: c::LPWCH,
base: *mut c::WCHAR,
iter: EnvIterator,
}

Expand Down Expand Up @@ -126,7 +126,7 @@ impl Iterator for Env {
}

#[derive(Clone)]
struct EnvIterator(c::LPWCH);
struct EnvIterator(*mut c::WCHAR);

impl Iterator for EnvIterator {
type Item = (OsString, OsString);
Expand Down
12 changes: 6 additions & 6 deletions std/src/sys/pal/windows/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
// Note that this theoretically checks validity twice in the (most common) case
// where the underlying byte sequence is valid utf-8 (given the check in `write()`).
let result = c::MultiByteToWideChar(
c::CP_UTF8, // CodePage
c::MB_ERR_INVALID_CHARS, // dwFlags
utf8.as_ptr(), // lpMultiByteStr
utf8.len() as c::c_int, // cbMultiByte
utf16.as_mut_ptr() as c::LPWSTR, // lpWideCharStr
utf16.len() as c::c_int, // cchWideChar
c::CP_UTF8, // CodePage
c::MB_ERR_INVALID_CHARS, // dwFlags
utf8.as_ptr(), // lpMultiByteStr
utf8.len() as c::c_int, // cbMultiByte
utf16.as_mut_ptr() as *mut c::WCHAR, // lpWideCharStr
utf16.len() as c::c_int, // cchWideChar
);
assert!(result != 0, "Unexpected error in MultiByteToWideChar");

Expand Down

0 comments on commit d621d21

Please sign in to comment.