Replace all printfs with tf_printf, which redirects to android logging. Change into the files directory so that sqlite can do its thing. Getting closer.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4203 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-03-07 17:50:17 +00:00
parent 1c10768aa4
commit 61ff466908
16 changed files with 240 additions and 186 deletions

View File

@ -1,5 +1,6 @@
#include "ssb.import.h"
#include "log.h"
#include "mem.h"
#include "ssb.db.h"
#include "ssb.h"
@ -98,7 +99,7 @@ static char* _tf_ssb_import_read_file(uv_loop_t* loop, const char* path, size_t*
}
else
{
printf("Failed to read %s: %s.\n", path, uv_strerror(r));
tf_printf("Failed to read %s: %s.\n", path, uv_strerror(r));
}
uv_fs_req_cleanup(&read_req);
@ -106,12 +107,12 @@ static char* _tf_ssb_import_read_file(uv_loop_t* loop, const char* path, size_t*
r = uv_fs_close(loop, &close_req, handle, NULL);
if (r)
{
printf("Failed to close %s: %s.\n", path, uv_strerror(r));
tf_printf("Failed to close %s: %s.\n", path, uv_strerror(r));
}
}
else
{
printf("Failed to open %s: %s.\n", path, uv_strerror(handle));
tf_printf("Failed to open %s: %s.\n", path, uv_strerror(handle));
}
uv_fs_req_cleanup(&req);
return data;
@ -138,7 +139,7 @@ static void _tf_ssb_import_recursive_add_files(tf_ssb_t* ssb, uv_loop_t* loop, J
bool is_new = false;
if (tf_ssb_db_blob_store(ssb, (const uint8_t*)blob, size, id, sizeof(id), &is_new) && is_new)
{
printf("Stored %s as %s.\n", full_path, id);
tf_printf("Stored %s as %s.\n", full_path, id);
}
JS_SetPropertyStr(context, files, full_path + strlen(root) + 1, JS_NewString(context, id));
@ -149,7 +150,7 @@ static void _tf_ssb_import_recursive_add_files(tf_ssb_t* ssb, uv_loop_t* loop, J
}
else
{
printf("Failed to scan directory %s: %s.", path, uv_strerror(r));
tf_printf("Failed to scan directory %s: %s.", path, uv_strerror(r));
}
uv_fs_req_cleanup(&req);
}
@ -203,7 +204,7 @@ static void _tf_ssb_import_app_json(tf_ssb_t* ssb, uv_loop_t* loop, JSContext* c
if (_tf_ssb_register_app(ssb, user, app, id))
{
printf("Registered %s path:%s as %s.\n", user, app, id);
tf_printf("Registered %s path:%s as %s.\n", user, app, id);
_tf_ssb_import_add_app(ssb, user, app);
}
}
@ -218,7 +219,7 @@ static void _tf_ssb_import_app_json(tf_ssb_t* ssb, uv_loop_t* loop, JSContext* c
}
else
{
printf("Failed to open %s: %s.\n", path, uv_strerror(r));
tf_printf("Failed to open %s: %s.\n", path, uv_strerror(r));
}
uv_fs_req_cleanup(&req);
}
@ -245,7 +246,7 @@ void tf_ssb_import(tf_ssb_t* ssb, const char* user, const char* path)
}
else
{
printf("Failed to scan directory %s: %s.", path, uv_strerror(r));
tf_printf("Failed to scan directory %s: %s.", path, uv_strerror(r));
}
uv_fs_req_cleanup(&req);
}