Commit c51b8102 authored by Ray Strode's avatar Ray Strode

jsauthority: switch from JS_ConvertArguments to JS::CallArgsFromVp

Signed-off-by: Ray Strode's avatarRay Strode <rstrode@redhat.com>

https://bugs.freedesktop.org/show_bug.cgi?id=105865
parent cda7a100
......@@ -1290,20 +1290,18 @@ js_polkit_log (JSContext *cx,
{
/* PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); */
bool ret = false;
JSString *str;
char *s;
if (!JS_ConvertArguments (cx, argc, JS_ARGV (cx, vp), "S", &str))
goto out;
JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
s = JS_EncodeString (cx, str);
s = JS_EncodeString (cx, args[0].toString ());
JS_ReportWarningUTF8 (cx, s);
JS_free (cx, s);
ret = true;
JS_SET_RVAL (cx, vp, JS::UndefinedValue()); /* return undefined */
out:
args.rval ().setUndefined (); /* return undefined */
return ret;
}
......@@ -1375,7 +1373,7 @@ js_polkit_spawn (JSContext *cx,
{
/* PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); */
bool ret = false;
JSObject *array_object;
JS::RootedObject array_object(cx);
gchar *standard_output = NULL;
gchar *standard_error = NULL;
gint exit_status;
......@@ -1388,8 +1386,8 @@ js_polkit_spawn (JSContext *cx,
SpawnData data = {0};
guint n;
if (!JS_ConvertArguments (cx, js_argc, JS_ARGV (cx, vp), "o", &array_object))
goto out;
JS::CallArgs args = JS::CallArgsFromVp (js_argc, vp);
array_object = &args[0].toObject();
if (!JS_GetArrayLength (cx, array_object, &array_len))
{
......@@ -1400,7 +1398,7 @@ js_polkit_spawn (JSContext *cx,
argv = g_new0 (gchar*, array_len + 1);
for (n = 0; n < array_len; n++)
{
JS::Value elem_val;
JS::RootedValue elem_val(cx);
char *s;
if (!JS_GetElement (cx, array_object, n, &elem_val))
......@@ -1474,7 +1472,7 @@ js_polkit_spawn (JSContext *cx,
ret = true;
ret_jsstr = JS_NewStringCopyZ (cx, standard_output);
JS_SET_RVAL (cx, vp, JS::StringValue (ret_jsstr));
args.rval ().setString (ret_jsstr);
out:
g_strfreev (argv);
......@@ -1498,17 +1496,14 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
{
/* PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); */
bool ret = false;
JSString *user_str;
JSString *netgroup_str;
char *user;
char *netgroup;
bool is_in_netgroup = false;
if (!JS_ConvertArguments (cx, argc, JS_ARGV (cx, vp), "SS", &user_str, &netgroup_str))
goto out;
JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
user = JS_EncodeString (cx, user_str);
netgroup = JS_EncodeString (cx, netgroup_str);
user = JS_EncodeString (cx, args[0].toString());
netgroup = JS_EncodeString (cx, args[1].toString());
if (innetgr (netgroup,
NULL, /* host */
......@@ -1523,8 +1518,8 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
ret = true;
JS_SET_RVAL (cx, vp, JS::BooleanValue (is_in_netgroup));
out:
args.rval ().setBoolean (is_in_netgroup);
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment