Skip to content

Commit 56e816c

Browse files
committed
Switch from deprecated widestring function
1 parent dc37d3d commit 56e816c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

stdlib/src/socket.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,9 @@ mod _socket {
16671667
netioapi::ConvertInterfaceLuidToNameW(luid, buf.as_mut_ptr(), buf.len())
16681668
};
16691669
if ret == 0 {
1670-
Ok(widestring::WideCString::from_vec_with_nul(&buf[..]).unwrap())
1670+
Ok(widestring::WideCString::from_ustr_truncate(
1671+
widestring::WideStr::from_slice(&buf[..]),
1672+
))
16711673
} else {
16721674
Err(io::Error::from_raw_os_error(ret as i32))
16731675
}

vm/src/stdlib/nt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub(crate) mod module {
304304
return Err(errno_err(vm));
305305
}
306306
}
307-
let buffer = widestring::WideCString::from_vec_with_nul(buffer).unwrap();
307+
let buffer = widestring::WideCString::from_vec_truncate(buffer);
308308
path.mode.process_path(buffer.to_os_string(), vm)
309309
}
310310

@@ -319,7 +319,7 @@ pub(crate) mod module {
319319
if ret == 0 {
320320
return Err(errno_err(vm));
321321
}
322-
let buffer = widestring::WideCString::from_vec_with_nul(buffer).unwrap();
322+
let buffer = widestring::WideCString::from_vec_truncate(buffer);
323323
path.mode.process_path(buffer.to_os_string(), vm)
324324
}
325325

0 commit comments

Comments
 (0)