forked from cory/tildefriends
Merge branch 'main' into prettier
This commit is contained in:
commit
dbf5c7b832
@ -452,6 +452,12 @@ static void _file_stat_complete(uv_fs_t* request)
|
|||||||
|
|
||||||
void tf_file_stat(tf_task_t* task, const char* path, void (*callback)(tf_task_t* task, const char* path, int result, const uv_stat_t* stat, void* user_data), void* user_data)
|
void tf_file_stat(tf_task_t* task, const char* path, void (*callback)(tf_task_t* task, const char* path, int result, const uv_stat_t* stat, void* user_data), void* user_data)
|
||||||
{
|
{
|
||||||
|
if (!path)
|
||||||
|
{
|
||||||
|
callback(task, path, -EINVAL, NULL, user_data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const char* zip = tf_task_get_zip_path(task);
|
const char* zip = tf_task_get_zip_path(task);
|
||||||
size_t path_length = strlen(path) + 1;
|
size_t path_length = strlen(path) + 1;
|
||||||
stat_t* data = tf_malloc(sizeof(stat_t) + path_length);
|
stat_t* data = tf_malloc(sizeof(stat_t) + path_length);
|
||||||
@ -575,6 +581,12 @@ static void _file_read_after_work(uv_work_t* work, int result)
|
|||||||
|
|
||||||
void tf_file_read(tf_task_t* task, const char* path, void (*callback)(tf_task_t* task, const char* path, int result, const void* data, void* user_data), void* user_data)
|
void tf_file_read(tf_task_t* task, const char* path, void (*callback)(tf_task_t* task, const char* path, int result, const void* data, void* user_data), void* user_data)
|
||||||
{
|
{
|
||||||
|
if (!path)
|
||||||
|
{
|
||||||
|
callback(task, path, -EINVAL, NULL, user_data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
size_t path_length = strlen(path) + 1;
|
size_t path_length = strlen(path) + 1;
|
||||||
read_t* data = tf_malloc(sizeof(read_t) + path_length);
|
read_t* data = tf_malloc(sizeof(read_t) + path_length);
|
||||||
memset(data, 0, sizeof(read_t));
|
memset(data, 0, sizeof(read_t));
|
||||||
|
@ -509,6 +509,11 @@ static void _httpd_endpoint_hitches(tf_http_request_t* request)
|
|||||||
|
|
||||||
static const char* _after(const char* text, const char* prefix)
|
static const char* _after(const char* text, const char* prefix)
|
||||||
{
|
{
|
||||||
|
if (!text || !prefix)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
size_t prefix_length = strlen(prefix);
|
size_t prefix_length = strlen(prefix);
|
||||||
if (strncmp(text, prefix, prefix_length) == 0)
|
if (strncmp(text, prefix, prefix_length) == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user