community/gpaste: fix build with gcc 14 on 32-bit

This commit is contained in:
mio 2024-09-14 04:39:10 +00:00 committed by Natanael Copa
parent 495fde8f4f
commit 1c907e8823
2 changed files with 205 additions and 2 deletions

View file

@ -5,7 +5,9 @@ pkgver=45.1
pkgrel=0
pkgdesc="Clipboard managment system"
url="https://github.com/Keruspe/GPaste"
arch="all !s390x" # limited by gnome-control-center
# armhf: limited by gjs
# s390x: limited by gnome-control-center
arch="all !armhf !s390x"
license="BSD-2-Clause"
makedepends="
appstream-glib-dev
@ -27,7 +29,9 @@ subpackages="
$pkgname-bash-completion:bashcomp
$pkgname-zsh-completion:zshcomp
"
source="gpaste-$pkgver.tar.gz::https://github.com/Keruspe/GPaste/archive/v$pkgver.tar.gz"
source="gpaste-$pkgver.tar.gz::https://github.com/Keruspe/GPaste/archive/v$pkgver.tar.gz
gcc14-32-bit.patch
"
builddir="$srcdir/GPaste-$pkgver"
build() {
@ -58,4 +62,5 @@ _gnome() {
sha512sums="
c6ec0959d70d20239f6b2272bb3ab6d8250ece8f1759cb12b14b5d1a4c2685cbc1dbdac88ad5d0979bc2585c4e66bb4af0e243eda340fcc01b7f2b9c9b21358f gpaste-45.1.tar.gz
61fcf8a38ccd50ebd59cd933c2fad806eda56af4b57f8e688add8772276f59b62b81a8e448c91a924b8c6789710e643e52391ebc068e5cbf7671b502748c55ab gcc14-32-bit.patch
"

View file

@ -0,0 +1,198 @@
Source: https://github.com/Keruspe/GPaste/pull/446.patch
Fix -Wincompatible-pointer-types error with gcc 14 on 32-bit arches.
```
../src/daemon/tmp/gpaste-search-provider.c: In function 'g_paste_dbus_get_as_result':
../src/daemon/tmp/gpaste-search-provider.c:37:63: error: passing argument 2 of 'g_variant_get_strv' from incompatible pointer type [-Wincompatible-pointer-types]
37 | g_autofree const gchar **r = g_variant_get_strv (variant, &_len);
| ^~~~~
| |
| guint64 * {aka long long unsigned int *}
In file included from /usr/include/glib-2.0/glib/gmessages.h:38,
from /usr/include/glib-2.0/glib.h:64,
from ../src/libgpaste/gpaste/gpaste-gdbus-defines.h:13,
from ../src/daemon/tmp/gpaste-search-provider.c:7:
/usr/include/glib-2.0/glib/gvariant.h:165:96: note: expected 'gsize *' {aka 'unsigned int *'} but argument is of type 'guint64 *' {aka 'long long unsigned int *'}
165 | gsize *length);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
```
--
From ab53397850471ad64a2a09bf5901741a987d9ee1 Mon Sep 17 00:00:00 2001
From: Adrian Bunk <bunk@debian.org>
Date: Tue, 6 Aug 2024 23:23:59 +0300
Subject: [PATCH] guint64 is not the same as gsize on 32-bit
---
src/daemon/tmp/gpaste-clipboard.c | 2 +-
src/daemon/tmp/gpaste-daemon.c | 18 +++++++++---------
src/daemon/tmp/gpaste-file-backend.c | 4 ++--
src/daemon/tmp/gpaste-history.c | 2 +-
src/daemon/tmp/gpaste-search-provider.c | 4 ++--
src/libgpaste/gpaste/gpaste-util.c | 2 +-
6 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/daemon/tmp/gpaste-clipboard.c b/src/daemon/tmp/gpaste-clipboard.c
index 0f3e6f52..b8aae8d3 100644
--- a/src/daemon/tmp/gpaste-clipboard.c
+++ b/src/daemon/tmp/gpaste-clipboard.c
@@ -328,7 +328,7 @@ _get_clipboard_data_from_special_atom (GtkSelectionData *selection_data,
if (atom >= G_PASTE_SPECIAL_ATOM_FIRST && atom < G_PASTE_SPECIAL_ATOM_LAST)
{
g_autofree guchar *data = NULL;
- guint64 length = 0;
+ gsize length = 0;
const gchar *str = g_paste_item_get_special_value (item, atom);
if (str)
diff --git a/src/daemon/tmp/gpaste-daemon.c b/src/daemon/tmp/gpaste-daemon.c
index 1722e4c0..2987b0b6 100644
--- a/src/daemon/tmp/gpaste-daemon.c
+++ b/src/daemon/tmp/gpaste-daemon.c
@@ -121,7 +121,7 @@ _err (const gchar *name,
static gchar *
g_paste_daemon_get_dbus_string_parameter (GVariant *parameters,
- guint64 *length)
+ gsize *length)
{
GVariantIter parameters_iter;
@@ -139,7 +139,7 @@ _variant_iter_read_strings_par https://github.com/Keruspe/GPaste/pull/446ameter (GVariantIter *parameters_iter,
{
g_autoptr (GVariant) variant1 = g_variant_iter_next_value (parameters_iter);
g_autoptr (GVariant) variant2 = g_variant_iter_next_value (parameters_iter);
- guint64 length;
+ gsize length;
*str1 = g_variant_dup_string (variant1, &length);
*str2 = g_variant_dup_string (variant2, &length);
@@ -255,7 +255,7 @@ g_paste_daemon_private_add (const GPasteDaemonPrivate *priv,
GVariant *parameters,
GPasteDBusError **err)
{
- guint64 length;
+ gsize length;
g_autofree gchar *text = g_paste_daemon_get_dbus_string_parameter (parameters, &length);
g_paste_daemon_private_do_add (priv, text, length, err);
@@ -267,7 +267,7 @@ g_paste_daemon_private_add_file (const GPasteDaemonPrivate *priv,
GError **error,
GPasteDBusError **err)
{
- guint64 length;
+ gsize length;
g_autofree gchar *file = g_paste_daemon_get_dbus_string_parameter (parameters, &length);
g_autofree gchar *content = NULL;
@@ -486,10 +486,10 @@ g_paste_daemon_private_get_elements (const GPasteDaemonPrivate *priv,
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)"));
g_autoptr (GVariant) variant = g_variant_iter_next_value (&parameters_iter);
- guint64 len;
+ gsize len;
g_autofree const gchar **uuids = g_variant_get_strv (variant, &len);
- for (guint64 i = 0; i < len; ++i)
+ for (gsize i = 0; i < len; ++i)
{
const GPasteItem *item = g_paste_history_get_by_uuid (history, uuids[i]);
G_PASTE_DBUS_ASSERT_FULL (item, "received no value for this index", NULL);
@@ -614,7 +614,7 @@ g_paste_daemon_private_merge (const GPasteDaemonPrivate *priv,
_variant_iter_read_strings_parameter (&parameters_iter, &decoration, &separator);
g_autoptr (GVariant) v_uuids = g_variant_iter_next_value (&parameters_iter);
- guint64 length;
+ gsize length;
const GStrv uuids = (const GStrv) g_variant_get_strv (v_uuids, &length);
G_PASTE_DBUS_ASSERT (length, "nothing to merge");
@@ -724,7 +724,7 @@ g_paste_daemon_private_replace (const GPasteDaemonPrivate *priv,
{
GPasteHistory *history = priv->history;
GVariantIter parameters_iter;
- guint64 length;
+ gsize length;
g_variant_iter_init (&parameters_iter, parameters);
@@ -751,7 +751,7 @@ g_paste_daemon_private_set_password (const GPasteDaemonPrivate *priv,
{
GPasteHistory *history = priv->history;
GVariantIter parameters_iter;
- guint64 length;
+ gsize length;
g_variant_iter_init (&parameters_iter, parameters);
diff --git a/src/daemon/tmp/gpaste-file-backend.c b/src/daemon/tmp/gpaste-file-backend.c
index bf1fa234..36fd21a4 100644
--- a/src/daemon/tmp/gpaste-file-backend.c
+++ b/src/daemon/tmp/gpaste-file-backend.c
@@ -402,7 +402,7 @@ end_tag (GMarkupParseContext *context G_GNUC_UNUSED,
static void
on_text (GMarkupParseContext *context G_GNUC_UNUSED,
const gchar *text,
- guint64 text_len,
+ gsize text_len,
gpointer user_data,
GError **error G_GNUC_UNUSED)
{
@@ -528,7 +528,7 @@ g_paste_file_backend_read_history_file (const GPasteStorageBackend *self,
G_MARKUP_TREAT_CDATA_AS_TEXT,
&data,
NULL);
- guint64 text_length;
+ gsize text_length;
g_file_get_contents (history_file_path, &text, &text_length, NULL);
g_markup_parse_context_parse (ctx, text, text_length, NULL);
diff --git a/src/daemon/tmp/gpaste-history.c b/src/daemon/tmp/gpaste-history.c
index 5b4ecb4b..7f45b608 100644
--- a/src/daemon/tmp/gpaste-history.c
+++ b/src/daemon/tmp/gpaste-history.c
@@ -36,7 +36,7 @@ typedef struct
GPasteStorageBackend *backend;
GPasteSettings *settings;
GList *history;
- guint64 size;
+ gsize size;
gchar *name;
diff --git a/src/daemon/tmp/gpaste-search-provider.c b/src/daemon/tmp/gpaste-search-provider.c
index 3f30b2e4..90965326 100644
--- a/src/daemon/tmp/gpaste-search-provider.c
+++ b/src/daemon/tmp/gpaste-search-provider.c
@@ -33,7 +33,7 @@ G_PASTE_DEFINE_TYPE_WITH_PRIVATE (SearchProvider, search_provider, G_PASTE_TYPE_
static char *
g_paste_dbus_get_as_result (GVariant *variant)
{
- guint64 _len;
+ gsize _len;
g_autofree const gchar **r = g_variant_get_strv (variant, &_len);
return g_strjoinv (" ", (gchar **) r);
@@ -183,7 +183,7 @@ g_paste_search_provider_private_get_result_metas (const GPasteSearchProviderPriv
g_variant_iter_init (&parameters_iter, parameters);
g_autoptr (GVariant) results = g_variant_iter_next_value (&parameters_iter);
- guint64 len;
+ gsize len;
g_autofree const gchar **uuids = g_variant_get_strv (results, &len);
if (!len)
diff --git a/src/libgpaste/gpaste/gpaste-util.c b/src/libgpaste/gpaste/gpaste-util.c
index 695fd8ed..56aae815 100644
--- a/src/libgpaste/gpaste/gpaste-util.c
+++ b/src/libgpaste/gpaste/gpaste-util.c
@@ -366,7 +366,7 @@ G_PASTE_VISIBLE guint32 *
g_paste_util_get_dbus_au_result (GVariant *variant,
guint64 *len)
{
- guint64 _len;
+ gsize _len;
const guint32 *r = g_variant_get_fixed_array (variant, &_len, sizeof (guint32));
guint32 *ret = g_memdup2 (r, _len * sizeof (guint32));