MCPcopy Create free account
hub / github.com/GNOME/gjs / gjs_encode

Function gjs_encode

gjs/text-encoding.cpp:524–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522}
523
524GJS_JSAPI_RETURN_CONVENTION
525static bool gjs_encode(JSContext* cx, unsigned argc, JS::Value* vp) {
526 JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
527 JS::RootedString str(cx);
528 JS::UniqueChars encoding;
529 if (!gjs_parse_call_args(cx, "encode", args, "Ss", "string", &str,
530 "encoding", &encoding))
531 return false;
532
533 JS::RootedObject uint8array(
534 cx, gjs_encode_to_uint8array(cx, str, encoding.get(),
535 GjsStringTermination::EXPLICIT_LENGTH));
536 if (!uint8array)
537 return false;
538
539 args.rval().setObject(*uint8array);
540 return true;
541}
542
543GJS_JSAPI_RETURN_CONVENTION
544static bool gjs_encode_into(JSContext* cx, unsigned argc, JS::Value* vp) {

Callers

nothing calls this directly

Calls 3

gjs_parse_call_argsFunction · 0.85
gjs_encode_to_uint8arrayFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected