mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
Bug 435288 - Deprecate JS_NewDouble and JS_NewDoubleValue, add correctness assertions (r=brendan)
This commit is contained in:
parent
1d75986c69
commit
8d7a73885f
@ -345,7 +345,7 @@ JS_PushArgumentsVA(JSContext *cx, void **markp, const char *format, va_list ap)
|
||||
break;
|
||||
case 'd':
|
||||
case 'I':
|
||||
if (!JS_NewDoubleValue(cx, va_arg(ap, jsdouble), sp))
|
||||
if (!JS_NewNumberValue(cx, va_arg(ap, jsdouble), sp))
|
||||
goto bad;
|
||||
break;
|
||||
case 's':
|
||||
@ -1831,16 +1831,25 @@ JS_strdup(JSContext *cx, const char *s)
|
||||
JS_PUBLIC_API(jsdouble *)
|
||||
JS_NewDouble(JSContext *cx, jsdouble d)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
jsint i;
|
||||
#endif
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
JS_ASSERT(!JSDOUBLE_IS_INT(d, i) || !INT_FITS_IN_JSVAL(i));
|
||||
return js_NewWeaklyRootedDouble(cx, d);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_NewDoubleValue(JSContext *cx, jsdouble d, jsval *rval)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
jsint i;
|
||||
#endif
|
||||
jsdouble *dp;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
JS_ASSERT(!JSDOUBLE_IS_INT(d, i) || !INT_FITS_IN_JSVAL(i));
|
||||
dp = js_NewWeaklyRootedDouble(cx, d);
|
||||
if (!dp)
|
||||
return JS_FALSE;
|
||||
|
@ -699,9 +699,11 @@ JS_free(JSContext *cx, void *p);
|
||||
extern JS_PUBLIC_API(char *)
|
||||
JS_strdup(JSContext *cx, const char *s);
|
||||
|
||||
/* Deprecated -- use JS_NewNumberValue instead. */
|
||||
extern JS_PUBLIC_API(jsdouble *)
|
||||
JS_NewDouble(JSContext *cx, jsdouble d);
|
||||
|
||||
/* Deprecated -- use JS_NewNumberValue instead. */
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_NewDoubleValue(JSContext *cx, jsdouble d, jsval *rval);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user