From 6383bec560ef7b376ddf30f7a77f4ae02f9dfa47 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Sun, 18 Apr 2021 19:59:32 +0200 Subject: [PATCH] BUILD: All TODOs generate warnings now, to not forget them... --- src/base/bufferfd.c | 3 ++- src/base/commands.c | 9 +++------ src/base/config.c | 2 +- src/database/open.c | 7 +++---- src/database/update.c | 6 ++++-- src/mkv/write.c | 2 +- src/module/module_repo.c | 9 ++++----- src/module/module_sdl2.c | 2 +- src/module/mpv.h | 2 +- src/net/listen.c | 2 +- 10 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/base/bufferfd.c b/src/base/bufferfd.c index 129942c5..fdf09b84 100644 --- a/src/base/bufferfd.c +++ b/src/base/bufferfd.c @@ -23,7 +23,8 @@ __fill(struct bufferfd *bf) ssize_t bufferfd_bytes(struct bufferfd *bf, size_t n, uint8_t *res) { - ssize_t r = __fill(bf); /* TODO repeat until n is reached */ +#pragma message(TODO "Repeat until n is reached") + ssize_t r = __fill(bf); if (r < (ssize_t)n) return -1; diff --git a/src/base/commands.c b/src/base/commands.c index 9c038922..19fc9b88 100644 --- a/src/base/commands.c +++ b/src/base/commands.c @@ -43,7 +43,7 @@ command_restart(struct lkt_state *srv, size_t c, char UNUSED *__argv[LKT_MESSAGE env_set(LKT_ENV_CURRENT, "NULL"); database_close_all(); - /* TODO: Clean close of fds... */ +#pragma message(TODO "Clean close of fds...") free(srv->fds); free(srv->clients); @@ -143,11 +143,8 @@ command_stats(struct lkt_state *srv, size_t c, char UNUSED *args[LKT_MESSAGE_ARG database_get_update(srv->db, &ts_update, NULL, NULL); database_stats(srv->db, &artists, &albums, &songs); - /* TODO: Missing fields: - * db_playtime: total time of what can be played with the database (can be - * problematic, needs some work to be done) - * playtime: time already played by lektord (need some modifications of - * the sdl2 module and any player module) */ +#pragma message(TODO "Missing field db_playtime: total time of what can be played with the database (can be problematic, needs some work to be done)") +#pragma message(TODO "Missing field playtime: time already played by lektord (need some modifications of the sdl2 module and any player module)") out->data_len = safe_snprintf(out->data, LKT_MESSAGE_MAX, "__is_updating: %d\n" /* Custom field here */ "__update_progress: %ld:%ld\n" diff --git a/src/base/config.c b/src/base/config.c index 1db7389e..d45acc8c 100644 --- a/src/base/config.c +++ b/src/base/config.c @@ -161,7 +161,7 @@ ini_parse(const char *path, volatile sqlite3 *db) void config_default_file(char *dest, size_t len) { - /* TODO: Use ~/.config/baka and not ~/.config/lektor. */ +#pragma message(TODO "Use ~/.config/baka instead of ~/.config/lektor for all applications (lektor, amadeus, etc)") /* First try the XDG_CONFIG_HOME variable, else the default location HOME/.config. */ memset(dest, 0, len * sizeof(char)); char *home = getenv("XDG_CONFIG_HOME"); diff --git a/src/database/open.c b/src/database/open.c index 368d90b4..1ab8718f 100644 --- a/src/database/open.c +++ b/src/database/open.c @@ -88,10 +88,9 @@ database_new(volatile sqlite3 **db) { *db = NULL; static int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_NOFOLLOW | SQLITE_OPEN_FULLMUTEX; - if (SQLITE_OK != sqlite3_enable_shared_cache(1) || sqlite3_soft_heap_limit64(HEAP_LIMIT_SOFT) < 0 || - /* sqlite3_hard_heap_limit64(HEAP_LIMIT_HARD) < 0 || TODO: Find a way to call this - * function only if available - * on the system */ +#pragma message(TODO "Find a way to check if sqlite3_hard_heap_limit64(HEAP_LIMIT_HARD) is available on the system") + if (SQLITE_OK != sqlite3_enable_shared_cache(1) || + sqlite3_soft_heap_limit64(HEAP_LIMIT_SOFT) < 0 || SQLITE_OK != sqlite3_open_v2(":memory:", (sqlite3 **)db, flags, NULL)) return false; SQLITE_EXEC(*db, (const char *)___src_database_memory_sql, err_not_init); diff --git a/src/database/update.c b/src/database/update.c index 1b72f4e2..5bf7ac6d 100644 --- a/src/database/update.c +++ b/src/database/update.c @@ -112,13 +112,14 @@ __database_add_kara(volatile sqlite3 *db, const char *filename) SQLITE_PREPARE(db, stmt, SQL_STMT, error); } +#pragma message(TODO "In bind int at position 7, pass the is_new") if ((sqlite3_bind_text(stmt, 1, data.song_name, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 2, data.source_name, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 3, data.category, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 4, data.song_type, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 5, data.language, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 6, filename, -1, 0) != SQLITE_OK) || - (sqlite3_bind_int(stmt, 7, 0) /* TODO */ != SQLITE_OK) || + (sqlite3_bind_int(stmt, 7, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 8, data.author_name, -1, 0) != SQLITE_OK) || (sqlite3_bind_int(stmt, 9, data.song_number) != SQLITE_OK)) { LOG_ERROR("DB", "Failed to bind for kara %s: %s", filename, sqlite3_errmsg((sqlite3 *)db)); @@ -169,13 +170,14 @@ database_update_add(volatile sqlite3 *db, const char *kara_path, struct kara_met SQLITE_PREPARE(db, stmt, SQL_STMT, error); +#pragma message(TODO "In bind int at position 7, pass the is_new") if ((sqlite3_bind_text(stmt, 1, mdt->song_name, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 2, mdt->source_name, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 3, mdt->category, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 4, mdt->song_type, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 5, mdt->language, -1, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 6, kara_path, -1, 0) != SQLITE_OK) || - (sqlite3_bind_int(stmt, 7, 0) /* TODO */ != SQLITE_OK) || + (sqlite3_bind_int(stmt, 7, 0) != SQLITE_OK) || (sqlite3_bind_text(stmt, 8, mdt->author_name, -1, 0) != SQLITE_OK) || (sqlite3_bind_int(stmt, 9, mdt->song_number) != SQLITE_OK) || (sqlite3_bind_int(stmt, 10, id) != SQLITE_OK) || (sqlite3_bind_int(stmt, 11, avail) != SQLITE_OK)) { diff --git a/src/mkv/write.c b/src/mkv/write.c index b20c6b76..37e4b33e 100644 --- a/src/mkv/write.c +++ b/src/mkv/write.c @@ -149,7 +149,7 @@ metadata_from_path(char *const mkvfile, struct kara_metadata *meta) char msgbuf[LEKTOR_TAG_MAX]; char *endptr; - /* TODO: Import types and categories from the db */ +#pragma message(TODO "Import the types and categories from the db") static const char *rgx = "^/(.+)/(vo|va|amv|cdg|autres|vtuber|vocaloid)/" "(jp|fr|en|ru|sp|it|ch|latin|multi|undefined)/(.+)/" "(.+) - (OP|ED|IS|AMV|PV|MV|LIVE)([[:digit:]]*) - (.+)\\.mkv$"; diff --git a/src/module/module_repo.c b/src/module/module_repo.c index 7e782797..9e3fc52d 100644 --- a/src/module/module_repo.c +++ b/src/module/module_repo.c @@ -121,7 +121,7 @@ ___sleep(void) static inline void ___mkdir(const char *dir, unsigned int umask) { - /* TODO pour le Kubat du futur: include le umask dans la conf. */ +#pragma message(TODO "Pour le Kubat du futur: inlude the umask from the conf") if (umask == 0) umask = 00700; @@ -297,8 +297,7 @@ retest: } } - /* TODO: Buffered writes - * The buffer needs to be 1Mio to do something (each time, packets are 10Kio...) */ +#pragma message(TODO "Buffered writes. The buffer needs to be 1Mio to do something (each time, packets are 10Kio...)") struct ___file file = { .path = path, .index = 0, @@ -571,8 +570,8 @@ ___worker_rescan(void UNUSED *worker, void *___repo) GOTO_IF(pthread_mutex_unlock(&(repo->mtx)), "Failed to unlock", end_no_lock); #pragma message(TODO "Pass the check stop condition to the database_update from the REPO module") +#pragma message(TODO "Here we never check timestamp, but sometimes we might want it...") database_update(repo->db, kara_prefix, 0); - /* Don't check timestamp. TODO: Sometimes we want to check them */ GOTO_IF(pthread_mutex_lock(&(repo->mtx)), "Failed to lock", end_no_lock); repo->updating &= (~REPO_UPDATE_KARA); @@ -679,7 +678,7 @@ ___worker_import_favorites_internal(const char UNUSED *k, const char *val, int U char fav[LKT_LINE_MAX]; safe_strncpy(fav, val, LKT_LINE_MAX); - /* TODO: Add a way to use the workers to do this for each fav list */ +#pragma message(TODO "Add a way to use the workers to do this for each fav list") LOG_INFO("REPO", "Processing favorite list: %s", fav); ___handle_fav_list(repo, fav, LKT_LINE_MAX); lkt_queue_send(repo->queue, lkt_event_db_update_tick, NULL); diff --git a/src/module/module_sdl2.c b/src/module/module_sdl2.c index 9a5fd7b8..5d6ef3f4 100644 --- a/src/module/module_sdl2.c +++ b/src/module/module_sdl2.c @@ -468,7 +468,7 @@ module_sdl2_close(struct module_sdl2_window *win) static const char *cmd[] = { "stop", NULL }; mpv_command_async((mpv_handle *)win->mpv, 0, cmd); LOG_INFO("WINDOW", "Module closed"); - /* TODO: make the SDL window background be black. */ +#pragma message(TODO "Make the SDL window background black") } static void diff --git a/src/module/mpv.h b/src/module/mpv.h index c1039893..1c2e1fd6 100644 --- a/src/module/mpv.h +++ b/src/module/mpv.h @@ -16,7 +16,7 @@ int lmpv_set_position(mpv_handle *ctx, int pos); int lmpv_load_file(mpv_handle *ctx, const char *file); int lmpv_toggle_pause(mpv_handle *ctx); -/* TODO: place all pointers inside a struct */ +#pragma message(TODO "Place all the pointers for the function lmpv_handle inside a struct") int lmpv_handle(struct lkt_module *mod, mpv_handle *ctx, struct queue *queue, volatile int *time_pos, volatile int *time_duration, volatile int *state, volatile int *hinib, volatile int *set_seek); diff --git a/src/net/listen.c b/src/net/listen.c index 9b5e582c..26af30a8 100644 --- a/src/net/listen.c +++ b/src/net/listen.c @@ -933,7 +933,7 @@ __lkt_handle_INT(struct lkt_state *srv) signal(SIGINT, SIG_DFL); signal(SIGQUIT, SIG_DFL); - /* TODO: Clean close of fds... */ +#pragma message(TODO "Clean close of fds...") free(srv->fds); free(srv->clients); -- GitLab