tree: fix compiler warnings
authorJonathan Lebon <jlebon@redhat.com>
Tue, 3 Oct 2017 21:34:43 +0000 (21:34 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 4 Oct 2017 12:54:53 +0000 (12:54 +0000)
Mostly innocuous warnings, except for -Wtautological-compare, which
caught a shady guint64 subtraction.

Closes: #1245
Approved by: cgwalters

src/libostree/ostree-fetcher-curl.c
src/libostree/ostree-repo.c
src/ostree/ot-main.c

index 7aaabb7859376d3535155f19cb67f2d5da88c85c..dc85d3fe4c1708b7413d5df0d9e179c50e10388f 100644 (file)
@@ -693,7 +693,7 @@ adopt_steal_mainctx (OstreeFetcher *self,
       guint64 readytime = g_source_get_ready_time (self->timer_event);
       guint64 curtime = g_source_get_time (self->timer_event);
       guint64 timeout_micros = curtime - readytime;
-      if (timeout_micros < 0)
+      if (curtime < readytime)
         timeout_micros = 0;
       update_timeout_cb (self->multi, timeout_micros / 1000, self);
     }
@@ -706,7 +706,7 @@ static void
 initiate_next_curl_request (FetcherRequest *req,
                             GTask *task)
 {
-  CURLMcode rc;
+  CURLcode rc;
   OstreeFetcher *self = req->fetcher;
 
   if (req->easy)
@@ -802,8 +802,8 @@ initiate_next_curl_request (FetcherRequest *req,
   curl_easy_setopt (req->easy, CURLOPT_WRITEDATA, task);
   curl_easy_setopt (req->easy, CURLOPT_PROGRESSDATA, task);
 
-  rc = curl_multi_add_handle (self->multi, req->easy);
-  g_assert (rc == CURLM_OK);
+  CURLMcode multi_rc = curl_multi_add_handle (self->multi, req->easy);
+  g_assert (multi_rc == CURLM_OK);
 }
 
 static void
index a3cfd6f58c06e81b3bade405100342602b88605f..508291521c5a0979f6d799f52ef1996acfd160b9 100644 (file)
@@ -4960,7 +4960,6 @@ _ostree_repo_allocate_tmpdir (int tmpdir_dfd,
   while (!ret_tmpdir.initialized)
     {
       struct dirent *dent;
-      glnx_fd_close int existing_tmpdir_fd = -1;
       g_autoptr(GError) local_error = NULL;
 
       if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
index 1f7e9382ff41330055cb597894c8ec20279d2f14..8e8c4631588e2528dc7b129fc6c22cc8c476d3db 100644 (file)
@@ -163,10 +163,8 @@ ostree_run (int    argc,
 
   if (!command->fn)
     {
-      g_autoptr(GOptionContext) context = NULL;
-      g_autofree char *help = NULL;
-
-      context = ostree_option_context_new_with_commands (commands);
+      g_autoptr(GOptionContext) context =
+        ostree_option_context_new_with_commands (commands);
 
       /* This will not return for some options (e.g. --version). */
       if (ostree_option_context_parse (context, NULL, &argc, &argv, OSTREE_BUILTIN_FLAG_NO_REPO, NULL, cancellable, &error))