forked from cory/tildefriends
Minor cleanup. Missing traces.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4356 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
#include "mem.h"
|
||||
#include "task.h"
|
||||
#include "trace.h"
|
||||
#include "util.js.h"
|
||||
|
||||
#include "unzip.h"
|
||||
@ -256,11 +257,14 @@ typedef struct _zip_read_work_t
|
||||
static void _file_read_file_zip_work(uv_work_t* work)
|
||||
{
|
||||
zip_read_work_t* data = work->data;
|
||||
tf_trace_t* trace = tf_task_get_trace(data->task);
|
||||
tf_trace_begin(trace, "file_read_zip_work");
|
||||
unzFile zip = unzOpen(tf_task_get_zip_path(data->task));
|
||||
bool is_file_open = false;
|
||||
if (!zip)
|
||||
{
|
||||
data->result = errno;
|
||||
tf_trace_end(trace);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -291,6 +295,7 @@ static void _file_read_file_zip_work(uv_work_t* work)
|
||||
tf_free(data->buffer);
|
||||
data->buffer = NULL;
|
||||
}
|
||||
tf_trace_end(trace);
|
||||
|
||||
done:
|
||||
if (is_file_open)
|
||||
@ -303,6 +308,8 @@ done:
|
||||
static void _file_read_file_zip_after_work(uv_work_t* work, int status)
|
||||
{
|
||||
zip_read_work_t* data = work->data;
|
||||
tf_trace_t* trace = tf_task_get_trace(data->task);
|
||||
tf_trace_begin(trace, "file_read_zip_after_work");
|
||||
if (data->result >= 0)
|
||||
{
|
||||
tf_task_resolve_promise(data->task, data->promise, tf_util_new_uint8_array(data->context, data->buffer, data->result));
|
||||
@ -314,11 +321,12 @@ static void _file_read_file_zip_after_work(uv_work_t* work, int status)
|
||||
tf_free(data->buffer);
|
||||
tf_free((void*)data->file_path);
|
||||
tf_free(data);
|
||||
tf_trace_end(trace);
|
||||
}
|
||||
|
||||
static JSValue _file_read_file_zip(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
void* task = JS_GetContextOpaque(context);
|
||||
tf_task_t* task = JS_GetContextOpaque(context);
|
||||
const char* file_name = JS_ToCString(context, argv[0]);
|
||||
|
||||
zip_read_work_t* work = tf_malloc(sizeof(zip_read_work_t));
|
||||
|
Reference in New Issue
Block a user