Skip to content

Fix build warnings

Avinash Sonawane requested to merge rootkea/thunar:small-fixes into master

On latest git master clang throws these warnings:

...
thunar-list-model.c:1914:3: warning: expression which evaluates to zero treated as a null pointer constant of type 'const char *' [-Wnon-literal-null-conversion]
  _thunar_return_val_if_fail (THUNAR_IS_LIST_MODEL (store), THUNAR_DATE_STYLE_SIMPLE);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../thunar/thunar-private.h:33:47: note: expanded from macro '_thunar_return_val_if_fail'
#define _thunar_return_val_if_fail(expr, val) g_return_val_if_fail (expr, (val))
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmessages.h:644:16: note: expanded from macro 'g_return_val_if_fail'
        return (val); \
               ^~~~~
...
thunar-tree-view.c:713:15: warning: variable 'file' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
          if (path != NULL && gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path))
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thunar-tree-view.c:730:15: note: uninitialized use occurs here
          if (file)
              ^~~~
thunar-tree-view.c:713:11: note: remove the 'if' if its condition is always true
          if (path != NULL && gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thunar-tree-view.c:713:15: warning: variable 'file' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
          if (path != NULL && gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path))
              ^~~~~~~~~~~~
thunar-tree-view.c:730:15: note: uninitialized use occurs here
          if (file)
              ^~~~
thunar-tree-view.c:713:15: note: remove the '&&' if its condition is always true
          if (path != NULL && gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path))
              ^~~~~~~~~~~~~~~
thunar-tree-view.c:653:26: note: initialize the variable 'file' to silence this warning
  ThunarFile        *file;
                         ^
                          = NULL
thunar-tree-view.c:713:15: warning: variable 'device' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
          if (path != NULL && gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path))
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thunar-tree-view.c:718:16: note: uninitialized use occurs here
          if ((device != NULL && thunar_device_is_mounted (device)) ||
               ^~~~~~
thunar-tree-view.c:713:11: note: remove the 'if' if its condition is always true
          if (path != NULL && gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thunar-tree-view.c:713:15: warning: variable 'device' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
          if (path != NULL && gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path))
              ^~~~~~~~~~~~
thunar-tree-view.c:718:16: note: uninitialized use occurs here
          if ((device != NULL && thunar_device_is_mounted (device)) ||
               ^~~~~~
thunar-tree-view.c:713:15: note: remove the '&&' if its condition is always true
          if (path != NULL && gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path))
              ^~~~~~~~~~~~~~~
thunar-tree-view.c:652:28: note: initialize the variable 'device' to silence this warning
  ThunarDevice      *device;
                           ^
                            = NULL
...

Merge request reports