1
0
Fork 0

Fix usage of spare_capacity_mut which isn't available in MSRV 1.59 (#190)

This commit is contained in:
Adrien Prokopowicz 2024-05-23 01:54:39 +02:00 committed by GitHub
parent 45465c5f46
commit 579130ecb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -148,15 +148,9 @@ impl DropTarget {
for i in 0..item_count { for i in 0..item_count {
let characters = DragQueryFileW(hdrop, i, null_mut(), 0); let characters = DragQueryFileW(hdrop, i, null_mut(), 0);
let buffer_size = characters as usize + 1; let buffer_size = characters as usize + 1;
let mut buffer = Vec::<u16>::with_capacity(buffer_size); let mut buffer = vec![0u16; buffer_size];
DragQueryFileW( DragQueryFileW(hdrop, i, buffer.as_mut_ptr().cast(), buffer_size as u32);
hdrop,
i,
buffer.spare_capacity_mut().as_mut_ptr().cast(),
buffer_size as u32,
);
buffer.set_len(buffer_size);
paths.push(OsString::from_wide(&buffer[..characters as usize]).into()) paths.push(OsString::from_wide(&buffer[..characters as usize]).into())
} }