fix(napi): windows-i686 release build problem
This commit is contained in:
parent
add6e2b9dc
commit
1669b3a8f1
2 changed files with 6 additions and 4 deletions
|
@ -344,13 +344,15 @@ impl Env {
|
|||
|
||||
pub fn create_function(&self, name: &str, callback: Callback) -> Result<JsFunction> {
|
||||
let mut raw_result = ptr::null_mut();
|
||||
let name = CString::new(name.to_owned())?;
|
||||
let len = name.as_bytes().len();
|
||||
check_status(unsafe {
|
||||
sys::napi_create_function(
|
||||
self.0,
|
||||
name.as_ptr() as *const c_char,
|
||||
name.len() as _,
|
||||
name.into_raw(),
|
||||
len,
|
||||
Some(callback),
|
||||
callback as *mut c_void,
|
||||
ptr::null_mut(),
|
||||
&mut raw_result,
|
||||
)
|
||||
})?;
|
||||
|
|
|
@ -257,7 +257,7 @@ macro_rules! impl_object_methods {
|
|||
where
|
||||
T: NapiValue,
|
||||
{
|
||||
let key = CString::new(name)?;
|
||||
let key = CString::new(name.to_owned())?;
|
||||
check_status(unsafe {
|
||||
sys::napi_set_named_property(self.0.env, self.0.value, key.as_ptr(), value.raw())
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue