0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

Updated some type assertions to work with other libc implementations. (#1837)

This commit is contained in:
andy finch 2019-02-26 03:56:19 -05:00 committed by Ryan Dahl
parent d426d78ae7
commit 9ed413b318
2 changed files with 5 additions and 4 deletions

View file

@ -3,6 +3,7 @@ use crate::libdeno;
use getopts;
use getopts::Options;
use libc::c_char;
use libc::c_int;
use std::ffi::CStr;
use std::ffi::CString;
@ -343,7 +344,7 @@ pub fn v8_set_flags(args: Vec<String>) -> Vec<String> {
.collect::<Vec<_>>();
let mut c_argv = raw_argv
.iter_mut()
.map(|arg| arg.as_mut_ptr() as *mut i8)
.map(|arg| arg.as_mut_ptr() as *mut c_char)
.collect::<Vec<_>>();
// Store the length of the c_argv array in a local variable. We'll pass
@ -360,7 +361,7 @@ pub fn v8_set_flags(args: Vec<String>) -> Vec<String> {
c_argv
.iter()
.map(|ptr| unsafe {
let cstr = CStr::from_ptr(*ptr as *const i8);
let cstr = CStr::from_ptr(*ptr as *const c_char);
let slice = cstr.to_str().unwrap();
slice.to_string()
}).chain(rest.into_iter())

View file

@ -287,10 +287,10 @@ impl Isolate {
source: String,
) -> Result<libdeno::deno_mod, JSError> {
let name_ = CString::new(name.clone()).unwrap();
let name_ptr = name_.as_ptr() as *const i8;
let name_ptr = name_.as_ptr() as *const c_char;
let source_ = CString::new(source.clone()).unwrap();
let source_ptr = source_.as_ptr() as *const i8;
let source_ptr = source_.as_ptr() as *const c_char;
let id = unsafe {
libdeno::deno_mod_new(self.libdeno_isolate, name_ptr, source_ptr)