Skip to content

Commit

Permalink
filebrowser: fix warning -Wincompatible-pointer-types
Browse files Browse the repository at this point in the history
based in pluma commit:
mate-desktop/pluma@6bd3418

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);
      |                      ^
  • Loading branch information
sc0w committed Aug 5, 2024
1 parent 1e2ddd2 commit 67823b8
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions plugins/filebrowser/lapiz-file-bookmarks-store.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 67823b8

Please sign in to comment.