chore(napi): remove useless type cast in JsBuffer

This commit is contained in:
LongYinan 2020-12-09 19:24:44 +08:00
parent 305d42d524
commit 78245b0e8f
No known key found for this signature in database
GPG key ID: A3FFE134A3E20881

View file

@ -21,12 +21,7 @@ impl JsBuffer {
let mut data = ptr::null_mut(); let mut data = ptr::null_mut();
let mut len: usize = 0; let mut len: usize = 0;
check_status!(unsafe { check_status!(unsafe {
sys::napi_get_buffer_info( sys::napi_get_buffer_info(self.0.env, self.0.value, &mut data, &mut len)
self.0.env,
self.0.value,
&mut data,
&mut len as *mut usize as *mut _,
)
})?; })?;
Ok(JsBufferValue { Ok(JsBufferValue {
data: mem::ManuallyDrop::new(unsafe { Vec::from_raw_parts(data as *mut _, len, len) }), data: mem::ManuallyDrop::new(unsafe { Vec::from_raw_parts(data as *mut _, len, len) }),