Minor cleanups.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3672 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-10-24 19:23:21 +00:00
parent f4f6bb8333
commit 08e32c0de4
5 changed files with 12 additions and 20 deletions

View File

@ -1099,11 +1099,6 @@ JSValue _tf_task_sandbox_require(JSContext* context, JSValueConst this_val, int
return JS_UNDEFINED;
}
static JSValue _utf8Decode(JSContext* context, uint8_t* data, size_t length)
{
return JS_NewStringLen(context, (const char*)data, length);
}
static JSValue _tf_task_utf8Decode(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
{
JSValue result = JS_NULL;
@ -1117,7 +1112,7 @@ static JSValue _tf_task_utf8Decode(JSContext* context, JSValueConst this_val, in
uint8_t* array = tf_try_get_array_buffer(context, &length, argv[0]);
if (array)
{
result = _utf8Decode(context, array, length);
result = JS_NewStringLen(context, (const char*)array, length);
}
else
{
@ -1130,7 +1125,7 @@ static JSValue _tf_task_utf8Decode(JSContext* context, JSValueConst this_val, in
array = tf_try_get_array_buffer(context, &size, buffer);
if (array)
{
result = _utf8Decode(context, array, size);
result = JS_NewStringLen(context, (const char*)array, size);
}
}
JS_FreeValue(context, buffer);