mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-05 12:26:52 +02:00
testing/apt-dater: fix build with gcc 14
This commit is contained in:
parent
67374e0e45
commit
a1170007d2
@ -2,19 +2,26 @@
|
||||
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
|
||||
pkgname=apt-dater
|
||||
pkgver=1.0.4
|
||||
pkgrel=3
|
||||
pkgrel=4
|
||||
pkgdesc="terminal-based remote package update manager"
|
||||
url="https://github.com/DE-IBH/apt-dater"
|
||||
arch="all"
|
||||
license="GPL-2.0-or-later"
|
||||
depends="lockfile-progs screen openssh-client util-linux-misc"
|
||||
makedepends="automake popt-dev glib-dev ncurses-dev tcl-dev libconfig-dev libxml2-dev
|
||||
makedepends="autoconf automake popt-dev glib-dev ncurses-dev tcl-dev libconfig-dev libxml2-dev
|
||||
xxd"
|
||||
subpackages="$pkgname-doc $pkgname-lang"
|
||||
source="apt-dater-$pkgver.tar.gz::https://github.com/DE-IBH/apt-dater/archive/v$pkgver.tar.gz
|
||||
apt-dater-fix-includes.patch
|
||||
fix-gnu-source-warning.patch
|
||||
gcc14.patch
|
||||
"
|
||||
|
||||
prepare() {
|
||||
default_prepare
|
||||
autoreconf -fi
|
||||
}
|
||||
|
||||
build() {
|
||||
./configure \
|
||||
--build=$CBUILD \
|
||||
@ -45,5 +52,9 @@ package() {
|
||||
rm -f "$pkgdir"/usr/share/man/man1/apt-dater-host.1
|
||||
}
|
||||
|
||||
sha512sums="6b4c3fe555d5b1ecdab63ff0f05713657cd0a0ac89fa114b4d23a95059fc1b91159cae180afeea3d58ef476629566c495e35f126ce19c3922c2896f8c1790020 apt-dater-1.0.4.tar.gz
|
||||
562631999cbcf0dcfeb987705c3ec66b274b0f6914527229adbe9281b2a791f601052ed51dff9004220c376b3de9e3da812e0961b3e999174c9c4fb75593499c apt-dater-fix-includes.patch"
|
||||
sha512sums="
|
||||
6b4c3fe555d5b1ecdab63ff0f05713657cd0a0ac89fa114b4d23a95059fc1b91159cae180afeea3d58ef476629566c495e35f126ce19c3922c2896f8c1790020 apt-dater-1.0.4.tar.gz
|
||||
562631999cbcf0dcfeb987705c3ec66b274b0f6914527229adbe9281b2a791f601052ed51dff9004220c376b3de9e3da812e0961b3e999174c9c4fb75593499c apt-dater-fix-includes.patch
|
||||
f59ebeee3cff9eee2b024b96c7267ce40b5d6a9b53fec4fac3b5e233c92f616db2105af2e46783cd9bcf4364ad78cc152e74dcabd167b0b691f3dfec180c55e9 fix-gnu-source-warning.patch
|
||||
4844996d46d1af2c5b0c17bc7acaf34318126e37324747ffca52a261055050bb857ff1c4d76fa25b62f9ecb97a3edae456eb8bb16e5e2ada2bd8be04a76de7e0 gcc14.patch
|
||||
"
|
||||
|
||||
473
testing/apt-dater/fix-gnu-source-warning.patch
Normal file
473
testing/apt-dater/fix-gnu-source-warning.patch
Normal file
@ -0,0 +1,473 @@
|
||||
Source: https://github.com/DE-IBH/apt-dater/pull/181.patch
|
||||
--
|
||||
From 4e820e5f885d6102a740553679ae188b3f5902bf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20B=C3=BChler?= <source@stbuehler.de>
|
||||
Date: Sat, 30 Sep 2023 14:28:26 +0200
|
||||
Subject: [PATCH 1/5] fix _GNU_SOURCE redefinition warning
|
||||
|
||||
---
|
||||
src/apt-dater.h | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/apt-dater.h b/src/apt-dater.h
|
||||
index 7eda355..447c29d 100644
|
||||
--- a/src/apt-dater.h
|
||||
+++ b/src/apt-dater.h
|
||||
@@ -25,7 +25,9 @@
|
||||
#ifndef _APT_DATER_H
|
||||
#define _APT_DATER_H
|
||||
|
||||
-#define _GNU_SOURCE
|
||||
+#ifndef _GNU_SOURCE
|
||||
+# define _GNU_SOURCE
|
||||
+#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
From 1f65f0267bb3319e9513298409352cb9aef78819 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20B=C3=BChler?= <source@stbuehler.de>
|
||||
Date: Mon, 2 Oct 2023 13:39:36 +0200
|
||||
Subject: [PATCH 2/5] consistent include of config.h
|
||||
|
||||
---
|
||||
src/apt-dater.h | 9 ++++-----
|
||||
src/runcust.c | 8 ++++----
|
||||
src/screen.h | 4 +++-
|
||||
3 files changed, 11 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/apt-dater.h b/src/apt-dater.h
|
||||
index 447c29d..7de9d28 100644
|
||||
--- a/src/apt-dater.h
|
||||
+++ b/src/apt-dater.h
|
||||
@@ -42,7 +42,10 @@
|
||||
#include <glib/gstdio.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
-#include "../config.h"
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include "config.h"
|
||||
+#endif
|
||||
+
|
||||
#include "../include/adproto.h"
|
||||
|
||||
#ifdef HAVE_GETTEXT
|
||||
@@ -60,10 +63,6 @@
|
||||
#define BUF_MAX_LEN 256
|
||||
#define PROG_NAME PACKAGE
|
||||
|
||||
-#ifdef HAVE_CONFIG_H
|
||||
-# include "config.h"
|
||||
-#endif
|
||||
-
|
||||
#ifndef NDEBUG
|
||||
typedef enum {
|
||||
T_CFGFILE=1,
|
||||
diff --git a/src/runcust.c b/src/runcust.c
|
||||
index bc41e5f..70ecd6e 100644
|
||||
--- a/src/runcust.c
|
||||
+++ b/src/runcust.c
|
||||
@@ -25,16 +25,16 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include "config.h"
|
||||
+#endif
|
||||
+
|
||||
#ifdef HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_CONFIG_H
|
||||
-# include "config.h"
|
||||
-#endif
|
||||
-
|
||||
#ifdef FEAT_RUNCUST
|
||||
|
||||
#include "apt-dater.h"
|
||||
diff --git a/src/screen.h b/src/screen.h
|
||||
index 410d341..292acb9 100644
|
||||
--- a/src/screen.h
|
||||
+++ b/src/screen.h
|
||||
@@ -25,7 +25,9 @@
|
||||
#ifndef _SCREEN_H
|
||||
#define _SCREEN_H
|
||||
|
||||
-#include "config.h"
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include "config.h"
|
||||
+#endif
|
||||
|
||||
#ifndef FEAT_TMUX
|
||||
|
||||
|
||||
From 28559dca8f26b112f246245f981b321c39be0cc8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20B=C3=BChler?= <source@stbuehler.de>
|
||||
Date: Mon, 2 Oct 2023 15:07:43 +0200
|
||||
Subject: [PATCH 3/5] fix runcust feature check in header
|
||||
|
||||
---
|
||||
src/runcust.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/runcust.h b/src/runcust.h
|
||||
index b82daf3..19cc712 100644
|
||||
--- a/src/runcust.h
|
||||
+++ b/src/runcust.h
|
||||
@@ -29,7 +29,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
-#ifndef FEAT_RUNCUST
|
||||
+#ifdef FEAT_RUNCUST
|
||||
|
||||
#include "apt-dater.h"
|
||||
|
||||
|
||||
From 1f72d30df6f179cefed6501ddc0022a547eface4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20B=C3=BChler?= <source@stbuehler.de>
|
||||
Date: Sat, 30 Sep 2023 15:17:24 +0200
|
||||
Subject: [PATCH 4/5] tmux: use g_spawn_check_wait_status instead of deprecated
|
||||
g_spawn_check_exit_status with glib>=2.70
|
||||
|
||||
---
|
||||
src/tmux.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/tmux.c b/src/tmux.c
|
||||
index 8b939d7..f2a5c2c 100644
|
||||
--- a/src/tmux.c
|
||||
+++ b/src/tmux.c
|
||||
@@ -120,7 +120,12 @@ tmux_get_sessions(HostNode *n) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+#if GLIB_CHECK_VERSION(2, 70, 0)
|
||||
+ if(!g_spawn_check_wait_status(rc, &error)) {
|
||||
+#else
|
||||
+ /* deprecated name for g_spawn_check_wait_status: */
|
||||
if(!g_spawn_check_exit_status(rc, &error)) {
|
||||
+#endif
|
||||
/* g_warning("error on list-sessions: %s", error->message);
|
||||
g_clear_error (&error);*/
|
||||
|
||||
|
||||
From 02c8c2fb96dfeb3d4c08deba84217c3b70f47859 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20B=C3=BChler?= <source@stbuehler.de>
|
||||
Date: Sat, 30 Sep 2023 16:39:32 +0200
|
||||
Subject: [PATCH 5/5] replace deprecated GCompletion with smaller local
|
||||
implementation
|
||||
|
||||
---
|
||||
po/POTFILES.in | 1 +
|
||||
src/Makefile.am | 2 +
|
||||
src/completion.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/completion.h | 50 +++++++++++++++++++
|
||||
src/ui.c | 31 ++++--------
|
||||
5 files changed, 183 insertions(+), 23 deletions(-)
|
||||
create mode 100644 src/completion.c
|
||||
create mode 100644 src/completion.h
|
||||
|
||||
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
||||
index affacd0..7e6be98 100644
|
||||
--- a/po/POTFILES.in
|
||||
+++ b/po/POTFILES.in
|
||||
@@ -2,6 +2,7 @@
|
||||
./src/autoref.c
|
||||
./src/clusters.c
|
||||
./src/colors.c
|
||||
+./src/completion.c
|
||||
./src/env.c
|
||||
./src/exec.c
|
||||
./src/history.c
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index f79a6ca..ed6287b 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -12,6 +12,8 @@ SHARED_SOURCES = \
|
||||
apt-dater.h \
|
||||
colors.c \
|
||||
colors.h \
|
||||
+ completion.c \
|
||||
+ completion.h \
|
||||
exec.c \
|
||||
exec.h \
|
||||
extern.h \
|
||||
diff --git a/src/completion.c b/src/completion.c
|
||||
new file mode 100644
|
||||
index 0000000..35e78c7
|
||||
--- /dev/null
|
||||
+++ b/src/completion.c
|
||||
@@ -0,0 +1,122 @@
|
||||
+/* apt-dater - terminal-based remote package update manager
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * 2023 (C) Stefan Bühler <source@stbuehler.de>
|
||||
+ *
|
||||
+ * License:
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this package; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include "apt-dater.h"
|
||||
+#include "completion.h"
|
||||
+#include "ui.h"
|
||||
+
|
||||
+Completion *completion_init() {
|
||||
+ Completion *cmpl = NULL;
|
||||
+
|
||||
+ cmpl = g_new0(Completion, 1);
|
||||
+ return cmpl;
|
||||
+}
|
||||
+
|
||||
+static void completion_reset(Completion *cmpl) {
|
||||
+ g_list_free(cmpl->entries);
|
||||
+ cmpl->entries = NULL;
|
||||
+
|
||||
+ g_free(cmpl->cached_prefix);
|
||||
+ cmpl->cached_prefix = NULL;
|
||||
+
|
||||
+ g_list_free(cmpl->cached_entries);
|
||||
+ cmpl->cached_entries = NULL;
|
||||
+}
|
||||
+
|
||||
+void completion_set_entries(Completion *cmpl, GList *entries) {
|
||||
+ completion_reset(cmpl);
|
||||
+
|
||||
+ cmpl->entries = g_list_copy(entries);
|
||||
+}
|
||||
+
|
||||
+static gboolean prefix_match(const gchar *entry_name, const gchar *prefix, gsize prefix_len) {
|
||||
+ return 0 == g_ascii_strncasecmp(entry_name, prefix, prefix_len);
|
||||
+}
|
||||
+
|
||||
+static gboolean entry_match(GList *entry, const gchar *prefix, gsize prefix_len) {
|
||||
+ gchar *entry_name;
|
||||
+
|
||||
+ entry_name = getStrFromDrawNode((DrawNode *) entry->data);
|
||||
+ return prefix_match(entry_name, prefix, prefix_len);
|
||||
+}
|
||||
+
|
||||
+GList *completion_search(Completion *cmpl, const gchar *prefix) {
|
||||
+ GList *entry = NULL;
|
||||
+ gsize prefix_len;
|
||||
+
|
||||
+ prefix_len = strlen(prefix);
|
||||
+ if (0 == prefix_len) {
|
||||
+ return cmpl->entries;
|
||||
+ }
|
||||
+
|
||||
+ if (cmpl->cached_prefix) {
|
||||
+ gsize cached_len = strlen(cmpl->cached_prefix);
|
||||
+
|
||||
+ if (cached_len <= prefix_len && prefix_match(prefix, cmpl->cached_prefix, cached_len)) {
|
||||
+ if (cached_len == prefix_len) {
|
||||
+ return cmpl->cached_entries;
|
||||
+ }
|
||||
+
|
||||
+ for (entry = cmpl->cached_entries; entry; ) {
|
||||
+ GList *next = g_list_next(entry);
|
||||
+ if (!entry_match(entry, prefix, prefix_len)) {
|
||||
+ cmpl->cached_entries = g_list_delete_link(cmpl->cached_entries, entry);
|
||||
+ }
|
||||
+ entry = next;
|
||||
+ }
|
||||
+
|
||||
+ goto search_done;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* no cache / cache prefix mismatch: */
|
||||
+
|
||||
+ g_list_free(cmpl->cached_entries);
|
||||
+ cmpl->cached_entries = NULL;
|
||||
+
|
||||
+ for (entry = cmpl->entries; entry; entry = g_list_next(entry)) {
|
||||
+ if (entry_match(entry, prefix, prefix_len)) {
|
||||
+ cmpl->cached_entries = g_list_prepend(cmpl->cached_entries, entry->data);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+search_done:
|
||||
+ /* Modified cache; remember prefix (unless result is empty)*/
|
||||
+
|
||||
+ if (cmpl->cached_prefix) {
|
||||
+ g_free(cmpl->cached_prefix);
|
||||
+ cmpl->cached_prefix = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (cmpl->cached_entries) {
|
||||
+ cmpl->cached_prefix = g_strdup(prefix);
|
||||
+ }
|
||||
+
|
||||
+ return cmpl->cached_entries;
|
||||
+}
|
||||
+
|
||||
+void completion_free(Completion *cmpl) {
|
||||
+ if (!cmpl) return;
|
||||
+
|
||||
+ completion_reset(cmpl);
|
||||
+
|
||||
+ g_free(cmpl);
|
||||
+}
|
||||
diff --git a/src/completion.h b/src/completion.h
|
||||
new file mode 100644
|
||||
index 0000000..5244fd9
|
||||
--- /dev/null
|
||||
+++ b/src/completion.h
|
||||
@@ -0,0 +1,50 @@
|
||||
+/* apt-dater - terminal-based remote package update manager
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * 2023 (C) Stefan Bühler <source@stbuehler.de>
|
||||
+ *
|
||||
+ * License:
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this package; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#ifndef _COMPLETION_H
|
||||
+#define _COMPLETION_H
|
||||
+
|
||||
+#include <glib.h>
|
||||
+
|
||||
+/* Find entries in a GList that match a given prefix.
|
||||
+ *
|
||||
+ * Based on deprecated glib GCompletion
|
||||
+ */
|
||||
+
|
||||
+typedef struct _completion {
|
||||
+ GList *entries;
|
||||
+
|
||||
+ /* remember last prefix and the matched entries */
|
||||
+ gchar* cached_prefix;
|
||||
+ GList* cached_entries;
|
||||
+} Completion;
|
||||
+
|
||||
+Completion *completion_init();
|
||||
+
|
||||
+/* entries: list of `DrawNode*` */
|
||||
+void completion_set_entries(Completion *cmpl, GList *entries);
|
||||
+
|
||||
+/* returns non-owned list; returned list gets invalidated with any other completion_* call on this instance */
|
||||
+GList *completion_search(Completion *cmpl, const gchar *prefix);
|
||||
+
|
||||
+void completion_free(Completion *cmpl);
|
||||
+
|
||||
+#endif /* _COMPLETION_H */
|
||||
diff --git a/src/ui.c b/src/ui.c
|
||||
index 2b71bcb..262ee3f 100644
|
||||
--- a/src/ui.c
|
||||
+++ b/src/ui.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "apt-dater.h"
|
||||
#include "ui.h"
|
||||
#include "colors.h"
|
||||
+#include "completion.h"
|
||||
#include "ttymux.h"
|
||||
#include "exec.h"
|
||||
#include "stats.h"
|
||||
@@ -75,7 +76,7 @@ gchar maintainer[48];
|
||||
gchar filterexp[BUF_MAX_LEN];
|
||||
#endif
|
||||
gint sc_mask = 0;
|
||||
-static GCompletion* dlCompl = NULL;
|
||||
+static Completion* dlCompl = NULL;
|
||||
|
||||
#ifdef FEAT_TCLFILTER
|
||||
static Tcl_Interp *tcl_interp = NULL;
|
||||
@@ -397,20 +398,6 @@ static void setMenuEntries(gint mask) {
|
||||
}
|
||||
|
||||
|
||||
-static gchar *compDl(gpointer p)
|
||||
-{
|
||||
- gchar *ret = NULL;
|
||||
-
|
||||
- ret = getStrFromDrawNode((DrawNode *) p);
|
||||
-
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-static gint strcompDl (const gchar *s1, const gchar *s2, gsize n)
|
||||
-{
|
||||
- return(g_ascii_strncasecmp(s1, s2, n));
|
||||
-}
|
||||
-
|
||||
void freeDrawNode (DrawNode *n)
|
||||
{
|
||||
g_free(n);
|
||||
@@ -1864,9 +1851,8 @@ void doUI (GList *hosts)
|
||||
refreshDraw();
|
||||
|
||||
/* Create completion list. */
|
||||
- dlCompl = g_completion_new(compDl);
|
||||
- g_completion_add_items(dlCompl, drawlist);
|
||||
- g_completion_set_compare(dlCompl, strcompDl);
|
||||
+ dlCompl = completion_init();
|
||||
+ completion_set_entries(dlCompl, drawlist);
|
||||
|
||||
const gchar *m = getenv("MAINTAINER");
|
||||
if (m)
|
||||
@@ -2499,8 +2485,7 @@ static void expandAllNodes(GList *hosts)
|
||||
|
||||
rebuildDrawList(hosts);
|
||||
}
|
||||
- g_completion_clear_items (dlCompl);
|
||||
- g_completion_add_items (dlCompl, drawlist);
|
||||
+ completion_set_entries(dlCompl, drawlist);
|
||||
}
|
||||
|
||||
|
||||
@@ -2558,7 +2543,7 @@ void searchEntry(GList *hosts) {
|
||||
|
||||
/* find completion matches */
|
||||
if(strlen(s))
|
||||
- matches = g_completion_complete(dlCompl, s, NULL);
|
||||
+ matches = completion_search(dlCompl, s);
|
||||
else
|
||||
matches = NULL;
|
||||
|
||||
@@ -2568,7 +2553,7 @@ void searchEntry(GList *hosts) {
|
||||
s[--pos] = 0;
|
||||
|
||||
if(pos>0)
|
||||
- matches = g_completion_complete(dlCompl, s, NULL);
|
||||
+ matches = completion_search(dlCompl, s);
|
||||
}
|
||||
/* print new search string */
|
||||
else {
|
||||
@@ -3738,7 +3723,7 @@ gboolean ctrlUI (GList *hosts)
|
||||
#ifdef FEAT_TCLFILTER
|
||||
if (!Tcl_InterpDeleted(tcl_interp)) Tcl_DeleteInterp(tcl_interp);
|
||||
#endif
|
||||
- if(dlCompl) g_completion_free (dlCompl);
|
||||
+ if(dlCompl) completion_free (dlCompl);
|
||||
|
||||
ret = FALSE;
|
||||
attrset(A_NORMAL);
|
||||
37
testing/apt-dater/gcc14.patch
Normal file
37
testing/apt-dater/gcc14.patch
Normal file
@ -0,0 +1,37 @@
|
||||
Fix -Wint-conversion error with gcc 14.
|
||||
|
||||
```
|
||||
screen.c: In function 'screen_get_sdir':
|
||||
screen.c:49:21: error: passing argument 2 of 'g_strlcpy' makes pointer from integer without a cast [-Wint-conversion]
|
||||
49 | g_strlcpy(sdir, sizeof(sdir), getenv("SCREENDIR"));
|
||||
| ^~~~~~~~~~~~
|
||||
| |
|
||||
| long unsigned int
|
||||
In file included from /usr/include/glib-2.0/glib/gstring.h:37,
|
||||
from /usr/include/glib-2.0/glib/giochannel.h:36,
|
||||
from /usr/include/glib-2.0/glib.h:56,
|
||||
from screen.c:29:
|
||||
/usr/include/glib-2.0/glib/gstrfuncs.h:124:55: note: expected 'const gchar *' {aka 'const char *'} but argument is of type 'long unsigned int'
|
||||
124 | const gchar *src,
|
||||
| ~~~~~~~~~~~~~~^~~
|
||||
screen.c:49:35: error: passing argument 3 of 'g_strlcpy' makes integer from pointer without a cast [-Wint-conversion]
|
||||
49 | g_strlcpy(sdir, sizeof(sdir), getenv("SCREENDIR"));
|
||||
| ^~~~~~~~~~~~~~~~~~~
|
||||
| |
|
||||
| char *
|
||||
/usr/include/glib-2.0/glib/gstrfuncs.h:125:55: note: expected 'gsize' {aka 'long unsigned int'} but argument is of type 'char *'
|
||||
125 | gsize dest_size);
|
||||
| ~~~~~~~~~~~~~~^~~~~~~~~
|
||||
```
|
||||
|
||||
--- apt-dater-1.0.4-origin/src/screen.c
|
||||
+++ apt-dater-1.0.4/src/screen.c
|
||||
@@ -46,7 +46,7 @@
|
||||
static gchar sdir[PATH_MAX];
|
||||
|
||||
if (g_strcmp0(getenv("SCREENDIR"), NULL) != 0) {
|
||||
- g_strlcpy(sdir, sizeof(sdir), getenv("SCREENDIR"));
|
||||
+ g_strlcpy(sdir, getenv("SCREENDIR"), sizeof(sdir));
|
||||
return sdir;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user