core: Avoid trivial snprintfs.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 34m10s

This commit is contained in:
2025-06-10 21:17:55 -04:00
parent 3a2a829940
commit b135a210cc
13 changed files with 96 additions and 74 deletions

View File

@ -931,7 +931,7 @@ static void _httpd_endpoint_app_blob_work(tf_ssb_t* ssb, void* user_data)
char* app_path = tf_malloc(path_length);
snprintf(app_path, path_length, "path:%s", data->user_app->app);
const char* value = tf_ssb_db_get_property(ssb, data->user_app->user, app_path);
snprintf(data->app_blob_id, sizeof(data->app_blob_id), "%s", value);
tf_string_set(data->app_blob_id, sizeof(data->app_blob_id), value);
tf_free(app_path);
tf_free((void*)value);
data->file = last_slash + 1;
@ -1130,7 +1130,7 @@ static void _httpd_endpoint_view_work(tf_ssb_t* ssb, void* user_data)
char* app_path = tf_malloc(app_path_length);
snprintf(app_path, app_path_length, "path:%s", user_app->app);
const char* value = tf_ssb_db_get_property(ssb, user_app->user, app_path);
snprintf(blob_id, sizeof(blob_id), "%s", value);
tf_string_set(blob_id, sizeof(blob_id), value);
tf_free(app_path);
tf_free((void*)value);
}
@ -1157,7 +1157,7 @@ static void _httpd_endpoint_view_work(tf_ssb_t* ssb, void* user_data)
sqlite3* db = tf_ssb_acquire_db_writer(ssb);
tf_ssb_db_add_blob_wants(db, blob_id);
tf_ssb_release_db_writer(ssb, db);
snprintf(view->notify_want_blob_id, sizeof(view->notify_want_blob_id), "%s", blob_id);
tf_string_set(view->notify_want_blob_id, sizeof(view->notify_want_blob_id), blob_id);
}
}
}
@ -1308,7 +1308,7 @@ static void _httpd_endpoint_save_work(tf_ssb_t* ssb, void* user_data)
tf_ssb_db_set_property(ssb, user_app->user, app_path, blob_id))
{
tf_ssb_db_add_value_to_array_property(ssb, user_app->user, "apps", user_app->app);
snprintf(save->blob_id, sizeof(save->blob_id), "%s", blob_id);
tf_string_set(save->blob_id, sizeof(save->blob_id), blob_id);
save->response = 200;
}
else
@ -1341,7 +1341,7 @@ static void _httpd_endpoint_save_work(tf_ssb_t* ssb, void* user_data)
char blob_id[k_blob_id_len] = { 0 };
if (tf_ssb_db_blob_store(ssb, request->body, request->content_length, blob_id, sizeof(blob_id), NULL))
{
snprintf(save->blob_id, sizeof(save->blob_id), "%s", blob_id);
tf_string_set(save->blob_id, sizeof(save->blob_id), blob_id);
save->response = 200;
}
else
@ -1961,7 +1961,7 @@ static void _httpd_endpoint_login_work(tf_ssb_t* ssb, void* user_data)
const char* return_url = _form_data_get(form_data, "return");
if (return_url)
{
snprintf(login->location_header, sizeof(login->location_header), "%s", return_url);
tf_string_set(login->location_header, sizeof(login->location_header), return_url);
}
else
{
@ -2066,7 +2066,7 @@ static void _httpd_endpoint_login_work(tf_ssb_t* ssb, void* user_data)
const char* return_url = _form_data_get(form_data, "return");
if (return_url)
{
snprintf(login->location_header, sizeof(login->location_header), "%s", return_url);
tf_string_set(login->location_header, sizeof(login->location_header), return_url);
}
else
{