forked from cory/tildefriends
Move some things to C that probably should have never been in JS, especially sha1. Minor refactors, cleanup, and deletes along the way.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4154 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -72,15 +72,9 @@ static void _file_read_read_callback(uv_fs_t* req)
|
||||
promiseid_t promise = (promiseid_t)(intptr_t)req->data;
|
||||
if (req->result >= 0)
|
||||
{
|
||||
JSValue arrayBuffer = JS_NewArrayBufferCopy(context, (const uint8_t*)fsreq->buffer, req->result);
|
||||
JSValue global = JS_GetGlobalObject(context);
|
||||
JSValue constructor = JS_GetPropertyStr(context, global, "Uint8Array");
|
||||
JSValue typedArray = JS_CallConstructor(context, constructor, 1, &arrayBuffer);
|
||||
JS_FreeValue(context, constructor);
|
||||
JS_FreeValue(context, global);
|
||||
JS_FreeValue(context, arrayBuffer);
|
||||
tf_task_resolve_promise(task, promise, typedArray);
|
||||
JS_FreeValue(context, typedArray);
|
||||
JSValue array = tf_util_new_uint8_array(context, (const uint8_t*)fsreq->buffer, req->result);
|
||||
tf_task_resolve_promise(task, promise, array);
|
||||
JS_FreeValue(context, array);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user