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_parameter (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));
 

