diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index 58f2230..ccb0682 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -1684,7 +1684,7 @@ g_daemon_file_poll_mountable (GFile               *file,
 		      callback, user_data,
 		      poll_mountable_async_cb,
 		      NULL,
-		      0,
+		      NULL,
                       0);
 }
 
diff --git a/client/gdaemonfileinputstream.c b/client/gdaemonfileinputstream.c
index c942c9e..4591832 100644
--- a/client/gdaemonfileinputstream.c
+++ b/client/gdaemonfileinputstream.c
@@ -2035,14 +2035,11 @@ async_query_done (GInputStream *stream,
                   GCancellable *cancellable,
 		  GError *io_error)
 {
-  GDaemonFileInputStream *file;
   GSimpleAsyncResult *simple;
   QueryOperation *op;
   GFileInfo *info;
   GError *error;
 
-  file = G_DAEMON_FILE_INPUT_STREAM (stream);
-  
   op = op_data;
 
   if (io_error)
diff --git a/client/gdaemonfileoutputstream.c b/client/gdaemonfileoutputstream.c
index c5263e1..74e4caf 100644
--- a/client/gdaemonfileoutputstream.c
+++ b/client/gdaemonfileoutputstream.c
@@ -1564,14 +1564,11 @@ async_query_done (GOutputStream *stream,
                   GCancellable *cancellable,
 		  GError *io_error)
 {
-  GDaemonFileOutputStream *file;
   GSimpleAsyncResult *simple;
   QueryOperation *op;
   GFileInfo *info;
   GError *error;
 
-  file = G_DAEMON_FILE_OUTPUT_STREAM (stream);
-  
   op = op_data;
 
   if (io_error)
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 59131b0..0cc884a 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -614,7 +614,7 @@ fill_mountable_info (GDaemonVfs *vfs)
   DBusMessageIter iter, array_iter, struct_iter;
   MountableInfo *info;
   GPtrArray *infos, *uri_schemes;
-  gint i, count;
+  gint i;
 
   message = dbus_message_new_method_call (G_VFS_DBUS_DAEMON_NAME,
                                           G_VFS_DBUS_MOUNTTRACKER_PATH,
@@ -649,7 +649,6 @@ fill_mountable_info (GDaemonVfs *vfs)
   infos = g_ptr_array_new ();
   uri_schemes = g_ptr_array_new ();
   g_ptr_array_add (uri_schemes, g_strdup ("file"));
-  count = 0;
   do
     {
       char *type, *scheme, **scheme_aliases;
diff --git a/client/gdaemonvolumemonitor.c b/client/gdaemonvolumemonitor.c
index 2ca2113..c254511 100644
--- a/client/gdaemonvolumemonitor.c
+++ b/client/gdaemonvolumemonitor.c
@@ -249,10 +249,6 @@ g_daemon_volume_monitor_finalize (GObject *object)
 static void
 g_daemon_volume_monitor_dispose (GObject *object)
 {
-  GDaemonVolumeMonitor *monitor;
-  
-  monitor = G_DAEMON_VOLUME_MONITOR (object);
-
   G_LOCK (daemon_vm);
   _the_daemon_volume_monitor = NULL;
   G_UNLOCK (daemon_vm);
diff --git a/common/gsysutils.c b/common/gsysutils.c
index 9dd8afa..6c056ab 100644
--- a/common/gsysutils.c
+++ b/common/gsysutils.c
@@ -89,7 +89,7 @@ _g_socket_receive_fd (int socket_fd)
 
   iov[0].iov_base = buf;
   iov[0].iov_len = 1;
-  msg.msg_name = 0;
+  msg.msg_name = NULL;
   msg.msg_namelen = 0;
   msg.msg_iov = iov;
   msg.msg_iovlen = 1;
@@ -165,7 +165,7 @@ _g_socket_connect (const char *address,
       strncpy (addr.sun_path, path, path_len);
     }
   
-  if (connect (fd, (struct sockaddr*) &addr, G_STRUCT_OFFSET (struct sockaddr_un, sun_path) + path_len) < 0)
+  if (connect (fd, (const struct sockaddr*) &addr, G_STRUCT_OFFSET (struct sockaddr_un, sun_path) + path_len) < 0)
     {      
       int errsv = errno;
 
diff --git a/common/gvfsdbusutils.c b/common/gvfsdbusutils.c
index 9945ba8..1b735cd 100644
--- a/common/gvfsdbusutils.c
+++ b/common/gvfsdbusutils.c
@@ -289,13 +289,10 @@ _g_dbus_message_append_args_valist (DBusMessage *message,
 				    int          first_arg_type,
 				    va_list      var_args)
 {
-  int type;
   DBusMessageIter iter;
 
   g_return_if_fail (message != NULL);
 
-  type = first_arg_type;
-
   dbus_message_iter_init_append (message, &iter);
 
   _g_dbus_message_iter_append_args_valist (&iter,
diff --git a/daemon/ParseFTPList.c b/daemon/ParseFTPList.c
index 2d2ce0f..8c46732 100644
--- a/daemon/ParseFTPList.c
+++ b/daemon/ParseFTPList.c
@@ -1705,8 +1705,6 @@ int ParseFTPList(const char *line, struct list_state *state,
 /* ==================================================================== */
 #if 0
 
-#include <stdio.h>
-
 static int do_it(FILE *outfile, 
                  char *line, size_t linelen, struct list_state *state,
                  char **cmnt_buf, unsigned int *cmnt_buf_sz,
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index 95dc428..0adf9a2 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -730,13 +730,11 @@ static gboolean
 ms_response_is_target (MsResponse *response)
 {
   const char *text;
-  const char *path;
   SoupURI    *target;
   SoupURI    *uri;
   gboolean    res;
 
   uri    = NULL;
-  path   = NULL;
   target = response->multistatus->target;
   text   = node_get_content (response->href);
 
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index ff44828..580d380 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -3209,9 +3209,7 @@ replace_truncate_original (GVfsBackendSftp *backend,
 {
   GVfsJobOpenForWrite *op_job;
   GDataOutputStream *command;
-  ReplaceData *data;
 
-  data = job->backend_data;
   op_job = G_VFS_JOB_OPEN_FOR_WRITE (job);
   
   command = new_command_stream (backend,
@@ -4031,9 +4029,7 @@ query_info_reply (GVfsBackendSftp *backend,
       if (reply->type == SSH_FXP_NAME)
         {
           char *symlink_target;
-          guint32 count;
           
-          count = g_data_input_stream_read_uint32 (reply->data, NULL, NULL);
           symlink_target = read_string (reply->data, NULL);
           g_file_info_set_symlink_target (op_job->file_info, symlink_target);
           g_free (symlink_target);
diff --git a/daemon/gvfsftpconnection.c b/daemon/gvfsftpconnection.c
index 1f8ee11..3df27fe 100644
--- a/daemon/gvfsftpconnection.c
+++ b/daemon/gvfsftpconnection.c
@@ -291,7 +291,7 @@ g_vfs_ftp_connection_listen_data_connection (GVfsFtpConnection *conn,
   GSocketAddress *local, *addr;
 
   g_return_val_if_fail (conn != NULL, NULL);
-  g_return_val_if_fail (conn->data == NULL, FALSE);
+  g_return_val_if_fail (conn->data == NULL, NULL);
 
   g_vfs_ftp_connection_stop_listening (conn);
 
diff --git a/daemon/gvfsftpdircache.c b/daemon/gvfsftpdircache.c
index b301442..cd19c17 100644
--- a/daemon/gvfsftpdircache.c
+++ b/daemon/gvfsftpdircache.c
@@ -590,7 +590,7 @@ g_vfs_ftp_dir_cache_funcs_process (GInputStream *        stream,
                                    GCancellable *        cancellable,
                                    GError **             error)
 {
-  struct list_state state = { 0, };
+  struct list_state state = { NULL, };
   GDataInputStream *data;
   GFileInfo *info;
   int type;
diff --git a/daemon/gvfsjobopeniconforread.c b/daemon/gvfsjobopeniconforread.c
index 95287c5..1e36a24 100644
--- a/daemon/gvfsjobopeniconforread.c
+++ b/daemon/gvfsjobopeniconforread.c
@@ -43,10 +43,6 @@ static gboolean     try          (GVfsJob        *job);
 static void
 g_vfs_job_open_icon_for_read_finalize (GObject *object)
 {
-  GVfsJobOpenIconForRead *job;
-
-  job = G_VFS_JOB_OPEN_ICON_FOR_READ (object);
-
   if (G_OBJECT_CLASS (g_vfs_job_open_icon_for_read_parent_class)->finalize)
     (*G_OBJECT_CLASS (g_vfs_job_open_icon_for_read_parent_class)->finalize) (object);
 }
diff --git a/daemon/mount.c b/daemon/mount.c
index 9f0c873..1190cd1 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -33,7 +33,6 @@
 #include "gmountoperationdbus.h"
 #include "gvfsdaemonprotocol.h"
 #include "gvfsdbusutils.h"
-#include <glib.h>
 #include <gio/gio.h>
 
 typedef struct {
@@ -1190,7 +1189,7 @@ dbus_message_function (DBusConnection  *connection,
   return res;
 }
 
-struct DBusObjectPathVTable tracker_dbus_vtable = {
+static struct DBusObjectPathVTable tracker_dbus_vtable = {
   NULL,
   dbus_message_function
 };
diff --git a/metadata/metatree.c b/metadata/metatree.c
index 3a1c12b..e9797b7 100644
--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -50,7 +50,6 @@
 #include "metabuilder.h"
 #include <glib.h>
 #include <glib/gstdio.h>
-#include <errno.h>
 #include "crc32.h"
 
 #ifdef HAVE_LIBUDEV
@@ -592,9 +591,7 @@ meta_tree_lookup_by_name (const char *name,
 MetaTree *
 meta_tree_ref (MetaTree *tree)
 {
-  gint old_val;
-
-  old_val = g_atomic_int_exchange_and_add ((int *)&tree->ref_count, 1);
+  g_atomic_int_exchange_and_add ((int *)&tree->ref_count, 1);
   return tree;
 }
 
@@ -1444,7 +1441,7 @@ meta_journal_reverse_map_path_and_key (MetaJournal *journal,
 				       guint64 *mtime,
 				       gpointer *value)
 {
-  PathKeyData data = {0};
+  PathKeyData data = {NULL};
   char *res_path;
 
   data.key = key;
@@ -1699,7 +1696,7 @@ get_child_info (EnumDirData *data,
   char *name;
 
   slash = strchr (remainder, '/');
-  if (slash != 0)
+  if (slash != NULL)
     name = g_strndup (remainder, slash - remainder);
   else
     name = g_strdup (remainder);
@@ -2762,7 +2759,7 @@ struct _MetaLookupCache {
 
 #ifdef HAVE_LIBUDEV
 
-struct udev *udev;
+static struct udev *udev;
 G_LOCK_DEFINE_STATIC (udev);
 
 static char *
@@ -3084,7 +3081,7 @@ find_mountpoint_for (MetaLookupCache *cache,
 {
   char *first_dir, *dir, *last;
   const char *prefix;
-  dev_t dir_dev;
+  dev_t dir_dev = 0;
 
   first_dir = get_dirname (file);
   if (first_dir == NULL)
@@ -3105,8 +3102,7 @@ find_mountpoint_for (MetaLookupCache *cache,
     {
       if (dir)
 	dir_dev = get_devnum (dir);
-      if (dir == NULL ||
-	  dev != dir_dev)
+      if (dir == NULL || dev != dir_dev)
 	{
 	  g_free (dir);
 	  cache->last_parent_mountpoint = last;
diff --git a/monitor/gdu/ggduvolumemonitor.c b/monitor/gdu/ggduvolumemonitor.c
index 8f0e643..794d354 100644
--- a/monitor/gdu/ggduvolumemonitor.c
+++ b/monitor/gdu/ggduvolumemonitor.c
@@ -106,10 +106,6 @@ list_free (GList *objects)
 static void
 g_gdu_volume_monitor_dispose (GObject *object)
 {
-  GGduVolumeMonitor *monitor;
-
-  monitor = G_GDU_VOLUME_MONITOR (object);
-
   the_volume_monitor = NULL;
 
   if (G_OBJECT_CLASS (g_gdu_volume_monitor_parent_class)->dispose)
@@ -1431,7 +1427,7 @@ update_fstab_volumes (GGduVolumeMonitor *monitor,
           GduDevice *device;
 
           /* doesn't exist */
-          if (realpath (device_file, resolved_path) != 0)
+          if (realpath (device_file, resolved_path) != NULL)
             continue;
 
           /* is handled by DKD */
@@ -1581,7 +1577,7 @@ update_discs (GGduVolumeMonitor *monitor,
   GList *new_discs;
   GList *removed, *added;
   GList *l, *ll;
-  GGduDrive *drive;
+  GGduDrive *drive = NULL;
   GGduVolume *volume;
   GGduMount *mount;
 
diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c
index 25affe3..ea4fbfc 100644
--- a/monitor/gphoto2/ggphoto2volumemonitor.c
+++ b/monitor/gphoto2/ggphoto2volumemonitor.c
@@ -36,7 +36,6 @@
 #include "ggphoto2volume.h"
 
 #ifdef HAVE_GUDEV
-#include <gio/gio.h>
 #include <gio/gunixmounts.h>
 #else
 #include "hal-pool.h"
diff --git a/monitor/proxy/gvfsproxyvolumemonitordaemon.c b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
index 0a7e1da..413afc5 100644
--- a/monitor/proxy/gvfsproxyvolumemonitordaemon.c
+++ b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
@@ -917,12 +917,11 @@ handle_mount_op_reply (DBusConnection *connection, DBusMessage *message)
   dbus_bool_t anonymous;
   DBusError dbus_error;
   DBusHandlerResult ret;
-  GList *volumes, *l;
+  GList *l;
   DBusMessage *reply;
   GMountOperation *mount_operation;
   const gchar *sender;
 
-  volumes = NULL;
   decoded_password = NULL;
   ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
@@ -1808,10 +1807,8 @@ filter_function (DBusConnection *connection, DBusMessage *message, void *user_da
             {
               GMountOperation *op = G_MOUNT_OPERATION (l->data);
               const gchar *owner;
-              const gchar *id;
 
               owner = g_object_get_data (G_OBJECT (op), "mount_op_owner");
-              id = g_object_get_data (G_OBJECT (op), "mount_op_id");
               if (g_strcmp0 (owner, name) == 0)
                 {
                   print_debug ("****** name `%s' has an outstanding mount operation object, aborting it",
@@ -2066,7 +2063,7 @@ g_vfs_proxy_volume_monitor_daemon_main (int argc,
                                         const char *dbus_name,
                                         GType volume_monitor_type)
 {
-  int rc;
+  int rc G_GNUC_UNUSED;
   int ret;
   GMainLoop *loop;
   DBusError dbus_error;
diff --git a/programs/gvfs-set-attribute.c b/programs/gvfs-set-attribute.c
index be3713f..931841e 100644
--- a/programs/gvfs-set-attribute.c
+++ b/programs/gvfs-set-attribute.c
@@ -199,7 +199,7 @@ main (int argc, char *argv[])
 			     attribute,
 			     type,
 			     value,
-			     0, 0, &error))
+			     0, NULL, &error))
     {
       g_printerr (_("Error setting attribute: %s\n"), error->message);
       g_error_free (error);
diff --git a/test/benchmark-common.c b/test/benchmark-common.c
index 8f7e9cc..ecff8f8 100644
--- a/test/benchmark-common.c
+++ b/test/benchmark-common.c
@@ -63,8 +63,8 @@ BenchmarkDataPlot;
 
 static gint benchmark_run (gint argc, gchar *argv []);
 
-GList    *benchmark_data_plots = NULL;
-gboolean  benchmark_is_running = FALSE;
+static GList    *benchmark_data_plots = NULL;
+static gboolean  benchmark_is_running = FALSE;
 
 #if 0
 static void
diff --git a/test/benchmark-gvfs-big-files.c b/test/benchmark-gvfs-big-files.c
index af9c7b7..d8bd197 100644
--- a/test/benchmark-gvfs-big-files.c
+++ b/test/benchmark-gvfs-big-files.c
@@ -72,7 +72,7 @@ create_file (GFile *base_dir)
   if (!scratch_file)
     return NULL;
 
-  output_stream = G_OUTPUT_STREAM (g_file_replace (scratch_file, 0, FALSE, G_FILE_CREATE_NONE, NULL, &error));
+  output_stream = G_OUTPUT_STREAM (g_file_replace (scratch_file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error));
   if (!output_stream)
     {
       g_printerr ("Failed to create scratch file: %s\n", error->message);
diff --git a/test/benchmark-gvfs-small-files.c b/test/benchmark-gvfs-small-files.c
index 2e3143d..d7a6652 100644
--- a/test/benchmark-gvfs-small-files.c
+++ b/test/benchmark-gvfs-small-files.c
@@ -72,7 +72,7 @@ create_file (GFile *base_dir)
   if (!scratch_file)
     return NULL;
 
-  output_stream = G_OUTPUT_STREAM (g_file_replace (scratch_file, 0, FALSE, G_FILE_CREATE_NONE, NULL, &error));
+  output_stream = G_OUTPUT_STREAM (g_file_replace (scratch_file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error));
   if (!output_stream)
     {
       g_printerr ("Failed to create scratch file: %s\n", error->message);
