Bug 482384 - Fix GCC warnings about casting between data and function pointers. r+sr=jst

--HG--
extra : rebase_source : bb9356f20f563511e5f4bd3e4308e1f82b1f8d52
This commit is contained in:
Blake Kaplan 2009-03-10 15:21:25 -07:00
parent 578a60f6cd
commit a8a28deffb
4 changed files with 12 additions and 10 deletions

View File

@ -6290,7 +6290,8 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
if (!::JS_DefineUCProperty(cx, windowObj, ::JS_GetStringChars(str),
::JS_GetStringLength(str), JSVAL_VOID,
(JSPropertyOp)funObj, nsnull,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funObj),
nsnull,
JSPROP_ENUMERATE | JSPROP_GETTER |
JSPROP_SHARED)) {
return NS_ERROR_FAILURE;

View File

@ -211,8 +211,8 @@ ReifyPropertyOps(JSContext *cx, JSObject *obj, jsval idval, jsid interned_id,
if(setterobjp)
*setterobjp = setterobj;
return JS_DefinePropertyById(cx, obj, interned_id, JSVAL_VOID,
(JSPropertyOp)getterobj,
(JSPropertyOp)setterobj,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, getterobj),
JS_DATA_TO_FUNC_PTR(JSPropertyOp, setterobj),
attrs);
}
@ -256,7 +256,7 @@ LookupGetterOrSetter(JSContext *cx, JSBool wantGetter, jsval *vp)
if(attrs & JSPROP_GETTER)
{
JS_SET_RVAL(cx, vp,
OBJECT_TO_JSVAL(reinterpret_cast<JSObject *>(getter)));
OBJECT_TO_JSVAL(JS_FUNC_TO_DATA_PTR(JSObject *, getter)));
return JS_TRUE;
}
}
@ -265,7 +265,7 @@ LookupGetterOrSetter(JSContext *cx, JSBool wantGetter, jsval *vp)
if(attrs & JSPROP_SETTER)
{
JS_SET_RVAL(cx, vp,
OBJECT_TO_JSVAL(reinterpret_cast<JSObject *>(setter)));
OBJECT_TO_JSVAL(JS_FUNC_TO_DATA_PTR(JSObject *, setter)));
return JS_TRUE;
}
}

View File

@ -1470,13 +1470,13 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
{
// JSPROP_GETTER means the getter is actually a
// function object.
ccx.SetCallee((JSObject*)getter);
ccx.SetCallee(JS_FUNC_TO_DATA_PTR(JSObject*, getter));
}
else if(XPT_MD_IS_SETTER(info->flags) && (attrs & JSPROP_SETTER))
{
// JSPROP_SETTER means the setter is actually a
// function object.
ccx.SetCallee((JSObject*)setter);
ccx.SetCallee(JS_FUNC_TO_DATA_PTR(JSObject*, setter));
}
}
}

View File

@ -378,7 +378,8 @@ DefinePropertyIfFound(XPCCallContext& ccx,
if(resolved)
*resolved = JS_TRUE;
return OBJ_DEFINE_PROPERTY(ccx, obj, id, JSVAL_VOID,
(JSPropertyOp) funobj, nsnull,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj),
nsnull,
propFlags, nsnull);
}
@ -484,8 +485,8 @@ DefinePropertyIfFound(XPCCallContext& ccx,
JSObject* funobj = JSVAL_TO_OBJECT(funval);
return JS_ValueToId(ccx, idval, &id) &&
OBJ_DEFINE_PROPERTY(ccx, obj, id, JSVAL_VOID,
(JSPropertyOp) funobj,
(JSPropertyOp) funobj,
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj),
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funobj),
propFlags, nsnull);
}