diff --git a/.gitignore b/.gitignore index 4bb8d3c4d7d19ae066208ee7bd2de7dc7c62718e..9331625cf740dfa75c83b2d01f2e8e2ab049cb8c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ autom4te.cache *\~ *.AppImage *.pro.user +target/ diff --git a/src/database/cache.c b/src/database/cache.c index 861cca21ac5f54729ea7c7750657ff27d51925a5..73f5e743fc61352cb8c34634199e8fa144655cea 100644 --- a/src/database/cache.c +++ b/src/database/cache.c @@ -67,7 +67,7 @@ database_cache_kara(volatile sqlite3 *db, int id) LOG_INFO("CACHE", "Cached mtime %ld and duration %ld for '%s' kara %d", mtime, duration_uint, filepath, id); } -#define ___cache_set_from_id(what) \ +#define ___cache_set_from_id(what) \ PRIVATE_FUNCTION bool database_set_kara_##what##_id(volatile sqlite3 *db, int id, uint64_t what) \ { \ bool ret_code = false; \ diff --git a/src/net/listen.c b/src/net/listen.c index 7da4f4dbf8af627ea1a6f2fee06cb99e5482450a..6969f5944a19354e286624c8165d2f292facd57a 100644 --- a/src/net/listen.c +++ b/src/net/listen.c @@ -836,46 +836,46 @@ handle_queue_events(struct lkt_state *srv) redo: evt = lkt_queue_handle(&srv->queue); + // clang-format off switch (evt.type) { - // clang-format off - __CASE(PLAY_POS, { - string = safe_malloc(BUFFER_MAX * sizeof(char)); - safe_snprintf(string, BUFFER_MAX, "%ld", (size_t)evt.attr); - command_play(srv, &string); - free(string); - }) - - __CASE(PLAY_NEXT, command_next(srv, NULL)) - __CASE(PLAY_PREV, command_previous(srv, NULL)) - - __CASE(PLAY_TOGGLE, { __ATTR_IS_STATE(PAUSE, database_queue_set_paused(srv->db, 1)) - __ATTR_IS_STATE(PLAY, database_queue_set_paused(srv->db, 0)) - __ATTR_IS_STATE(TOGGLE, database_queue_toggle_pause(srv->db)) - __ATTR_IS_STATE(STOP, database_queue_stop(srv->db)) }) - - __CASE(PROP_VOL, database_config_queue(srv->db, "volume", (size_t)evt.attr)) - __CASE(PROP_DUR, database_config_queue(srv->db, "duration", (size_t)evt.attr)) - __CASE(PROP_TIME, database_config_queue(srv->db, "elapsed", (size_t)evt.attr)) - - __CASE(SKIP_CURRENT, { - string = safe_malloc(PATH_MAX * sizeof(char)); - database_queue_skip_current(srv->db, string); - MOD_CALL(srv->window_mod, "load", string); - free(string); - }) - - __CASE(DB_UPDATE_TOTAL, { srv->update_total += (size_t)evt.attr; }) - __CASE(DB_UPDATING, { srv->is_updating = (((uint8_t)(size_t)evt.attr) > 0); }) - __CASE(DB_UPDATE_TICK, { - if (srv->update_current != ((size_t)-1)) - srv->update_current++; - if (srv->update_current >= srv->update_total) - (LOG_WARN("EVENT", "Force updating state because tikcs exceded the update count"), srv->is_updating = 0, - srv->update_total = 0, srv->update_current = 0); - }) - - /* The null event / ignored events, just return / continue */ - __CASE(PLAY_FILE, {}) + __CASE(PLAY_POS, { + string = safe_malloc(BUFFER_MAX * sizeof(char)); + safe_snprintf(string, BUFFER_MAX, "%ld", (size_t)evt.attr); + command_play(srv, &string); + free(string); + }) + + __CASE(PLAY_NEXT, command_next(srv, NULL)) + __CASE(PLAY_PREV, command_previous(srv, NULL)) + + __CASE(PLAY_TOGGLE, { __ATTR_IS_STATE(PAUSE, database_queue_set_paused(srv->db, 1)) + __ATTR_IS_STATE(PLAY, database_queue_set_paused(srv->db, 0)) + __ATTR_IS_STATE(TOGGLE, database_queue_toggle_pause(srv->db)) + __ATTR_IS_STATE(STOP, database_queue_stop(srv->db)) }) + + __CASE(PROP_VOL, database_config_queue(srv->db, "volume", (size_t)evt.attr)) + __CASE(PROP_DUR, database_config_queue(srv->db, "duration", (size_t)evt.attr)) + __CASE(PROP_TIME, database_config_queue(srv->db, "elapsed", (size_t)evt.attr)) + + __CASE(SKIP_CURRENT, { + string = safe_malloc(PATH_MAX * sizeof(char)); + database_queue_skip_current(srv->db, string); + MOD_CALL(srv->window_mod, "load", string); + free(string); + }) + + __CASE(DB_UPDATE_TOTAL, { srv->update_total += (size_t)evt.attr; }) + __CASE(DB_UPDATING, { srv->is_updating = (((uint8_t)(size_t)evt.attr) > 0); }) + __CASE(DB_UPDATE_TICK, { + if (srv->update_current != ((size_t)-1)) + srv->update_current++; + if (srv->update_current >= srv->update_total) + (LOG_WARN("EVENT", "Force updating state because tikcs exceded the update count"), srv->is_updating = 0, + srv->update_total = 0, srv->update_current = 0); + }) + + /* The null event / ignored events, just return / continue */ + __CASE(PLAY_FILE, {}) case LKT_EVENT_NULL: return; @@ -883,8 +883,8 @@ redo: default: LOG_FATAL("Got unknown type event: %ld", evt.type); return; - // clang-format on } + // clang-format on goto redo; #undef __ATTR_IS_STATE