Skip to content
Snippets Groups Projects
Commit a985ab51 authored by rswindell's avatar rswindell
Browse files

Use Spidermonkey's JS_ValueToECMAUint32() rather than our own

JS_ValueToUint32() for converting to integers where we may need the full 32
bits.
parent d5be70e3
No related branches found
No related tags found
No related merge requests found
......@@ -58,16 +58,6 @@ typedef struct
} privatemsg_t;
JSBool JS_ValueToUint32(JSContext *cx, jsval v, uint32 *ip)
{
jsdouble d;
if(!JS_ValueToNumber(cx, v, &d))
return JS_FALSE;
*ip = (uint32)d;
return JS_TRUE;
}
/* Destructor */
static void js_finalize_msgbase(JSContext *cx, JSObject *obj)
......@@ -842,7 +832,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
prop_name = "columns";
hfield_type = SMB_COLUMNS;
if(JS_GetProperty(cx, hdr, prop_name, &val) && !JSVAL_NULL_OR_VOID(val)) {
if(!JS_ValueToUint32(cx, val, &u32)) {
if(!JS_ValueToECMAUint32(cx, val, &u32)) {
JS_ReportError(cx, "Invalid \"%s\" number in header object", prop_name);
goto err;
}
......@@ -868,7 +858,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
msg->idx.votes=msg->hdr.votes;
}
if(JS_GetProperty(cx, hdr, "auxattr", &val) && !JSVAL_NULL_OR_VOID(val)) {
if(!JS_ValueToUint32(cx,val,&u32))
if(!JS_ValueToECMAUint32(cx,val,&u32))
goto err;
msg->hdr.auxattr=u32;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment