From e25f40f86db5db35d05a991559fe8a3659deec3a Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Thu, 14 May 2020 16:17:34 +0200
Subject: [PATCH] Solve segfault

---
 PKGBUILD              |  2 +-
 inc/lektor/commands.h | 22 +++++++++++-----------
 src/commands.c        |  2 +-
 src/database/queue.c  |  2 +-
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/PKGBUILD b/PKGBUILD
index 80eda5ce..29880370 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
 # Maintainer: Maël 'Kubat' MARTIN <mael.martin31@gmail.com>
 pkgname=lektor
-pkgver=mk7.956.1e4b3aa
+pkgver=mk7.957.7f1fbc7
 pkgrel=1
 pkgdesc="The lektor kara player, from the Bakaclub"
 arch=(x86_64 i686)
diff --git a/inc/lektor/commands.h b/inc/lektor/commands.h
index a75b27a7..bfa1d47f 100644
--- a/inc/lektor/commands.h
+++ b/inc/lektor/commands.h
@@ -28,17 +28,17 @@ bool command_stop    (volatile sqlite3 *db, struct lkt_win *win,
 bool command_set_pos(volatile sqlite3 *db, struct lkt_win *win, mpd_idle_flag *watch_mask_ptr, int index);
 
 /* The queue */
-bool command_add    (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr,
-                     int priority);
-bool command_addid  (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr);
-bool command_multiaddid  (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr);
-bool command_del    (volatile sqlite3 *db, struct lkt_win *win, char *pos_range,                  mpd_idle_flag *watch_mask_ptr);
-bool command_delid  (volatile sqlite3 *db, struct lkt_win *win, char *id,                         mpd_idle_flag *watch_mask_ptr);
-bool command_clear  (volatile sqlite3 *db,                                                        mpd_idle_flag *watch_mask_ptr);
-bool command_crop   (volatile sqlite3 *db,                                                        mpd_idle_flag *watch_mask_ptr);
-bool command_move   (volatile sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX],                      mpd_idle_flag *watch_mask_ptr);
-bool command_shuffle(volatile sqlite3 *db,                                                        mpd_idle_flag *watch_mask_ptr);
-bool command_playid (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr);
+bool command_add       (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr,
+                        int priority);
+bool command_addid     (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr);
+bool command_multiaddid(volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr);
+bool command_del       (volatile sqlite3 *db, struct lkt_win *win, char *pos_range,                  mpd_idle_flag *watch_mask_ptr);
+bool command_delid     (volatile sqlite3 *db, struct lkt_win *win, char *id,                         mpd_idle_flag *watch_mask_ptr);
+bool command_clear     (volatile sqlite3 *db,                                                        mpd_idle_flag *watch_mask_ptr);
+bool command_crop      (volatile sqlite3 *db,                                                        mpd_idle_flag *watch_mask_ptr);
+bool command_move      (volatile sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX],                      mpd_idle_flag *watch_mask_ptr);
+bool command_shuffle   (volatile sqlite3 *db,                                                        mpd_idle_flag *watch_mask_ptr);
+bool command_playid    (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr);
 
 bool command_queue_list(struct lkt_state *srv, size_t c, char *args[LKT_MESSAGE_ARGS_MAX]);
 
diff --git a/src/commands.c b/src/commands.c
index 0e615fe6..824fe657 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -289,7 +289,7 @@ command_multiaddid(volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MES
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     STRTOL(id, args[0], endptr, err);
     RETURN_IF(err, "STRTOL failed", false);
-    uri.value = (void *) (size_t) id;
+    uri.value = &id;
     return database_queue_add_uri(db, &uri, 1);
     /*
     UNUSED(win);
diff --git a/src/database/queue.c b/src/database/queue.c
index a6f9e36b..7d476cfa 100644
--- a/src/database/queue.c
+++ b/src/database/queue.c
@@ -266,7 +266,7 @@ database_queue_add_uri(volatile sqlite3 *db, struct lkt_uri *uri, int priority)
         return queue_add_with_col_like_str(db, LKT_DATABASE_KARA_ALL,
                                            uri->value, priority);
     case uri_id:
-        return database_queue_add_id(db, *(int *) uri->value, priority);
+        return database_queue_add_id(db, *(size_t *) uri->value, priority);
     case uri_type:
         return queue_add_with_col_like_str(db, LKT_DATABASE_NAME_KTYPE,
                                            uri->value, priority);
-- 
GitLab