fix dom bindings for android(and 32bit system) build

This commit is contained in:
aydin.kim 2013-05-27 17:01:27 +09:00
parent 730c10e6aa
commit da2ccb048e
3 changed files with 5 additions and 5 deletions

View file

@ -1563,7 +1563,7 @@ for (uint32_t i = 0; i < length; ++i) {
raise TypeError("We don't support nullable enumerated return types " raise TypeError("We don't support nullable enumerated return types "
"yet") "yet")
return ("""assert!((%(result)s as uint) < %(strings)s.len()); return ("""assert!((%(result)s as uint) < %(strings)s.len());
let %(resultStr)s: *JSString = JS_NewStringCopyN(cx, ptr::to_unsafe_ptr(&%(strings)s[%(result)s as u32].value[0]) as *i8, %(strings)s[%(result)s as u32].length as u64); let %(resultStr)s: *JSString = JS_NewStringCopyN(cx, ptr::to_unsafe_ptr(&%(strings)s[%(result)s as u32].value[0]) as *i8, %(strings)s[%(result)s as u32].length as libc::size_t);
if %(resultStr)s.is_null() { if %(resultStr)s.is_null() {
return 0; return 0;
} }

View file

@ -70,7 +70,7 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
unsafe { unsafe {
let name = str::raw::from_c_str(className); let name = str::raw::from_c_str(className);
let nchars = "[object ]".len() + name.len(); let nchars = "[object ]".len() + name.len();
let chars: *mut jschar = cast::transmute(JS_malloc(cx, (nchars + 1) as u64 * (size_of::<jschar>() as u64))); let chars: *mut jschar = cast::transmute(JS_malloc(cx, (nchars + 1) as libc::size_t * (size_of::<jschar>() as libc::size_t)));
if chars.is_null() { if chars.is_null() {
return ptr::null(); return ptr::null();
} }
@ -80,7 +80,7 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
*chars.offset(i as int) = c as jschar; *chars.offset(i as int) = c as jschar;
} }
*chars.offset(nchars as int) = 0; *chars.offset(nchars as int) = 0;
let jsstr = JS_NewUCString(cx, cast::transmute(chars), nchars as u64); let jsstr = JS_NewUCString(cx, cast::transmute(chars), nchars as libc::size_t);
if jsstr.is_null() { if jsstr.is_null() {
JS_free(cx, cast::transmute(chars)); JS_free(cx, cast::transmute(chars));
} }

View file

@ -37,8 +37,8 @@ use js::{JSPROP_SETTER, JSVAL_VOID, JSVAL_TRUE, JSVAL_FALSE};
use js::{JS_THIS_OBJECT, JSFUN_CONSTRUCTOR, JS_CALLEE, JSPROP_READONLY}; use js::{JS_THIS_OBJECT, JSFUN_CONSTRUCTOR, JS_CALLEE, JSPROP_READONLY};
use js; use js;
static TOSTRING_CLASS_RESERVED_SLOT: u64 = 0; static TOSTRING_CLASS_RESERVED_SLOT: libc::size_t = 0;
static TOSTRING_NAME_RESERVED_SLOT: u64 = 1; static TOSTRING_NAME_RESERVED_SLOT: libc::size_t = 1;
struct GlobalStaticData { struct GlobalStaticData {
proxy_handlers: HashMap<uint, *libc::c_void>, proxy_handlers: HashMap<uint, *libc::c_void>,