From 587f871c9c0bd94c0c2a6305e4129f9f6d105c0c Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Wed, 1 Mar 2023 19:39:15 +0100
Subject: [PATCH] MISC: Run style formatter + Update changelog

---
 CHANGELOG.md             |  1 +
 src/module/module_repo.c | 20 +++++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fda1ef9c..cb242c00 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@
 - Add: the regex used to populate the database from disk is now modifiable from the config file, the keys are `database/{types,categories,languages}`. Those fields must only contain alpha characters and commas
 - Add: re-use more informations from databases when upgrading the database because minimal version where added to the different fields in the table descriptions
 - Add: new field `repo_timestamp` which is the timestamp of the kara from the repo. This field is defaulted to the `cached_mtime` at upgrade time if needed
+- Add: config flag to set verbose log level indications or not (less confusing messages...)
 - Fix: Correctly reading the `XDG_CONFIG_HOME` variable if present in the env...
 - Fix: fix incorrect parsing of lists of commands with multiple arguments: the parser could overrun the correct command buffer and insert a '\0' between the next command and its furst argument
 - Fix: fix issue #100 -> the `database_queue_add_id` won't add ids that doesn't exist
diff --git a/src/module/module_repo.c b/src/module/module_repo.c
index 73115472..c62f5ea4 100644
--- a/src/module/module_repo.c
+++ b/src/module/module_repo.c
@@ -10,9 +10,9 @@
 #define REPO_UPDATE_KARA       ((unsigned int)(1 << 1)) /* Downloading or rescanning the bakabase */
 #define REPO_UPDATE_FAV        ((unsigned int)(1 << 2)) /* Downloading the favorites */
 #define REPO_UPDATE_ALL        (REPO_UPDATE_FAV | REPO_UPDATE_KARA) /* Update all flag */
-#define REPO_TOKEN_MAX 128
-#define REPO_HEADER_AUTH_NAME "X-Token-Authorization: "
-#define REPO_HEADER_AUTH_SIZE (sizeof(REPO_HEADER_AUTH_NAME) + REPO_TOKEN_MAX + 1)
+#define REPO_TOKEN_MAX         128
+#define REPO_HEADER_AUTH_NAME  "X-Token-Authorization: "
+#define REPO_HEADER_AUTH_SIZE  (sizeof(REPO_HEADER_AUTH_NAME) + REPO_TOKEN_MAX + 1)
 
 /***********
  * Globals *
@@ -321,7 +321,8 @@ retest:
 
     char author_token[REPO_HEADER_AUTH_SIZE];
     memset(author_token, 0, REPO_HEADER_AUTH_SIZE);
-    snprintf(author_token, REPO_HEADER_AUTH_SIZE - 1, REPO_HEADER_AUTH_NAME"%s", repo->download_token);
+    snprintf(author_token, REPO_HEADER_AUTH_SIZE - 1, REPO_HEADER_AUTH_NAME "%s",
+             repo->download_token);
 
     headers = curl_slist_append(headers, "Accept: video/x-matroska");
     headers = curl_slist_append(headers, "Content-Type: video/x-matroska");
@@ -425,10 +426,10 @@ ___update_repo_timestamp_if_needed_on_ignore_kara(struct kara *kara, uint64_t re
 PRIVATE_FUNCTION int
 ___handle_got_json_internal_callback(const char *key, const char *val, int comp, void *user)
 {
-    struct json_parse_arg *arg   = (struct json_parse_arg *)user;
-    struct kara *kara            = (struct kara *)arg->real_arg;
-    struct module_repo_internal *repo = (struct module_repo_internal*)arg->repo;
-    const struct lkt_uri *filter = (const struct lkt_uri *)kara->filter_uri;
+    struct json_parse_arg *arg        = (struct json_parse_arg *)user;
+    struct kara *kara                 = (struct kara *)arg->real_arg;
+    struct module_repo_internal *repo = (struct module_repo_internal *)arg->repo;
+    const struct lkt_uri *filter      = (const struct lkt_uri *)kara->filter_uri;
 
     /* Check if interrupt was asked */
     WORKER_STATUS sta = worker_pool_get_status(arg->worker);
@@ -1061,7 +1062,8 @@ module_repo_new(struct module_repo_internal *repo_, struct queue *queue, lkt_db
         exit(EXIT_FAILURE);
     }
 
-    static_assert((LKT_LINE_MAX >= REPO_HEADER_AUTH_SIZE), "REPO_HEADER_AUTH_SIZE can't be bigger than LKT_LINE_MAX");
+    static_assert((LKT_LINE_MAX >= REPO_HEADER_AUTH_SIZE),
+                  "REPO_HEADER_AUTH_SIZE can't be bigger than LKT_LINE_MAX");
     /* Check token config separately, as it's empty by default, and the error should ask the user to add it to the config */
     if (!database_config_get_text(db, "repo", "token", repo.download_token, REPO_TOKEN_MAX)) {
         LOG_ERROR("REPO", "No download token in repo configuration, please add it");
-- 
GitLab