From 67823b815915a6051aa6651047113f72485564a3 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Mon, 5 Aug 2024 10:56:33 +0200 Subject: [PATCH] filebrowser: fix warning -Wincompatible-pointer-types based in pluma commit: https://github.com/mate-desktop/pluma/commit/6bd34181f2490f313a835ce59f82f696c42a2d0a Fixes the warning: lapiz-file-bookmarks-store.c: In function 'lapiz_file_bookmarks_store_get_uri': lapiz-file-bookmarks-store.c:857:22: warning: assignment to 'GFile *' {aka 'struct _GFile *'} from incompatible pointer type 'GObject *' {aka 'struct _GObject *'} [-Wincompatible-pointer-types] 857 | file = g_object_ref (obj); | ^ --- .../filebrowser/lapiz-file-bookmarks-store.c | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/plugins/filebrowser/lapiz-file-bookmarks-store.c b/plugins/filebrowser/lapiz-file-bookmarks-store.c index fb334c8..0a0c2a7 100644 --- a/plugins/filebrowser/lapiz-file-bookmarks-store.c +++ b/plugins/filebrowser/lapiz-file-bookmarks-store.c @@ -828,10 +828,8 @@ lapiz_file_bookmarks_store_get_uri (LapizFileBookmarksStore * model, CtkTreeIter * iter) { GObject * obj; - GFile * file = NULL; guint flags; gchar * ret = NULL; - gboolean isfs; g_return_val_if_fail (LAPIZ_IS_FILE_BOOKMARKS_STORE (model), NULL); g_return_val_if_fail (iter != NULL, NULL); @@ -843,26 +841,25 @@ lapiz_file_bookmarks_store_get_uri (LapizFileBookmarksStore * model, &obj, -1); - if (obj == NULL) - return NULL; - - isfs = (flags & LAPIZ_FILE_BOOKMARKS_STORE_IS_FS); - - if (isfs && (flags & LAPIZ_FILE_BOOKMARKS_STORE_IS_MOUNT)) - { - file = g_mount_get_root (G_MOUNT (obj)); - } - else if (!isfs) + if (obj != NULL) { - file = g_object_ref (obj); - } + if (flags & LAPIZ_FILE_BOOKMARKS_STORE_IS_FS) + { + if (flags & LAPIZ_FILE_BOOKMARKS_STORE_IS_MOUNT) + { + GFile * file; - g_object_unref (obj); + file = g_mount_get_root (G_MOUNT (obj)); + ret = g_file_get_uri (file); + g_object_unref (file); + } + } + else + { + ret = g_file_get_uri (G_FILE (obj)); + } - if (file) - { - ret = g_file_get_uri (file); - g_object_unref (file); + g_object_unref (obj); } return ret;