Skip to content

Commit

Permalink
Use size_of_val on slices for binary size
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Oct 14, 2023
1 parent bd7762c commit e7a90c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,19 +276,19 @@ impl Device {
}
control::Value::CompoundU8(ref val) => {
control.__bindgen_anon_1.p_u8 = val.as_ptr() as *mut u8;
control.size = (val.len() * std::mem::size_of::<u8>()) as u32;
control.size = std::mem::size_of_val(val.as_slice()) as u32;
}
control::Value::CompoundU16(ref val) => {
control.__bindgen_anon_1.p_u16 = val.as_ptr() as *mut u16;
control.size = (val.len() * std::mem::size_of::<u16>()) as u32;
control.size = std::mem::size_of_val(val.as_slice()) as u32;
}
control::Value::CompoundU32(ref val) => {
control.__bindgen_anon_1.p_u32 = val.as_ptr() as *mut u32;
control.size = (val.len() * std::mem::size_of::<u32>()) as u32;
control.size = std::mem::size_of_val(val.as_slice()) as u32;
}
control::Value::CompoundPtr(ref val) => {
control.__bindgen_anon_1.ptr = val.as_ptr() as *mut std::os::raw::c_void;
control.size = (val.len() * std::mem::size_of::<u8>()) as u32;
control.size = std::mem::size_of_val(val.as_slice()) as u32;
}
};

Expand Down

0 comments on commit e7a90c5

Please sign in to comment.