[glib] fix warnings



commit c37273dccb183c98ee45f164117f515e4efbff06
Author: Dan Winship <danw gnome org>
Date:   Mon Apr 30 06:31:20 2012 -0400

    fix warnings

 gio/gdbusdaemon.c                 |    1 -
 gio/gtestdbus.c                   |    2 +-
 gio/tests/buffered-input-stream.c |    2 +-
 glib/goption.c                    |    1 -
 tests/gobject/defaultiface.c      |    3 +--
 tests/gobject/dynamictype.c       |    3 +--
 tests/gobject/ifaceinit.c         |    2 ++
 tests/slice-color.c               |    7 ++++---
 tests/slice-test.c                |    2 +-
 tests/threadpool-test.c           |   16 +++++++++++-----
 10 files changed, 22 insertions(+), 17 deletions(-)
---
diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c
index 96db54d..35a724c 100644
--- a/gio/gdbusdaemon.c
+++ b/gio/gdbusdaemon.c
@@ -1523,7 +1523,6 @@ on_authorize_authenticated_peer (GDBusAuthObserver *observer,
 				 GCredentials      *credentials,
 				 gpointer           user_data)
 {
-  GDBusDaemon *daemon = user_data;
   gboolean authorized = TRUE;
 
   if (credentials != NULL)
diff --git a/gio/gtestdbus.c b/gio/gtestdbus.c
index 99f855b..6b9fdd3 100644
--- a/gio/gtestdbus.c
+++ b/gio/gtestdbus.c
@@ -515,7 +515,7 @@ start_daemon (GTestDBus *self)
   GError *error = NULL;
 
   if (g_getenv ("G_TEST_DBUS_DAEMON") != NULL)
-    argv[0] = g_getenv ("G_TEST_DBUS_DAEMON");
+    argv[0] = (gchar *)g_getenv ("G_TEST_DBUS_DAEMON");
 
   /* Write config file and set its path in argv */
   file = write_config_file (self);
diff --git a/gio/tests/buffered-input-stream.c b/gio/tests/buffered-input-stream.c
index 7039367..82604db 100644
--- a/gio/tests/buffered-input-stream.c
+++ b/gio/tests/buffered-input-stream.c
@@ -297,7 +297,7 @@ test_seek (void)
   error = NULL;
 
   /* Seek by read */
-  g_assert_cmpstr (g_seekable_tell (G_SEEKABLE (in)), ==, 0);
+  g_assert_cmpint (g_seekable_tell (G_SEEKABLE (in)), ==, 0);
   byte = g_buffered_input_stream_read_byte (G_BUFFERED_INPUT_STREAM (in), NULL, &error);
   g_assert_no_error (error);
   g_assert_cmpint (byte, ==, 'a');
diff --git a/glib/goption.c b/glib/goption.c
index f5372ff..7f8af97 100644
--- a/glib/goption.c
+++ b/glib/goption.c
@@ -261,7 +261,6 @@ static glong
 _g_utf8_strwidth (const gchar *p)
 {
   glong len = 0;
-  const gchar *start = p;
   g_return_val_if_fail (p != NULL, 0);
 
   while (*p)
diff --git a/tests/gobject/defaultiface.c b/tests/gobject/defaultiface.c
index ece9259..b6710a4 100644
--- a/tests/gobject/defaultiface.c
+++ b/tests/gobject/defaultiface.c
@@ -139,10 +139,9 @@ module_register (GTypeModule *module)
 static void
 test_dynamic_iface (void)
 {
-  GTypeModule *module;
   TestDynamicIfaceClass *dynamic_iface;
 
-  module = test_module_new (module_register);
+  test_module_new (module_register);
 
   /* Not loaded until we call ref for the first time */
   dynamic_iface = g_type_default_interface_peek (TEST_TYPE_DYNAMIC_IFACE);
diff --git a/tests/gobject/dynamictype.c b/tests/gobject/dynamictype.c
index fba1ced..4516bd6 100644
--- a/tests/gobject/dynamictype.c
+++ b/tests/gobject/dynamictype.c
@@ -110,10 +110,9 @@ module_register (GTypeModule *module)
 static void
 test_dynamic_type (void)
 {
-  GTypeModule *module;
   DynamicObjectClass *class;
 
-  module = test_module_new (module_register);
+  test_module_new (module_register);
 
   /* Not loaded until we call ref for the first time */
   class = g_type_class_peek (DYNAMIC_OBJECT_TYPE);
diff --git a/tests/gobject/ifaceinit.c b/tests/gobject/ifaceinit.c
index 9715c95..a4aa268 100644
--- a/tests/gobject/ifaceinit.c
+++ b/tests/gobject/ifaceinit.c
@@ -418,5 +418,7 @@ main (int   argc,
   iface = TEST_IFACE6_GET_CLASS (object);
   g_assert (iface && iface->val == 0x60006 && iface->base_val == 0x660066);
 
+  g_type_class_unref (object_class);
+
   return 0;
 }
diff --git a/tests/slice-color.c b/tests/slice-color.c
index c4a417d..6245f5b 100644
--- a/tests/slice-color.c
+++ b/tests/slice-color.c
@@ -131,13 +131,14 @@ main (int   argc,
   /* basic sanity checks */
   if (!block_size || !n_blocks || block_size >= area_size)
     {
-      g_printerr ("Invalid arguments: block-size=%llu memory-size=%llu\n", block_size, area_size);
+      g_printerr ("Invalid arguments: block-size=%" G_GUINT64_FORMAT " memory-size=%" G_GUINT64_FORMAT "\n", block_size, area_size);
       usage();
       return 1;
     }
 
-  g_printerr ("Will allocate and touch %llu blocks of %llu bytes (= %llu bytes) %llu times with color increment: 0x%08llx\n",
-              n_blocks, block_size, n_blocks * block_size, repeats, g_slice_get_config (G_SLICE_CONFIG_COLOR_INCREMENT));
+  g_printerr ("Will allocate and touch %" G_GUINT64_FORMAT " blocks of %" G_GUINT64_FORMAT " bytes (= %" G_GUINT64_FORMAT " bytes) %" G_GUINT64_FORMAT " times with color increment: 0x%08" G_GUINT64_MODIFIER "x\n",
+              n_blocks, block_size, n_blocks * block_size, repeats,
+	      (guint64)g_slice_get_config (G_SLICE_CONFIG_COLOR_INCREMENT));
 
   touch_mem (block_size, n_blocks, repeats);
   
diff --git a/tests/slice-test.c b/tests/slice-test.c
index beafce3..9ff96ae 100644
--- a/tests/slice-test.c
+++ b/tests/slice-test.c
@@ -297,7 +297,7 @@ main (int   argc,
         for (i = 0; i < n_chunks; i++)
           {
             gint64 *vals = g_slice_get_config_state (G_SLICE_CONFIG_CONTENTION_COUNTER, i, &n);
-            g_print ("  %9llu   |  %9llu   |  %9llu\n", vals[0], vals[2], vals[1]);
+            g_print ("  %9" G_GINT64_FORMAT "   |  %9" G_GINT64_FORMAT "   |  %9" G_GINT64_FORMAT "\n", vals[0], vals[2], vals[1]);
             g_free (vals);
           }
       }
diff --git a/tests/threadpool-test.c b/tests/threadpool-test.c
index 6e1f6fc..1f0442b 100644
--- a/tests/threadpool-test.c
+++ b/tests/threadpool-test.c
@@ -5,8 +5,13 @@
 
 #include <glib.h>
 
-#define DEBUG_MSG(x)
-/* #define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n");  */
+/* #define DEBUG 1 */
+
+#ifdef DEBUG
+# define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n");
+#else
+# define DEBUG_MSG(x)
+#endif
 
 #define WAIT                5    /* seconds */
 #define MAX_THREADS         10
@@ -128,9 +133,11 @@ test_thread_stop_unused (void)
 static void
 test_thread_pools_entry_func (gpointer data, gpointer user_data)
 {
+#ifdef DEBUG
   guint id = 0;
 
   id = GPOINTER_TO_UINT (data);
+#endif
 
   DEBUG_MSG (("[pool] ---> [%3.3d] entered thread.", id));
 
@@ -293,9 +300,11 @@ test_thread_sort (gboolean sort)
 static void
 test_thread_idle_time_entry_func (gpointer data, gpointer user_data)
 {
+#ifdef DEBUG
   guint thread_id;
 
   thread_id = GPOINTER_TO_UINT (data);
+#endif
 
   DEBUG_MSG (("[idle] ---> entered thread:%2.2d", thread_id));
 
@@ -307,11 +316,8 @@ test_thread_idle_time_entry_func (gpointer data, gpointer user_data)
 static gboolean
 test_thread_idle_timeout (gpointer data)
 {
-  guint interval;
   gint i;
 
-  interval = GPOINTER_TO_UINT (data);
-
   for (i = 0; i < 2; i++) {
     g_thread_pool_push (idle_pool, GUINT_TO_POINTER (100 + i), NULL);
     DEBUG_MSG (("[idle] ===> pushed new thread with id:%d, number "



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]